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

//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

//logx(a^n)=loga(a^n)/logx(a)
//logx(a*b)=logx(a)+logx(b)
//logx(y)=log(y)/log(x)

#define ordered_set tree<ll,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define putf push_front
#define gainb pop_back

#define gainf pop_front
#define len(x) (ll)x.size()

// 1/b%mod=b^(m-2)%mod
// (a>>x)&1==0

typedef double db;
typedef long long ll;

const ll ary=5e3+5;
const ll mod=1e9+7;
const ll inf=1e18;

using namespace std;
using namespace __gnu_pbds;
ll n,h[ary],bp[ary],p=31;
string s;
ll hash(ll l,ll r){
	return (h[r]-(h[l-1]*bp[r-l+1]%mod)+mod)%mod;
}
ll ch(ll k){
	for(int i=0;i<len(s);i++){
		if(i+k-1>=len(s)){
			break;
		}
		for(int j=i+k;j<len(s);j++){
			if(j+k-1>=len(s)){
				break;
			}
			if(hash(i,i+k-1)==hash(j,j+k-1)){
				return 1;
			}
		}
	}
	return 0;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	bp[0]=1;
	for(int i=1;i<=ary-5;i++){
		bp[i]=bp[i-1]*p;
		bp[i]%=mod;
	}
	cin>>n>>s;
	for(int i=0;i<len(s);i++){
		h[i]=s[i];
		if(i){
			h[i]+=(h[i-1]*p);
		}
		h[i]%=mod;
	}
	ll l=1,r=n,ans=0;
	while(l<=r){
		ll m=(l+r)/2;
		if(ch(m)){
			l=m+1;
			ans=m;
		}
		else{
			r=m-1;
		}
	}
	cout<<ans;
}

Compiler output:
a.cc:7:9: warning: "full" redefined
    7 | #define full(x) x.begin(),x.end()
      |         ^~~~
a.cc:6:9: note: this is the location of the previous definition
    6 | #define full(x,n) x,x+n+1
      |         ^~~~
