criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>
#include <chrono>

#include <boost/math/tools/minima.hpp>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

template<class T>
inline bool chmax(T &a, T b) { return a < b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	auto start = chrono::system_clock::now();
	auto split = chrono::system_clock::now();

	int N;
	cin >> N;
	string s;
	cin >> s;

	auto check = [&](int cut) {
		int res = 0;
		int dp[5010][5010] = {};
		for (int i = 0; i < cut; i++) {
			for (int j = cut; j < N; j++) {
				if (s[i] == s[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
				chmax(res, dp[i + 1][j + 1]);
			}
		}
		return res;
	};

	//// 3分探索
	//int lb = 0, ub = N, ans = 0;
	//while (chrono::duration_cast<chrono::milliseconds>(split-start).count() < 1920) {

	//	int t1 = (2 * lb + ub) / 3;
	//	int t2 = ceil((lb + 2 * ub) / 3.0);

	//	int c1 = check(t1);
	//	int c2 = check(t2);
	//	if (c1 < c2) lb = t1;
	//	else ub = t2;

	//	chmax(ans, max(c1, c2));
	//	split = chrono::system_clock::now();
	//}

	cout << boost::brent_find_minima(check, 0, N).second << endl;

	//DMP(ub, lb);
	//cout << ans << "\n";

	return 0;
}


Compiler output:
a.cc:15:10: fatal error: boost/math/tools/minima.hpp: No such file or directory
   15 | #include <boost/math/tools/minima.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

// ローリングハッシュ
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }
};

int main() {
    int N;
    string S;
    cin >> N >> S;

    // ロリハ
    RollingHash rh(S);

    // 二分探索判定
    bool check = [&](int d) {
        map<pair<long long, long long>, int> ma;
        for (int i = 0; i + d <= N; ++i) {
            auto p = rh.get(i, i+d);
            if (ma.count(p)) {
                if (i - ma[p] >= d) return true;
            }
            else ma[p] = i;
        }
        return false;
    };

    // 二分探索
    int left = 0, right = N/2 + 1;
    while (right - left > 1) {
        int mid = (left + right) >> 1;
        if (check(mid)) left = mid;
        else right = mid;
    }
        
    cout << left << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:18: error: cannot convert 'main()::<lambda(int)>' to 'bool' in initialization
   48 |     bool check = [&](int d) {
      |                  ^~~~~~~~~~~~
      |                  |
      |                  main()::<lambda(int)>
   49 |         map<pair<long long, long long>, int> ma;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   50 |         for (int i = 0; i + d <= N; ++i) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   51 |             auto p = rh.get(i, i+d);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~
   52 |             if (ma.count(p)) {
      |             ~~~~~~~~~~~~~~~~~~
   53 |                 if (i - ma[p] >= d) return true;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   54 |             }
      |             ~     
   55 |             else ma[p] = i;
      |             ~~~~~~~~~~~~~~~
   56 |         }
      |         ~         
   57 |         return false;
      |         ~~~~~~~~~~~~~
   58 |     };
      |     ~             
a.cc:64:18: error: 'check' cannot be used as a function
   64 |         if (check(mid)) left = mid;
      |             ~~~~~^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

// ローリングハッシュ
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }
};

int main() {
    int N;
    string S;
    cin >> N >> S;

    // ロリハ
    RollingHash rh(S);

    // 二分探索判定
    auto check = [&](int d) -> bool {
        map<pair<long long, long long> > ma;
        for (int i = 0; i + d <= N; ++i) {
            auto p = rh.get(i, i+d);
            if (ma.count(p)) {
                if (i - ma[p] >= d) return true;
            }
            else ma[p] = i;
        }
        return false;
    };

    // 二分探索
    int left = 0, right = N/2 + 1;
    while (right - left > 1) {
        int mid = (left + right) >> 1;
        if (check(mid)) left = mid;
        else right = mid;
    }
        
    cout << left << endl;
}


Compiler output:
a.cc: In lambda function:
a.cc:49:40: error: wrong number of template arguments (1, should be at least 2)
   49 |         map<pair<long long, long long> > ma;
      |                                        ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:52:20: error: request for member 'count' in 'ma', which is of non-class type 'int'
   52 |             if (ma.count(p)) {
      |                    ^~~~~
a.cc:53:27: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<long long int, long long int>')
   53 |                 if (i - ma[p] >= d) return true;
      |                           ^
a.cc:55:20: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<long long int, long long int>')
   55 |             else ma[p] = i;
      |                    ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

// ローリングハッシュ
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }
};

