Count of ways to empty given String by recursively removing all adjacent duplicates

#include using namespace std;  int dp[505][505], choose[502][502];  int calc(int l, int r, string& s){          if (abs(r – l) % 2 == 0) {        return 0;    }      if (l > r) {        return dp[l][r] = 1;    }          if (dp[l][r] != -1) {        return dp[l][r];    }          if ((r – l) == 1) {        if (s[l] == s[r]) {            dp[l][r] = 1;        }        else {            dp[l][r] = 0;        }        return dp[l][r];    }          int ans = 0;    for (int k = l + 1; k