a.cc: In function 'll ch(ll)':
a.cc:51:28: error: reference to 'hash' is ambiguous
   51 |                         if(hash(i,i+k-1)==hash(j,j+k-1)){
      |                            ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:3:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:39:4: note:                 'll hash(ll, ll)'
   39 | ll hash(ll l,ll r){
      |    ^~~~
a.cc:51:43: error: reference to 'hash' is ambiguous
   51 |                         if(hash(i,i+k-1)==hash(j,j+k-1)){
      |                                           ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:39:4: note:                 'll hash(ll, ll)'
   39 | ll hash(ll l,ll r){
      |    ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 1000000007;
const int MOD = (int)1e9+7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-1, 0, 1, 1};
int dx[4] = {0, 1, 0, 1};

int n;
string s;

int f(string s) {
	int n = s.size(), l = -1, r = -1;
	vi p(n);

	for(int i=1; i<n; ++i) {
		if(i<=r) p[i] = min(r-i, p[i-l]);
		while (i+p[i]+1<n && s[i+p[i]+1] == s[p[i]+1]) p[i]++;
		if (r < i+p[i]) r = i+p[i], l = i;
	}

	int ret = 0;
	rep(i,1,n) {
		ret = max(ret, min(i,p[i]));
	}
	return ret;
}

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	scanf("%d", &n);
	char buff[5001]
	scanf("%s", buff)
	s = string(buff);
	int ret = 0;
	rep(i,0,n) {
		ret = max(ret, f(s.substr(i)));
	}
	cout << ret << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:9: error: expected initializer before 'scanf'
   50 |         scanf("%s", buff)
      |         ^~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int dp[5005][5005];

int main(){
  int n;
  string s;
  cin >> n >> 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] = dp[i+1][j+1] + 1;
      else dp[i][j] = 0;
    }
  }
  
  int ans = 0;
  int s = 0;
  rep(i,n){
    rep(j,n){
      if(i>=j) continue;
      s = min(dp[i][j],j-i);
      ans = max(ans,s);
    }
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:7: error: conflicting declaration 'int s'
   21 |   int s = 0;
      |       ^
a.cc:10:10: note: previous declaration as 'std::string s'
   10 |   string s;
      |          ^
a.cc:26:16: error: no matching function for call to 'max(int&, std::string&)'
   26 |       ans = max(ans,s);
      |             ~~~^~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:26:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   26 |       ans = max(ans,s);
      |             ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:26:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |       ans = max(ans,s);
      |             ~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int dp[5005][5005];

int main(){
  int n;
  string s;
  cin >> n >> 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] = dp[i+1][j+1] + 1;
      }else{
        dp[i][j] = 0;
      }
    }
  }
  
  ll ans = 0;
  ll s = 0;
  rep(i,n){
    rep(j,n){
      if(i>=j) continue;
      s = min(dp[i][j],j-i);
      ans = max(ans,s);
    }
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:6: error: conflicting declaration 'll s'
   24 |   ll s = 0;
      |      ^
a.cc:10:10: note: previous declaration as 'std::string s'
   10 |   string s;
      |          ^
a.cc:29:16: error: no matching function for call to 'max(ll&, std::string&)'
   29 |       ans = max(ans,s);
      |             ~~~^~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:29:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   29 |       ans = max(ans,s);
      |             ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |       ans = max(ans,s);
      |             ~~~^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define N 5000 + 10
int f[N][N],n,ans;
char s[N];

int main(){
ios::sync_with_stdio(false);
cin>>n>>s;
for(int i=n-1;i>=0;i--)
for(int j=n-1;j>=0;j--){
if(s[i]==s[j])
f[i][j]=max(f[i][j],f[i+1][j+1]-1);
ans=max(ans,min(f[i][j],j-1);
}
cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: expected ')' before ';' token
   15 | ans=max(ans,min(f[i][j],j-1);
      |        ~                    ^
      |                             )
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define N 5000 + 10
int f[N][N],n,ans;
char s[N];

int main(){
ios::sync_with_stdio(false);
cin>>n>>s;
for(int i=n-1;i>=0;i++)
for(int j=n-1;j>=0;j++){
if(s[i]==s[j])
f[i][j]=max(f[i][j],f[i+1][j+1]-1);
ans=max(ans,min(f[i][j],j-1);
}
cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: expected ')' before ';' token
   15 | ans=max(ans,min(f[i][j],j-1);
      |        ~                    ^
      |                             )
Language: C++

#include "bits/stdc++.h"
#include <random>
#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
constexpr int dy[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template <class T> bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
// verified: http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3381829
// moda, modb は桁数増やした方が良いかも.
using namespace std;
class RollingHash {
  using ull = uint64_t;
  int n;
  random_device seed;
  mt19937 rnd{seed};
  static const ull moda = (ull)1e9 + 7;
  static const ull modb = (ull)1e9 + 9;
  ull b1 = (ull)rnd(), b2 = (ull)rnd();
  std::vector<ull> a, b, p, q;

public:
  RollingHash(const std::string& str) : n((int)str.size()), a(n + 1, 0), b(n + 1, 0), p(n + 1, 1), q(n + 1, 1) {
    for (int i = 0; i < n; i++) {
      a[i + 1] = (a[i] * b1 + ull(str[i])) % moda;
      b[i + 1] = (b[i] * b2 + ull(str[i])) % modb;
      p[i + 1] = p[i] * b1 % moda;
      q[i + 1] = q[i] * b2 % modb;
    }
  }
  // [l, r) のハッシュ値を取得
  std::pair<ull, ull> query(int l, int r) {
    assert(0 <= l && l <= r && r <= n);
    ull h1 = (p[r - l] * a[l] - a[r] + moda) % moda;
    ull h2 = (q[r - l] * b[l] - b[r] + modb) % modb;
    return std::make_pair(h1, h2);
  }
};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  string s; cin >> s;
  RollingHash h(s);
  using ull = uint64_t;
  map< pair<ull, ull>, int> a, b, c;
  REP(i, n)FOR(j, i, n) {
    auto d = h.query(i, j + 1);
    if (a.count(d)) {
      a[d] = min((int)i, a[d]);
    }
    else {
      a[d] = i;
    }
    if (b.count(d)) {
      b[d] = max((int)i, b[d]);
    }
    else {
      b[d] = i;
    }
    c[d] = j - i + 1;
  }
  int ans = 0;
  for (auto d : c) {
    auto p = d.first;
    if (b[p] - a[p] >= d.second)ans = max(ans, d.second);
  }
  cout << ans << endl;
}


Compiler output:
a.cc:47:19: error: could not convert '{((RollingHash*)this)->RollingHash::seed}' from '<brace-enclosed initializer list>' to 'std::mt19937' {aka 'std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>'}
   47 |   mt19937 rnd{seed};
      |                   ^
      |                   |
      |                   <brace-enclosed initializer list>
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=5e4+7;
int rak[maxn],sa[maxn],tax[maxn],tp[maxn],Height[maxn];
char a[maxn];           //这里其实每个数组元素就相当于一个字符，连起来就相当于一个字符串，不要死板的以为只能输char数组,有很多转换变形 
int M,len;	
void Qsort()
{
    for(int i=0;i<=M;++i)   tax[i]=0;
    for(int i=1;i<=len;++i)    tax[rak[i]]++;
    for(int i=1;i<=M;++i)   tax[i]+=tax[i-1];
    for(int i=len;i>=1;--i)     sa[tax[rak[tp[i]]]--] = tp[i];
}
void suffixsort()
{
    M=5050;
    for(int i=1;i<=len;++i)
    {
        rak[i]=a[i];
        tp[i]=i;
    }
    Qsort();
    for(int w=1;w<=len;w<<=1)
    {
        int p=0;
        for(int i=len-w+1;i<=len;++i)
            tp[++p]=i;
        for(int i=1;i<=len;++i)
            if(sa[i]>w)
                tp[++p]=sa[i]-w;
        Qsort();
        swap(rak,tp);
        rak[sa[1]]=p=1;
        for(int i=2;i<=len;++i){
            rak[sa[i]]=((tp[sa[i-1]]==tp[sa[i]])&&(tp[sa[i-1]+w]==tp[sa[i]+w]))?p:++p;
            if(p==len)  break;
            M=p;
        }
    }
}
void getHeight()
{
    int j,k=0;
    for(int i=1;i<=len;++i){
    	if(rank[i]==1) continue;
        if(k)   k--;
        int j=sa[rak[i]-1];
        while (i+k<=len && j+k<=len &&a[i + k] == a[j + k]) k++;
        Height[rak[i]] = k;
    }
}
int check(int x)
{
    int mx=sa[1],mi=sa[1];
    for(int i=2;i<=len;++i){
        if(Height[i]<x) mx=mi=sa[i];
        else{
            if(sa[i]<mi)    mi=sa[i];
            if(sa[i]>mx)    mx=sa[i];
            if(mx-mi>=x)     return 1;
        }
    }
    return 0;
}
int main()
{
		cin>>len;cin>>(a+1);
		map<char,int> mp;int ok=0;
		for(int i=1;i<=len;i++)
		{
			if(mp.count(a[i]))
			{
				ok=1;break;
			}
			else mp[a[i]]=1;
		}                                  
        suffixsort();
        getHeight();
        int res=0;
        int l=1,r=len/2+1,mid;
        while(l<r)
        {
            mid=(l+r)>>1;
            if(check(mid)){
                res=mid;
                l=mid+1;
            }
            else{
                r=mid;
            }
        }
        cout<<res<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'void getHeight()':
a.cc:45:16: error: expected unqualified-id before '[' token
   45 |         if(rank[i]==1) continue;
      |                ^
Language: Java

public class Main {

    public static void main(String[] args) {
        int res = maxRepeatSubString2("1x23231923263");
        System.out.println(res);  // 输出 3
    }
    
    /**
     * 不允许交叉
     * 
     * @param src
     * @return
     */
    public static int maxRepeatSubString2(String src) {
        SuffixArray.Suff[] sa = SuffixArray.getSa2(src);
        int[] height = SuffixArray.getHeight(src, sa);
        int l = 0;
        int r = height.length;
        int ans = 0;
        while (l <= r) {
            int mid = l + ((r - l) >> 1);// check的重叠长度
            if (check(height, sa, mid)) {
                if (mid == height.length / 2) {
                    return mid;
                }
                l = mid + 1;
                ans = mid;
                // return mid;
            } else {
                r = mid - 1;
            }
        }
        return ans;
    }
    
    /**
     * 用len将height分组,小于组和大于等于组交替
     * 在大于组中更新最大最小原始小标,大转小的时候检查上一个大于组是否满足不重叠
     * 在小于组中,只需持续地将原始下标付给max和min,这样小转大的时候,可以保留小于组最后一个元素的下标
     */
    private static boolean check(int []height,SuffixArray.Suff[]sa,int len){
        int minIndex = sa[0].index;
        int maxIndex = sa[0].index;
        for(int i = 1;i<height.length;i++){
            int index = sa[i].index;
            if(height[i]>=len){ // lcp 大于 len
                minIndex = Math.min(minIndex,index);
                maxIndex = Math.max(maxIndex, index);
            } else {
                if (maxIndex - minIndex >= len) {
                    return true;
                }
                maxIndex = index;
                minIndex = index;
            }
        }
        return (maxIndex - minIndex) >= len;
    }

}

Compiler output:
Main.java:41: error: package SuffixArray does not exist
    private static boolean check(int []height,SuffixArray.Suff[]sa,int len){
                                                         ^
Main.java:15: error: package SuffixArray does not exist
        SuffixArray.Suff[] sa = SuffixArray.getSa2(src);
                   ^
Main.java:15: error: cannot find symbol
        SuffixArray.Suff[] sa = SuffixArray.getSa2(src);
                                ^
  symbol:   variable SuffixArray
  location: class Main
Main.java:16: error: cannot find symbol
        int[] height = SuffixArray.getHeight(src, sa);
                       ^
  symbol:   variable SuffixArray
  location: class Main
4 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define LL long long

const int p1 = 1009;
const int p2 = 35534783;

string S;
int N, N;
LL P[500010], H[500010];
bool Hash[p2];

bool check(int m){
	bool flag = false;
	for (int i = m + 1; i + m - 1 <= N; i++){
		LL x;
		x = (P[i - 1] - P[i - m - 1] * H[m] % p2 + p2) % p2;
		Hash[x] = true;
		x = (P[i + m - 1] - P[i - 1] * H[m] % p2 + p2) % p2;
		if (Hash[x]){
			flag = true;
			break;
		}
	}
	for (int i = 1; i + m - 1 <= N; i++){
		LL x;
		x = (P[i + m - 1] - P[i - 1] * H[m] % p2 + p2) % p2;
		Hash[x] = 0;
	}
	return flag;
}

int main(){
	cin >> N >> S;
	int l = 0, r = N;
	P[0] = 0;
	H[0] = 1;
	for (int i = 1; i <= N; i++){
		P[i] = (P[i - 1] * p1 % p2 + S[i - 1]) % p2;
		H[i] = H[i - 1] * p1 % p2;
	}
	while (l < r){
		int mid = (l + r + 1) >> 1;
		if (check(mid)) l = mid;
		else r = mid - 1;
	}
	cout << l << endl;
}

Compiler output:
a.cc:10:8: error: redefinition of 'int N'
   10 | int N, N;
      |        ^
a.cc:10:5: note: 'int N' previously declared here
   10 | int N, N;
      |     ^
Language: C++

//
//  ROIGold.cpp
//  Main calisma
//
//  Created by Rakhman on 05/02/2019.
//  Copyright © 2019 Rakhman. All rights reserved.
//

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k)

const int MXN = 3e5 + 200;
const long long MNN = 5e3 + 100;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

llong n;
ullong pw[MNN], h[MNN];
map<ullong, int> mp;
string s;

bool check(llong len){
    mp.clear();
    for(int i = 1; i <= n - len + 1; i++){
        ullong x = h[i + len - 1] - h[i - 1];
        x *= pw[n - i];
        if(mp[x] != 0 && i > mp[x]) return true;
        else if(mx[x] == 0) mp[x] = i + len - 1;
    }
    return false;
}

int main () {
    ios;
    cin >> n;
    cin >> s;
    s = '#' + s;
    pw[0] = 1;
    for(int i = 1; i <= n; i++){
        pw[i] = pw[i - 1] * 37;
        h[i] = (h[i - 1] + (s[i] - 'a' + 1) * pw[i]);
    }
    int l = 1, r = n / 2;
    while(r - l > 1){
        int tm = (r + l) / 2;
        if(check(tm)){
            l = tm;
        }else{
            r = tm;
        }
    }
    if(check(r)){
        cout << r;
    }else if(check(l)){
        cout << l;
    }else{
        cout << 0;
    }
    return 0;
}


Compiler output:
a.cc: In function 'bool check(llong)':
a.cc:64:17: error: 'mx' was not declared in this scope; did you mean 'x'?
   64 |         else if(mx[x] == 0) mp[x] = i + len - 1;
      |                 ^~
      |                 x
Language: C++

#include <iostream>
#include <string>

using namespace std;

int findMaxLenSlowly(string s){
    int maxLenSoFar = 0;
    for (auto left = s.begin(); left != s.end();left++){
        for (auto right = left + maxSoFar + 1; right != s.end();right++){
            int l = 0;
            for (auto it = left; it < right; it++,++l){
                /*
                if(right+l>=s.end()){
                    break;
                }
                */
                if(*it != *(right+l)){
                    break;
                }
            }
            maxLenSoFar = max(maxLenSoFar, l);
        }
    }
    return maxLenSoFar;
}

int main(){
    string s;
    int len; // not used
    cin >> len;
    cin >> s;
    cout << findMaxLenSlowly(s) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int findMaxLenSlowly(std::string)':
a.cc:9:34: error: 'maxSoFar' was not declared in this scope; did you mean 'maxLenSoFar'?
    9 |         for (auto right = left + maxSoFar + 1; right != s.end();right++){
      |                                  ^~~~~~~~
      |                                  maxLenSoFar
Language: C++

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

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

class RollingHash {
    ll base1;
    ll base2;
    ll mod1;
    ll mod2;
    vector<ll> hash1, hash2, pow1, pow2;
public:
    RollingHash() : base1(1009), base2(2009), mod1(1000000007), mod2(1000000009) {
    }

    void init(const string &S) {
        int n = (int) S.size();

        hash1.assign(n + 1, 0);
        hash2.assign(n + 1, 0);
        pow1.assign(n + 1, 1);
        pow2.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;
            pow1[i + 1] = (pow1[i] * base1) % mod1;
            pow2[i + 1] = (pow2[i] * base2) % mod2;
        }
    }

    inline pair<ll, ll> get(int l, int r) const {
        ll h1 = hash1[r] - hash1[l] * pow1[r - l] % mod1;
        if (h1 < 0) h1 += mod1;
        ll h2 = hash2[r] - hash2[l] * pow2[r - l] % mod2;
        if (h2 < 0) h2 += mod2;
        return make_pair(h1, h2);
    }

    inline int getLCP(int a, int b) const {
        int len = min((int) hash1.size() - a, (int) hash1.size() - b);
        int low = 0;
        int high = len;
        while (high - low > 1) {
            int mid = (high + low) >> 1;
            if (get(a, a + mid) != get(b, b + mid)) {
                high = mid;
            } else {
                low = mid;
            }
        }
        return low;
    }
};

void Main() {
    int N;
    string S;
    cin >> N >> S;
    RollingHash rollingHash;
    rollingHash.init(S);

    ll ans = 0;
    rep(i, N) {
        rep2(j, i + 1, N) {
            ll lcp = rollingHash.getLCP(i, j);
            lcp = min(lcp, j - i);
            ans = max(ans, lcp);
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:100:22: error: 'setprecision' was not declared in this scope
  100 |     cout << fixed << setprecision(15);
      |                      ^~~~~~~~~~~~
a.cc:5:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    4 | #include <algorithm>
  +++ |+#include <iomanip>
    5 | using namespace std;
Language: C++

#include<iostream>
#include<cstdlib>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
typedef long long ll;
using namespace std;

int dp[5005][5005];

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans(0);
 
    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 nas(0)
    for(int i(0);i<n;i++){
        for(int j(0);j<n;j++){
            if(i>=j) continue;
            int now = min(dp[i][j],j-1);
            ans = max(ans,now);
        }
    }
    cout << ans << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: expected ',' or ';' before 'for'
   28 |     for(int i(0);i<n;i++){
      |     ^~~
a.cc:28:18: error: 'i' was not declared in this scope
   28 |     for(int i(0);i<n;i++){
      |                  ^
Language: C++

#include<iostream>
#include<cstdlib>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
typedef long long ll;
using namespace std;

int dp[5005][5005];

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans(0);
 
    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 nas(0)
    for(int i(0);i<n;i++){
        for(int j(0);j<n;j++){
            if(i>=j) continue;
            int now = min(dp[i][j],j-1);
            ans = max(ans,now);
        }
    }
    cout << ans << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: initializer in range-based 'for' loop
   22 |         for(int j=n-1:j>=0;--j){
      |                  ^
a.cc:22:27: error: expected ')' before ';' token
   22 |         for(int j=n-1:j>=0;--j){
      |            ~              ^
      |                           )
a.cc:22:30: error: 'j' was not declared in this scope
   22 |         for(int j=n-1:j>=0;--j){
      |                              ^
a.cc:28:5: error: expected ',' or ';' before 'for'
   28 |     for(int i(0);i<n;i++){
      |     ^~~
a.cc:28:18: error: 'i' was not declared in this scope
   28 |     for(int i(0);i<n;i++){
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;cin>>n;
    string s;cin>>s;
    int n=s.size();
    int dp[n][n];
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) dp[i][j]=0;
    int max_=0;
    for(int i=1;i<n;i++)
    {
        if(s[i]==s[0]) {dp[0][i]=1; max_=1;}
    }

    for(int i=1;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(s[i]==s[j]) {dp[i][j]=min(j-i,1+dp[i-1][j-1]); max_=max(max_,dp[i][j]);}
        }
    }
    cout<<max_;
    /*
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<dp[i][j]<<' ';
        }cout<<endl;
    }
    */


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: redeclaration of 'int n'
    7 |     int n=s.size();
      |         ^
a.cc:5:7: note: 'int n' previously declared here
    5 |   int n;cin>>n;
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m,n;
    char str1[6000];
    scanf("%d",&n);
    scanf("%s",str1);
    int max1=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(str1[j]==str1[i]&&str[i-1]!=str[j-1]){
                int l=0;
                for(int k=0;k<j-i;k++){
                    if(str1[i+k]==str1[j+k]){
                        l++;
                    }
                    else{
                        break;
                    }
                }
                if(l>max1)max1=l;
            }
        }
    }
    printf("%d\n",max1);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:34: error: 'str' was not declared in this scope; did you mean 'str1'?
   12 |             if(str1[j]==str1[i]&&str[i-1]!=str[j-1]){
      |                                  ^~~
      |                                  str1
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n;
string s;

bool check(int x)
{
    map<string, int> v;
    for(int i=1;i<=n+1-x;i++)
    {
        string a = s.substr(i - 1, x);
        if(v[a]&&i-v[a]>=x
            return true;
        else
            v[a] = i;
    }
    return false;
}

int main()
{
    cin >> n >> s;
    int l = 0, r = n / 2;
    while(l <= r)
    {
        int m = (l + r) >> 1;
        if(check(m))
            l = m + 1;
        else
            r = m - 1;
    }
    cout << r << endl;
}


Compiler output:
a.cc: In function 'bool check(int)':
a.cc:12:27: error: expected ';' before 'return'
   12 |         if(v[a]&&i-v[a]>=x
      |                           ^
      |                           ;
   13 |             return true;
      |             ~~~~~~         
a.cc:14:9: error: expected primary-expression before 'else'
   14 |         else
      |         ^~~~
a.cc:13:25: error: expected ')' before 'else'
   13 |             return true;
      |                         ^
      |                         )
   14 |         else
      |         ~~~~             
a.cc:12:11: note: to match this '('
   12 |         if(v[a]&&i-v[a]>=x
      |           ^
Language: C++

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define N 10000
int maxsubstr(char* src)
{
    char tmp[N];
    int max1=0;
    int l=strlen(src);
    for(int i=1;i<=l/2;i++)
    {
        for(int j=0;j<l-i;j++)
        {
            strncpy(tmp,src+j,i);
            for(int k=0;k<j-i+1;k++)
            {
                if(strncmp(src+k,tmp,i)==0)
                max1=max(i,max1);
            }
        }
    }
    return max1;
}
int main()
{
	char s[N];
	gets(s);
	int n = maxsubstr(s);
	printf("%d\n",n);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   28 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    int n;
    string S, now;
    cin >> n >> S;
    int ans = 0;
    int a[5001] = {};
    a[0] = n;
    REP(offset, n-1){
        now = S.substr(offset);
        //cout << now << endl;
        int i=1,j=0;
        a[0] = now.size();
        for(int m = 1; m <= n; m++) a[m] = 0;
        while(i < now.size()){
            while(i+j < n && j < i && now[j] == now[i+j]){++j;}
            a[i] = j;
            //cout << a[i] << endl;
            if(j==0){
                i++;
                continue;
            }
            int k = 1;
            while(i+k < n && k+a[k] < j){
                a[i+k] = a[k];
                k++;
            }
            i += k;
            j -= k;
        }
        for(int i = 1; i<now.size(); i++){
            if(a[i] > ans) ans = a[i];
        }
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:41:6: error: expected '}' at end of input
   41 |     }
      |      ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int n;
	string s;
	cin >> n >> s;
	vector<vector<Int>> dp(n, vector<Int>(n, -1));
	for(Int i=0; i<n; ++i)
		if(s[i] == s[n-1])
			dp[i][n-1] = 1;
	for(Int i=n-2; i>0; --i)
		for(Int j=i-1; j>=0; --j)
			if(s[i] == s[j])
				dp[j][i] = 1+max(0ll, dp[j+1][i+1]);
	Int ans = 0;
	for(Int i=0; i<n; ++i)
		for(Int j=0; j<n; ++j)
			ans = max(ans, min(dp[i][j], j-i));
	cout << ans << "\n";
//	for(Int i=0; i<n; ++i)
//		for(Int j=0; j<n; ++j)
//			cout << dp[i][j] << " \n"[j+1==n];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:49: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type&)'
   18 |                                 dp[j][i] = 1+max(0ll, dp[j+1][i+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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:18:49: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'})
   18 |                                 dp[j][i] = 1+max(0ll, dp[j+1][i+1]);
      |                                              ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:18:49: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |                                 dp[j][i] = 1+max(0ll, dp[j+1][i+1]);
      |                                              ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

using System;
using static System.Console;

class Program
{
    public static void Main()
    {
        int n = int.Parse(ReadLine());
        string s = ReadLine();

        int res = 0;
        int[,] dp = new int[n+1, n+1];
        for (int i = n-1; i >= 0; i--)
        {
            for (int j = n-1; j > i; j--)
            {
                if (s[i] == s[j])
                    dp[i,j] = Math.Max(dp[i,j], dp[i+1, j+1] + 1);
                res = Math.Max(res, Math.Min(dp[i, j], j-i));
            }
        }

        WriteLine(res);
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'static'
    2 | using static System.Console;
      |       ^~~~~~
a.cc:6:11: error: expected ':' before 'static'
    6 |     public static void Main()
      |           ^~~~~~~
      |           :
a.cc:25:2: error: expected ';' after class definition
   25 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Main()':
a.cc:8:17: error: expected primary-expression before 'int'
    8 |         int n = int.Parse(ReadLine());
      |                 ^~~
a.cc:9:9: error: 'string' was not declared in this scope
    9 |         string s = ReadLine();
      |         ^~~~~~
a.cc:12:13: error: expected identifier before ',' token
   12 |         int[,] dp = new int[n+1, n+1];
      |             ^
a.cc:12:13: error: expected ']' before ',' token
a.cc:12:12: error: structured binding declaration cannot have type 'int'
   12 |         int[,] dp = new int[n+1, n+1];
      |            ^
a.cc:12:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:12:12: error: empty structured binding declaration
a.cc:12:16: error: expected initializer before 'dp'
   12 |         int[,] dp = new int[n+1, n+1];
      |                ^~
a.cc:17:21: error: 's' was not declared in this scope
   17 |                 if (s[i] == s[j])
      |                     ^
a.cc:18:21: error: 'dp' was not declared in this scope
   18 |                     dp[i,j] = Math.Max(dp[i,j], dp[i+1, j+1] + 1);
      |                     ^~
a.cc:18:31: error: 'Math' was not declared in this scope
   18 |                     dp[i,j] = Math.Max(dp[i,j], dp[i+1, j+1] + 1);
      |                               ^~~~
a.cc:19:23: error: 'Math' was not declared in this scope
   19 |                 res = Math.Max(res, Math.Min(dp[i, j], j-i));
      |                       ^~~~
a.cc:19:46: error: 'dp' was not declared in this scope
   19 |                 res = Math.Max(res, Math.Min(dp[i, j], j-i));
      |                                              ^~
a.cc:23:9: error: 'WriteLine' was not declared in this scope
   23 |         WriteLine(res);
      |         ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

vector<int> Zalgo(const string &s){
	int n = (int) s.size();
	vector<int> res(n);
	res[0] = n;
	int i = 1, j = 0;
	while(i < n){
		while(i + j < N && S[j] == S[i + j]) j++;
		res[i] = j;
		if(j == 0){
			i++;
			continue;
		}

		int k = 1;
		while(i + k && k + res[k] < j){
			res[i + k] = res[k];
			k++;
		}

		i += k, j -= k;
	}

	return res;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	string s;
	cin >> s;

	int res = 0;
	rep(i, n){
		string t = s.substr(i);
		auto lcp = Zalgo(t);

		rep(j, t.size()){
			int l = min(lcp[j], j);
			rep = max(res, l);
		}
	}
}


Compiler output:
a.cc: In function 'std::vector<int> Zalgo(const std::string&)':
a.cc:14:31: error: 'N' was not declared in this scope
   14 |                 while(i + j < N && S[j] == S[i + j]) j++;
      |                               ^
a.cc:14:36: error: 'S' was not declared in this scope
   14 |                 while(i + j < N && S[j] == S[i + j]) j++;
      |                                    ^
a.cc: In function 'int main()':
a.cc:51:25: error: 'rep' was not declared in this scope
   51 |                         rep = max(res, l);
      |                         ^~~
Language: C++

g a [] = 0
g a bs@(t:xs) = let la = length a
                    p = take la xs
                in if a == p then la
                             else g a xs

sq [] = return []
sq (x:xs) = [x] : [x:p | p <- sq xs]

counts [] = []
counts a@(x:xs) = map (`g` a) (sq a) ++ counts xs

main = do
  n <- getLine
  x <- getLine
  print $ maximum $ counts x

Compiler output:
a.cc:2:7: error: stray '@' in program
    2 | g a bs@(t:xs) = let la = length a
      |       ^
a.cc:11:9: error: stray '@' in program
   11 | counts a@(x:xs) = map (`g` a) (sq a) ++ counts xs
      |         ^
a.cc:11:24: error: stray '`' in program
   11 | counts a@(x:xs) = map (`g` a) (sq a) ++ counts xs
      |                        ^
a.cc:11:26: error: stray '`' in program
   11 | counts a@(x:xs) = map (`g` a) (sq a) ++ counts xs
      |                          ^
a.cc:1:1: error: 'g' does not name a type
    1 | g a [] = 0
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;

int table[5001][5001]

int main() {
	int n;
    string s;
    cin >> n >> s;
    for (int i=n-1; i>=0; i--) {
    	for (int j=n-1; j>=0; j--) {
        	if (s[i] == s[j]) {
            	table[i][j] == table[i+1][j+1]++;
            }
        }
    }
    int ans = 0;
    rep(i, n) rep(j,n) {
    	if (i >= j) continue;
        ans = max(ans, table[i][j]);
    }
    cout << ans;
    return 0;
}

Compiler output:
a.cc:8:1: error: expected initializer before 'int'
    8 | int main() {
      | ^~~
Language: C++

#include<iostream>
#include<math.h>
#include<queue>
#include<string>
using namespace std;
int main(){
	int n;cin>>n;
	string s;cin>>s;
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=i+ans+1;j<n;j++){
			if(i!=0 and s[i-1]=s[j-1]){continue;}
			int t=0;
			bool h=true;
			while(j+t<n ans h==true){
				if(s[i+t]==s[j+t]){t++;}
				else{h=false;}
			}
			ans=max(ans,t);
		}
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:33: error: lvalue required as left operand of assignment
   12 |                         if(i!=0 and s[i-1]=s[j-1]){continue;}
a.cc:15:36: error: expected ')' before 'ans'
   15 |                         while(j+t<n ans h==true){
      |                              ~     ^~~~
      |                                    )
a.cc:15:40: error: expected ';' before 'h'
   15 |                         while(j+t<n ans h==true){
      |                                        ^~
      |                                        ;
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int dp[5005][5005];

int main() {
    int n;
    string s;
    cin>>n>>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;
    rp(i,n)rep(j,n) {
        if(i>=j)    continue;
        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:20:8: error: 'i' was not declared in this scope
   20 |     rp(i,n)rep(j,n) {
      |        ^
a.cc:20:5: error: 'rp' was not declared in this scope; did you mean 'dp'?
   20 |     rp(i,n)rep(j,n) {
      |     ^~
      |     dp
a.cc:20:16: error: 'j' was not declared in this scope
   20 |     rp(i,n)rep(j,n) {
      |                ^
a.cc:3:30: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0;i<(n);++i)
      |                              ^
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int dp[5005][5005];

int main() {
    int n;
    string s;
    cin>>n>>s;
    for(int 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;
    rp(i,n)rep(j,n) {
        if(i>=j)    continue;
        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:13:14: error: expected ';' before '-' token
   13 |     for(int n-1;i>=0;--i) {
      |              ^
      |              ;
a.cc:13:17: error: 'i' was not declared in this scope
   13 |     for(int n-1;i>=0;--i) {
      |                 ^
a.cc:13:21: error: expected ')' before ';' token
   13 |     for(int n-1;i>=0;--i) {
      |        ~            ^
      |                     )
a.cc:13:24: error: 'i' was not declared in this scope
   13 |     for(int n-1;i>=0;--i) {
      |                        ^
a.cc:20:5: error: 'rp' was not declared in this scope; did you mean 'dp'?
   20 |     rp(i,n)rep(j,n) {
      |     ^~
      |     dp
a.cc:20:16: error: 'j' was not declared in this scope
   20 |     rp(i,n)rep(j,n) {
      |                ^
a.cc:3:30: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0;i<(n);++i)
      |                              ^
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector<int> v;
  int n,x;
  cin >> n;
  for(int i = 0 ; i < n ; i++ )
  {
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(),v.end());
  int sum=0;
  for(int i = 0 ; i < v.size() ; i++ )
  {
      sum+=(v[0]+v[1])/2;
      erase(v.begin(),v.begin()+1);
  }
  cout<<sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'erase' was not declared in this scope
   19 |       erase(v.begin(),v.begin()+1);
      |       ^~~~~
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector<int> v;
  int n,x;
  cin >> n;
  for(int i = 0 ; i < n ; i++ )
  {
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(),v.end());
  int sum=0;
  for(int i = 0 ; i < v.size() ; i++ )
  {
      sum+=(v[0]+v[1])/2;
      v.pop_front();
  }
  cout<<sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'class std::vector<int>' has no member named 'pop_front'
   19 |       v.pop_front();
      |         ^~~~~~~~~