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

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

int main(){
  long long n,m,ans=0;
  cin >> n >> m;
  vector<long long> a(n);
  for(int i=0; i<n; i++){
    cin>> a.at(i);
  }sort(a.begin(),a.end());
  for(int i=0; i<m; i++){
    a.at(a.size()-1)/=2;
    sort(a,begin(),a.end());
    for(int i=0; i<n; i++){
      ans+=a.at(i);
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: no matching function for call to 'begin()'
   13 |     sort(a,begin(),a.end());
      |            ~~~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)'
   88 |     begin(initializer_list<_Tp> __ils) noexcept
      |     ^~~~~
/usr/include/c++/14/initializer_list:88:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)'
   52 |     begin(_Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:52:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)'
   63 |     begin(const _Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:63:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])'
   95 |     begin(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:95:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)'
 1227 |     begin(valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/14/valarray:1227:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/14/valarray:1238:5: note:   candidate expects 1 argument, 0 provided
Language: C++

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

int SORTAND(vector<double> &a) {
  sort(a.begin(), a.end());
  a.at(N - 1) /= 2;
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<double> A(N);
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < M; i++) {
    SORTAND(A);
  }
  int64_t S = 0;
  for(int i = 0; i < N; i++) {
    S += (int)A.at(i);
  }
  cout << S << endl;
}

Compiler output:
a.cc: In function 'int SORTAND(std::vector<double>&)':
a.cc:6:8: error: 'N' was not declared in this scope
    6 |   a.at(N - 1) /= 2;
      |        ^
a.cc:7:1: warning: no return statement in function returning non-void [-Wreturn-type]
    7 | }
      | ^
Language: C++

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

using ll=long long;
using int64=int64_t;
const int inf=100000000;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

int div1(ll x){
  return x%1000000007;
}

main(){
    int n=in(),m=in(),b;
    vector<int> a(n);
    for (int i=0;i<n;i++) cin >> a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    for (int i=0;i<m;i++){
        a[0]/=2;
        b=0
        while (a[b]<a[b+1]) swap(a[b],a[b+1]);
    }
    cout << accumulate(a.begin(), a.end(), 0) << endl;
}

Compiler output:
a.cc:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:58:12: error: expected ';' before 'while'
   58 |         b=0
      |            ^
      |            ;
   59 |         while (a[b]<a[b+1]) swap(a[b],a[b+1]);
      |         ~~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int N,M; cin>>N>>M;
  vector<int> A(N);
  long long ans = 0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }

  for(int i=0;i<M;i++){
      sort(A.begin(),A.end());
      A.at(N-1) /= 2;
  }


  for(int i=0;i<N;i++){
    ans += A.at(i);
  }
  cout<<ans<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |       sort(A.begin(),A.end());
      |       ^~~~
      |       short
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  priority_queue<ll> A;
  
  REP(i,N){
    ll a;
    cin>>a;
    A.push(a);
  }
  
  
  REP(i,M){
    A.top()/=2;
  }
  
  ll ans=0;
  REP(i,N){
    ans+=A.top();
    A.pop();
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:12: error: assignment of read-only location 'A.std::priority_queue<long long int>::top()'
   33 |     A.top()/=2;
      |     ~~~~~~~^~~
Language: C++

#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
  lll ii,jj,kk;

  lll n,m;
  vector<lll> a;

  cin >> n >> m;

  a.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }

  sort(a.begin(),a.end(),std::greater<int>());

