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

#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"
 
const ll inf = (ll)1e18 + 10;
const int maxn = 500;
const int maxl = 500;
priority_queue < pii >  pq;
int a[N] , b[N];
signed main(){
  fast;
 

  int n , x , y , val , ans = 0;
  cin >> n;
  for(int i = 0 ; i < n ; i++)
       cin >> a[i];
  for(int i = 0 ; i < n ; i++){
       cin >> b[i];
       if(b[i] != a[i])
       pq.push(mp(b[i] , i));
     }
   int cnt = 0;
    while(pq.size() > 0){
          pii p = pq.top();
          pq.pop();
          x = p.ss;
          val = p.ff ;
          y = b[(x- 1 + n) % n] + b[(x + 1) % n];
          int r = (val - a[x])/y;
          if(r == 0){
            ans = -1;
            break;
          }
          
          ans += r;
          
          b[x] -= r*y;
          if(b[x] != a[x]) 
          pq.push(mp(b[x]  , x));

    }
    
    cout << ans << endl;

 
}

Compiler output:
a.cc:29:10: error: expected initializer before 'inf'
   29 | const ll inf = (ll)1e18 + 10;
      |          ^~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 3e18+7
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

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 double PI = acos(-1.0);
const double EPS = 1e-10;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<ll> a(N),b(N);
    priority_queue<pair<ll,int>> pq;
    REP(i,N) cin >> a[i];
    REP(i,N){
        cin >> b[i];
        pq.push({b[i],i});
    }
    int ans = 0;
    while(!pq.empty()){
        ll now = pq.top().first;
        int idx = pq.top().second;
        pq.pop();
        if(now == a[idx]) continue;
        else if(a[idx] > now){
            cout << -1 << endl;
            return 0;
        }
        else{
            ll sa = b[idx] - a[idx];
            ll wa = b[(idx-1+N)%N] + b[(idx+1)%N]
            if(sa / wa <= 0){
                cout << -1 << endl;
                return 0;
            }
            ans += sa / wa;
            now -= sa / wa * wa;
            b[idx] = now;
            pq.push({b[idx],idx});
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: expected ',' or ';' before 'if'
   54 |             if(sa / wa <= 0){
      |             ^~
Language: C++

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
#define PI (acos(-1))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

#define MAXN 1123456
#define MOD 1000000007

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;

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

  int n;
  cin>>n;
  vi a(n), b(n);
  rep(i,0,n)cin>>a[i];
  rep(i,0,n)cin>>b[i];
  ll ans = 0;
  priority_queue<pii> pq;
  rep(i,0,n) if (b[i] > a[i]) pq.push({b[i], i});
  bool good=true;
  while (!pq.empty()) {
    int wtf = pq.top().fst;
    int m = pq.top().snd;
    pq.pop();
    if (b[m] != wtf) continue;
    int y=max(a[m],max(b[(m-1+n)%n], b[(m+1)%n]));
    int sum = b[(m-1+n)%n] + b[(m+1)%n];
    int k = ((b[m] - y + sum - 1) / sum);
    b[m] -= k * sum;
    ans += k;
    if (b[m] != a[m])
      pq.push({b[m],m});
    if (b[m] < a[m]) break;
  }
  rep(i,0,n) {
      if (a[i]!=b[i]) {
        good=false;
        if (b[i] < a[i]) goto fail;
      }
    }
  if (good)cout<<ans<<endl;
  else cout<<-1<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:55:31: error: label 'fail' used but not defined
   55 |         if (b[i] < a[i]) goto fail;
      |                               ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,int> pr; // val, id
int N;
ll A[200001],B[200001];
 
int getPrev(int x){
    return (x-1+N)%N;
}
int getNext(int x){
    return (x+1)%N;
}
set<pr> tmp;
ll cnt=0;
int main(void){
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    
    for(int i=0;i<N;i++){
        cin >> B[i];
        if (B[i] < A[i]){
            cout << -1 << endl;
             return 0;
        }
        if (B[i]!=A[i]) tmp.insert({B[i], i});
    }
    while(tmp.size()>0){
        auto it = tmp.end();
        it--;
        int id = it->second;
        ll val = it->first;
        tmp.erase(it);
        int prev = getPrev(id);
        int nxt = getNext(id);
        B[id] = val - B[prev] - B[nxt];
        cnt++;
        if (B[id] < A[id]){
            // cout << "id: " << id << endl;
            cout << -1 << endl;
            return 0;
        }
        if (B[id] > A[id]){
            tmp.insert({B[id], id});
        }
    }
    cout << cnt << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:49:25: error: expected '}' at end of input
   49 |     cout << cnt << endl;
      |                         ^
a.cc:16:15: note: to match this '{'
   16 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <cstring>
#include <queue>


#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define eREP(i, n) for(int (i) = 0; (i) <= (n); ++(i))
#define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; ++(i))
#define ALL(TheArray) TheArray.begin(), TheArray.end()

template <class T> inline T& chmax(T& a, T b){return (a < b) ? a = b : a;}
template <class T> inline T& chmin(T& a, T b){return (a > b) ? a = b : a;}

using lli = long long int;
using pli = std::pair<lli, int>;

std::vector<lli> A, B;

int main(void){
    std::priority_queue<pli> Q;
    int n; scanf("%d", &n);
    A.resize(n); B.resize(n);
    REP(i, n) scanf("%lld", &A[i]);
    REP(i, n) {scanf("%lld", &B[i]); if(A[i] < B[i]) Q.push(pli(B[i], i));}

    lli res = 0;
    while(not Q.empty()){
        int idx; lli v = 0;
        std::tie(std::ignore, idx) = Q.top(); Q.pop();
        if(not Q.empty()) std::tie(v, std::ignore) = Q.top();
        int idx_p = (idx-1 + n) % n;
        int idx_l = (idx+1) % n;
        lli K1 = (B[idx] - A[idx]) / V; if(K1 == 0) K1 = 1;
        B[idx] -= K1 * V; res += K1;
        if(B[idx] < A[idx]) break;
        else if(B[idx] > A[idx]){
            Q.push(pli(B[idx], idx));
        }
    }
    bool same = true;
    REP(i, n) if(A[i] != B[i]){
        same = false;
        break;
    }
    if(same) printf("%lld\n", res);
    else puts("-1");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:38: error: 'V' was not declared in this scope
   36 |         lli K1 = (B[idx] - A[idx]) / V; if(K1 == 0) K1 = 1;
      |                                      ^
Language: C++

#include<iostream>
int main()
{
  cout << -1 ;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    4 |   cout << -1 ;
      |   ^~~~
      |   std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int i, j, n, ans;
	long tmp, saidai, saidainum;
	cin >> n;
	vector<long> a;
	vector<long> b;

	for (i = 0; i < n; i++) {
		cin >> tmp;
		a.push_back(tmp);
	}
	for (i = 0; i < n; i++) {
		cin >> tmp;
		b.push_back(tmp);
	}
	
	ans = 0;
	for (i = 0; i < 200000; i++) {
		saidai = b[0];
		saidainum = 0;
		for (j = 1; j < n; j++) {
			if (saidai < b[j]) {
				saidainum = j;
				saidai = b[j];
			}
		}
		if (saidainum == 0) {
			b[saidainum] -= (b[n - 1] + b[saidainum + 1]);
		}
		else if (saidainum == n - 1) {
			b[saidainum] -= (b[saidainum - 1] + b[0]);
		}
		else {
			b[saidainum] -= (b[saidainum - 1] + b[saidainum + 1]);
		}
		ans++;

		for (j = 0; j < n; j++) {
			if (a[j] != b[j])break;
			if (a[j] <＝0) {
				cout << -1 << endl;
				return 0;
			}
		}
		if (j == n)break;
	}

	if (i == 200000) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:35: error: '\U0000ff1d0' was not declared in this scope
   44 |                         if (a[j] <＝0) {
      |                                   ^~~
Language: C++

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define ll long long
#define sz size()
#define all(x) x.begin(), x.end()
#define forn(x) for(int i=1;i<=x;i++) 
#define sforn(x, y) for(int i=1;i<=x;i++)for(int j=1;j<=y;j++)
#define pii pair<int, int>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

ll arr[200100];
ll brr[200100];
ll n;
bool comp(int a, int b){
    return brr[a] > brr[b];
}
int main(){ speed;
    cin >> n;
    forn(n) cin >> arr[i];
    forn(n) cin >> brr[i];
    ll ans = 0;
    bool any;
    priority_queue<pii> q;
    forn(n) q.push(mp(brr[i], i));
    int cnt = 0;
    while(q.sz > 0){
        pii top = q.top();
        q.pop();
        int ind = top.se;
        int lind = ind - 1;
        if(lind < 1) lind = n;
        int rind = ind + 1;
        if(rind > n) rind = 1;
        int sum = brr[lind] + brr[rind];
        if(sum >= brr[ind]) {
            q.push(mp(brr[ind], ind));
            if(cnt >= 1e6);
            break;
        }
        ans += brr[ind] / sum;
        brr[ind] %= sum;
        if(brr[ind] == 0) brr[ind] = sum, --ans;
        if(brr[ind] > arr[ind]) q.push(mp(brr[ind], ind));
    }
    q.clear();
    forn(n) q.push(mp(brr[i], i));
    cnt = 0;
    while(q.sz > 0){
        pii top = q.top();
        q.pop();
        int ind = top.se;
        int lind = ind - 1;
        if(lind < 1) lind = n;
        int rind = ind + 1;
        if(rind > n) rind = 1;
        int sum = brr[lind] + brr[rind];
        if(sum >= brr[ind]) {
            q.push(mp(brr[ind], ind));
            if(cnt >= 1e6);
            break;
        }
        ans += brr[ind] / sum;
        brr[ind] %= sum;
        if(brr[ind] == 0) brr[ind] = sum, --ans;
        if(brr[ind] > arr[ind]) q.push(mp(brr[ind], ind));
    }
    for(int i=1;i<=n;i++){
        if(brr[i] != arr[i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:7: error: 'class std::priority_queue<std::pair<int, int> >' has no member named 'clear'
   78 |     q.clear();
      |       ^~~~~
Language: C++

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define ll long long
#define sz size()
#define all(x) x.begin(), x.end()
#define forn(x) for(int i=1;i<=x;i++) 
#define sforn(x, y) for(int i=1;i<=x;i++)for(int j=1;j<=y;j++)
#define pii pair<int, int>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

ll arr[200100];
ll brr[200100];
ll n;
bool comp(int a, int b){
    return brr[a] > brr[b];
}
int main(){ speed;
    cin >> n;
    forn(n) cin >> arr[i];
    forn(n) cin >> brr[i];
    ll ans = 0;
    bool any;
    priority_queue<pii> q;
    forn(n) q.push(mp(brr[i], i));
    int cnt = 0;
    while(q.sz > 0){
        pii top = q.top();
        q.pop();
        int ind = top.se;
        int lind = ind - 1;
        if(lind < 1) lind = n;
        int rind = ind + 1;
        if(rind > n) rind = 1;
        int sum = brr[lind] + brr[rind];
        if(sum >= brr[ind]) {
            q.push(mp(brr[ind], ind));
            if(cnt >= 1e6);
            break;
        }
        ans += brr[ind] / sum;
        brr[ind] %= sum;
        if(brr[ind] == 0) brr[ind] = sum, --ans;
        if(brr[ind] > arr[ind]) q.push(mp(brr[ind], ind));
    }
    forn(n) q.push(mp(brr[i], i));
    int cnt = 0;
    while(q.sz > 0){
        pii top = q.top();
        q.pop();
        int ind = top.se;
        int lind = ind - 1;
        if(lind < 1) lind = n;
        int rind = ind + 1;
        if(rind > n) rind = 1;
        int sum = brr[lind] + brr[rind];
        if(sum >= brr[ind]) {
            q.push(mp(brr[ind], ind));
            if(cnt >= 1e6);
            break;
        }
        ans += brr[ind] / sum;
        brr[ind] %= sum;
        if(brr[ind] == 0) brr[ind] = sum, --ans;
        if(brr[ind] > arr[ind]) q.push(mp(brr[ind], ind));
    }
    for(int i=1;i<=n;i++){
        if(brr[i] != arr[i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:9: error: redeclaration of 'int cnt'
   79 |     int cnt = 0;
      |         ^~~
a.cc:58:9: note: 'int cnt' previously declared here
   58 |     int cnt = 0;
      |         ^~~
Language: C++

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0


int main() {

    int N;
    vl A;
    vl B;
    deque<int> isum;

    Scd(N);
    ll ans = 0;

    A.resize(3*N);
    B.resize(3*N);

    Rep(i,N){
        Scd(A[i]);
        A[i+N] = A[i];
        A[i+2*N] = A[i];
    }
    Rep(i,N){
        Scd(B[i]);
        B[i+N] = B[i];
        B[i+2*N] = B[i];
        if( B[i] < A[i] ) ans = -1;
    }

    if( ans < 0 ){ 
        printf ("%lld\n", ans );
        break;
    }

    Repe(i,N*2,N){
        if( B[i] > B[i-1] + B[i+1] ){
            isum.push_back(i);
        }
    }

    ans = 0;

    while( isum.size() ){
        int from = isum.front();
        isum.pop_front();


        ll cnt = ( B[from] - A[from] ) / ( B[from-1] + B[from+1] );
        ans += cnt;
        B[from] -= ( B[from-1] + B[from+1] ) * cnt;
        B[from+N] = B[from]; B[from-N] = B[from];

        if( B[from-1] > B[from-2] + B[from] ) isum.push_back((from-1+N)%N+N);
        if( B[from+1] > B[from] + B[from+2] ) isum.push_back((from+1+N)%N+N);

    }

    Rep(i,N){
        if( B[i] != A[i] ) ans = -1;
    }
    printf ("%lld\n", ans );


    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:75:9: error: break statement not within loop or switch
   75 |         break;
      |         ^~~~~
Language: C++

#include<iostream>
#include<cstring>
#include<sstream>

using namespace std;


int main() {
	int n,a[1000],b[1000],gat[1000],nr=0;
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		gat[i] = 0;
	}
	for (int i = 0;i < n;i++)
		cin >> b[i];
	int ok = 0;
	int min = INT_MAX,poz;
	while (ok == 0) {
		ok = 1;
		if (min == INT_MAX) {
			for (int i = 0;i < n;i++) {
				if (gat[i] == 0 && min > b[i])
				{
					min = b[i];
					poz = i;
					ok = 0;
				}
			}
		}

		int sum;
		if(poz==0)
		{
			sum = a[poz] + a[poz + 1] + a[n - 1];
			
		}
		else {
			if (poz == n - 1)
				sum = a[poz] + a[poz - 1] + a[0];
			else sum = a[poz] + a[poz - 1] + a[poz + 1];
		}

		if (sum == min) {
			ok = 0;
			gat[poz] = 1;
			a[poz] = min;
			min = INT_MAX;
			nr++;
		}
		else {
			if (sum > min)
			{
				min = INT_MAX;

			}
			else {
				ok = 0;
				a[poz] = sum;
				nr++;
			}
		}
	}
	cout << nr;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: 'INT_MAX' was not declared in this scope
   18 |         int min = INT_MAX,poz;
      |                   ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<sstream>
  +++ |+#include <climits>
    4 | 
a.cc:26:41: error: 'poz' was not declared in this scope
   26 |                                         poz = i;
      |                                         ^~~
a.cc:33:20: error: 'poz' was not declared in this scope
   33 |                 if(poz==0)
      |                    ^~~
a.cc:46:29: error: 'poz' was not declared in this scope
   46 |                         gat[poz] = 1;
      |                             ^~~
a.cc:59:35: error: 'poz' was not declared in this scope
   59 |                                 a[poz] = sum;
      |                                   ^~~
Language: C

#include<stdio.h>

int same(long int goal[], long int now[], int n){
	int same=0;
	for(int i=1; i<=n; i++){
		if(goal[i] == now[i]) same++;
	}
	return (same);
}

int small(long int goal[], long int now[], int n){
	for(int i=1; i<=n; i++){
		if((now[i]-goal[i]) < 0){
			return -1;
		}
	}
	return 0;
}

int main(){
	int n;
	scanf("%d", &n);
	long int goal[n+1], now[n+1];
	goal[0] = -100, now[0] = -100;
	for(int i=1; i<=n; i++){
		scanf("%ld", &goal[i]);
	}
	for(int i=1; i<=n; i++){
		scanf("%ld", &now[i]);
	}
	//入力
	int count=0, max=0, max_n=0;
	
	while(1){
		if(same(goal, now, n) == n){
			printf("%d", count);
			break;
		}
		else if(count == 0){
			if(small(goal, now, n) == -1){
				printf("%d", -1);
				break;
			}
		}
		
		max=0, max_n=0;
		for(int i=1; i<=n; i++){
			if(max < now[i]){
				max=now[i];
				max_n=i;
			}
		}
		if(max_n == 1){
			now[1] = now[1]-now[2]-now[n];
			if((now[1]-goal[1]) < 0){
				printf("%d", -1){
					break;
				}
			}
		}
		else if(max_n == n){
			now[n] = now[n]-now[n-1]-now[1];
			if((now[n]-goal[n]) < 0){
				printf("%d", -1){
					break;
				}
			}
		}
		else{
			now[max_n] = now[max_n]-now[max_n+1]-now[max_n-1];
			if((now[max_n]-goal[max_n]) < 0){
				printf("%d", -1){
					break;
				}
			}
		}
		count++;
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:56:49: error: expected ';' before '{' token
   56 |                                 printf("%d", -1){
      |                                                 ^
      |                                                 ;
main.c:64:49: error: expected ';' before '{' token
   64 |                                 printf("%d", -1){
      |                                                 ^
      |                                                 ;
main.c:72:49: error: expected ';' before '{' token
   72 |                                 printf("%d", -1){
      |                                                 ^
      |                                                 ;
Language: C++

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

int next(int i, int n) {
	if (i == n - 1) return 0;
	else return i + 1;
}

int prev(int i, int n) {
	if (i == 0) return n - 1;
	else return i - 1;
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}

	int ans = 0, fin = 0, miss = 0;
	vector<bool> finished(n);
	for (int i = 0; i < n; i++) finished[i] = false;

	for (int i = 0;; i = next(i, n)) {
		if (fin == n || miss == n) break;
		if (!finished[i]) {
			int ne = next(i, n), pr = prev(i, n);
			if (b[i] - b[ne] - b[pr] > 0) {
				miss = 0;
				ans += b[i] / (b[ne] + b[pr]);
				b[i] = b[i] % (b[ne] + b[pr]);
				if (b[i] == a[i]) { finished[i] = true; fin++; }
				else if (b[i] < a[i]) miss = n;
			}
			else miss++;
		}
	}

	if (miss == n) cout << -1 << endl;
	else cout << ans << endl;

	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)			// repeat reverse
#define size(collection) ((ll) (collection).size())						// collection size

#endif

void Solve(ll index)
{

}

int main(void)
{
	ll n; cin >> n;
	vector<ll> a(n);
	vector<ll> b(n);

	rep(i, 0, n)
		cin >> a[i];
	rep(i, 0, n)
		cin >> b[i];

	ll same = 0;
	rep(i, 0, n)
	{
		if (a[i] == b[i])
			same++;
		if (same == n)
		{
			cout << 0;
			return 0;
		}
	}

	multiset<pair<ll, ll>> bset;
	rep(i, 0, n)
		bset.insert(make_pair(b[i], i));


	ll i = 0;
	ll count = 0;
	ll max = *max_element(all(a));
	while(1)
	{
		auto it = bset.end(); it--;
		i = it->second;
		if (it->first < max)
		{
			cout << -1;
			return 0;
		}
		else if (it->first == max)
		{
			break;
		}

		ll btemp = it->first;
		btemp -= (i - 1 == -1) ? (b.back() + b[i + 1]) : (i + 1 == size(b)) ? (b[i - 1] + b.front()) : (b[i - 1] + b[i + 1]);

		if (btemp <= 0)
		{
			cout << -1;
			return 0;
		}

		bset.erase(it);
		bset.insert(make_pair(btemp, i));
		b[i] = btemp;
		count++;
	}

	ll same = 0;
	rep(i, 0, n)
	{
		if (a[i] == b[i])
			same++;
		if (same == n)
		{
			cout << count;
			return 0;
		}
	}
	
	cout << -1;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:12: error: redeclaration of 'll same'
   82 |         ll same = 0;
      |            ^~~~
a.cc:33:12: note: 'll same' previously declared here
   33 |         ll same = 0;
      |            ^~~~
Language: C++

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;

int main()
{
	int n; cin>>n;
	ll a[200020], b[200020];
	ll cnt=0;
	bool ok[200020]={};
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	priority_queue<P> que;
	for(int i=0; i<n; i++){
		cin>>b[i];
		if(a[i]==b[i]) ok[i]=1;
		else que.push({b[i], i});
	}
	ll ans=0;
  int cnt=0;
	while(!que.empty()){
		P p=que.top(); que.pop();
      cnt++;
      if(cnt>10000000){
        cout<<-1<<endl;
        return 0;
      }
		int x=p.second;
		ll b1=b[(x-1+n)%n], b2=b[(x+1)%n];
		if(b[x]-b1-b2<=0){
			cout<<-1<<endl;
			return 0;
		}
		if(ok[(x-1+n)%n] && ok[(x+1)%n]){
			if((b[x]-a[x])%(b1+b2)!=0){
				cout<<-1<<endl;
				return 0;
			}
			ans+=(b[x]-a[x])/(b1+b2);
			ok[x]=1;
		}else{
			b[x]-=(b1+b2);
			ans++;
			if(a[x]==b[x]) ok[x]=1;
			else que.push({b[x], x});
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:7: error: conflicting declaration 'int cnt'
   42 |   int cnt=0;
      |       ^~~
a.cc:30:12: note: previous declaration as 'll cnt'
   30 |         ll cnt=0;
      |            ^~~
Language: C++

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;

int main()
{
	int n; cin>>n;
	ll a[200020], b[200020];
	ll cnt=0;
	//bool ok[200020]={};
	for(int i=0; i<n; i++){
		cin>>a[i];
	}
	priority_queue<P> que;
	for(int i=0; i<n; i++){
		cin>>b[i];
		if(a[i]==b[i]) ok[i]=1;
		else que.push({b[i], i});
	}
	ll ans=0;
	int cnt=0;
	while(!que.empty()){
		P p=que.top(); que.pop();
		cnt++;
		if(cnt>10000000){
			cout<<-1<<endl;
			return 0;
		}
		int x=p.second;
		ll b1=b[(x-1+n)%n], b2=b[(x+1)%n];
		if(b[x]-b1-b2<=0){
			cout<<-1<<endl;
			return 0;
		}
		if(ok[(x-1+n)%n] && ok[(x+1)%n]){
			if((b[x]-a[x])%(b1+b2)!=0){
				cout<<-1<<endl;
				return 0;
			}
			ans+=(b[x]-a[x])/(b1+b2);
			ok[x]=1;
		}else{
			b[x]-=(b1+b2);
			ans++;
			if(a[x]==b[x]) ok[x]=1;
			else que.push({b[x], x});
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:32: error: 'ok' was not declared in this scope
   38 |                 if(a[i]==b[i]) ok[i]=1;
      |                                ^~
a.cc:42:13: error: conflicting declaration 'int cnt'
   42 |         int cnt=0;
      |             ^~~
a.cc:30:12: note: previous declaration as 'll cnt'
   30 |         ll cnt=0;
      |            ^~~
a.cc:56:20: error: 'ok' was not declared in this scope
   56 |                 if(ok[(x-1+n)%n] && ok[(x+1)%n]){
      |                    ^~
Language: C++

#include <iostream>
#include<vector>

#include <algorithm>

using namespace std;

int main(){
  int  n;
  long long count=0;
  long long cc=0;
  long long  t=0;
  cin >>n;
  vector<int> a(n);
  vector<int> b(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
}
    for(int i=0;i<n;i++){
    cin>>b.at(i);
}
  
  
  for(int i=0;i<n;i++){
    
    while(a.at(i)!=b.at(i)){
      
      if(i==0){t=a.at(n-1)+a.at(0)+a.at(1);
               a.at(0)=t;
               count++;
              }
    
    	 else if(i==n-1){t=a.at(n-1)+a.at(n-2)+a.at(0);
               a.at(n-1)=t;
               count++;
              }
      
      else{t=a.at(i-1)+a.at(i)+a.at(i+1);
               a.at(i)=t;
               count++;
          }
  	
  	if(a.at(i)>b.at(i){
      cout<<"-1"<<endl;
    	break;
    }
    
    
    
    
    }
  
  cc+=count;
    count=0;
  }
  cout<<cc<<endl;
  
}
  
  
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:43:27: error: expected ')' before '{' token
   43 |         if(a.at(i)>b.at(i){
      |           ~               ^
      |                           )
a.cc:51:5: error: expected primary-expression before '}' token
   51 |     }
      |     ^
Language: C++

#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
void fin(int n){
  cout<<n<<endl;
  exit(0);
}
//main
signed main(){
  int N;cin>>N;
  std::vector<int> a(N),b(N);
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)cin>>b[i];
  for(int i=0;i<N;i++)if(b[i]<a[i])fin(-1);
  for(int i=0;i<N;i++){
    if(b[i]==a[i]){
      ok++;
      ook[i]++;
    }
  }
  queue<int> que;
  int ok=0,ans=0;
  std::vector<int> ook(N,0);
  for(int i=0;i<N;i++)if(b[i]<b[(i+1)%N]&&b[(i+1)%N]>b[(i+2)%N])que.push((i+1)%N);
  while(que.size()){
    int p=que.front();que.pop();
    int l=b[(p-1+N)%N],r=b[(p+1)%N];int t=l+r;
    int s=(b[p]-max({l,r,a[p]}))/t;
    if((b[p]-max({l,r,a[p]}))%t)s++;
    b[p]-=s*t;
    ans+=s;
    if(b[p]<a[p])fin(-1);
    if(b[p]==a[p]){
      ok++;
      ook[p]++;
    }
    if(ok==N)fin(ans);
    if(ook[(p+1)%N]==0)if(b[p]<b[(p+1)%N]&&b[(p+1)%N]>b[(p+2)%N])que.push((p+1)%N);
    if(ook[(p-1+N)%N]==0)if(b[(p-2+N)%N]<b[(p-1+N)%N]&&b[(p-1+N)%N]>b[p])que.push((p-1+N)%N);
  }
  fin(-1);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: 'ok' was not declared in this scope
   22 |       ok++;
      |       ^~
a.cc:23:7: error: 'ook' was not declared in this scope
   23 |       ook[i]++;
      |       ^~~
Language: C++

#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
void fin(int n){
  cout<<n<<endl;
  exit(0);
}
//main
signed main(){
  int N;cin>>N;
  std::vector<int> a(N),b(N);
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)cin>>b[i];
  queue<int> que;
  int ok=0,ans=0;
  std::vector<int> ook(N,0);
  for(int i=0;i<N;i++)if(b[i]<b[(i+1)%N]&&b[(i+1)%N]>b[(i+2)%N])que.push((i+1)%N);
  while(que.size()){
    int p=que.front();que.pop();
    int l=b[(p-1+N)%N],r=b[(p+1)%N];int t=l+r;
    int s=(b[p]-max({l,r,a[p]}))/t;
    if((b[p]-max({l,r,a[p]}))%t)s++;
    b[p]-=s*t;
    ans+=s;
    if(b[p]<a[p])fin(-1);
    if(b[p]==a[p]){
      ok++;
      ook[p]++;
    }
    if(ok==N)fin(ans);
    if(ook[(p+1)%N==0)if(b[p]<b[(p+1)%N]&&b[(p+1)%N]>b[(p+2)%N])que.push((p+1)%N);
    if(ook[(p-1+N)%N==0)if(b[(p-2+N)%N]<b[(p-1+N)%N]&&b[(p-1+N)%N]>b[p])que.push((p-1+N)%N);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:22: error: expected ']' before ')' token
   36 |     if(ook[(p+1)%N==0)if(b[p]<b[(p+1)%N]&&b[(p+1)%N]>b[(p+2)%N])que.push((p+1)%N);
      |                      ^
      |                      ]
a.cc:37:24: error: expected ']' before ')' token
   37 |     if(ook[(p-1+N)%N==0)if(b[(p-2+N)%N]<b[(p-1+N)%N]&&b[(p-1+N)%N]>b[p])que.push((p-1+N)%N);
      |                        ^
      |                        ]
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=105;
int n,m;
bool e[N][N];
int match[N];
bool vis[N];
bool dfs(int u)
{
	for(int v=1;v<=n;v++)
		if(e[u][v]&&!vis[v])
		{
			vis[v]=1;
			if(!match[v]||dfs(match[v]))
			{
				match[v]=u;
				return true;
			}
		}
	return false;
}
void match()
{
	memset(match,0,sizeof(match));
	for(int i=1;i<=n;i++)
	{
		memset(vis,false,sizeof(vis));
		dfs(i);
	}
	return;
}
int a[N][N],b[N][N],id[N][N];
bool book[N][N];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			scanf("%d",&a[i][j]);
			id[i][j]=(a[i][j]-1)/m+1;
		}
	for(int k=1;k<=m;k++)
	{
		memset(e,0,sizeof(e));
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++)
				if(!book[i][j]) e[i][id[i][j]]=1;
		match();
		for(int j=1;j<=n;j++)
		{
			int u=match[j];
			for(int v=1;v<=m;v++)
				if(!book[u][v]&&id[u][v]==j)
				{
					book[u][v]=true;
					b[u][k]=a[u][v];
					break;
				}
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			printf("%d ",b[i][j]);
		printf("\n");
	}
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)
			for(int k=1;k<j;k++)
				if(b[j][i]<b[k][i]) swap(b[j][i],b[k][i]);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			printf("%d ",b[i][j]);
		printf("\n");
	}
	return 0;
}

Compiler output:
a.cc:24:12: error: 'void match()' redeclared as different kind of entity
   24 | void match()
      |            ^
a.cc:8:5: note: previous declaration 'int match [105]'
    8 | int match[N];
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:51:22: error: 'match' cannot be used as a function
   51 |                 match();
      |                 ~~~~~^~
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
#define ll long long
int n,m;
int a[102][102];
int x[102];
bool vis[102][102];
int main()
{
	//freopen("sort.out","w",stdout);
    //freopen("sort.in","r",stdin);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
   		for(int j=1;j<=m;j++)
    		scanf("%d",&a[i][j]);
    for(int i=1;i<=m;i++)
    	printf("%d ",a[1][i]),vis[(a[1][i]-1)/m][i]=1,x[(a[1][i]-1)/m]++;
    for(int i=2;i<=n;i++)
    {
    	
		for(int j=1;j<=m;j++)
			if(x[(a[i][j]-1)/m]>0)
				
			
			
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: expected primary-expression before '}' token
   29 |         }
      |         ^
Language: C++

// Remember...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn=110,mod=998244353;
const ll inf=1e18;

int a[maxn][maxn], b[maxn][maxn], f[maxn], n, m;
bool adj[maxn][maxn], is[maxn][maxn], mark[maxn];

bool dfs(int u){
    mark[u]=1;
    for(int i=0;i<n;i++){
	if(adj[u][i]==0) continue;
	if(f[i]==-1){
	    f[i]=u;
	    return 1;
	}
	if(mark[ f[i] ]==0 && dfs( f[i] ) ){
	    f[i]=u;
	    return 1;
	}
    }
    return 0;
}

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

    cin>>n>>m;

    for(int i=0;i<n;i++){
	for(int j=0;j<m;j++)
	    cin>>a[i][j], a[i][j]--;
    }
    for(int col=0;col<m;col++){
	memset(adj,0,sizeof adj);
	for(int i=0;i<n;i++){
	    for(int j=col;j<m;j++){
		adj[ a[i][j]/m ][i]=1;
	    }
	}
	memset(f,-1,sizeof f);
	for(int k=0;k<n;k++)
	    memset(mark,0,sizeof mark), assert(dfs(k));
	for(int i=0;i<n;i++){
	    int id=-1;
	    for(int j=col;j<m;j++)
		if(a[i][j]==f[i]) id=j;
	    assert(id!=-1);
	    swap(a[i][j], a[i][id]);
	}
    }
    for(int i=0;i<n;i++)
	for(int j=0;j<m;j++)
	    cout<<a[i][j]<<" \n"[j==m-1], b[i][j]=a[i][j];
    for(int i=0;i<n;i++){
	for(int j=0;j<m;j++){
	    a[ b[i][j]/m ][j]= b[i][j];
	}
    }
    for(int i=0;i<n;i++){
	for(int j=0;j<m;j++)
	    cout<<a[i][j]+1<<" \n"[j==m-1];
    }
    return 0;
}
// Deathly mistakes:
//  * Read the problem carefully.
//  * Check maxn.
//  * Overflows.


// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


Compiler output:
a.cc: In function 'int main()':
a.cc:63:23: error: 'j' was not declared in this scope
   63 |             swap(a[i][j], a[i][id]);
      |                       ^
Language: C++

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


int main(){
    int N,M;
    cin >> N >> M;
    int A[N][M];
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            cin >> A[i][j];
        }
        
    }
    int mp[N] = {0};
    int cnt = 0;
    int temp;
    for (int k = 0; k < M-1; k++)
    {
        for (int i = 0; i < N; i++)
            {
                mp[(A[i][k]-1)/M]++;
                if(mp[(A[i][k]-1)/M] > 1){
                    while(true){
                        cnt++;
                        if(mp[(A[i][k+cnt]-1)/M] == 0){
                            temp = A[i][k+cnt];
                            A[i][k+cnt] = A[i][k];
                            A[i][k] = temp;
                            break;
                        }
                    }
                    cnt = 0;
                }
            }
            for (int i = 0; i < N; i++)
            {
                mp[i] = 0;
            }
            
    }

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            if(j != M-1) cout << A[i][j] << " ";
            else cout << A[i][j] << endl;
        }
        
    }
        
    int B[N][M];

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            B[i][j] = (A[i][k]-1)/M;
        }
        
    }
    
    int C[N][M];
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            C[i][j] = A[B[i][j]][j];
        }
        
    }
    
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            if(j != M-1) cout << C[i][j] << " ";
            else cout << C[i][j] << endl;
        }
        
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:29: error: 'k' was not declared in this scope
   62 |             B[i][j] = (A[i][k]-1)/M;
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<double> VD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1 << 7;
int n, m;
vector<vector<int>> a;
char used[N][N];

void print(vector<VI>& x)
{
	FOR(i, 0, SZ(x))
	{
		FOR(j, 0, SZ(x[0]))
			cout << x[i][j] + 1 << ' ';
		cout << endl;
	}
}

VI g[N];
int mt[N];
char U[N];

bool kuhn(int v)
{
	if (U[v])
		return 0;
	
	U[v] = 1;
	
	for(auto i: g[v])
		if (mt[i] == -1)
		{
			mt[i] = v;
			return 1;
		}
		
	for(auto i: g[v])
		if (kuhn(mt[i]))
		{
			mt[i] = v;
			return 1;
		}
		
	return 0;
}

void go_kuhn()
{
	VI kek;
	FOR(i, 0, m)
		kek[i] = i;
	shuffle(ALL(kek), rng);
	
	FILL(mt, -1);
	FOR(i, 0, m)
	{
		FILL(U, 0);
		kuhn(kek[i]);
	}
	
	FOR(i, 0, m)
		if (mt[i] == -1)
		{
			go_kuhn(i);
			break;
		}
}

void go(VI& row)
{
	FOR(i, 0, m)
		g[i].clear();
	
	FOR(i, 0, m)
		FOR(j, 0, m)
			if (!used[i][row[j] / m])
				g[i].PB(j);
	
	go_kuhn();
	VI bulo = row;
	FOR(i, 0, m)
		row[mt[i]] = bulo[i];
	
	FOR(i, 0, m)
		used[i][row[i] / m] = 1;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);
	
	cin >> n >> m;
	a.assign(n, VI(m));
	FOR(i, 0, n)
		FOR(j, 0, m)
		{
			cin >> a[i][j];
			a[i][j]--;
		}
	
	FOR(i, 0, m)
		used[i][a[0][i] / m] = 1;
	
	vector<VI> step1 = a;
	FOR(i, 1, n)
	{
		VI row = step1[i];
		go(row);
		step1[i] = row;
	}	
	
	print(step1);
	
	vector<VI> step2 = step1;
	FOR(i, 0, m)
	{
		VI tut(n);
		FOR(j, 0, n)
			tut[j] = step2[j][i];
		sort(ALL(tut));
		FOR(j, 0, n)
			step2[j][i] = tut[j];
	}	
	
	print(step2);
			
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void go_kuhn()':
a.cc:86:32: error: too many arguments to function 'void go_kuhn()'
   86 |                         go_kuhn(i);
      |                         ~~~~~~~^~~
a.cc:69:6: note: declared here
   69 | void go_kuhn()
      |      ^~~~~~~
Language: C++



#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
using namespace std;


void AGC037D()
{
	string str1, str2;
	cin >> str1 >> str2;
	int N = stoi(str1);
	int M = stoi(str2);

	map<int, int> rowMap;
	map<int, int> colMap;
	vector<vector<int> > loc(N, vector<int>(M));
	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < M; ++j)
		{
			cin >> str1;
			int x = stoi(str1);
			rowMap[x] = i;
			colMap[x] = j;
			loc[i][j] = x;
		}
	}

	vector<vector<int> > loc1(loc);
	for (int i = 0; i < N; ++i)
	{
		vector<int> spaces(M, 0);
		for (int j = 0; j < M; ++j)
		{
			int x = i * M + j + 1;
			int iRow = rowMap.find(x)->second;
			int iCol = colMap.find(x)->second;

			int k = 0;
			for (; k < M; ++k)
			{
				if (spaces[k] == 0 && loc1[iRow][k] >= x)
				{
					int y = loc1[iRow][k];
					loc1[iRow][k] = x;
					loc1[iRow][iCol] = y;
					colMap[x] = k;
					colMap[y] = iCol;
					spaces[k] = 1;
					break;
				}
			}
			if (k == M)
			{
				spaces[iCol] = 1;
			//	throw "Should not reach here";
			}

		}
	}

	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < M; ++j)
		{
			cout << loc1[i][j];
			if(j < M-1)
				cout << ' ';
		}
		cout << endl;
	}

	vector<vector<int> > loc2(M, vector<int>(N));
	for (int i = 0; i < N; ++i)
		for (int j = 0; j < M; ++j)
			loc2[j][i] = loc1[i][j];

	for (int j = 0; j < M; ++j)
		sort(loc2[j].begin(), loc2[j].end());

	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < M; ++j)
		{
			cout << loc2[j][i];
			if(j < M-1)
				cout << ' ';
		}
		cout << endl;
	}
  
  int main()
{
	AGC037D();
	return 0;
}

Compiler output:
a.cc: In function 'void AGC037D()':
a.cc:100:11: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  100 |   int main()
      |           ^~
a.cc:100:11: note: remove parentheses to default-initialize a variable
  100 |   int main()
      |           ^~
      |           --
a.cc:100:11: note: or replace parentheses with braces to value-initialize a variable
a.cc:101:1: error: a function-definition is not allowed here before '{' token
  101 | {
      | ^
a.cc:104:2: error: expected '}' at end of input
  104 | }
      |  ^
a.cc:16:1: note: to match this '{'
   16 | {
      | ^
Language: C++

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

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string t = s;
    reverse(t.begin(), t.end());
    s += t;
    int l = 0;
    for(int i = 1; i <= n; i++){
        if(s.substr(i, n) < s.substr(l, n)) l = i;
    }
    int c, r = 0;
    for(c = 1; c < n; c++){
        if(s[l + c] != s[l]){
            r = l + c;
            break;
        }
    }
    for(int i = 0; i < k - 1; i++){
        c <<= 1;
        if(c >= n){
            c = n;
            break;
        }
    }
    for(int i = 0; i < c; i++) cout << s[l];
    for(int i = 0; i < n - c; i++) cout << s[r + i];
    cout << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'reverse' was not declared in this scope
   12 |     reverse(t.begin(), t.end());
      |     ^~~~~~~
Language: C++

n, k = map(int, input().split())
s = input()
u = s + s[::-1]
mi = "z" * n
for i in range(n + 1):
    if mi > u[i:i + n]:
        mi = u[i:i + n]
print(mi)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, k = map(int, input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int n, k;
    cin >> n >> k >> s;
    string t = s;
    reverse(be(t));
    s += t;
    string u = s.substr(0, n);
    for(int i=1;i<=n;i++) m = min(m, s.substr(i, n));
    int x = 1;
    while(x < m.length() && m[0] == m[x]) x++;
    int y = x;
    k--;
    if(k > 17) y = N;
    else y <<= k;
    string ans = "";
    while(ans.length() < n && k > 0) y--, ans += m[0];
    ans += m.substr(x, n - ans.length());
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:27: error: 'm' was not declared in this scope
   20 |     for(int i=1;i<=n;i++) m = min(m, s.substr(i, n));
      |                           ^
a.cc:22:15: error: 'm' was not declared in this scope
   22 |     while(x < m.length() && m[0] == m[x]) x++;
      |               ^
a.cc:25:20: error: 'N' was not declared in this scope
   25 |     if(k > 17) y = N;
      |                    ^
a.cc:28:50: error: 'm' was not declared in this scope
   28 |     while(ans.length() < n && k > 0) y--, ans += m[0];
      |                                                  ^
a.cc:29:12: error: 'm' was not declared in this scope
   29 |     ans += m.substr(x, n - ans.length());
      |            ^
Language: C++

#include<cstdio>
#include<Cstring>
#define N 10001
int i,j,k,l,n;char c[N],x[N],y[N];
int main()
{
	scanf("%d%d%s",&n,&k,c+1),k--;
	for(i=1,j=n<<1;i<=n;c[j--]=c[i++])y[i-1]='z';
	for(i=j=1;i<=n;i=j)
	{
		while(j<=n&&c[i]==c[j])j++;
		if(k>12||j-i<<k>=n)memset(x,c[i],n);
		else memset(x,c[i],j-i<<k),memcpy(x+(j-i<<k),c+j,n-(j-i<<k));
		if(strcmp(x,y)<0)memcpy(y,x,n);
	}
	return 0*printf("%s\n",y);
}

Compiler output:
a.cc:2:9: fatal error: Cstring: No such file or directory
    2 | #include<Cstring>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

//A###......
//で連続する部分列のうち長さiで最小なもの
vector<int> argmin_subseq(vector<int> A){
  const int mi=numeric_limits<int>::min();
  int N=A.size(),mx=mi;
  vector<int> idx,nx;
  for(int i=0;i<N;i++){
    A[i]*=-1;
    mx=max(mx,A[i]);
  }
  for(int i=0;i<N;i++){
    A[i]-=mx-1;
    if(A[i]==1){idx.push_back(i);}
  }
  for(int len=1;len<N;){
    for(auto I:idx){
      mx=max(mx,I+len<N?A[I+len]:mi);
    }
   if(mx<=0){
      for(auto I:idx){
        if((I+len<N?A[I+len]:mi)==mx){
          A[I]++;
          nx.push_back(I);
        }
      }
      len++;
    }
    else{
      reverse(idx.begin(),idx.end());
      for(auto I:idx){
        if(I+len<N && A[I+len]>0){
          A[I]+=A[I+len];
          mx=max(mx,A[I]);
        }
      }
      reverse(idx.begin(),idx.end());
      for(auto I:idx){
        if(A[I]==mx){nx.push_back(I);}
      }
      len=mx;
    }
    idx.clear();
    swap(nx,idx);
  }
  for(auto &I:A){I=max(I,0);}
  return A;
}

Compiler output:
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<int> argmin_subseq(vector<int> A){
      | ^~~~~~