int main() {
    int N;
    string S;
    cin >> N >> S;

    // ロリハ
    RollingHash rh(S);

    // 二分探索判定
    auto check = [&](int d) -> bool {
        set<pair<long long, long long> > se;
        for (int i = 0; i + d <= N; ++i) {
            auto p = rh.get(i, i+d);
            if (se.count(p)) return true;
            se.insert(p);
        }
        return false;
    };

    // 二分探索
    int left = 0, right = N/2 + 1;
    while (right - left > 1) {
        int mid = (left + right) >> 1;
        if (check(mid)) left = mid;
        else right = mid;
    }
        
    cout << left << endl;
}


Compiler output:
a.cc: In lambda function:
a.cc:48:9: error: 'set' was not declared in this scope
   48 |         set<pair<long long, long long> > se;
      |         ^~~
a.cc:5:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    4 | #include <algorithm>
  +++ |+#include <set>
    5 | using namespace std;
a.cc:48:40: error: expected primary-expression before '>' token
   48 |         set<pair<long long, long long> > se;
      |                                        ^
a.cc:48:42: error: 'se' was not declared in this scope
   48 |         set<pair<long long, long long> > se;
      |                                          ^~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


// ローリングハッシュ
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }
};


int main() { 
    int N;
    string S;
    cin >> N >> S;

    // ロリハ
    RollingHash rh(S);

    // 二分探索判定
    bool check = [&](int d) {
        for (int i = 0; i < N; ++i) {
            for (int j = i+d; j+d <= N; ++j) {
                if (S[i] != S[j]) continue;
                if (rh.get(i, i+d) == rh.get(j, j+d)) return true;
            }
        }
        return false;
    };

    // 二分探索
    int left = 0, right = N/2 + 1;
    while (right - left > 1) {
        int mid = (left + right) >> 1;
        if (check(mid)) left = mid;
        else right = mid;
    }
        
    cout << left << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:18: error: cannot convert 'main()::<lambda(int)>' to 'bool' in initialization
   49 |     bool check = [&](int d) {
      |                  ^~~~~~~~~~~~
      |                  |
      |                  main()::<lambda(int)>
   50 |         for (int i = 0; i < N; ++i) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   51 |             for (int j = i+d; j+d <= N; ++j) {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   52 |                 if (S[i] != S[j]) continue;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   53 |                 if (rh.get(i, i+d) == rh.get(j, j+d)) return true;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   54 |             }
      |             ~     
   55 |         }
      |         ~         
   56 |         return false;
      |         ~~~~~~~~~~~~~
   57 |     };
      |     ~             
a.cc:63:18: error: 'check' cannot be used as a function
   63 |         if (check(mid)) left = mid;
      |             ~~~~~^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


// ローリングハッシュ
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }
};


