func_code_string: #include <bits/stdc++.h>   using namespace std;   void PLAY() {     cout << fixed << setprecision(10);     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   int max(int a, int b) {     if (a > b) return a;     return b;   }   int min(int a, int b) {     if (a < b) return a;     return b;   }   long long fx4[] = {-1, 1, 0, 0};   long long fy4[] = {0, 0, -1, 1};   long long fx8[] = {-1, -1, -1, 0, 1, 1, 1, 0};   long long fy8[] = {-1, 0, 1, 1, 1, 0, -1, -1};   const double PI = 3.141592653589793;   const long long N = 2e5 + 5;   const long long mod = 1000000007;   long long m, n;   long long ar[N];   vector<long long> arr;   long long dp[5005][5005];   long long func(long long l, long long r) {     if (l == r)       return 0;     else if (l + 1 == r)       return 1;     long long &ans = dp[l][r];     if (ans != -1) return ans;     ans = 0;     long long op1 = INT_MAX;     long long op2 = INT_MAX;     long long op3 = INT_MAX;     if (arr[l] == arr[r])       op1 = 1 + func(l + 1, r - 1);     else {       op2 = 1 + func(l, r - 1);       op3 = 1 + func(l + 1, r);     }     ans = min(op1, min(op2, op3));     return ans;   }   int32_t main() {     PLAY();     cin >> m;     for (long long i = 0; i < m; i++) cin >> ar[i];     arr.push_back(ar[0]);     for (long long i = 1; i < m;) {       while (ar[i] == ar[i - 1]) i++;       if (i < m) arr.push_back(ar[i]);       i++;     }     memset(dp, -1, sizeof(dp));     n = arr.size();     cout << func(0, n - 1) <<   n ;   }   