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

#include <bits/stdc++.h>

using namespace std;

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

int main(){
  
  int N;
  cin >> N;
  
  int tmp;
  vector<deque<int>> A(N, deque<int>());
  
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N-1; j++){
      cin >> tmp;
      A.at(i).push_back(tmp);
    }
  }
  
  int ans = 0, cnt = 0, wrong = 0;
  vector<int> check;
  vector<int>::iterator itr_1, itr_2;
  size_t index_1, index_2;
  
  while (true){
    
  	for (int i = 0; i < N; i++){
      
      if (A.at(i).front()-1 == A.at(A.at(i).front()-1).front()-1)){
        cout << -1;
        return 0;
      }
      
      if (A.at(i).size() == 0) {
        cnt++;
        wrong++;
        continue;
      }
      
      if (check.size() != 0){
        itr_1 = find(check.begin(), check.end(), i);
        index_1 = distance(check.begin(), itr_1);
        itr_2 = find(check.begin(), check.end(), A.at(i).front()-1);
        index_2 = distance(check.begin(), itr_2);
        
        if (index_1 != check.size() || index_2 != check.size()) continue;
      }
      
      if (i == A.at(A.at(i).front()-1).front()-1){
        check.push_back(i);
        check.push_back(A.at(i).front()-1);
        A.at(A.at(i).front()-1).pop_front();
        A.at(i).pop_front();
      } else wrong++;

  	}
    
    if (cnt == N){
      cout << ans;
      return 0;
    } else if (wrong == N){
      cout << -1;
      return 0;
    }
    
    check.clear();
    ans++;
    cnt = 0;
    wrong = 0;
  }
  
  return 0;
}


Compiler output:
a.cc:5:1: error: 'cin' does not name a type
    5 | cin.tie(nullptr);
      | ^~~
a.cc:6:26: error: expected constructor, destructor, or type conversion before '(' token
    6 | ios_base::sync_with_stdio(false);
      |                          ^
a.cc: In function 'int main()':
a.cc:32:66: error: expected primary-expression before ')' token
   32 |       if (A.at(i).front()-1 == A.at(A.at(i).front()-1).front()-1)){
      |                                                                  ^
Language: Java

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class ELeague {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();
        LinkedList<Integer>[] matches = new LinkedList[n+1];
        for(int i=0;i<=n;i++){
            matches[i] = new LinkedList<>();
        }
        for(int i=1;i<=n;i++){
            for(int j=1;j<n;j++){
                matches[i].addLast(in.nextInt());
            }
        }
        int day=0;
        boolean run = true;
        HashSet<Integer> check = new HashSet<>();
        while (run){
            run=false;
            check.clear();
            for (int i=1;i<=n;i++){
                if(matches[i].size()>0 && !check.contains(i)){
                    int next = matches[i].get(0);
                    if( matches[next].get(0)==i && !check.contains(next)){
                        matches[i].removeFirst();
                        matches[next].removeFirst();
                        check.add(i);check.add(next);
                        run=true;
                    }
                }
            }
            if(run)
                day++;
            if(day>500)
                throw new RuntimeException();
        }
        for(int i=1;i<=n;i++){
            if(matches[i].size()>0){
                System.out.println(-1);
                return;
            }

        }
        System.out.println(day);
    }
}


Compiler output:
Main.java:5: error: class ELeague is public, should be declared in a file named ELeague.java
public class ELeague {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    ios_();
    int n;
    cin >> n;
    vector<deque<int>> deq(n);
    REP(i, n){
        REP(j, n-1){
            int a;
            cin >> a;
            deq[i].push_back(a-1);
        }
    }