int main() { 
    int N;
    string S;
    cin >> N >> S;

    // ロリハ
    RollingHash rh(S);

    // 二分探索判定
    auto check = [&](int d) {
        for (int i = 0; i < N; ++i) {
            for (int j = i+d; j+d <= N; ++j) {
                if (S[i] != S[j]) continue;
                if (rh.get(i, i+d) == rh.get(j, j+d)) return true;
            }
        }
        return false;
    }

    // 二分探索
    int left = 0, right = N/2 + 1;
    while (right - left > 1) {
        int mid = (left + right) >> 1;
        if (check(mid)) left = mid;
        else right = mid;
    }
        
    cout << left << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:5: error: expected ',' or ';' before 'int'
   60 |     int left = 0, right = N/2 + 1;
      |     ^~~
a.cc:61:18: error: ISO C++ forbids using pointer to a function in subtraction [-fpermissive]
   61 |     while (right - left > 1) {
      |            ~~~~~~^~~~~~
a.cc:62:25: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'std::ios_base&(std::ios_base&)' to binary 'operator+'
   62 |         int mid = (left + right) >> 1;
      |                    ~~~~ ^ ~~~~~
      |                    |      |
      |                    |      std::ios_base&(std::ios_base&)
      |                    std::ios_base&(std::ios_base&)
a.cc:63:30: error: assignment of function 'std::ios_base& std::left(ios_base&)'
   63 |         if (check(mid)) left = mid;
      |                         ~~~~~^~~~~
a.cc:64:20: error: assignment of function 'std::ios_base& std::right(ios_base&)'
   64 |         else right = mid;
      |              ~~~~~~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

 bool check(string S, int n){
    int size = S.size();    
    FOR(j,0,size-n){
      int p = j;
      FOR(i,n+j,size){
        // if (size-i < n-(p-j)){
        //   break; 
        // }
        if (S[i] == S[p]){
          p++;
          if (p==n+j){
            return true;
          }
        }else{
            
            p=j;
            int a = 0;
            while(1){
              if (S[i-a]==S[j-a]){p++;a++}
            }
        }
      }
    }
    return false;
  }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string S;
  
  cin >> n;
  cin >> S;
  
  // while(!check(S,n)){
  //   n--;
  // }
  // cout << n << endl;
    int right = n;
    int left = 0;
    int mid;
    int ans = 0;
    while(left<right){
        mid = (left+right)/2;
        dump(mid);
        dump(check(S,mid));
        if(check(S,mid)){
            left = mid+1;
            ans = max(ans,mid);
        }else
        {
            right = mid;
        }
    }
  cout << ans  << endl;

}


Compiler output:
a.cc: In function 'bool check(std::string, int)':
a.cc:36:42: error: expected ';' before '}' token
   36 |               if (S[i-a]==S[j-a]){p++;a++}
      |                                          ^
      |                                          ;
Language: C++

using namespace std;


int main()
{
    // 整数の入力
    // スペース区切りの整数の入力
    int N;
    cin >> N;
    string s;
    cin >> s;
    int dp[N][N];
    int ans = 0;
    // 文字列の入力
    for(int i=N; 0<i; i--){
        for (int j=i-1; -1<j; j--) {
            if(s[i]==s[j]){
                if(i<N-1){
                    dp[i][j] = std::min(dp[i+1][j+1]+1, i-j);
                }else{
                    dp[i][j] = 1;
                }
            }else{
                dp[i][j] = 0;
            }
            if(dp[i][j]>ans){
                ans = dp[i][j];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> N;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:10:5: error: 'string' was not declared in this scope
   10 |     string s;
      |     ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:11:12: error: 's' was not declared in this scope
   11 |     cin >> s;
      |            ^
a.cc:19:37: error: 'min' is not a member of 'std'
   19 |                     dp[i][j] = std::min(dp[i+1][j+1]+1, i-j);
      |                                     ^~~
a.cc:31:5: error: 'cout' was not declared in this scope
   31 |     cout << ans << endl;
      |     ^~~~
a.cc:31:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:20: error: 'endl' was not declared in this scope
   31 |     cout << ans << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define MOD 1000000007
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

vector<int> z_algorithm(string &s) {
    vector<int> prefix(s.size());
    for(int i=1, j=0; i<s.size(); i++) {
        if(i + prefix[i-j] < j + prefix[j]) {
            prefix[i] = prefix[i - j];
        } else {
            int k = max(0, j + prefix[j] - i);
            while(i + k < s.size() && k < i && s[k] == s[i + k]) k++;
            prefix[i] = k;
            j = i;
        }z
    }
    return prefix;
}

int main() {
    int n;

    string s;
    cin >> n >> s;

    int ans = 0;
    for(int i=0; i<n; i++) {
        auto ss = s.substr(i);
        auto p = z_algorithm(ss);
        chmax(ans, *max_element(p.begin(), p.end()));
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'std::vector<int> z_algorithm(std::string&)':
a.cc:19:10: error: 'z' was not declared in this scope
   19 |         }z
      |          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ull mask(int a) { return (1ull << a) - 1; }
const int bases[64] = {257,262,266,275,276,281,285,290,296,302,306,310,311,313,323,333,344,345,350,357,367,370,373,402,423,425,431,440,442,443,454,457,458,462,471,478,481,487,489,492,499,501,502,503,506,514,524,532,535,541,550,552,557,559,562,563,567,570,571,580,592,597,604,612};
const ull mod = 0x1fffffffffffffff, base = bases[chrono::duration_cast<chrono::microseconds>(chrono::system_clock::now().time_since_epoch()).count() & 63];
struct RollingHash {
    vector<ull> hashed, power;
    inline ull mul(ull a, ull b) const {
        __uint128_t ans = __uint128_t(a) * b;
        ans = (ans >> 61) + (ans & mask(61));
        if(ans >= mod) ans -= mod;
        return ans;
    }
    RollingHash(const string &s) {
        ll n = s.size();
        hashed.assign(n + 1, 0);
        power.assign(n + 1, 0);
        power[0] = 1;
        rep(n) {
            power[i + 1] = mul(power[i], base);
            hashed[i + 1] = mul(hashed[i], base) + s[i];
            if(hashed[i + 1] >= mod) hashed[i + 1] -= mod;
        }
    }
    ull get(ll l, ll r) const {
        ull ret = hashed[r] + mod - mul(hashed[l], power[r - l]);
        if(ret >= mod) ret -= mod;
        return ret;
    }
};
struct HashSet{
    vector<pair<ll, ll>> data[1 << 14];
    ll get(ll at, ll val){
        for(auto& i : data[at & mask(14)]) if(i.first == at) return val - i.second;
        data[at & mask(14)].emplace_back(at, val);
        return 0;
    }
};
int main(){
    int n;
    string s;
    cin >> n >> s;
    RollingHash rh(s);
    int ok = 0, ng = n / 2 + 1;
    while(ng - ok > 1){
        int cen = (ok + ng) / 2;
        bool flag = 0;
        HashSet cnt;
        for(int i = cen; i <= n; i++) if(cnt.get(rh.get(i - cen, i), i) >= cen){
            flag = 1;
            break;
        }
        if(flag) ok = cen;
        else ng = cen;
    }
    cout << ok << endl;
}


Compiler output:
a.cc: In constructor 'RollingHash::RollingHash(const std::string&)':
a.cc:22:9: error: 'rep' was not declared in this scope
   22 |         rep(n) {
      |         ^~~
Language: C

#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
	long int i, j, k, l;
	long int n;
	long int sum;
	long int max;
	long int count;
	long int index;
	long int a[26][5001] = {{0}};
	char str[5001];
	
	scanf("%ld%s", &n, str);
	
	max = sum = 0;
	
	/*
	for(i = 0; i < n; i++) {
		for(j = i + 1; j < n; j++) {
			if( str[i] == str[j] ) {
				sum = 1;
				for(k = 1; k + j < n; k++) {
					if( (str[i + k] != str[j + k]) || (i + k >= j) ) {
						j += k;
						break;
					}
					sum++;
				}
				if(sum > max) {
					max = sum;
				}
			}
		}
	}
	*/
	
	for(i = 0; i < 26; i++) {
		for(j = 1; j < a[i][0] - 1; j++) {
			for(k = j + 1; k < a[i][0]; k++) {
				sum = 1;
				for(l = 1; l + a[i][k] < n; l++) {
					if( (str[ a[i][j] + l ] != str[ a[i][k] + l) || ( a[i][j] + l >= a[i][k] ) ) {
						break;
					}
				}
				if(sum > max) {
					max = sum;
				}
			}
		}
	}
	
	printf("%ld\n", max);
	
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:48:84: error: expected ']' before ')' token
   48 |                                         if( (str[ a[i][j] + l ] != str[ a[i][k] + l) || ( a[i][j] + l >= a[i][k] ) ) {
      |                                                                                    ^
      |                                                                                    ]
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())


lli dp[5005][5005];

signed main(){

	lli n;
	cin>>n;
	string s;
	cin>>s;

	for(lli i=n-1;i>=0;i--){
		for(lli j=n-1;j>=0;j--){
			if(s[i] != s[j])dp[i][j] = 0;
			else dp[i][j] = dp[i+1][j+1] + 1;
		}
	}

	lli ans = 0;
	REP(i,0,n){
		REP(j,0,n){
			if(i>=j)continue;
			lli now = min(dp[i][j],j-1);
			ans = max(ans,now);
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:38: error: no matching function for call to 'min(long long int&, int)'
   35 |                         lli now = min(dp[i][j],j-1);
      |                                   ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:35:38: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   35 |                         lli now = min(dp[i][j],j-1);
      |                                   ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:35:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |                         lli now = min(dp[i][j],j-1);
      |                                   ~~~^~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
using uint = unsigned int;

int main() {
	int N;
	cin >> N;
	string  S;
	cin >> S;
	
	for(uint i=N/2; i>0; i--) {
		for(uint k=0; k+i<N; k++) {
			string t = S.substr(k, i);
			
			string f = S.substr(0, k);
			string l = S.substr(k+i);
			
			if (f.find(t) != nops || l.find(t) != nops) {
				cout << i;
				return 0
			}
		}
	}
	
	cout << 0;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:42: error: 'nops' was not declared in this scope
   19 |                         if (f.find(t) != nops || l.find(t) != nops) {
      |                                          ^~~~
a.cc:21:41: error: expected ';' before '}' token
   21 |                                 return 0
      |                                         ^
      |                                         ;
   22 |                         }
      |                         ~
Language: C++

#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int table[110000];
void createTable(string pat){
    table[0] = -1;
    int j = -1;
    for(int i = 1; i < pat.size(); i++){
        while(j >= 0 && pat[i] != pat[j]){
            j = table[j];
        }
        j += 1;
        table[i + 1] = j;
    }
}

int KMPSearch(string target, string pattern){
    createTable(pattern, sz2);
    int ret = 0;
    int i = 0, p = 0;
    while(i < target.size() && p < pattern.size()){
        if(target[i] == pattern[p]){
            i += 1;
            p += 1;
        }else if(p == 0){
            i += 1;
        }else{
            p = table[p];
        }
        ret = max(ret, p);
    }
    return ret;
}

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int ans = 0;
    for(int i = 1; i < N; i++){
        ans = max(ans, KMPSearch(S.substr(0, i), S.substr(i)));
    }
    cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int KMPSearch(std::string, std::string)':
a.cc:38:26: error: 'sz2' was not declared in this scope
   38 |     createTable(pattern, sz2);
      |                          ^~~
Language: C++


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int dp[5001][5001];

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;

    for(int i = N-1; i >= 0; i--){
        for(int j = N-1; j >= 0; j--){
            if(s[i] != s[j]){
                dp[i][j] = 0;
            }else{
                dp[i][j] = dp[i-1][j-1] + 1;
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(i >= j){
                continue;
            }else{
                int now = min(dp[i][j], j-i);
                ans = max(ans, now);
            }
        }
    }

    cout << ans << endl;


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: 's' was not declared in this scope
   19 |             if(s[i] != s[j]){
      |                ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main(){
  int n;
  cin >> n;
  string str;
  cin >> str;
  int res = 0;
  vector<vector<int>> spells(26, vector<int>());
  for(int i=0; i<n; i++){
    if(spells[str[i] - 'a'].empty()){
      spells[str[i] - 'a'].push_back(i);
    }else{
      for(int j=0; j<spells[str[i] - 'a'].size(); j++){
        int p = spells[str[i] - 'a'][j];
        int k = i;
        int kari = 0;
        bool irane = false;
        while(k<n){
          if(str[p] == str[k]){
            if(p == i){
              irane = true;
              break;
            }
            kari++;
          }else{
            break;
          }
          k++;
          p++;
        }
        if(kari > res) res = kari;
      }
      if(!irane) spells[str[i] - 'a'].push_back(i);
    }
  }
  cout << res << endl;
  return 0;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:36:11: error: 'irane' was not declared in this scope
   36 |       if(!irane) spells[str[i] - 'a'].push_back(i);
      |           ^~~~~
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
#define MAXN 50100
#define INF (1<<30)
#define ll long long
int wa[MAXN],wb[MAXN],wv[MAXN],wss[MAXN];
int cmp(int *r,int a,int b,int l){
    return r[a]==r[b] && r[a+l]==r[b+l];
}
int sa[MAXN],Rank[MAXN],height[MAXN];
void SA(int *r,int n,int m){
    int *x=wa,*y=wb;

    for(int i=0; i<m; ++i) wss[i]=0;
    for(int i=0; i<n; ++i) ++wss[x[i]=r[i]];
    for(int i=1; i<m; ++i) wss[i]+=wss[i-1];
    for(int i=n-1; i>=0; --i) sa[--wss[x[i]]]=i;

    int p=1;
    for(int j=1; p<n; j<<=1,m=p){
        p=0;
        for(int i=n-j; i<n; ++i) y[p++]=i;
        for(int i=0; i<n; ++i) if(sa[i]>=j) y[p++]=sa[i]-j;
        for(int i=0; i<n; ++i) wv[i]=x[y[i]];
        for(int i=0; i<m; ++i) wss[i]=0;
        for(int i=0; i<n; ++i) ++wss[wv[i]];
        for(int i=1; i<m; ++i) wss[i]+=wss[i-1];
        for(int i=n-1; i>=0; --i) sa[--wss
            [wv[i]]]=y[i];
        swap(x,y); x[sa[0]]=0; p=1;
        for(int i=1; i<n; ++i) x[sa[i]]=cmp(y,sa[i-1],sa[i],j)?p-1:p++;
    }

    for(int i=1; i<n; ++i) Rank[sa[i]]=i;
    int k=0;
    for(int i=0; i<n-1; height[Rank[i++]]=k){
        if(k) --k;
        for(int j=sa[Rank[i]-1]; r[i+k]==r[j+k]; ++k);
    }
}
int check(int n,int k,int mid)
{
    int i,s=1;
    for(i=1;i<=n;i++)
    if(height[i]>=mid)
    {
      s++;
      if(s>=k) return(1);
    }
    else s=1;
    return(0);
}


int minnum[MAXN][16];
void RMQ(int n)         //预处理  O(nlogn)
{
    int i,j;
    int m=(int)(log(n*1.0)/log(2.0));
    for(i=1;i<=n;i++)
        minnum[i][0]=height[i];
    for(j=1;j<=m;j++)
        for(i=1;i+(1<<j)-1<=n;i++)
            minnum[i][j]=min(minnum[i][j-1],minnum[i+(1<<(j-1))][j-1]);
}
int Ask_MIN(int a,int b)    //O(1)
{
    int k=int(log(b-a+1.0)/log(2.0));
    return min(minnum[a][k],minnum[b-(1<<k)+1][k]);
}
int calprefix(int a,int b)
{
    a=Rank[a],b=Rank[b];
    if(a>b)
        swap(a,b);
    return Ask_MIN(a+1,b);
}


int a[MAXN];


int main(){
    int n;
    char ss[50100];
    scanf("%d",&n);
    scanf("%s",ss);
    int len=strlen(ss);
    for(int i=0; i<len; ++i){
        a[i]=(int)ss[i];
        //cout<<a[i]<<"    ";
    }
    a[len]=0;
    //cout<<endl<<endl;
    SA(a,len+1,300);
    int ans=0;
    for(int i=1;i<=len;i++){
        ans=max(min(abs(sa[i]-sa[i-1]),height[i]),ans);
    }
    printf("%d\n",ans);
    



    return 0;
}


Compiler output:
a.cc: In function 'void RMQ(int)':
a.cc:62:17: error: 'log' was not declared in this scope; did you mean 'long'?
   62 |     int m=(int)(log(n*1.0)/log(2.0));
      |                 ^~~
      |                 long
a.cc: In function 'int Ask_MIN(int, int)':
a.cc:71:15: error: 'log' was not declared in this scope; did you mean 'long'?
   71 |     int k=int(log(b-a+1.0)/log(2.0));
      |               ^~~
      |               long
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

/////////////////////////////////////////////////////////

bool comp(pair<string, ll> a, pair<string, ll> b){
  if(a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}

void Main() {
  ll N; cin >> N;
  string S; cin >> S;
  ll res = 0;
  vector<pair<string, ll>> list(N);
  rep(i, 0, N){
    list[i] = make_pair(S.substr(i, N - i), i);
  }
  sort(all(list), comp);
  rep(i, 0LL, N - 1LL){
    ll m = list[i].first.size();
    ll n = list[i + 1LL].first.size();
    ll ma = abs(list[i + 1Ll].second - list[i].second);
    rep(j, 0LL, min({m, n, ma})){
      if(list[i].first[j] != list[i + 1LL].first[j]){
        chmax(res, j);
        break;
      }
      if(j == min({m, n, ma}) - 1LL){
        chmax(res, min({m, n, ma}));
      }
    }
  }
  cout << res << endl;
}

/////////////////////////////////////////////////////////

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();
}


Compiler output:
a.cc: In function 'void Main()':
a.cc:77:26: error: unable to find numeric literal operator 'operator""Ll'
   77 |     ll ma = abs(list[i + 1Ll].second - list[i].second);
      |                          ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>

using namespace std;

string S;

int DFS(pair<int, int> p, int depth){
    if(p.second + depth >= S.length())
        return depth;

    if (p.first + depth >= p.second)
        return depth;

    if(S[p.first + depth] == S[p.second + depth])
        return DFS(p, depth + 1);

    return depth;
}

int main(void){
    int N, result = 0;

    cin >> N >> S;

    for(int i = 0; i < S.length(); i++){
        for(int j = i + 1; j < S.length(); j++){
            if(S[i] == S[j]){}
                int tmp = DFS(make_pair(i, j), 1);
                j += tmp;
                result = max(result, tmp);
        }
        }
    }
    cout << result << endl;
    return 0;
}

Compiler output:
a.cc:37:5: error: 'cout' does not name a type
   37 |     cout << result << endl;
      |     ^~~~
a.cc:38:5: error: expected unqualified-id before 'return'
   38 |     return 0;
      |     ^~~~~~
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
  	int N;
	string S;
    cin >> N;
    cin >> S;
    int cnt = 0,maxv = 0;
    REP(i,N-1){
        if(S[i] == S[i+1]){
            if(i == N-2){cout << (N/2) << endl;return 0;}
        }
      	else break;
    }
    for(int i = 0; i < N-1;++i){
        for(int j = i+1;j < N;++j){
            if(S[i] == S[j]){
                ++cnt;
                ++i;
                if(j+1 >= S.size()) flag = 1;;
                if(i + 1 == stop) flag = 1;
            }
            else{
                maxv = max(maxv,cnt);
                cnt = 0;
            }
            if(flag){
                maxv = max(maxv,cnt);
                cnt = 0;
            }
        }
    }
    cout << maxv << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:37: error: 'flag' was not declared in this scope
   35 |                 if(j+1 >= S.size()) flag = 1;;
      |                                     ^~~~
a.cc:36:29: error: 'stop' was not declared in this scope
   36 |                 if(i + 1 == stop) flag = 1;
      |                             ^~~~
a.cc:36:35: error: 'flag' was not declared in this scope
   36 |                 if(i + 1 == stop) flag = 1;
      |                                   ^~~~
a.cc:42:16: error: 'flag' was not declared in this scope
   42 |             if(flag){
      |                ^~~~
Language: C

#include <stdio.h>
#include <math.h>

int mian(){
  int n,flag=0,jsum,ksum;
  scanf("%d",&n);
  char s[n+1];
  scanf("%s",s);
  
  int N;
  if(n%2==1){
    N=(n-1)/2;
  }else{
    N=n/2;
  }
  
  for(int i=N;i>=1;i--){
    for(int j=0;j<=n-2*i+1;j++){
      for(int k=j+i+1;k<=n-1;k++){
        jsum=0;
        ksum=0;
        for(int l=0;l<=i-1;l++){
          int a=s[j+l]-'a';
          int b=s[k+l]-'a';
          jsum+=pow(2,a);
          ksum+=pow(2,b);
          if(jsum-ksum>0.01 || jsum-ksum<-0.01){
            break;
          }else{
            if(l==i-1){
              printf("%d",i);
              flag=1;
            }
          }
          if(flag==1){
            break;
          }
        }
        if(flag==1){
         break; 
        }
      }
      if(flag==1){
        break;
      }
    }
    if(flag==1){
      break;
    }
  }
  if(flag==0){
    printf("0");
  }
  return 0;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
/usr/bin/ld: /tmp/cctvhUy5.o: in function `mian':
main.c:(.text+0x156): undefined reference to `pow'
/usr/bin/ld: main.c:(.text+0x188): undefined reference to `pow'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;
typedef pair<int,int> p;
int main(){
	int n;cin>>n;
	string s;
	cin>>s;
	int a = n/2;
//	ch(a,'a');
	int ans = 0;
	int k = 0;
	for(int a = n/2; a>0; a--){
	  //cout<<"kore umaku ikeba ans is"<<a<<endl;
	for(int i = 0 ;a+i<n; i++){
		for( k = 0; k < a; k++){
		  for(int es = 0 ;es+a+i+k<n; es++){
		  if(s[i+k]!=s[i+a+k+es]){
	//		ch(i+k,"i+k");che(s[i+k],"s[i+k]");
	//		ch(i+k+a,"i+k+a");che(s[i+k+a],"S[i+k+a");
			break;
			}}
		   if(k==a-1){
			  ans = a; 
			  break;
			}
			}
			if(ans!=0){
				break;
			  }
		if(ans!=0){
				break;
			  }

	  }if(k==a-1){
			  ans = a; 
			  break;

	  }
	   cout<<ans<<endl;

 }



Compiler output:
a.cc: In function 'int main()':
a.cc:50:3: error: expected '}' at end of input
   50 |  }
      |   ^
a.cc:13:11: note: to match this '{'
   13 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;
typedef pair<int,int> p;
int main(){
	int n;cin>>n;
	string s;
	cin>>s;
	int a = n/2;
//	ch(a,'a');
	int ans = 0;
	for(int a = n/2; a>0; a--){
	  //cout<<"kore umaku ikeba ans is"<<a<<endl;
	for(int i = 0 ;a+i<n; i++){
		for(int k = 0; k < a; k++){
		  for(int es = 0 ;es+a+i+k<n){
		  if(s[i+k]!=s[i+a+k+es]){
	//		ch(i+k,"i+k");che(s[i+k],"s[i+k]");
	//		ch(i+k+a,"i+k+a");che(s[i+k+a],"S[i+k+a");
			break;
			}}
		   if(k==a-1){
			  ans = a; 
			  break;
			}
			}
			if(ans!=0){
				break;
			  }
		if(ans!=0){
				break;
			  }

	  }if(k==a-1){
			  ans = a; 
			  break;

	  }
	   cout<<ans<<endl;

 }




Compiler output:
a.cc: In function 'int main()':
a.cc:24:45: error: expected ';' before ')' token
   24 |                   for(int es = 0 ;es+a+i+k<n){
      |                                             ^
      |                                             ;
a.cc:42:15: error: 'k' was not declared in this scope
   42 |           }if(k==a-1){
      |               ^
a.cc:49:3: error: expected '}' at end of input
   49 |  }
      |   ^
a.cc:13:11: note: to match this '{'
   13 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

//++時計回り --反時計回り
// int dx[4] = {1, 0, -1, 0};
// int dy[4] = {0, 1, 0, -1};

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  REP(i, N) {
    for (int j = i + 1; j < N; j++) {
      if (ans >= (N-i)/2) break;
      if (S[i] == S[j]) {
        int count = 1;
        int same = 1;
        for (int k = i + 1; k < N; k++) {
          if (S[k] == S[k+j-i] && k != j) {
            count++;
            if (S[k] == S[k-1]) same++;
            ans = max(ans, count);
          } else {
            break;
          }
        }
      }
    }
    i += ans - 1
  }
  cout << ans << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:17: error: expected ';' before '}' token
   38 |     i += ans - 1
      |                 ^
      |                 ;
   39 |   }
      |   ~
Language: C++

<bits/stdc++.h>

using namespace std;


int main(){
    
    int N;
    cin >> N;
    string S;
    cin >> S;
    
    int anser = 0;
    
    for (int i = 0; i < N; i++) {
        int len = 0;
        int ans = 0;
        
        for (int j = i+1; j < N; j++) {
            int an = 0;
            int f = 0;
            if (S[i] == S[j]) {
                len = j-i;
                f = 0;
                an = 0;
                
                //cout << "len" << i << " " << j << "    " << len << endl;
                for (int k = 0; k < len && j+k < N; k++) {
                    if (S[i+k] == S[j+k]) {
                        an += 1;
                        if (S[i] == S[i+k] && f == k) {
                            f += 1;
                        }
                    }else{
                        break;
                    }
                    
                }
                //cout << an << endl;
                if (ans < an) {
                    ans = an;
                    
                }
            }
            
            
    
            
        }
        
        
        if (anser < ans) {
            anser = ans;
        }
        
        
        
        
    }
    
    cout << anser << endl;
}


Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> N;
      |     ^~~
a.cc:10:5: error: 'string' was not declared in this scope
   10 |     string S;
      |     ^~~~~~
a.cc:11:12: error: 'S' was not declared in this scope
   11 |     cin >> S;
      |            ^
a.cc:61:5: error: 'cout' was not declared in this scope
   61 |     cout << anser << endl;
      |     ^~~~
a.cc:61:22: error: 'endl' was not declared in this scope
   61 |     cout << anser << endl;
      |                      ^~~~
Language: C++

using namespace std;
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <unordered_set>
int main(){
  int N;
  string str;
  cin >> N >> str;
  vector<vector<int>> dp(str.length() + 1, vector<int>(str.length() + 1));
  vector<vector<unordered_set<int>>> uset(str.length() + 1, vector<unordered_set<int>>(str.length() + 1));
  int maxLength = 0;
  for (int i1 = 1; i1 <= str.length(); i1++) {
    for (int i2 = i1+1; i2 <= str.length(); i2++) {
      if (str[i1 - 1] == str[i2 - 1]) {
        auto it1 =uset[i1-1][i2-1].find(i2)
        if (!(it1 == uset[i1-1][i2-1].end())){
          unordered_set<int> x(uset[i1-1][i2-1]);
          x.insert(i2);
          uset[i1][i2] = x;
          dp[i1][i2] = 1 + dp[i1 - 1][i2 - 1];
        }
        maxLength = max(maxLength, dp[i1][i2]);
      } 
    }
  }
  cout << maxLength << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: expected ',' or ';' before 'if'
   18 |         if (!(it1 == uset[i1-1][i2-1].end())){
      |         ^~