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

#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

int run(int N, std::vector<std::queue<int>> opponents)
{
	int day = 0;
	std::size_t rest = N * (N - 1) / 2;
	std::set<int> set;
	for (auto i : boost::irange(0, N))
	{
		auto op = opponents[i].front();
		if (opponents[op].front() == i)
		{
			set.emplace(std::min(i, op));
		}
	}
	for (; rest != 0; ++day)
	{
		if (set.size() == 0)
		{
			return -1;
		}
		rest -= set.size();
		std::set<int> next;
		for (auto i : set)
		{
			auto op = opponents[i].front();
			opponents[i].pop();
			opponents[op].pop();
			for (auto j : { i,op })
			{
				if (opponents[j].size() != 0)
				{
					auto op2 = opponents[j].front();
					if (opponents[op2].front() == j)
					{
						next.emplace(std::min(j, op2));
					}
				}
			}
		}
		std::swap(set, next);
	}
	return day;
}

void Main()
{
	try
	{
		int N;
		std::cin >> N;
		std::vector<std::queue<int>> opponents(N);
		for (auto& queue : opponents)
		{
			for (auto i : boost::irange(0, N - 1))
			{
				int a;
				std::cin >> a;
				--a;
				queue.emplace(a);
			}
		}
		std::cout << run(N, std::move(opponents)) << std::endl;
	}
	catch (std::exception& exp)
	{
		lib::print::message(exp.what());
	}
}

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

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