    int ans = 0, rem = n * (n-1);
    while(rem > 0){
        vector<bool> checker(n, false);
        ans++;
        fail = true;
        REP(i, n-1){
            if(deq[i].empty() || checker[i]) continue;
            int j = deq[i].front();
            if(!deq[j].empty() && deq[j].front() == i && !checker[j]){
                checker[i] = true;
                checker[j] = true;
                deq[i].pop_front();
                deq[j].pop_front();
                rem -= 2;
                fail = false;
            }
        }
        if(fail){
            ans = -1;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'fail' was not declared in this scope
   47 |         fail = true;
      |         ^~~~
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N;
int A[MAX_N + 1][MAX_N + 1];
int ddd[MAX_N + 1];

int main(void)
{
  cin >> N;
  REP(i, N) REP(j, N)
  {
    int x;
    cin >> x;
    // 0-indexed
    A[i][j] = x - 1;
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N - 1; j++) {
      // この選手と試合できる日を探す
      int t = A[i][j];
      int d = 0;
      for (int k = 0; k < N - 1; k++) {
        if (A[t][k] == i) {
          d = k + 1;
          break;
        }
      }
      if (d > ddd[i])
        ddd[i] = d;
      else {
        ddd[i] += 1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) ans = max(ans, ddd[i]);
  if (ans < N) {
    cout << -1 << endl;
  }
  else {
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
/tmp/cchyTaL9.o: in function `main':
a.cc:(.text+0x1ae): relocation truncated to fit: R_X86_64_PC32 against symbol `ddd' defined in .bss section in /tmp/cchyTaL9.o
a.cc:(.text+0x1ca): relocation truncated to fit: R_X86_64_PC32 against symbol `ddd' defined in .bss section in /tmp/cchyTaL9.o
a.cc:(.text+0x1e6): relocation truncated to fit: R_X86_64_PC32 against symbol `ddd' defined in .bss section in /tmp/cchyTaL9.o
a.cc:(.text+0x200): relocation truncated to fit: R_X86_64_PC32 against symbol `ddd' defined in .bss section in /tmp/cchyTaL9.o
a.cc:(.text+0x250): relocation truncated to fit: R_X86_64_PC32 against symbol `ddd' defined in .bss section in /tmp/cchyTaL9.o
collect2: error: ld returned 1 exit status
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N;
int A[MAX_N + 1][MAX_N + 1];
int day[MAX_N + 1];

int main(void)
{
  cin >> N;
  REP(i, N) REP(j, N)
  {
    int x;
    cin >> x;
    // 0-indexed
    A[i][j] = x - 1;
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N - 1; j++) {
      // この選手と試合できる日を探す
      int t = A[i][j];
      int d = 0;
      for (int k = 0; k < N - 1; k++) {
        if (A[t][k] == i) {
          d = k + 1;
          break;
        }
      }
      if (d > day[i])
        day[i] = d;
      else {
        day[i] += 1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) ans = max(ans, day[i]);
  if (ans < N) {
    cout << -1 << endl;
  }
  else {
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
/tmp/ccby1U75.o: in function `main':
a.cc:(.text+0x1ae): relocation truncated to fit: R_X86_64_PC32 against symbol `day' defined in .bss section in /tmp/ccby1U75.o
a.cc:(.text+0x1ca): relocation truncated to fit: R_X86_64_PC32 against symbol `day' defined in .bss section in /tmp/ccby1U75.o
a.cc:(.text+0x1e6): relocation truncated to fit: R_X86_64_PC32 against symbol `day' defined in .bss section in /tmp/ccby1U75.o
a.cc:(.text+0x200): relocation truncated to fit: R_X86_64_PC32 against symbol `day' defined in .bss section in /tmp/ccby1U75.o
a.cc:(.text+0x250): relocation truncated to fit: R_X86_64_PC32 against symbol `day' defined in .bss section in /tmp/ccby1U75.o
collect2: error: ld returned 1 exit status
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N;
int A[MAX_N + 1][MAX_N + 1];
int a[MAX_N + 1];

int main(void)
{
  cin >> N;
  REP(i, N) REP(j, N)
  {
    int x;
    cin >> x;
    // 0-indexed
    A[i][j] = x - 1;
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N - 1; j++) {
      // この選手と試合できる日を探す
      int t = A[i][j];
      int d = 0;
      for (int k = 0; k < N - 1; k++) {
        if (A[t][k] == i) {
          d = k + 1;
          break;
        }
      }
      if (d > a[i])
        a[i] = d;
      else {
        a[i] += 1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) ans = max(ans, a[i]);
  if (ans < N) {
    cout << -1 << endl;
  }
  else {
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
/tmp/ccUHcrDE.o: in function `main':
a.cc:(.text+0x1ae): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccUHcrDE.o
a.cc:(.text+0x1ca): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccUHcrDE.o
a.cc:(.text+0x1e6): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccUHcrDE.o
a.cc:(.text+0x200): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccUHcrDE.o
a.cc:(.text+0x250): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccUHcrDE.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3+10;
int a[maxn][maxn];
bool vis[maxn];
int  now[maxn];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)now[i]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n-1;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	int day = 0;
    int round = 0;
    while(1)
    {   memset(vis,false,sizeof(vis));
        bool ok = false;
    	for(int j=1;j<=n;j++)
    	{   
    	if(now[j]>=n)continue;
		int b = a[j][now[j]]; 
    		else
    		{   ok = true;
    			now[j]++;
    			now[b]++;
    			vis[j]=true;
    			vis[b]=true;
    			round++;
    			if(round==n*(n-1)/2)return 0*printf("%d\n",day+1);
			}
		}
		if(!ok)return 0*printf("-1\n");
		day++;
	}
	return 0*printf("%d\n",day);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: 'else' without a previous 'if'
   28 |                 else
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
//#include "Local_Debug.h"
using namespace std;
#define Endl endl
#define debug(x) cout << #x << " = " << (x) << endl;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e3 + 5;
ll n, t, vis[MAXN];
int main()
{//189112
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> n)
	{
		vector<queue<ll>> v(n + 5);
		for (ll i = 1; i <= n; ++i)
			for (ll j = 1; j < n&&cin >> t; ++j)
				v[i].emplace(t);
		ll ans = 0;
		bool go = true;
		while (go)
		{
			go = false;
			for (ll i = 1; i <= n; ++i)
				vis[i] = 0;
			for (ll i = 1; i <= n; ++i)
				if (!v[i].empty() && !vis[i])
				{
					ll tmp = v[i].front();
					if (!v[tmp].empty() && !vis[tmp] && v[tmp].front() == i)
						v[i].pop(), v[tmp].pop(), vis[tmp] = vis[i] = 1, go = true;
				}
			ans++;
			ll sum = 0;
			for (ll i = 1; i <= n; ++i)
				sum += v[i].size();
			if (!sum)
				go = false;
			if (ans > 100000)
			{
				cout << 499500 << endl;
				return;
			}
		}
		bool flag = true;
		for (ll i = 1; i <= n&&flag; ++i)
			if (!v[i].empty())
				flag = false;
		cout << (flag ? ans : -1) << endl;
	}
}
/*
3
2 3
1 3
1 2

4
2 3 4
1 3 4
4 1 2
3 1 2

3
2 3
3 1
1 2
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:42:33: error: return-statement with no value, in function returning 'int' [-fpermissive]
   42 |                                 return;
      |                                 ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;



int main(){
    LL n;cin >> n;
    vector<vector<int>> a(n,vector<int> (n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n-1; j++) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    vector<int> c(n,0);
    vector<int> x(n,0);
    auto q = clock();
    for (int i = 1; i <= n*(n-1)/2+1; i++) {
        if((clock()-q >= 190000){
            cout << n*(n-1)/2 << endl;
            return 0;
        }
        bool f = false;
        bool t = false;
        for (int j = 0; j < n; j++) {
            if(c[j]==n-1) continue;
            t=true;
            int en = a[j][c[j]];
            if(x[j]==i||x[en]==i) continue;
            if(c[en]==n-1) continue;
            if(j==a[en][c[en]]){
                c[j]++;
                c[en]++;
                x[j]=i;
                x[en]=i;
                f = true;
            }
        }
        if(!t){
            cout << i-1 << endl;
            return 0;
        }
        if(!f){
            puts("-1");
            return 0;
        }
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:33: error: expected ';' before '{' token
   31 |         if((clock()-q >= 190000){
      |                                 ^
      |                                 ;
a.cc:35:23: error: expected ')' before ';' token
   35 |         bool f = false;
      |                       ^
      |                       )
a.cc:31:11: note: to match this '('
   31 |         if((clock()-q >= 190000){
      |           ^
a.cc:48:17: error: 'f' was not declared in this scope
   48 |                 f = true;
      |                 ^
a.cc:55:13: error: 'f' was not declared in this scope
   55 |         if(!f){
      |             ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#define fr(i,a,b) for(register int i=a;i<=b;i++)
#define int long long
#define N 1010
using namespace std;

int a[N][N],now[N]
bool vis[N];

inline int read(){
	int x = 0,f = 1;char c = getchar();
	while(!isdigit(c)){if(c == '-')f = -1;c = getchar();}
	while(isdigit(c)){x = x * 10 + c - '0';c = getchar();}
	return f * x;
}

signed main(){
	int n;
	n = read();
	fr(i,1,n)
		fr(j,1,n - 1)
			a[i][j] = read();
	fr(i,1,n)now[i] = 1;
	int ans = 0;
  	bool flag = 1;
	while(++ans){
		bool f = 1;flag = 0;
		memset(vis,false,sizeof(vis));
		fr(j,1,n){
			int p = a[j][now[j]];
			if(a[p][now[p]] == j && !vis[p] && !vis[j])flag = 1,now[j]++,now[p]++,vis[j] = 1,vis[p] = 1;
		}
		fr(j,1,n)if(now[j] != n){f = 0;break;}
		if(f)break;
		if(!flag || ans > n * (n - 1) / 2){cout<<"-1";return 0;}
	}
	cout<<ans;
	return 0;
}


Compiler output:
a.cc:11:1: error: expected initializer before 'bool'
   11 | bool vis[N];
      | ^~~~
a.cc: In function 'int main()':
a.cc:23:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   23 |         fr(i,1,n)
      |            ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:24:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |                 fr(j,1,n - 1)
      |                    ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:26:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   26 |         fr(i,1,n)now[i] = 1;
      |            ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:26:18: error: 'now' was not declared in this scope
   26 |         fr(i,1,n)now[i] = 1;
      |                  ^~~
a.cc:31:24: error: 'vis' was not declared in this scope
   31 |                 memset(vis,false,sizeof(vis));
      |                        ^~~
a.cc:32:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |                 fr(j,1,n){
      |                    ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:33:38: error: 'now' was not declared in this scope
   33 |                         int p = a[j][now[j]];
      |                                      ^~~
a.cc:36:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   36 |                 fr(j,1,n)if(now[j] != n){f = 0;break;}
      |                    ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:36:29: error: 'now' was not declared in this scope
   36 |                 fr(j,1,n)if(now[j] != n){f = 0;break;}
      |                             ^~~
Language: C++

#include <bits/stdc++.h>
 
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, a, n) for(int i = a; i < n; i++)
#define PI 3.141592653589793238
#define bc __builtin_popcountll
#define pf push_front
#define pb push_back
#define rf pop_front
#define rb pop_back
#define fs first
#define sc second
#define mp make_pair
#define fi ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
const ll M = 1e9 + 7;
const ll INF = 1e9;
inline ll pwr(ll base, ll n, ll m) {ll ans = 1;while( n > 0 ) {if ( n & 1 ) ans = (ans * base) % m; base = (base * base) % m; n>>=1;}return ans;}
 
const int N = 1010;
int n, a[N][N], b[N], c[N];
 
int main() {
    // fi;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL)
    // #ifndef ONLINE_JUDGE
    // freopen( "input.txt", "r", stdin );
    // freopen( "output.txt", "w", stdout );
    // #endif
 
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
 
    cin >> n;
 
    loop(i, n) {
        loop(j, n-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
 
    int day = 0, matches = 0, req = (n*(n-1))/2;
    
    while(true) {
        day++;
        int f = 0;
 
        loop(i, n) {
            if( b[i] == n-1 || c[i] == day) continue;
            
            int choice1 = a[i][b[i]];
            int choice2 = a[choice1][b[choice1]];
 
            if( choice2 == i && c[choice1] != day) {
                f = -1;
                c[choice1] = day;
                c[i] = day;
                b[choice1]++;
                b[i]++;
                // cout << i+1 << " " << choice1 + 1 << ":: ";
                matches++;
            }
        }
        // cout << "\n";
        if( matches == req ) break;
        if( f == 0 ) {
            cout << -1;
            return 0;
        }
    }
 
    cout << day;
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: expected ';' before 'memset'
   29 |     cin.tie(NULL)
      |                  ^
      |                  ;
......
   35 |     memset(b, 0, sizeof(b));
      |     ~~~~~~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define maxn 1000010
using namespace std ;
struct dy {
	int y , next ;
}A[maxn];
int n , num , cnt , tot, ans ;
int head[maxn] , a[1010][1010] , vis[1010][1010] ;
int in[maxn] , t[maxn] , day[maxn] ;
void add(int u,int v) {
	A[++cnt].y = v ;
	A[cnt].next = head[u] ;
	head[u] = cnt ;
	return ;
}
void topsort() {
	for(int i = 1 ; i <= tot ; i ++) {
		int u = t[i] ;
		for(int j = head[u] ; j ; j = A[j].next) {
			int v = A[j].y ;
			day[v] = day[u] + 1 ;
			in[v] -- ;
			if(!in[v])
				t[++tot] = v ;
		}
	}
	for(int i = 1 ; i <= num ; i ++)
		 ans=max(ans,day[i]);
	return;
}
int main() {
	scanf("%d",&n);
	for(int i = 1 ; i <= n ; i ++) {
		for(int j = 1 ; j < n ; j ++) {
			scanf("%d",&a[i][j]) ;
			if(!vis[i][j]&&!vis[j][i]) 
				vis[i][j] = vis[j][i] = ++num ;
		}
	}
	for(int i = 1 ; i <= n ; i ++) {
		for(int j = 2 ; j < n ; j ++) {
			add(vis[i][a[i][j-1]],vis[i][a[i][j]]);
			in[vis[i][a[i][j]]] ++ ;
		}
	}
	for(int i = 1 ; i <= num ; i ++)
	  if(!in[i]) {
	  	t[++tot] = i ;
	  	day[i] = 1 ;
	  }
	topsort() ;
	if(tot != num) puts("-1");
	else printf("%d\n",ans);
	return 0;
}

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

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

int main(){
	int n;
	cin >> n;
	vector<vector<int> > v(n, vector<int>(n - 1));
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n - 1; j++){
			cin >> v[i][j];
		}
	}
	for(int i = 0; i < n - 1; i++){
		map<int, int> check;
		check.clear;
		for(int j = 0; j < n; j++){
			if(!check.count(v[i][j])){
				check[v[i][j]] = 1;
			}
			else{
				cout << "-1" << endl;
				return 0;
			}
		}
	}
	vector<vector<int> > dp(n, vector<int>(n, 0));
	int ans = 0;
	for(int i = 0; i < n; i++){
		int has_played = 1;
		for(int j = 0; j < n - 1; j++){
			if(dp[i][j] == 0){
				dp[i][j] = has_played++;
			}
			ans = max(ans, has_played);
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: invalid use of non-static member function 'void std::map<_Key, _Tp, _Compare, _Alloc>::clear() [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]'
   15 |                 check.clear;
      |                 ~~~~~~^~~~~
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:1182:7: note: declared here
 1182 |       clear() _GLIBCXX_NOEXCEPT
      |       ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
DWORD st = timeGetTime();
  int n;
  cin>>n;
  vector<vector<int>> a(n,vector<int>(n-1,0));
  for(int i=0;i<n;i++){
    for(int j=n-2;j>=0;j--){
      int z;
      cin>>z;
      a[i][j]=z-1;
    }
  }
  int c=0;
  while(true){
   DWORD ed = timeGetTime();
    if((double)(ed-st)>1900){
      cout<<n*(n-1)/2;
      return 0;
    }
    vector<bool> b(n,false);
    bool f=false,ff=false;
    for(int i=0;i<n;i++){
      if(!a[i].empty())f=true;
      if(!a[i].empty()&&!b[i]){
        if(!a[a[i].back()].empty()&&a[a[i].back()].back()==i&&!b[a[i].back()]){
          b[i]=b[a[i].back()]=true;
          a[a[i].back()].pop_back();
          a[i].pop_back();
          ff=true;
        }
      }
    }
    if(!f){
      cout<<c;
      return 0;
    }
    if(!ff){
      cout<<-1;
      return 0;
    }
    c++;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: 'DWORD' was not declared in this scope
    7 | DWORD st = timeGetTime();
      | ^~~~~
a.cc:20:9: error: expected ';' before 'ed'
   20 |    DWORD ed = timeGetTime();
      |         ^~~
      |         ;
a.cc:21:17: error: 'ed' was not declared in this scope
   21 |     if((double)(ed-st)>1900){
      |                 ^~
a.cc:21:20: error: 'st' was not declared in this scope; did you mean 'std'?
   21 |     if((double)(ed-st)>1900){
      |                    ^~
      |                    std
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#define fr(i,a,b) for(register int i=a;i<=b;i++)
#define N 1010
using namespace std;

int a[N][N],now[N]
bool vis[N];

inline int read(){
	int x = 0,f = 1;char c = getchar();
	while(!isdigit(c)){if(c == '-')f = -1;c = getchar();}
	while(isdigit(c)){x = x * 10 + c - '0';c = getchar();}
	return f * x;
}

int main(){
	int n;
	n = read();
	fr(i,1,n)
		fr(j,1,n - 1)
			a[i][j] = read();
	fr(i,1,n)now[i] = 1;
	int ans = 0;
  	bool flag = 1;
	while(++ans){
		bool f = 1;flag = 0;
		memset(vis,false,sizeof(vis));
		fr(j,1,n){
			int p = a[j][now[j]];
			if(a[p][now[p]] == j && !vis[p] && !vis[j])flag = 1,now[j]++,now[p]++,vis[j] = 1,vis[p] = 1;
		}
		fr(j,1,n)if(now[j] != n){f = 0;break;}
		if(f)break;
		if(!flag || ans > n * (n - 1) / 2){cout<<"-1";return 0;}
	}
	cout<<ans;
	return 0;
}


Compiler output:
a.cc:10:1: error: expected initializer before 'bool'
   10 | bool vis[N];
      | ^~~~
a.cc: In function 'int main()':
a.cc:22:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |         fr(i,1,n)
      |            ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:23:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   23 |                 fr(j,1,n - 1)
      |                    ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:25:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 |         fr(i,1,n)now[i] = 1;
      |            ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:25:18: error: 'now' was not declared in this scope
   25 |         fr(i,1,n)now[i] = 1;
      |                  ^~~
a.cc:30:24: error: 'vis' was not declared in this scope
   30 |                 memset(vis,false,sizeof(vis));
      |                        ^~~
a.cc:31:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   31 |                 fr(j,1,n){
      |                    ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:32:38: error: 'now' was not declared in this scope
   32 |                         int p = a[j][now[j]];
      |                                      ^~~
a.cc:35:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   35 |                 fr(j,1,n)if(now[j] != n){f = 0;break;}
      |                    ^
a.cc:5:36: note: in definition of macro 'fr'
    5 | #define fr(i,a,b) for(register int i=a;i<=b;i++)
      |                                    ^
a.cc:35:29: error: 'now' was not declared in this scope
   35 |                 fr(j,1,n)if(now[j] != n){f = 0;break;}
      |                             ^~~
Language: C

#include <stdio.h>

int main(){
  int n,i,j,k,a,b=1,c,d;
  int v[1000][999][4];
  scanf("%d",n);
  for(i=0;i<n;i++){
    for(j=0;j<n-1;j++){
    	scanf("%d",&a);
    	v[i][j][0]=a;
    	if(a<i){
          k=0;
          while(1){
            if(v[a][k][0]==i){
              v[a][k][1]=j;
              v[i][j][1]=k;
              break;
            }
        }
    }
  }
  while(b==1){
    b=0;
  	for(i=0;i<n;i++){
  	  for(j=0;j<n-1;j++){
        if(j!=0){
          a=v[i][j-1][2];
          if(a==0){
          	continue;
          }
        }else{
          a=0;
        }
        if(v[i][j][2]!=0){
          continue;
        }
   	   	c=v[i][j][0];
        d=v[i][j][1];
        if((d==0)|(v[c][d-1][2]!=0)){
          if(a<v[c][d-1][2]){
            a=v[c][d-1][2];
          }
          a++;
          v[c][d][2]=a;
          v[i][j][2]=a;
          b=1;
        }
  	  }
    }
  }
  b=0;
  for(i=0;i<n;i++){
    a=v[i][n-1][2];
    if(a==0){
      b=-1;
      break;
    }
    if(a>b){
      b=a;
    }
  }
  printf("%d");
  return(0);
}

Compiler output:
main.c: In function 'main':
main.c:64:1: error: expected declaration or statement at end of input
   64 | }
      | ^
Language: C++

#include <cstdio>
int main(){
  int n;
  scanf("%d", &n);
   int h[n][n-1];
for(int i = 0; i<n ; i++){
for(int j = 0; j<n ; j++){
  scanf("%d", &h[i][j]);
}}
  int d = 0;
  int count[n];
  int day = 0;
  int m,cc;
while(d == 0 || m <= (n * (n-1))/2){
  day++;
  d = 1;
for(j = 0; j<n ; j++){
  cc = h[j][count[j]];
  if((cc > j) && (j == h[cc][count[cc]])){count[j]++;
    count[cc]++;
    m++;
    d=0;
  }
}
}  
  if(d == 1) {printf("%d\n", -1);} else{ printf("%d\n", day)}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'j' was not declared in this scope
   17 | for(j = 0; j<n ; j++){
      |     ^
a.cc:26:61: error: expected ';' before '}' token
   26 |   if(d == 1) {printf("%d\n", -1);} else{ printf("%d\n", day)}
      |                                                             ^
      |                                                             ;
Language: C++

#include <cstdio>
int main(){
  int n;
  scanf("%d", &n);
   int h[n][n-1];
for(int i = 0; i<n ; i++){
for(int j = 0; j<n ; j++){
  scanf("%d", &h[i][j]);
}}
  int d = 0;
  int count[n];
  int day = 0;
  int m,cc;
while(d == 0 || m <= (n * (n-1))/2){
  day++
  d = 1;
for(j = 0; j<n ; j++){
  cc = h[j][count[j]];
  if((cc > j) && (j == h[cc][count[cc]])){count[j]++;
    count[cc]++;
    m++;
    d=0;
  }
}
}  
  if(d == 1) {printf("%d\n", -1);} else{ printf("%d\n", day)}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: expected ';' before 'd'
   15 |   day++
      |        ^
      |        ;
   16 |   d = 1;
      |   ~     
a.cc:17:5: error: 'j' was not declared in this scope
   17 | for(j = 0; j<n ; j++){
      |     ^
a.cc:26:61: error: expected ';' before '}' token
   26 |   if(d == 1) {printf("%d\n", -1);} else{ printf("%d\n", day)}
      |                                                             ^
      |                                                             ;
Language: C++

#include <iostream>
#include <vector>
#include <set>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
  int n;
  std::cin >> n;

  int l, a[n][n];
  REP(j, n){
    int i = 0;
    while (std::cin >> l) {
      a[j][i] = l;
      i++;
      if (i >= n - 1) {
        break;
      }
    }
  }

  int ans = 0, match = 0, nmatch = n*(n-1) /2;
  int ai[n];
  REP(i, n){ai[i] = 0;}
  while (match < nmatch){
    ans++;
    vector<set<int>> pair;
    REP(i,n){
      if (a[a[i][ai[i]] - 1][ai[a[i][ai[i]] - 1]] == i + 1 && find(pair.begin(), pair.end(), set<int>({i+1, a[i][ai[i]]})) == pair.end())
      {
        pair.push_back(set<int>({i+1, a[i][ai[i]]}));
        match++;
      }
      REP(i, pair.size()){
        for(auto itr = pair[i].begin(); itr != pair[i].end(); ++itr) {
          ai[*itr - 1]++;
        }
      }
      if (pair.size() == 0){
        std::cout << "-1" << std::endl;
        return 0;
      }
    }
  }
  REP(i,n){
    cout << ai[i] << endl;
    REP(j, n){
      std::cout << a[i][j] << std::endl;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:67: error: no matching function for call to 'find(std::vector<std::set<int> >::iterator, std::vector<std::set<int> >::iterator, std::set<int>)'
   35 |       if (a[a[i][ai[i]] - 1][ai[a[i][ai[i]] - 1]] == i + 1 && find(pair.begin(), pair.end(), set<int>({i+1, a[i][ai[i]]})) == pair.end())
      |                                                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:35:67: note:   '__gnu_cxx::__normal_iterator<std::set<int>*, std::vector<std::set<int> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   35 |       if (a[a[i][ai[i]] - 1][ai[a[i][ai[i]] - 1]] == i + 1 && find(pair.begin(), pair.end(), set<int>({i+1, a[i][ai[i]]})) == pair.end())
      |                                                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <algorithm>
#include <bitset>
//#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
// namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
// using ll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for (ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
  if (n == 0)
    return abs(m);
  return (gcd(n, m % n));
}
void putYN(bool b) {
  if (b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
void swap(ll &a, ll &b) {
  ll tmp = a;
  a = b;
  b = tmp;
}
ll combi(ll n, ll k) {
  ll r = 1, rr = 1;
  for (ll i = 0; i < k; ++i) {
    r *= (n - i);
    rr *= (i + 1);
    // r %= 1000000007;
    // rr %= 1000000007;
  }
  r /= rr;
  // r %= 1000000007;
  return r;
}
int main() {
  ll N;
  cin >> N;
  vector<vector<ll>> A(N, vector<ll>(N - 1));
  vector<vector<ll>> B(N, vector<ll>(N));
  FOR(i, N) {
    FOR(j, N - 1) {
      cin >> A[i][j];
      A[i][j]--;
      B[i][A[i][j]]=j;
      //iが何番目に入っているかを調べる
    }
  }
  vector<vector<ll>> D(N, vector<ll>(N - 1,-1));
  //最短日数

  function<ll(ll,ll,ll)> f =[&](ll i,ll n,ll ii)->ll{//iがi番目の選手 nが見る番号
      if(ii>N*(N+1))return -2;
      if(n==-1)return 0;
      if(D[i][n]!=-1)return D[i][n];
      ll a = A[i][n];//もう一つの選手
      ll an = B[a][i];
      ll day1 = f(i,n-1,ii+1)+1;
      ll day2 = f(a,an-1,ii+1)+1;
      if(day1==-1||day2==-1)day= -2;
      if(day1<day2)day1=day2;
      D[i][n]=day1;
      D[a][an]=day1;
      return day1;
  };
  ll maxd=0;
  FOR(i,N){
      ll day=f(i,N-2,0);
      if(day>maxd){
          maxd=day;
      }
      if(day==-2){
          cout<<-1<<endl;
          return 0;
      }
  }
  cout<<maxd<<endl;
  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:82:29: error: 'day' was not declared in this scope; did you mean 'day2'?
   82 |       if(day1==-1||day2==-1)day= -2;
      |                             ^~~
      |                             day2
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

typedef int ll;

ll mix_player_id(ll l, ll r) {
	if (l > r) {
		swap(l, r);
	}
	return l * 1000 + r;
}

int main (int argc, char* argv[]) {
	ll n;
	cin >> n;
	vector<queue<ll>> players(n);
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < n - 1; j++) {
			ll opp;
			cin >> opp;
			opp--;
			players[i].push(mix_player_id(i, opp));
		}
	}

	vector<ll> found(2000000, -1);

	int days = 0;
	vector<ll> update;
	vector<ll> next_update;
	for (ll i = 0; i < players.size(); i++) {
		update.push_bacl(i);
	}
	while (true) {
		bool is_finished = true;
		bool progressed = false;
		vector<bool> fought(1000);
		for (ll i : update) {
			if (fought[i]) continue;
			auto& q = players[i];
			if (q.empty()) continue;

			auto current_idx = q.front();
			is_finished = false;
			if (found[current_idx] >= 0 && found[current_idx] != i) {
				players[found[current_idx]].pop();
				q.pop();
				progressed = true;
				fought[i] = true;
				fought[found[current_idx]] = true;
				next_update.push_back(i);
				next_update.push_back(found[current_idx]);
				found.at(current_idx) = -1;
			} else {
				found.at(current_idx) = i;
			}
		}
		if (is_finished) {
			break;
		}
		if (!progressed) {
			cout << -1 << endl;
			return 0;
		}
		days++;
		swap(update, next_update); 
	}
	cout << days << endl;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:42:24: error: 'class std::vector<int>' has no member named 'push_bacl'; did you mean 'push_back'?
   42 |                 update.push_bacl(i);
      |                        ^~~~~~~~~
      |                        push_back
Language: C++

#include <iostream>
#include <string>
typedef long long ll;

int main() {
  int n,i,j,tmp,ans=0,total,k=0,ln,rn,odd=0;
  int a[1000][1000],l[1000],r[1000];
  bool b[1000];
  bool check=true;
  std::cin >> n;
  total=n*(n-1)/2;
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n-1; ++j) {
      std::cin >> tmp;
      a[i][tmp-1]=j;
    }
  }

  for (i = 0; i < n; ++i) {
    for (j = i+1; j < n; ++j) {
      l[0][k]=i;r[0][k]=j;
      ++k;
    }
  }
/*
  for (j = i+1; j < n; ++j) {
    if (a[i][j]==ans&&a[j][i]==ans){
      check=true;
      a[i][j]=-1000000;
      a[j][i]=-1000000;
      --total;
      b[i]=0;b[j]=0;
    }
    }
*/
  while (check&&total!=0){
    check=false;
    tmp=total;
    k=0;
    for (i=0;i<n;++i)b[i]=1;
    for (i = 0; i < k; ++i) {
      ln=l[odd][i];rn=r[odd][i];
      if (a[ln][rn]==ans&&a[rn][ln]==ans){
        check=true;
        a[ln][rn]=-1000000;
        a[rn][ln]=-1000000;
        --total;
        b[ln]=0;b[rn]=0;
      }else{
        l[(odd+1)%2][k]=ln;r[(odd+1)%2][k]=rn;
        ++k;
      }

    }
    for (i = 0; i < n; ++i) {
      if (b[i]){
        for (j = 0; j < n; ++j){
          ++a[i][j];
        }
      }
    }
    odd=(odd+1)%2;
    ++ans;
  }
  if (total==0){
    std::cout << ans << '\n';
  }else{
    std::cout << -1 << '\n';
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: invalid types 'int[int]' for array subscript
   21 |       l[0][k]=i;r[0][k]=j;
      |           ^
a.cc:21:21: error: invalid types 'int[int]' for array subscript
   21 |       l[0][k]=i;r[0][k]=j;
      |                     ^
a.cc:42:16: error: invalid types 'int[int]' for array subscript
   42 |       ln=l[odd][i];rn=r[odd][i];
      |                ^
a.cc:42:29: error: invalid types 'int[int]' for array subscript
   42 |       ln=l[odd][i];rn=r[odd][i];
      |                             ^
a.cc:50:21: error: invalid types 'int[int]' for array subscript
   50 |         l[(odd+1)%2][k]=ln;r[(odd+1)%2][k]=rn;
      |                     ^
a.cc:50:40: error: invalid types 'int[int]' for array subscript
   50 |         l[(odd+1)%2][k]=ln;r[(odd+1)%2][k]=rn;
      |                                        ^
Language: C++

#include <iostream>
#include <vector>
#include <set>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
  int n;
  std::cin >> n;

  int l, a[n][n];
  REP(j, n){
    int i = 0;
    while (std::cin >> l) {
      a[j][i] = l;
      i++;
      if (i >= n - 1) {
        break;
      }
    }
  }

  int ans = 0, match = 0, nmatch = n*(n-1) /2;
  int ai[n];
  REP(i, n){ai[i] = 0;}
  while (match < nmatch){
    ans++;
    vector<set<int>> pair;
    REP(i,n){
      if (a[a[i][ai[i]] - 1][ai[a[i][ai[i]] - 1]] == i + 1 && find(pair.begin(), pair.end(), set<int>({i+1, a[i][ai[i]]})) == pair.end())
      {
        pair.push_back(set<int>({i+1, a[i][ai[i]]}));
        match++;
      }
      REP(i, pair.size()){
        for(auto itr = pair[i].begin(); itr != pair[i].end(); ++itr) {
          ai[*itr - 1]++;
        }
      }
      if (pair.size() == 0){
        std::cout << "-1" << std::endl;
        return 0;
      }
    }
  }
  REP(i,n){
    cout << ai[i] << endl;
    REP(j, n){
      std::cout << a[i][j] << std::endl;
    }
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:67: error: no matching function for call to 'find(std::vector<std::set<int> >::iterator, std::vector<std::set<int> >::iterator, std::set<int>)'
   35 |       if (a[a[i][ai[i]] - 1][ai[a[i][ai[i]] - 1]] == i + 1 && find(pair.begin(), pair.end(), set<int>({i+1, a[i][ai[i]]})) == pair.end())
      |                                                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:35:67: note:   '__gnu_cxx::__normal_iterator<std::set<int>*, std::vector<std::set<int> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   35 |       if (a[a[i][ai[i]] - 1][ai[a[i][ai[i]] - 1]] == i + 1 && find(pair.begin(), pair.end(), set<int>({i+1, a[i][ai[i]]})) == pair.end())
      |                                                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
int d,n; 
bool f[1005];
int a[1005][1005];
inline bool check() {
	for(int i=1;i<=n;++i) if(a[i][0]!=n) return false;
	return true;
}
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
int main() {
	cin>>n;
	for(int i=1;i<=n;++i) 
		for(int j=1;j<n;++j) a[i][j]=read();
	for(int i=1;i<=n;i++) a[i][0]=1;
	while(1) {
        if (tf>=n&&check()) {printf("%d\n",d);return 0;}
        memset(f, false, sizeof(f));
        d++;
        bool tf=false;
        for(int i=1;i<=n;++i) {
            if(f[i]||a[i][0]==n) continue;
            int x=a[i][a[i][0]];
            int y=a[x][a[x][0]];
            if(!f[i]&&!f[x]&&y==i) {
                tf=true;
                a[i][0]++;
                a[x][0]++;
                f[i]=true;
                f[x]=true;
            }
        }
        if(!tf) {
            cout<<"-1"<<endl;
            return 0;
        }
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: 'tf' was not declared in this scope; did you mean 'tm'?
   24 |         if (tf>=n&&check()) {printf("%d\n",d);return 0;}
      |             ^~
      |             tm
Language: C++

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

int main() {
    int n;
    cin >> n;
    int A[n][n - 1];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n - 1; j++) {
            cin >> A[i][j];
        }
    }

    int cnt[n] = {0};
    int ans = 0;

    while (true) {
        bool is_playable = false;
        bool is_finished = true;
        ans++;
        for (int i = 0; i < n; i++) {
            if (cnt[n] == n) continue;
            int oppo = A[i][cnt[i]];
            if (A[A[oppo][cnt[oppo]]] == i) {
                cnt[i]++;
                cnt[oppo]++;
                is_playable = true;
            }
        }

        if (is_playable == false) {
            cout << -1 << endl;
            return 0;
        }

        for (int i = 0; i < n; i++) {
            if (cnt[i] != n - 1) {
                is_finished = false;
            }
        }
        if (is_finished == true) {
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |             if (A[A[oppo][cnt[oppo]]] == i) {
      |                 ~~~~~~~~~~~~~~~~~~~~~~^~~~