Language: C++

#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <ctype.h>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
// #include <pair> 
       
using namespace std;
typedef pair<long long int, long long int> ii;
typedef vector<long long int> vi;
typedef vector<ii> vii;
// #define INF 1000000000000000
       
#define endl '\n'
#define MOD 1000000007
// #define INF 1ll<<30
long long int inf =  100000000000000000;
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES
 
// long long binpow(long long a,long long b)
// {
//     if (b == 1) return a;
//     long long res = binpow(a, b/2)%MOD;
//     if (b % 2) return (res*((res*a)%MOD))%MOD;
//     else return (res * res)%MOD;
// }
 
// long long int fact(long long int a)
// {
//     if(a==0||a==1)
//         return 1;
//     long long int ans = 1;
//     for(int i=a;i>=1;i--)
//         ans = (ans * i);
//     return ans;
// }
 
// long long int ivmod(long long int a)
// {
//     return binpow(a,MOD-2);
// }
 
// long long int ncr(long long int a,long long int b)
// {
//     long long int pans=1;
//     for(int i =a;i>max(b,a-b);i--)
//         pans=pans*i;
//     long long int div = fact(min(b,a-b));
//     // cout<<ans<<"            "<<div<<endl;
//     pans = pans/div;
//     return pans;
// }

char* preprocess(string s,int n)
{
    int i=0,j=1;
    char *c =new char[2*n+1];
    c[0] = '#';
    for(i=0;i<n;i++)
    {
        c[j++] = s[i];
        c[j++] = '#';
    }
    c[j] = '\0';
    return c;
}
void count_pal(string s,int n)
{
    char *ch = preprocess(s,n);
    int *ptr = new int[2*n+1]();
    int i=1,r=0,c=0;
    for(i=1;i<2*n+1;i++)
    {
        if((2*c-i)>=0 && (r-i)>=ptr[2*c-i])
            ptr[i] = ptr[2*c-i];
        while(i-ptr[i]-1>=0 && ch[i-ptr[i]-1]==ch[i+ptr[i]+1])
            ptr[i]++;
        if(r<ptr[i]+i)
        {
            r = i+ptr[i];
            c =i;
        }
    }
    i=0;
    int j=0;
    n = 2*n+1;
    while(i<n)
    {
        if(ptr[i]>1 && ptr[i]%2==1)
        {
            j = j + (ptr[i]-3)/2 + 1;
            i ++;
        }
        else if(ptr[i]>1 && (ptr[i]%2==0))
        {
            j = j + (ptr[i]-2)/2 + 1;
            i ++;
        }
        else
            i++;
    }
    cout<<j<<"\n";
    
}

int palindrome(string s, int n)
{
    // set<string>st;
    long long int len = s.size();
    len = (len*(len+1))/2;
    long long int sss = s.size();

    vector<string>st;
    int i = 0;
    while (s[i])
    {
        string a(1, s[i++]);
        // st.insert(a);
        st.push_back(a);
    }
    
    for (i = 1; i < n; i++)
    {
        int low = i - 1, high = i;
        while (low >= 0 && high < n&&s[low] == s[high])
        {
            // st.insert(s.substr(low, high - low + 1));
            st.push_back(s.substr(low, high - low + 1));
            low--, high++;
        }
        low = i - 1, high = i + 1;
        while (low >= 0 && high < n&&s[low] == s[high])
        {
            // st.insert(s.substr(low, high - low + 1));
            st.push_back(s.substr(low, high - low + 1));
            low--, high++;
        }
    }
    long long int ans =0,long long temper = 0;
    // cout<<"Below are "<<st.size()<<" palindrome sub-strings : \n";
    for (vector<string>::iterator it = st.begin(); it != st.end(); it++)
    {
        // cout<<*it<<endl;
        ans++;
        if((*it).size()>1)
            temper++;
    }
    // cout<<temper<<endl<<ans<<endl<<len<<endl;
    cout<<len-(temper)-sss+1<<endl;
    return 0;
    
}


int main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    // #endif  
    string a;
    cin>>a;
    int pds = palindrome(a,a.size());
    // count_pal(a,a.size());

    return 0;
}

Compiler output:
a.cc: In function 'int palindrome(std::string, int)':
a.cc:159:26: error: expected unqualified-id before 'long'
  159 |     long long int ans =0,long long temper = 0;
      |                          ^~~~
a.cc:166:13: error: 'temper' was not declared in this scope
  166 |             temper++;
      |             ^~~~~~
a.cc:169:16: error: 'temper' was not declared in this scope
  169 |     cout<<len-(temper)-sss+1<<endl;
      |                ^~~~~~