#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std; 
int n;
int a[1007][1007],t[1007],p[1007];
queue<int>q[2];
int main(){
	cin>>n;
	for(int i=1;i<=n;++i)
        for(int j=1;j<n;++j)
            cin>>a[i][j];
	for(int i=1;i<=n;++i)
        q[0].push(i);
	int now=1;
	for(int day=1,tot=n*(n-1)/2;day<=n*(n-1)/2;++day){
		now^=1;
		while(!q[now].empty()){
			int x=q[now].front();
            q[now].pop();
			int y=a[x][++t[x]];
			if(p[y]==x){
				tot--;
				q[1-nex].push(x);
				q[1-nex].push(y);
				p[x]=p[y]=0;
			}
			else 
                p[x]=y;
		}
		if(!tot){
			cout<<day<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:23:37: error: 'nex' was not declared in this scope
   23 |                                 q[1-nex].push(x);
      |                                     ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

ll solve(const std::vector<std::vector<int>> &links, std::vector<int> &indeg) {
  std::vector<int> sorted;
  std::stack<int> st;
  std::vector<long long> depth(links.size(), 1);
  for(int i = 0; i < indeg.size(); ++i) if(indeg[i] == 0) st.push(i);

  while(!st.empty()) {
    int v = st.top();
    st.pop();
    sorted.push_back(v);
    for(int u : links[v]) {
      depth[u] = max(depth[u], depth[v] + 1);
      indeg[u]--;
      if(indeg[u] == 0) st.push(u);
    }
  }
  ll max_depth = 0;
  for(ll d : depth) max_depth = max(max_depth, d);
  return links.size() == sorted.size() ? max_depth : -1;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VVI links(n*n+n+1);
  VI indeg(n*n+n+1, 0);
  rep(i, n) {
    VI a(n-1);
    rep(j, n-1) {
      cin >> a[j];
      a[j]--;
    }
    rep(j, n-2) {
      int from_small = min(i, a[j]);
      int from_big = max(i, a[j]);
      int to_small = min(i, a[j+1]);
      int to_big = max(i, a[j+1]);
      indeg[to_big * n + to_small]++;
      links[from_big * n + from_small].push_back(to_big * n + to_small);
    }
  }
  ll ans = solve(links);
  out(hasCycle(links, indeg));

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:76:17: error: too few arguments to function 'll solve(const std::vector<std::vector<int> >&, std::vector<int>&)'
   76 |   ll ans = solve(links);
      |            ~~~~~^~~~~~~
a.cc:32:4: note: declared here
   32 | ll solve(const std::vector<std::vector<int>> &links, std::vector<int> &indeg) {
      |    ^~~~~
a.cc:77:7: error: 'hasCycle' was not declared in this scope
   77 |   out(hasCycle(links, indeg));
      |       ^~~~~~~~
a.cc:16:24: note: in definition of macro 'out'
   16 | #define out(x) cout << x << endl
      |                        ^
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <string.h>
#include <utility>
#include <vector>
#include <deque>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i > 0; i--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t int64;

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

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using namespace std;


class E {
	static const int MAX_N = 1001;
	static const int MAX_V = MAX_N * (MAX_N - 1) / 2;
	static int id[MAX_N][MAX_N];
	int n;
	vector<vector<int>> a;
	vector<int> G[MAX_V];
	int visited[MAX_V];
	int distance[MAX_V];

	static inline int getID(int i, int j) { return (i > j) ? id[j][i] : id[i][j]; }

	int dfs(int v)
	{
		if (visited[v])
			return (visited[v] == 1) ? -1: distance[v];
		visited[v]++;

		for (int u : G[v])
		{
			int depth = dfs(u);
			if (depth == -1)
				return -1;
			distance[v] = max(distance[v], depth + 1);
		}

		visited[v]++;
		return distance[v];
	}

public:
	E()
	{
		memset(visited, 0, sizeof visited);
		memset(distance, 0, sizeof distance);

		cin >> n;
		a.resize(n, vector<int>(n - 1));

		REP(i, n)
		{
			REP(j, n - 1)
			{
				cin >> a[i][j];
				--a[i][j];
			}
		}

		int v{ 0 };
		REP(i, n)
			REP(j, n)
		{
			if (i < j)
				id[i][j] = v++;
		}

		REP(i, n)
		{
			REP(j, n - 1)
				a[i][j] = getID(i, a[i][j]);

			REP(j, n - 2)
				G[a[i][j]].PB(a[i][j + 1]);
		}
	}

	void solve()
	{
		int ans = 0;
		REP(i, n)
		{
			int depth = dfs(i);
			if (depth == -1)
			{
				cout << "-1" << endl;
				return;
			}
			ans = max(ans, depth);
		}
		cout << ans << endl;
	}
};


int main()
{
	E solution;
	solution.solve();

	return 0;
}


Compiler output:
/usr/bin/ld: /tmp/cclBPEOm.o: warning: relocation against `_ZN1E2idE' in read-only section `.text._ZN1EC2Ev[_ZN1EC5Ev]'
/usr/bin/ld: /tmp/cclBPEOm.o: in function `E::getID(int, int)':
a.cc:(.text._ZN1E5getIDEii[_ZN1E5getIDEii]+0x32): undefined reference to `E::id'
/usr/bin/ld: a.cc:(.text._ZN1E5getIDEii[_ZN1E5getIDEii]+0x5b): undefined reference to `E::id'
/usr/bin/ld: /tmp/cclBPEOm.o: in function `E::E()':
a.cc:(.text._ZN1EC2Ev[_ZN1EC5Ev]+0x1ed): undefined reference to `E::id'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#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 ALL(v) v.begin(), v.end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

int node_search(set<int> &g, int a, int b)
{
  set<int> s{min(a,b),max(a,b)};
  int i=0;
  while(true){
    if(g[i] == s) return i;
    i++;
  }
  return -1;
}

int day = 0;
int pos = -1; 
vector<bool> seen, finished;
void dfs(const Graph &G, int v, int p, int d) {
  seen[v] = true;
  for (auto nv : G[v]) {
    if (nv == p) continue;
    if (finished[nv]) continue;
    if (seen[nv] && !finished[nv]) {
      pos = nv;
      return;
    }
    dfs(G, nv, v, d+1);
    if (pos != -1) return;
  }
  day = max(day,d);
  finished[v] = true;
}

int main()
{
  int n;
  scanf("%d",&n);
  int game = n*(n-1)/2;
  set<int> games[game];
  set<int> roots;
  Graph g(game);
  int cnt=0;
  REP(i,n){
    FOR(j,i+1,n){
      games[cnt].insert(i+1);
      games[cnt].insert(j+1);
      roots.insert(cnt);
      cnt++;
      if(cnt==n*(n-1)/2) break;
    }
    if(cnt==n*(n-1)/2) break;
  }
  
  int a[n][n-1];
  REP(i,n) REP(j,n-1) scanf("%d",&a[i][j]);
  REP(i,n) REP(j,n-2){
    int from = node_search(games,i+1,a[i][j]);
    int to = node_search(games,i+1,a[i][j+1]);
    g[from].push_back(to);
    roots.erase(to);
  }
  if(roots.size()==0){
    cout << "-1" << endl;
    return 0;
  }
  
  for(auto root: roots){
    seen.assign(game, false);
    finished.assign(game, false);
    dfs(g,root,-1,1);
    if(pos != -1){
      cout << "-1" << endl;
      return 0;
    }
  }
  cout << day << endl;
}


Compiler output:
a.cc: In function 'int node_search(std::set<int>&, int, int)':
a.cc:15:9: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int')
   15 |     if(g[i] == s) return i;
      |         ^
a.cc: In function 'int main()':
a.cc:63:28: error: invalid initialization of reference of type 'std::set<int>&' from expression of type 'std::set<int> [game]'
   63 |     int from = node_search(games,i+1,a[i][j]);
      |                            ^~~~~
a.cc:10:27: note: in passing argument 1 of 'int node_search(std::set<int>&, int, int)'
   10 | int node_search(set<int> &g, int a, int b)
      |                 ~~~~~~~~~~^
a.cc:64:26: error: invalid initialization of reference of type 'std::set<int>&' from expression of type 'std::set<int> [game]'
   64 |     int to = node_search(games,i+1,a[i][j+1]);
      |                          ^~~~~
a.cc:10:27: note: in passing argument 1 of 'int node_search(std::set<int>&, int, int)'
   10 | int node_search(set<int> &g, int a, int b)
      |                 ~~~~~~~~~~^
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int N; cin >> N;
  vvi A(N,vi(N-1)); 
  REP(i,N) {
    REP(j,N-1) {
      cin >> A[i][j];
      A[i][j]--;
    }
    reverse(ALL(A[i]));
  }

  vector<pii> q;

  auto check = [&](int i) {
    if (A[i].size() == 0) return;
    int j = A[i].back();
    if (A[j].size() == 0) return;
    if (A[j].back() == i) {
      pii p(i,j);
      if (p.SE < p.FI) swap(p.FI, p.SE);
      q.push_back(p);
    }
  }
  
  REP(i,N) {
    check[i];
  }

  int day = 0;
  while(q.size() > 0) {
    day++;
    SORT(q);
    q.erase(unique(ALL(q)),q.end());
    vector<pii> prevQ;
    swap(prevQ,q);
    for(pii p : prevQ) {
      int i = p.FI, j = p.SE;
      check[i];
      check[j];
    }
  }

  REP(i,N) {
    if (A[i].size() != 0) {
      puts("-1");
      return 0;
    }
  }
  cout << day << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:20: error: expected ',' or ';' before 'for'
    2 | #define FOR(i,a,b) for (int i = (a); i < (b); ++i)
      |                    ^~~
a.cc:4:18: note: in expansion of macro 'FOR'
    4 | #define REP(i,n) FOR(i,0,(n))
      |                  ^~~
a.cc:63:3: note: in expansion of macro 'REP'
   63 |   REP(i,N) {
      |   ^~~
a.cc:63:7: error: 'i' was not declared in this scope
   63 |   REP(i,N) {
      |       ^
a.cc:2:38: note: in definition of macro 'FOR'
    2 | #define FOR(i,a,b) for (int i = (a); i < (b); ++i)
      |                                      ^
a.cc:63:3: note: in expansion of macro 'REP'
   63 |   REP(i,N) {
      |   ^~~
a.cc:76:12: error: no match for 'operator[]' (operand types are 'main()::<lambda(int)>' and 'int')
   76 |       check[i];
      |            ^
a.cc:77:12: error: no match for 'operator[]' (operand types are 'main()::<lambda(int)>' and 'int')
   77 |       check[j];
      |            ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

int main() {
	int N;
	vector<vector<int>> A;
	cin >> N;

	A.resize(N+1, vector<int>(N-1));
	for (int &&i = 1; i <= N; ++i) {
		for (auto &x : A[i])
			cin >> x;
	}

	vector<int> day(N+1, 0);
	vector<int> next(N+1, 0);
	int cnt = 0, ans = 0;
	for (int &&i = 1;; ++i) {
		bool check = false;
		for (int &&j = 1; j <= N; ++j) {
			if (day[j] >= i) continue;
			if (next[j] == N-1) continue;
			int &&rival = A[j][next[j]];
			if (day[rival] >= i) continue;
			if (next[rival] == N-1) continue;
			if (A[rival][next[rival]] != j) continue;

			cnt++;
			day[j] = day[rival] = i;
			ans = i;
			++next[j];
			++next[rival];
			check = true;
		}
		if (check == false) break;
	}

	if (cnt == N*(N-1)/2)
		cout << ans << endl;
	else
		cout << -1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:51: error: cannot bind rvalue reference of type 'int&&' to lvalue of type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   32 |                         int &&rival = A[j][next[j]];
      |                                                   ^
Language: C++

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashSet;

public class Main {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] inputs = br.readLine().split(" ");
		int n = Integer.parseInt(inputs[0]);

		Deque<Integer>[] A = new Deque[n + 1];		 // A[i] → i選手の対戦順リスト
		HashSet<Integer> hasMatch = new HashSet<>(); // 全試合終了してないｐのリスト
		for ( int r = 1; r <= n; r++ ) {
			hasMatch.add(r);
			A[r] = new ArrayDeque<Integer>();
			inputs = br.readLine().split(" ");
			for ( int c = 0; c < n - 1; c++ ) {
				A[r].push(Integer.parseInt(inputs[c]));
			}
		}

		int match = n * (n - 1) / 2;
		int days = 0;

		HashSet<Integer> todayDone = new HashSet<>(); // その日の試合が成立して除外された選手をここに入れる
		HashSet<Integer> matchDone = new HashSet<>(); // 全試合終了したｐ
		do {
			days++;
			todayDone.clear();
			matchDone.clear();

			// p:player opp:opponent
			for ( int p = 1; p <= n; p++ ) {
				// for ( Integer p : hasMatch ) {
				if ( todayDone.contains(p) ) continue;
				Integer opp = A[p].peek();
				if ( opp == null ) {
					matchDone.add(p);
					continue;
				}

				if ( todayDone.contains(opp) ) continue;
				Integer opps_opp = A[opp].peek();
				if ( opps_opp == null ) {
					matchDone.add(opp);
					continue;
				}

				// 対戦可能相手の対戦可能相手がｐだったら試合成立
				if ( p == opps_opp ) {
					todayDone.add(A[p].pollFirst());
					todayDone.add(A[opp].pollFirst());
					match--;
				}
			}
			// hasMatch.removeAll(matchDone);

		} while ( todayDone.size() != 0 && match != 0 );

		int result = (match != 0 ? -1 : days);
		System.out.println(result);
		br.close();
	}
}


Compiler output:
a.cc:10:9: error: stray '@' in program
   10 |         @SuppressWarnings("unchecked")
      |         ^
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.BufferedReader;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.IOException;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.ArrayDeque;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Deque;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.HashSet;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
    8 | public class Main {
      | ^~~~~~
Language: C++

#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include <assert.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
#include<set>
#include <climits>
using namespace std;
typedef unsigned long long ull;
#define ll long long int
static const double PI = 3.141592653589793;
const ll INF = 100000000000000;
ll mod = 1000000007;
//typedef vector<int> V;
//typedef vector<V> VV;
//typedef vector<VV> VVV;



struct edge { ll from, to, cost; };
edge es[1000010];//max辺数

ll d[1000010];//max頂点数
ll V, E=0,flag=1,y=0;//頂点数,辺数

void shortest_path(ll s) {
	ll count = 0;
	for (ll i = 0; i < V + 10; i++) {
		d[i] = INF;
	}
	d[s] = 0;
	while (true) {
		//負の閉路があるとき中断
		if (count>V) {//Vかもしれない
			flag = 0;
			break;
		}
		bool update = false;
		for (ll i = 0; i < E; i++) {
			edge e = es[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				//cout << d[e.to] << " " << e.from<<" "<<e.to <<" "<<count<< endl;
				y = min(y, d[e.to]);
				update = true;
				count++;
			}
		}
		if (!update)break;
	}
}

ll m[1005][1005], a[1005][1005];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,s,t;
	cin >> n;
	ll ind = 1;
	for (int i = 1; i < n; i++) {
		for (int j = i + 1; j <= n; j++) {
			m[i][j] = ind;
			ind++;
		}
	}
	V = n * (n - 1) / 2;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < n; j++) {
			cin >>a[i][j];
			if (j == 1)s = m[min((ll)i, a[i][j])][max((ll)i, a[i][j])];
			else {
				t = m[min((ll)i, a[i][j])][max((ll)i, a[i][j])];
				es[E].from = s, es[E].to = t, es[E].cost = -1;
				//cout << "st " << s << " " << t << endl;
				E++;
				s = t;
			}
		}
	}


	for (int i = 1; i <= n; i++) {
		shortest_path(m[min(ll(i), a[i][1])][max(ll(i), a[i][1])]);
		if (!flag) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << 1-y << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: expected primary-expression before 'long'
   24 | #define ll long long int
      |            ^~~~
a.cc:97:37: note: in expansion of macro 'll'
   97 |                 shortest_path(m[min(ll(i), a[i][1])][max(ll(i), a[i][1])]);
      |                                     ^~
a.cc:24:12: error: expected primary-expression before 'long'
   24 | #define ll long long int
      |            ^~~~
a.cc:97:58: note: in expansion of macro 'll'
   97 |                 shortest_path(m[min(ll(i), a[i][1])][max(ll(i), a[i][1])]);
      |                                                          ^~
Language: C++

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

const int MAXN = 1005;
const int MAXV = MAXN*(MAXN-1)/2;
vector<int> to[MAXV];
int id[MAXN][MAXN];
int toId(int i, int j){
    if(i>j)swap(i,j);
    return id[i][j];
}
bool visited[MAXV];
bool calculated[MAXV];//ループ検出(計算途中か？)
int dp[MAXV];//max length of path from v
int dfs(int v){
    if(visited[v]){
        if(!calculated[v])return -1;
        return dp[v];
    }
    visited[v] = true;
    dp[v] = 0;
    for(int u : to[v]){
        int res = dfs(u);     
        if(res == -1)return -1;
        dp[v] = max[dp[v],dfs(u)+1]);
    }
    calculated[v] = true;
    return dp[v];
}

int main(){
    int n;
    cin >> n;
    vector<vector<int>> a(n,vector<int>(n-1));
    rep(i,n){
        rep(j,n-1){
            cin>>a[i][j];
            a[i][j]--;
        }
    }
    int V = 0;
    //各試合にidを振る
    rep(i,n)rep(j,n){
        if(i<j){
            id[i][j] = V++;
        }
    }
    rep(i,n){
        rep(j,n-1){
            a[i][j] = toId(i,a[i][j]);//idに書き換え
        }
        rep(j,n-2){
            to[a[i][j+1]].push_back(a[i][j]);//逆向きに辺を張る
        }
    }
    int ans = 0;
    //好きな頂点からdfs
    rep(i,n){
        int res = dfs(i);
        if(res == -1){
            puts("-1");
            return 0;
        }
        ans = max(ans,res);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:27:20: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   27 |         dp[v] = max[dp[v],dfs(u)+1]);
      |                    ^
Language: C++

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

using namespace std;

#define rip(i,n,s) (int i=(s);i<(int)(n);i++)
int n;

void dfs(vector<int> &day, vector<int> &co, vector<vector<int>> &da, int gg) {
	if (co[gg] == n - 1) {
		return;
	}
	int x = da[gg][co[gg]];
	if (co[x] == n - 1) {
		return;
	}
	if (da[x][co[x]] == gg) {
		co[x]++;
		co[gg]++;
		day[x] = max(day[x], day[gg]) + 1;
		day[gg] = day[x]
		dfs(day, co, da, gg);
		dfs(day, co, da, x);
	}
}

int main() {
	cin >> n;
	vector<vector<int>> da(n, vector<int>(n - 1));
	for rip(i, n, 0) {
		for rip(j, n - 1, 0) {
			cin >> da[i][j];
			da[i][j]--;
		}
	}
	vector<int> day(n, 0), co(n, 0);
	int ma = n * (n - 1) / 2;
	for rip(i, n, 0) {
		dfs(day, co, da, i);
	}
	for rip(i, n, 0) {
		if (co[i] != n - 1) {
			cout << -1 << endl;
			return 0;
		}
	}
	int ans = 0;
	for rip(i, n, 0) {
		ans = max(ans, day[i]);
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'void dfs(std::vector<int>&, std::vector<int>&, std::vector<std::vector<int> >&, int)':
a.cc:23:33: error: expected ';' before 'dfs'
   23 |                 day[gg] = day[x]
      |                                 ^
      |                                 ;
   24 |                 dfs(day, co, da, gg);
      |                 ~~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<utility>
#include<math.h>
#include<set>
#include<map>
#include<string.h>
#include<stack>
#define n 200000
#define loop(a, b) for(int i = a; i<=b; i++)
using namespace std;
typedef pair<int, int> P;
typedef long long lli;
typedef double llf;
struct edge{
	int from, to, weight;
	bool operator < (const edge& thing) const
	{
		return thing.weight < weight;
	}
};
bool cmp(int a, int b)
{
	return a > b;
}
vector<edge> V[n + 50];
bool visit[n + 50];
int arr[n + 50], a, b, c, d, e;
string str1, str2;
void addedge(int a, int b, int c)
{
	edge temp;
	temp.from = a;
	temp.to = b;
	temp.weight = c;
	V[a].push_back(temp);
}


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


void solve()
{
	cout << "-1";
}
int main()
{
	int times = 1;
//	cin << times;
	loop(times)
	{
		solve();
		printf("\n");
	}
	return 0;
}



Compiler output:
a.cc:55:19: error: macro "loop" requires 2 arguments, but only 1 given
   55 |         loop(times)
      |                   ^
a.cc:14:9: note: macro "loop" defined here
   14 | #define loop(a, b) for(int i = a; i<=b; i++)
      |         ^~~~
a.cc: In function 'int main()':
a.cc:55:9: error: 'loop' was not declared in this scope
   55 |         loop(times)
      |         ^~~~
Language: C++

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func do(m [][]int, ci []int, c int, preChanged []int) ([]int, int, []int, bool) {
	ci2 := make([]int, len(ci))
	copy(ci2, ci)
	checked := make([]bool, len(m))
	changed := make([]int, 0, len(m))
	flag := false
	j := len(m[0])
	for _, i := range preChanged {
		if checked[i] {
			continue
		}
		if ci[i] >= j {
			continue
		}
		n := m[i][ci[i]]
		if checked[n-1] {
			continue
		}
		if ci[n-1] >= j {
			flag = false
			break
		}
		if m[n-1][ci[n-1]] == i+1 {
			ci[i] = ci[i] + 1
			checked[i] = true
			ci[n-1] = ci[n-1] + 1
			checked[n-1] = true
			flag = true
			c++
			changed = append(changed, i)
			changed = append(changed, n-1)
		}
	}
	if !flag {
		return nil, c, nil, true
	}
	return ci, c, changed, false
}

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	var n int
	fmt.Scan(&n)
	m := make([][]int, n)
	for i := 0; i < n; i++ {
		v := nextInts(n - 1)
		m[i] = v
	}
	var day int
	var c int
	var err bool
	ci := make([]int, len(m))
	max := (n * (n - 1)) / 2
	changed := make([]int, 0, len(m))
	for i := 0; i < len(m); i++ {
		changed = append(changed, i)
	}
	for c < max {
		ci, c, changed, err = do(m, ci, c, changed)
		if err {
			day = -1
			break
		}
		day++
	}
	fmt.Println(day)
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:18:1: error: 'func' does not name a type
   18 | func nextInt() int {
      | ^~~~
a.cc:23:1: error: 'func' does not name a type
   23 | func nextInts(n int) []int {
      | ^~~~
a.cc:31:1: error: 'func' does not name a type
   31 | func do(m [][]int, ci []int, c int, preChanged []int) ([]int, int, []int, bool) {
      | ^~~~
a.cc:70:1: error: 'func' does not name a type
   70 | func main() {
      | ^~~~
Language: C++

n = '4'.to_i
a = []

n.times do |i|
  a << gets.split.map(&:to_i)
end

day = 0
while true
  break if a.all? {|i| i[0].nil? }
  day += 1
  finish_today = []
  n.times { finish_today << false }
  n.times do |i|
    next_comp = a[i][0]
    next if next_comp.nil? || a[next_comp-1][0].nil?
    if !finish_today[i] && a[next_comp-1][0] == i+1 && !finish_today[next_comp-1]
      finish_today[i] = true
      a[i].shift
      finish_today[next_comp-1] = true
    a[next_comp-1].shift
    end
  end
  if day == n*(n-1)
    day = -1
    break
  end
end
p day


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = '4'.to_i
      | ^
a.cc:11:3: error: 'day' does not name a type
   11 |   day += 1
      |   ^~~
a.cc:14:3: error: 'n' does not name a type
   14 |   n.times do |i|
      |   ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<vector<int>> A(N, vector<int>(N - 1));
    rep(i, N) {
        rep(j, N - 1) {
            cin >> A[i][j];
            A[i][j]--;
        }
        reverse(all(A));
    }

    int days = 0;
    vector<P> q;
    auto check = [&](int i) {
        if (A[i].size() == 0) return;
        int j = A[i].back();
        if (A[j].back() == i) {
            P p;
            if (p.second < p.first) swap(p.first, p.second);
            q.push_back(p);
        }
    };
    rep(i, n) { check(i); }
    while (q.size() > 0) {
        sort(all(q));
        erase(unique(all(q)), q.end());
        days++;
        vector<P> prevQ;
        swap(prevQ, q);
        for (P p : prevQ) {
            int i = p.first(), j = p.second();
            a[i].pop_back();
            a[j].pop_back();
            check(i);
            check(j);
        }
    }

    rep(i, n) {
        if (a[i].size() != 0) {
            puts("-1");
            return 0;
        }
    }
    cout << days << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: 'n' was not declared in this scope
   38 |     rep(i, n) { check(i); }
      |            ^
a.cc:5:42: note: in definition of macro 'REP'
    5 | #define REP(i, a, b) for (int i = a; i < b; i++)
      |                                          ^
a.cc:38:5: note: in expansion of macro 'rep'
   38 |     rep(i, n) { check(i); }
      |     ^~~
a.cc:41:9: error: 'erase' was not declared in this scope
   41 |         erase(unique(all(q)), q.end());
      |         ^~~~~
a.cc:46:28: error: expression cannot be used as a function
   46 |             int i = p.first(), j = p.second();
      |                     ~~~~~~~^~
a.cc:47:13: error: 'a' was not declared in this scope
   47 |             a[i].pop_back();
      |             ^
a.cc:48:15: error: 'j' was not declared in this scope
   48 |             a[j].pop_back();
      |               ^
a.cc:54:12: error: 'n' was not declared in this scope
   54 |     rep(i, n) {
      |            ^
a.cc:5:42: note: in definition of macro 'REP'
    5 | #define REP(i, a, b) for (int i = a; i < b; i++)
      |                                          ^
a.cc:54:5: note: in expansion of macro 'rep'
   54 |     rep(i, n) {
      |     ^~~
a.cc:55:13: error: 'a' was not declared in this scope
   55 |         if (a[i].size() != 0) {
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 
const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;
// get<K>(tuple型の変数)


// 有向グラフでの閉路検出
// O(V+E)
const int NMAX = 1001010;
vector<int> G[NMAX];
vector<int> status(NMAX, 0);
vector<int> dp(NMAX, -1);
// 0:New, 1:Active, 2:Finished
// Activeは行きがけ順序、Finishedは帰り掛け順序

bool IsAcyclicDFS(int v){
    status[v] = 1;
    for(auto to:G[v]){
        if(status[to] == 1) return false;
        else if(status[to] == 0){
            if(IsAcyclicDFS(to) == false) return false;
        }
    }
    status[v] = 2;
    return true;
}

bool IsAcyclic(){
    for(int i=0; i<NMAX; ++i) status[i] = 0;
    for(int i=0; i<NMAX; ++i){
        if(status[i] == 0){
            if(IsAcyclicDFS(i) == false) return false; 
        }
    }
    return true;
}

int rec(int now){
    if(dp[now] != -1) return dp[now];

    int res = 1;
    for(auto to:G[now]){
        chmax(res, rec(to)+1);
    }
    return dp[now] = res;
}

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

    int n; scanf("%d" &n);
    vector< vector<int> > a(n, vector<int>(n-1, 0));
    for(int i=0; i<n; ++i) for(int j=0; j<n-1; ++j) { scanf("%d", &a[i][j]); --a[i][j]; }

    for(int i=0; i<n; ++i){
        for(int j=0; j<n-2; ++j){
            int s1 = i, t1 = a[i][j];
            int s2 = i, t2 = a[i][j+1];
            if(s1 > t1) swap(s1, t1);
            if(s2 > t2) swap(s2, t2);
            G[1000*s1 + t1].push_back(1000*s2 + t2);
        }
    }

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

    int ans = 0;
    for(int i=0; i<n; ++i){
        for(int j=i+1; j<n; ++j){
            chmax(ans, rec(1000*i + j));
        }
    }
    printf("%d\n", ans);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:95:23: error: invalid operands of types 'const char [3]' and 'int' to binary 'operator&'
   95 |     int n; scanf("%d" &n);
      |                  ~~~~ ^~
      |                  |     |
      |                  |     int
      |                  const char [3]
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
using namespace std;
const long long MOD = 1000000007;

typedef long long ll;

int ans = INT_MIN, n;

void
dfs(int i, int j, int d, int next[1010][1010])
{
  if (d > n * (n - 1)) {
    ans = INT_MAX;
    return;
  }
  if (next[i][j] != -1) {
    dfs(i, next[i][j], d + 1, next);
  }
  if (next[j][i] != -1) {
    dfs(next[j][i], j, d + 1, next);
  }
  else ans = max(ans, d);
  return;
}

int
main(int argc, const char *argv[])
{
  scanf("%d", &n);
  int a[1010][1010], next[1010][1010];
  for (int i  = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      next[i][j] = -1;
    }
  }
  
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n - 1; j++) {
      scanf("%d", &a[i][j]);
      a[i][j]--;
      if(j != 0) next[i][a[i][j - 1]] = a[i][j];
    }
  }

  for (int i = 0; i < n; i++) {
    if (i == a[a[i][0]][0]) {
      dfs(i, a[i][0], 0, next);
    }
    if (ans == INT_MAX) break;
  }

  if (ans != INT_MAX && ans != INT_MIN) printf("%d\n", ans + 1);
  else printf("-1\n");

  return 0;
}


Compiler output:
a.cc:13:11: error: 'INT_MIN' was not declared in this scope
   13 | int ans = INT_MIN, n;
      |           ^~~~~~~
a.cc:8:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <cstring>
  +++ |+#include <climits>
    8 | using namespace std;
a.cc: In function 'void dfs(int, int, int, int (*)[1010])':
a.cc:18:11: error: 'n' was not declared in this scope
   18 |   if (d > n * (n - 1)) {
      |           ^
a.cc:19:11: error: 'INT_MAX' was not declared in this scope
   19 |     ans = INT_MAX;
      |           ^~~~~~~
a.cc:19:11: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int main(int, const char**)':
a.cc:35:16: error: 'n' was not declared in this scope
   35 |   scanf("%d", &n);
      |                ^
a.cc:55:16: error: 'INT_MAX' was not declared in this scope
   55 |     if (ans == INT_MAX) break;
      |                ^~~~~~~
a.cc:55:16: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:58:14: error: 'INT_MAX' was not declared in this scope
   58 |   if (ans != INT_MAX && ans != INT_MIN) printf("%d\n", ans + 1);
      |              ^~~~~~~
a.cc:58:14: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:58:32: error: 'INT_MIN' was not declared in this scope
   58 |   if (ans != INT_MAX && ans != INT_MIN) printf("%d\n", ans + 1);
      |                                ^~~~~~~
a.cc:58:32: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
using namespace std;
const long long MOD = 1000000007;

typedef long long ll;

int ans = INT_MIN, n;

void
dfs(int i, int j, int d, int next[1010][1010])
{
  if (d > n * (n - 1)) {
    ans = INT_MAX;
    return;
  }
  if (next[i][j] != -1) {
    dfs(i, next[i][j], d + 1, next);
  }
  if (next[j][i] != -1) {
    dfs(next[j][i], j, d + 1, next);
  }
  else ans = max(ans, d);
  return;
}

int
main(int argc, const char *argv[])
{
  scanf("%d", &n);
  int a[1010][1010], next[1010][1010];
  for (int i  = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      next[i][j] = -1;
    }
  }
  
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n - 1; j++) {
      scanf("%d", &a[i][j]);
      a[i][j]--;
      if(j != 0) next[i][a[i][j - 1]] = a[i][j];
    }
  }

  for (int i = 0; i < n; i++) {
    if (i == a[a[i][0]][0]) {
      dfs(i, a[i][0], 0, next);
    }
  }

  if (ans != INT_MAX && ans != INT_MIN) printf("%d\n", ans + 1);
  else printf("-1\n");

  return 0;
}


Compiler output:
a.cc:13:11: error: 'INT_MIN' was not declared in this scope
   13 | int ans = INT_MIN, n;
      |           ^~~~~~~
a.cc:8:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <cstring>
  +++ |+#include <climits>
    8 | using namespace std;
a.cc: In function 'void dfs(int, int, int, int (*)[1010])':
a.cc:18:11: error: 'n' was not declared in this scope
   18 |   if (d > n * (n - 1)) {
      |           ^
a.cc:19:11: error: 'INT_MAX' was not declared in this scope
   19 |     ans = INT_MAX;
      |           ^~~~~~~
a.cc:19:11: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int main(int, const char**)':
a.cc:35:16: error: 'n' was not declared in this scope
   35 |   scanf("%d", &n);
      |                ^
a.cc:57:14: error: 'INT_MAX' was not declared in this scope
   57 |   if (ans != INT_MAX && ans != INT_MIN) printf("%d\n", ans + 1);
      |              ^~~~~~~
a.cc:57:14: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:57:32: error: 'INT_MIN' was not declared in this scope
   57 |   if (ans != INT_MAX && ans != INT_MIN) printf("%d\n", ans + 1);
      |                                ^~~~~~~
a.cc:57:32: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<bits/stdc++.h>

using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef unsigned short us;
int main(){
    clock_t start=clock();
    int n;
    cin>>n;
    int a[n][n];rep(i,n)rep(j,n) a[i][j]=-1;
    rep(i,n){
        rep(j,n-1){
            cin>>a[i][j];a[i][j]--;
        }
    }
    
    //0~n-1人の試合の進行度
    int index[n]={};
    //1日たって何も進捗が埋めなければ-1出す用の旗
    bool update;
    for(int day=1;day<=n*(n-1)/2;day++){
        update=false;
        set<pair<int,int>> s;
        //今日まだ試合できるか
        bool can[n];
        rep(i,n) can[i]=true;
        for(int i=0;i<n;i++){
            if(index[i]>n-2) continue;
            if(!s.count(make_pair(a[i][index[i]],i))) s.insert(make_pair(i,a[i][index[i]]));
            else{
                update=true;
            }
        }
        vector<pair<int,int>> match;
        for(int i=0;i<n;i++){
            if(s.count(make_pair(a[i][index[i]],i))&&can[i]&&can[a[i][index[i]]]){
                //cout<<"DAY:"<<day<<" match:"<<i<<"-"<<a[i][index[i]]<<endl;
                match.push_back(make_pair(i,a[i][index[i]]));
                can[i]=false;can[a[i][index[i]]]=false;
            }
        }
        for(auto x:match){
            index[x.first]++;index[x.second]++;
        }
        if(!update){
            puts("-1");return 0;
        }
        //rep(i,n){cout<<index[i]<<' ';}cout<<endl;
        bool f=true;
        rep(i,n){
            if(index[i]!=n-1){f=false;break;}
        }
        if(f){
            cout<<day<<endl;return 0;
        }
        double ttt=(double)(clock()-start)/CLOCS_PER_SEC;
        if(ttt>1.2){
            cout<<n*(n-1)/2<<endl;return 0;
        }
    }
    cout<<(n*(n-1)/2)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:44: error: 'CLOCS_PER_SEC' was not declared in this scope; did you mean 'CLOCKS_PER_SEC'?
   66 |         double ttt=(double)(clock()-start)/CLOCS_PER_SEC;
      |                                            ^~~~~~~~~~~~~
      |                                            CLOCKS_PER_SEC
Language: C++

#include <bits/stdc++.h>

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

bool is_in(const vector<int> &v, int val) {
    return find(v.begin(), v.end(), val) != v.end();
}

bool is_continue(const int * C, int N, int V) {
    REP(i, N) {
        if (C[i] < V) {
            return true;
        }
    }
    return false;
}

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

    int N;
    cin >> N;

    int S[N][N-1];

    REP(i, N) REP(j, N-1) cin >> S[i][j];

    int C[N];
    REP(i, N) C[i] = 0;

    int d = 0;
    while (is_continue(C, N, N - 1)) {
        bool no_game = true;
//        vector<int> ignore;
        LL ignore = 0;
        REP(i, N) {
            if (C[i] > N - 2) continue;

            int p = S[i][C[i]] - 1;

//            if (is_in(ignore, i) || is_in(ignore, p)) continue;
            if ( (ignore & (1 << i)) || (ignore & (1 << p))) continue;

            if (S[p][C[p]] == i + 1) {
                no_game = false;
                ++C[i];
                ++C[p];
                ignore.push_back(i);
                ignore.push_back(p);
            }
        }

        if (no_game) {
            d = -1;
            break;
        }

        ++d;
    }

    cout << d << endl;



}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:24: error: request for member 'push_back' in 'ignore', which is of non-class type 'LL' {aka 'long long int'}
   67 |                 ignore.push_back(i);
      |                        ^~~~~~~~~
a.cc:68:24: error: request for member 'push_back' in 'ignore', which is of non-class type 'LL' {aka 'long long int'}
   68 |                 ignore.push_back(p);
      |                        ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	int N;
	vector<queue<int>> A(1005);
	int tmp;
	int day = 0;
	bool zero[1005];
	bool pop = false;
	bool end = true;
	memset(zero, 0, sizeof(zero));

	scanf_s("%d", &N);
	vector<bool> flag(N+5, false);

	rep(i, N)
	{
		rep(j, N - 1)
		{
			scanf_s("%d", &tmp);
			A[i + 1].push(tmp);
		}
	}

	while(true)
	{
		end = true;
		pop = false;
		fill(flag.begin(), flag.end(), false);
		for(int i = 1; i <= N; i++)
		{
			if (!A[i].empty() && flag[i] == false)
			{
				if (!A[A[i].front()].empty() && flag[A[i].front()] == false)
				{
					if (A[A[i].front()].front() == i)
					{
						int a;
						a = A[i].front();
						flag[i] = flag[A[i].front()] = true;
						A[A[i].front()].pop();
						A[i].pop();
						if (A[i].empty())
							zero[i] = true;
						if (A[a].empty())
							zero[a] = true;
						pop = true;
					}
				}
			}
			if (!zero[i])
				end = false;
		}
		if (!pop)
			break;
		day++;
		if (end)
			break;
	}

	if (day == 0 || (!pop && !end))
		cout << "-1" << endl;
	else
		cout << day << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   23 |         scanf_s("%d", &N);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);


	int N;
	cin >> N;
    vector< list<int> > A(N, list<int>());

	for(int i=0;i<N;i++){

        for(int j=0;j<N-1;j++){
            int tmp;
            cin >> tmp ;
            A[i].push_back(tmp);
        }
    }


    int days = 0;
    vector<int> desired(N);
    vector<int> nextdesired(N);
    for(int i=0;i<N;i++) desired[i] = nextdesired[i] =  *A[i].begin();



    
    while (true){
        bool firstgame = true;
        for(int i=0;i<N-1;i++){
            int a = desired[i];
            if(a <1) continue;
            int b = desired[a-1];
            if(b==i+1){
                A[i].pop_front();
                if(A[i].size()==0) A[i].push_back(-1);

                A[a-1].pop_front();
                if(A[a-1].size()==0) A[a-1].push_back(-1);



                desired[a-1] = -1;
                nextdesired[i] = *A[i].begin();
                nextdesired[a-1] = *A[a-1].begin();
                if (firstgame){
                    firstgame = false;
                    days++;
                }
            }
            
            


                    

        }

        if (firstgame){
            size_t n_count = std::count(desired.begin(), desired.end(), -1);
            if (n_count == N){
                cout << days << '\n' ;
                return 0;
            }else{
                cout << -1 << '\n' ;
                return 0;
            }
                
        }
        for(int i=0;i<N;i++) desired[i] = nextdesired[i];
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:35: error: 'count' is not a member of 'std'; did you mean 'cout'?
   65 |             size_t n_count = std::count(desired.begin(), desired.end(), -1);
      |                                   ^~~~~
      |                                   cout