//  for(ii=0;ii<n;ii++){
//    cout << a[ii] << endl;;
//  }
  lll tmp;
  for(ii=0;ii<m;ii++){
    a[0] /= 2;
    sort(a.begin(),a.end(),std::greater<int>());
    }
  }

  lll sum = 0;
  for(ii=0;ii<n;ii++){
    sum += a[ii];
  }

  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc:43:3: error: expected unqualified-id before 'for'
   43 |   for(ii=0;ii<n;ii++){
      |   ^~~
a.cc:43:12: error: 'ii' does not name a type
   43 |   for(ii=0;ii<n;ii++){
      |            ^~
a.cc:43:17: error: 'ii' does not name a type
   43 |   for(ii=0;ii<n;ii++){
      |                 ^~
a.cc:47:3: error: 'cout' does not name a type
   47 |   cout << sum << endl;
      |   ^~~~
a.cc:48:3: error: expected unqualified-id before 'return'
   48 |   return 0;
      |   ^~~~~~
a.cc:49:1: error: expected declaration before '}' token
   49 | }
      | ^
Language: C++

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

int main()
{
  
  long int tot;
  int i, n, m, temp;
  cin >> n >> m;
  
  vector<long int> a(n);

  for (i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  for (i = 0; i < m; i++)
  {
    a[0]  >>= 1;
    for (j = 0; j < n; j++)
    {
      if (a[j] < a[j + 1])
      {
        temp = a[j];
        a[j] = a[j + 1];
        a[j + 1] = temp;
      }
      else
      {
        break;
      }
    }
  }
    for (i = 0; i < n; i++)
  {
    tot += a[i];
  }
  
  
  cout << tot;

  return 0;  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:10: error: 'j' was not declared in this scope
   24 |     for (j = 0; j < n; j++)
      |          ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

class DPowerfulDiscountTickets {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        int n, m;
        cin >> n >> m;
        vector<long long int> a_vec(n);
        for (int i = 0; i < n; ++i) {
            cin >> a_vec[i];
        }
        priority_queue<long long int, vector<long long int>> que;
        for (const auto &item : a_vec) {
            que.push(item);
        }
        while (m != 0) {
            long long int tmp = que.top();
            que.pop();
            tmp /= 2;
            que.push(tmp);
            m -= 1;
        }
        long long int ans = 0;
        while (!que.empty()) {
            ans += que.top();
            que.pop();
        }
        cout << ans << endl;
    }
};

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'
collect2: error: ld returned 1 exit status
Language: Java


import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;

class Scanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        return hasNextByte() ? buffer[ptr++] : -1;
    }

    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    private void skipUnprintable() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
    }

    public boolean hasNext() {
        skipUnprintable();
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public int nextInt() {
        return (int) nextLong();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}

public class ABC141D {

	public static void main(String[] args) {
		Scanner sc = new Scanner();
	    int n = sc.nextInt();
	    int m = sc.nextInt();
	    int[] as = new int[n];
	    for (int i = 0; i < n; ++i) {
	    	as[i] = sc.nextInt();
	    }
	    long ans = solve(n, m, as);
	    System.out.println(ans);
	}

	public static long solve(int n, int m, int[] as) {
		Queue<Long> queue = new PriorityQueue<>();
		for (int i = 0; i < n; ++i) {
			queue.add(-(long)as[i]);
		}
		for (int i = 0; i < m; ++i) {
			long max = queue.poll();
			queue.add(max / 2);
		}

		return -queue.stream().reduce((long)0, (x, y) -> x + (long)y);
	}

}


Compiler output:
Main.java:89: error: class ABC141D is public, should be declared in a file named ABC141D.java
public class ABC141D {
       ^
1 error
Language: C++

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

int main() {
  int N, M; cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < M; i++) {
    int Mx, Mx_i;
    Mx = 0;
    Mx_j = 0;
    for (int j = 0; j < N; j++) {
      if (A.at(j) > Mx) {
        Mx_j = j;
        Mx = A.at(j);
      }
    }
    A.at(Mx_j) /= 2;
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += A.at(i);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'Mx_j' was not declared in this scope; did you mean 'Mx_i'?
   13 |     Mx_j = 0;
      |     ^~~~
      |     Mx_i
Language: Java

import java.util.*;

import Main.Job;

import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		int n = ni();
		int m = ni();
		long result = 0;

		Queue<Integer> jq = new PriorityQueue<>(Collections.reverseOrder());
		for(int i = 0; i < n; i++) {
			jq.add(ni());
		}
		
		for(int i = 0; i < m; i++) {
			int max = jq.poll();
			jq.add(max/2);
		}
		
		while(!jq.isEmpty()) {
			result += jq.poll();
		}
		
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		} 
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Compiler output:
Main.java:3: error: package Main does not exist
import Main.Job;
           ^
1 error
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int N,M;
  cin>>N>>M;
  vector<ll> A;
  REP(i,N){
    ll a;
    cin>>a;
    A.push_back(a);
  }
  
  SORT(A);
  REVERSE(A);
  
  REP(i,M){
    A.at(0)/=2;
    if(A.at(0)<A.at(1)){
      for(int j=0; j<N-1; ++j){
        if(A.at(j)<A.at(j+1){
          ll R=A.at(j);
          A.at(j)=A.at(j+1);
          A.at(j)=R;
        }
        else break;
      }
    }
  }
  
  ll ans=0;
  REP(i,N) ans+=A.at(i);
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:29: error: expected ';' before '{' token
   36 |         if(A.at(j)<A.at(j+1){
      |                             ^
      |                             ;
a.cc:41:9: error: expected primary-expression before 'else'
   41 |         else break;
      |         ^~~~
a.cc:40:10: error: expected ')' before 'else'
   40 |         }
      |          ^
      |          )
   41 |         else break;
      |         ~~~~
a.cc:36:11: note: to match this '('
   36 |         if(A.at(j)<A.at(j+1){
      |           ^
Language: C++

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

int main(){
    int n,m;cin>>n>>m;
    int a[n];
    for(int i=0;i<n;++i)cin>>a[i];
    priority_queue<int> Q;
    for(int i=0;i<n;++i)Q.push(a[i]);
    for(int i=0;i<m;++i){
        int t=Q.top();Q.pop();
        t/=2;Q.push();
    }
    long long ans=0;
    for(int i=0;i<n;++i){
        ans+=Q.top();Q.pop();
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: no matching function for call to 'std::priority_queue<int>::push()'
   12 |         t/=2;Q.push();
      |              ~~~~~~^~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>; value_type = int]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>; value_type = int]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 0 provided
Language: C++

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

int main(){
    int n,m;cin>>n>>m;
    int a[n];
    for(int i=0;i<n;++i)cin>>a[i];
    priority_queue<int> Q;
    for(int i=0;i<n;++i)Q.push(a[i]);
    for(int i=0;i<m;++i){
        int t=Q.top();Q.pop();
        t/=2;Q.push(t);
    }
    ll ans=0;
    for(int i=0;i<n;++i){
        ans+=Q.top();Q.pop();
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'll' was not declared in this scope
   14 |     ll ans=0;
      |     ^~
a.cc:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         ans+=Q.top();Q.pop();
      |         ^~~
      |         abs
a.cc:18:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

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

int main(){
    int n,m;cin>>n>>m;
    int a[n];
    for(int i=0;i<n;++i)cin>>a[i];
    priority_queue<int> Q;
    for(int i=0;i<n;++i)Q.push(a[i]);
    for(int i=0;i<m;++i){
        int t=Q.top();Q.pop();
        t/=2;Q.push();
    }
    ll ans=0;
    for(int i=0;i<n;++i){
        ans+=Q.top();Q.pop();
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: no matching function for call to 'std::priority_queue<int>::push()'
   12 |         t/=2;Q.push();
      |              ~~~~~~^~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>; value_type = int]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>; value_type = int]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 0 provided
a.cc:14:5: error: 'll' was not declared in this scope
   14 |     ll ans=0;
      |     ^~
a.cc:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         ans+=Q.top();Q.pop();
      |         ^~~
      |         abs
a.cc:18:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n,m;
  cin >> n >> m;

  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  priority_queue<int> que;
  REP(i,n) que.push(a[i]);

  REP(_,m){
    int x = qur.top();
    que.pop();
    que.push(x/2);
  }

  int ans = 0;
  REP(i,n) ans += que.top(),que.pop();

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:13: error: 'qur' was not declared in this scope; did you mean 'que'?
   68 |     int x = qur.top();
      |             ^~~
      |             que
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <atcoder/all>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
#define REP(i, m, n) for (ll(i) = (ll)(m); i < (ll)(n); ++i)
#define REP2(i, m, n) for (ll(i) = (ll)(n)-1; i >= (ll)(m); --i)
#define rep(i, n) REP(i, 0, n)
#define rep2(i, n) REP2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define rall(hoge) (hoge).rbegin(), (hoge).rend()
#define en '\n'
using Edge = pair<ll, ll>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
template <class T> inline void print(T x) { cout << x << '\n'; }
template <class T> bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return x / gcd(x,y)*y ;}
// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)
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 < N && k+res[k] < j) res[i+k] = res[k], ++k;
        i += k, j -= k;
    }
    return res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    string S;
    cin >> N >> S;

    int res = 0;
    for (int i = 0; i < N; ++i) {
        string T = S.substr(i);
        auto lcp = Zalgo(T);

        for (int j = 0; j < T.size(); ++j) {
            int l = min(lcp[j], j);
            res = max(res, l);
        }
    }

    print(res);

    return 0;
}


Compiler output:
a.cc:3:10: fatal error: atcoder/all: No such file or directory
    3 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

v#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(){
	ll n;
	string s;
	cin>>n>>s;
	ll ans=0;
	for(int l=0;l<n;l++){
		vector<ll> z(n-l);
		z[0]=n-l;
		int i=1,j=0;
		string t=s.substr(l,n-l);
		while(i<n-l){
		    while(i+j<n-l&&t[j]==t[i+j])j++;
		    z[i]=j;
		    if(!j){
	        i++;
	        continue;
		    }
		    int k=1;
		    while(k<j&&k+z[k]<j){
	        z[i+k]=z[k];
	        k++;
		    }
		    i+=k;
		    j-=k;
		}
		for(ll m=1;m<n-l;m++)ans=max(ans,min(m,z[m]));
	}
	cout<<ans;
	return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc:4:9: error: 'pair' does not name a type
    4 | typedef pair<ll,ll> P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'string' was not declared in this scope
    7 |         string s;
      |         ^~~~~~
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin>>n>>s;
      |         ^~~
a.cc:8:17: error: 's' was not declared in this scope
    8 |         cin>>n>>s;
      |                 ^
a.cc:11:17: error: 'vector' was not declared in this scope
   11 |                 vector<ll> z(n-l);
      |                 ^~~~~~
a.cc:11:26: error: expected primary-expression before '>' token
   11 |                 vector<ll> z(n-l);
      |                          ^
a.cc:11:28: error: 'z' was not declared in this scope
   11 |                 vector<ll> z(n-l);
      |                            ^
a.cc:14:23: error: expected ';' before 't'
   14 |                 string t=s.substr(l,n-l);
      |                       ^~
      |                       ;
a.cc:16:36: error: 't' was not declared in this scope
   16 |                     while(i+j<n-l&&t[j]==t[i+j])j++;
      |                                    ^
a.cc:30:50: error: 'min' was not declared in this scope; did you mean 'main'?
   30 |                 for(ll m=1;m<n-l;m++)ans=max(ans,min(m,z[m]));
      |                                                  ^~~
      |                                                  main
a.cc:30:42: error: 'max' was not declared in this scope
   30 |                 for(ll m=1;m<n-l;m++)ans=max(ans,min(m,z[m]));
      |                                          ^~~
a.cc:32:9: error: 'cout' was not declared in this scope
   32 |         cout<<ans;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ulong = unsigned long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

const ulong MASK30 = (1UL << 30) - 1;
const ulong MASK31 = (1UL << 31) - 1;
const ulong MOD = (1UL << 61) - 1;
const ulong MASK61 = MOD;
const ulong POSITIVIZER = MOD * ((1UL << 3) - 1);
const unsigned int Base = 1000000007;
ulong powMemo[5001];
ulong hashes[5001];

//mod 2^61-1を計算する関数
ulong CalcMod(ulong x)
{
    ulong xu = x >> 61;
    ulong xd = x & MASK61;
    ulong res = xu + xd;
    if (res >= MOD)
        res -= MOD;
    return res;
}

//a*b mod 2^61-1を返す関数(最後にModを取る)
ulong Mul(ulong a, ulong b)
{
    ulong au = a >> 31;
    ulong ad = a & MASK31;
    ulong bu = b >> 31;
    ulong bd = b & MASK31;
    ulong mid = ad * bu + au * bd;
    ulong midu = mid >> 30;
    ulong midd = mid & MASK30;
    return CalcMod(au * bu * 2 + midu + (midd << 31) + ad * bd);
}

ulong Slice(int start, int length)
{
    return CalcMod(hashes[start + length] + POSITIVIZER - Mul(hashes[start], powMemo[length]));
}

void rolling_hash(string const &s)
{
    for (int i = 0; i < s.size(); i++)
    {
        hashes[i + 1] = CalcMod(Mul(hashes[i], Base) + s[i]);
    }
    powMemo[0] = 1;
    for (int i = 1; i < 5001; i++)
        powMemo[i] = CalcMod(Mul(powMemo[i - 1], Base));
}

int main()
{
    int n;
    string s;
    cin >> n >> s;
    rolling_hash(s);
    // 二分探索
    int left = -1, right = (n / 2) + 1;
    while (right - left > 1)
    {
        int length = (left + right) / 2;
        bool exist_same = false;

        // 基準文字列の始点
        for (int i = 0; i < n && !exist_same; i++)
        {
            for (int j = i + length; j < n; j++)
            {
                if (j + length > n)
                {
                    break;
                }
                if (Slice(i, length) == Slice(j, length))
                {
                    exist_same = true;
                }
            }
        }
        if (exist_same)
        {
            left = length;
        }
        else
        {
            right = length;
        }
    }
    cout << left << endl;
    return 0;
}


Compiler output:
a.cc:4:7: error: conflicting declaration 'using ulong = long long unsigned int'
    4 | using ulong = unsigned long long;
      |       ^~~~~
In file included from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/types.h:148:27: note: previous declaration as 'typedef long unsigned int ulong'
  148 | typedef unsigned long int ulong;
      |                           ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

typedef unsigned long long ulong;

const ulong MASK30 = (1UL << 30) - 1;
const ulong MASK31 = (1UL << 31) - 1;
const ulong MOD = (1UL << 61) - 1;
const ulong MASK61 = MOD;
const ulong POSITIVIZER = MOD * ((1UL << 3) - 1);
const unsigned int Base = 1000000007;
ulong powMemo[5001];
ulong hashes[5001];

//mod 2^61-1を計算する関数
ulong CalcMod(ulong x)
{
    ulong xu = x >> 61;
    ulong xd = x & MASK61;
    ulong res = xu + xd;
    if (res >= MOD)
        res -= MOD;
    return res;
}

//a*b mod 2^61-1を返す関数(最後にModを取る)
ulong Mul(ulong a, ulong b)
{
    ulong au = a >> 31;
    ulong ad = a & MASK31;
    ulong bu = b >> 31;
    ulong bd = b & MASK31;
    ulong mid = ad * bu + au * bd;
    ulong midu = mid >> 30;
    ulong midd = mid & MASK30;
    return CalcMod(au * bu * 2 + midu + (midd << 31) + ad * bd);
}

ulong Slice(int start, int length)
{
    return CalcMod(hashes[start + length] + POSITIVIZER - Mul(hashes[start], powMemo[length]));
}

void rolling_hash(string const &s)
{
    for (int i = 0; i < s.size(); i++)
    {
        hashes[i + 1] = CalcMod(Mul(hashes[i], Base) + s[i]);
    }
    powMemo[0] = 1;
    for (int i = 1; i < 5001; i++)
        powMemo[i] = CalcMod(Mul(powMemo[i - 1], Base));
}

int main()
{
    int n;
    string s;
    cin >> n >> s;
    rolling_hash(s);
    for (int i = 0; i < 10; i++)
    {
        cout << hashes[i] << endl;
    }
    // 二分探索
    int left = -1, right = (n / 2) + 1;
    while (right - left > 1)
    {
        // cout << "left:" << left << " right:" << right << endl;
        int length = (left + right) / 2;
        bool exist_same = false;

        // 基準文字列の始点
        for (int i = 0; i < n && !exist_same; i++)
        {
            for (int j = i + length; j < n; j++)
            {
                if (j + length > n)
                {
                    break;
                }
                if (Slice(i, length) == Slice(j, length))
                {
                    exist_same = true;
                }
            }
        }
        if (exist_same)
        {
            left = length;
        }
        else
        {
            right = length;
        }
    }
    cout << left << endl;
    return 0;
}


Compiler output:
a.cc:20:28: error: conflicting declaration 'typedef long long unsigned int ulong'
   20 | typedef unsigned long long ulong;
      |                            ^~~~~
In file included from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/types.h:148:27: note: previous declaration as 'typedef long unsigned int ulong'
  148 | typedef unsigned long int ulong;
      |                           ^~~~~
Language: C++

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

class RollingHash_Mersenne {
	// RH (mod : 1UL << 61 - 1, base : random)
	// https://atcoder.jp/contests/abc141/submissions/16495886
	const unsigned long long MASK30 = (1ULL << 30) - 1;
	const unsigned long long MASK31 = (1ULL << 31) - 1;
	const unsigned long long MASK61 = (1ULL << 61) - 1;
	const unsigned long long MOD = MASK61;
	const unsigned long long base = rand() % (unsigned long long)1e5 + 3;
	const unsigned long long POSITIVIZER = MOD << 2;
	vector<unsigned long long> hash, power;

	// a * b と mod が等しい数を返す
	// 結果は (1UL << 63) + 3 - (1UL << 31) * 3 以下
	unsigned long long Mul(unsigned long long a, unsigned long long b) const {
		unsigned long long au = a >> 31;
		unsigned long long ad = a & MASK31;
		unsigned long long bu = b >> 31;
		unsigned long long bd = b & MASK31;
		unsigned long long mid = ad * bu + au * bd;
		unsigned long long midu = mid >> 30;
		unsigned long long midd = mid & MASK30;
		return au * bu * 2 + midu + (midd << 31) + ad * bd;
	}

	// mod 2^61-1を計算する
	unsigned long long CalcMod(unsigned long long x) const {
		unsigned long long xu = x >> 61;
		unsigned long long xd = x & MASK61;
		unsigned long long res = xu + xd;
		if(res >= MOD) res -= MOD;
		return res;
	}

   public:
	RollingHash_Mersenne(const string &s) {
		int sz = (int)s.size();
		hash.assign(sz + 1, 0);
		power.assign(sz + 1, 0);
		power[0] = 1;
		for(int i = 0; i < sz; i++) {
			power[i + 1] = CalcMod(Mul(power[i], base));
			hash[i + 1] = CalcMod(Mul(hash[i], base) + s[i]);
		}
	}

	template <class T>
	RollingHash_Mersenne(const vector<T> &v) {
		int sz = (int)v.size();
		hash.assign(sz + 1, 0);
		power.assign(sz + 1, 0);
		power[0] = 1;
		for(int i = 0; i < sz; i++) {
			power[i + 1] = CalcMod(Mul(power[i], base));
			hash[i + 1] = CalcMod(Mul(hash[i], base) + v[i]);
		}
	}

	unsigned long long get(int l, int r) const { return CalcMod(hash[r] + POSITIVIZER - Mul(hash[l], power[r - l])); }

	unsigned long long connect(unsigned long long h1, unsigned long long h2, unsigned long long h2len) const { return CalcMod(Mul(h1, power[h2len]) + h2); }

	// Longest Common Prefix
	int LCP(int l_this, int r_this, RollingHash_Mersenne &other, int l_other, int r_other) {
		int len = min(r_this - l_this, r_other - l_other);
		int low = 0, high = len + 1;
		while(high - low > 1) {
			int mid = (low + high) / 2;
			if(get(l_this, l_this + mid) == other.get(l_other, l_other + mid))
				low = mid;
			else
				high = mid;
		}
		return low;
	}
};


int main() {
	int n;
	string s;
	cin >> n >> s;

	RollingHash_Mersenne rh(s);
	int res = 0;
	for(int i=0 i<n;i++) {
		for(int j=0;j< n;j++) {
			if(j <= i + res) continue;
			int a = rh.LCP(i, n, rh, j, n);
			//	cout << a << endl;
			res = max(res, min(a, j - i));
		}
	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:20: error: expected ';' before 'i'
   88 |         for(int i=0 i<n;i++) {
      |                    ^~
      |                    ;
Language: C++

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

class RollingHash_Mersenne {
	// RH (mod : 1UL << 61 - 1, base : random)
	// https://atcoder.jp/contests/abc141/submissions/16495886
	const unsigned long long MASK30 = (1ULL << 30) - 1;
	const unsigned long long MASK31 = (1ULL << 31) - 1;
	const unsigned long long MASK61 = (1ULL << 61) - 1;
	const unsigned long long MOD = MASK61;
	const unsigned long long base = rand() % (unsigned long long)1e5 + 3;
	const unsigned long long POSITIVIZER = MOD << 2;
	vector<unsigned long long> hash, power;

	// a * b と mod が等しい数を返す
	// 結果は (1UL << 63) + 3 - (1UL << 31) * 3 以下
	unsigned long long Mul(unsigned long long a, unsigned long long b) const {
		unsigned long long au = a >> 31;
		unsigned long long ad = a & MASK31;
		unsigned long long bu = b >> 31;
		unsigned long long bd = b & MASK31;
		unsigned long long mid = ad * bu + au * bd;
		unsigned long long midu = mid >> 30;
		unsigned long long midd = mid & MASK30;
		return au * bu * 2 + midu + (midd << 31) + ad * bd;
	}

	// mod 2^61-1を計算する
	unsigned long long CalcMod(unsigned long long x) const {
		unsigned long long xu = x >> 61;
		unsigned long long xd = x & MASK61;
		unsigned long long res = xu + xd;
		if(res >= MOD) res -= MOD;
		return res;
	}

   public:
	RollingHash_Mersenne(const string &s) {
		int sz = (int)s.size();
		hash.assign(sz + 1, 0);
		power.assign(sz + 1, 0);
		power[0] = 1;
		for(int i = 0; i < sz; i++) {
			power[i + 1] = CalcMod(Mul(power[i], base));
			hash[i + 1] = CalcMod(Mul(hash[i], base) + s[i]);
		}
	}

	template <class T>
	RollingHash_Mersenne(const vector<T> &v) {
		int sz = (int)v.size();
		hash.assign(sz + 1, 0);
		power.assign(sz + 1, 0);
		power[0] = 1;
		for(int i = 0; i < sz; i++) {
			power[i + 1] = CalcMod(Mul(power[i], base));
			hash[i + 1] = CalcMod(Mul(hash[i], base) + v[i]);
		}
	}

	unsigned long long get(int l, int r) const { return CalcMod(hash[r] + POSITIVIZER - Mul(hash[l], power[r - l])); }

	unsigned long long connect(unsigned long long h1, unsigned long long h2, unsigned long long h2len) const { return CalcMod(Mul(h1, power[h2len]) + h2); }

	// Longest Common Prefix
	int LCP(int l_this, int r_this, RollingHash_Mersenne &other, int l_other, int r_other) {
		int len = min(r_this - l_this, r_other - l_other);
		int low = 0, high = len + 1;
		while(high - low > 1) {
			int mid = (low + high) / 2;
			if(get(l_this, l_this + mid) == other.get(l_other, l_other + mid))
				low = mid;
			else
				high = mid;
		}
		return low;
	}
};


int main() {
	int n;
	string s;
	cin >> n >> s;

	RollingHash_Mersenne rh(s);
	int res = 0;
	rep(i, n) {
		rep(j, n) {
			if(j <= i + res) continue;
			int a = rh.LCP(i, n, rh, j, n);
			//	cout << a << endl;
			res = max(res, min(a, j - i));
		}
	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:13: error: 'i' was not declared in this scope
   88 |         rep(i, n) {
      |             ^
a.cc:88:9: error: 'rep' was not declared in this scope; did you mean 'res'?
   88 |         rep(i, n) {
      |         ^~~
      |         res
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)

typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;

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

#define TOSTRING(x) string(#x)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os  << "["; for(auto _: v) os << _ << ", "; os << "]" << endl; return os; };
template <typename T> ostream &operator<<(ostream &os, set<T> &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" <<p.first << ", " << p.second << "}";return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; }

#define DUMPOUT cerr
void dump_func(){ DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); }

#ifdef DEBUG
#define dbg(...) dump_func(__VA_ARGS__)
#define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__)
#else
#define dbg(...)
#define dump(...)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/


int main() {
    ll N;
    string S;
    cin >> N >> S;
    vvec<int> dp(N+1, vec<int>(N+1, 0));
    rep(i,N)rep(j,N){
        if(i >= j)continue;
        if(S[i] == S[j])dp[i+1][j+1] = dp[i][j] + 1;
    }
    auto calc = [&](int x, int y) -> ll{
        int sx = x;
        int sy = y;
        while(x < N && y < N && dp[x][y] + 1 == dp[x+1][y+1]){x++, y++};
        int gx = x;
        int gy = y;
        if(gx < sy)return gx - sx + 1;
        else return sy - 1 - sx + 1;
    };
    ll ans = 0;
    rep(i,N+1)rep(j,N+1){
        if(i >= j)continue;
        if(dp[i][j] == 1)chmax(ans, calc(i,j));
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In lambda function:
a.cc:63:71: error: expected ';' before '}' token
   63 |         while(x < N && y < N && dp[x][y] + 1 == dp[x+1][y+1]){x++, y++};
      |                                                                       ^
      |                                                                       ;
Language: C++

#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

int n;
string s;

bool check(int len) {
	map<string, int> seen, first;
	for(int i = 0; i <= n - len; i++) {	
		string t = s.substr(i, len);
		if(seen[t] && first[t] + len <= i) return true;
		else {
			seen[t] = 1;
			if(!first.coutn(t)) first[t] = i;
		}
	}
	
	return false;
}

void solve() {
	cin >> n >> s;
	
	int l = 0, r = n / 2, ans = 0;
	while(l <= r) {
		int mid = (r + l) / 2;
		if(check(mid)) {
			ans = max(ans, mid);
			l = mid + 1;
		} else r = mid - 1;
	}
	
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Compiler output:
a.cc: In function 'bool check(int)':
a.cc:32:35: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'coutn'; did you mean 'count'?
   32 |                         if(!first.coutn(t)) first[t] = i;
      |                                   ^~~~~
      |                                   count
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <string>

using namespace std;

template<class T>
class RollingHash {
    const int base1 = 1007, base2 = 2009;
    const int mod1 = 1000000007, mod2 = 1000000009;

    vector<long> hash1, hash2, exp1, exp2;

public:
    RollingHash(vector<T> &sequence) :
            hash1(sequence.size() + 1, 0), hash2(sequence.size() + 1, 0),
            exp1(sequence.size() + 1, 1), exp2(sequence.size() + 1, 1) {
        for (int i = 0; i < sequence.size(); ++i) {
            hash1[i + 1] = (hash1[i] * base1 + sequence[i]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + sequence[i]) % mod2;
            exp1[i + 1] = (exp1[i] * base1) % mod1;
            exp2[i + 1] = (exp2[i] * base2) % mod2;
        }
    }

    pair<long, long> get_hash(int l, int r) const {
        long res1 = hash1[r] - hash1[l] * exp1[r - l] % mod1;
        if (res1 < 0) {
            res1 += mod1;
        }
        long res2 = hash2[r] - hash2[l] * exp2[r - l] % mod2;
        if (res2 < 0) {
            res2 += mod2;
        }
        return {res1, res2};
    }
};


int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<char> seq(s.begin(), s.end());
    RollingHash rh(seq);
    for (int length = seq.size() / 2; length > 0; --length) {
        unordered_map<pair<long, long>, int, pair_hash> cnt;
        for (int i = 0; i <= seq.size() - length; ++i) {
            auto h = rh.get_hash(i, i+length);
            auto item = cnt.find(h);
            if (item != cnt.end() && (item->second + length) <= i) {
                cout << length << endl;
                return 0;
            }
            cnt[h] = i;
        }
    }
    cout << 0 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:46: error: 'pair_hash' was not declared in this scope
   51 |         unordered_map<pair<long, long>, int, pair_hash> cnt;
      |                                              ^~~~~~~~~
a.cc:51:55: error: template argument 3 is invalid
   51 |         unordered_map<pair<long, long>, int, pair_hash> cnt;
      |                                                       ^
a.cc:54:29: error: request for member 'find' in 'cnt', which is of non-class type 'int'
   54 |             auto item = cnt.find(h);
      |                             ^~~~
a.cc:55:29: error: request for member 'end' in 'cnt', which is of non-class type 'int'
   55 |             if (item != cnt.end() && (item->second + length) <= i) {
      |                             ^~~
a.cc:59:16: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<long int, long int>')
   59 |             cnt[h] = i;
      |                ^