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

#include <iostream>
using namespace std;

int main() {
	
  	int N;
  	ans == 0;
  	cin >> N;
  	if (N != 1) {
  		for (int i = 1; i < N; i++) {
			ans += i;
     	}
     }
  
  	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |         ans == 0;
      |         ^~~
      |         abs
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main() {
    int n, ans;
    cin >> n;
    ans = 0

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expected ';' before 'for'
    9 |     ans = 0
      |            ^
      |            ;
   10 | 
   11 |     for (int i = 0; i < N; i++) {
      |     ~~~     
a.cc:11:21: error: 'i' was not declared in this scope
   11 |     for (int i = 0; i < N; i++) {
      |                     ^
a.cc:11:25: error: 'N' was not declared in this scope
   11 |     for (int i = 0; i < N; i++) {
      |                         ^
Language: C

#include<stdio.h>
 
int nmax(int c[n], int n){
 	int m=0;
  	for(int i=0;i<n;i++){
     if(c[i]>m){ m = c[i];} 
    }
  	return m;
}
 
int main(){
   int n,ans=0;
   scanf("%d", &n);
   int a,c[n],max;
  	for(int i=1;i<=n;i++){
      for(int j=1;i<=n;j++){
		 c[j] = i%j;
         max = nmax(c,n);
      }
      ans = max + ans ;
    }	
 
 
  	printf("%d", a);
	return 0;
 
}

Compiler output:
main.c:3:16: error: 'n' undeclared here (not in a function)
    3 | int nmax(int c[n], int n){
      |                ^
main.c: In function 'main':
main.c:18:21: error: type of formal parameter 1 is incomplete
   18 |          max = nmax(c,n);
      |                     ^
Language: C

#include<stdio.h>

int nmax(int c[n], int n){
 	int m=0;
  	for(int i=0;i<n;i++){
     if(c[i]>m){ m = c[i];} 
    }
  	return m;
}
 
int main(){
   int n,ans=0;
   scanf("%d", &n);
   int a,c[n],max;
  	for(int i=1;i<=n;i++){
      for(int j=1;i<=n;j++){
		 c[j] = i%j;
         max = nmax(c,n);
      }
      ans = m + ans ;
    }	


  	printf("%d", a);
	return 0;
 
}

Compiler output:
main.c:3:16: error: 'n' undeclared here (not in a function)
    3 | int nmax(int c[n], int n){
      |                ^
main.c: In function 'main':
main.c:18:21: error: type of formal parameter 1 is incomplete
   18 |          max = nmax(c,n);
      |                     ^
main.c:20:13: error: 'm' undeclared (first use in this function)
   20 |       ans = m + ans ;
      |             ^
main.c:20:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

using namespace std;

int main(){
  int n ; cin >> n;
  vector<int> nn(n);
  rep(i,n){ nn[i] = i + 1; }; 
  vector<int> p(n);
  int ans = 0;

  for(int i =0;i<n;i++){
      if(i==n-1){
        p[i] = nn[0];
      }else{
        p[i] = nn[i+1];
      }
  }

  for(int i = 0; i < n ; i++) {
    int aaa = nn[i] % p[i];
    ans += aaa;
  }

/*
  rep(i,n){
    cout << p[i];
  }
  */
  cout << ans << endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:11: error: 'cin' was not declared in this scope
    7 |   int n ; cin >> n;
      |           ^~~
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> nn(n);
      |   ^~~~~~
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> nn(n);
      |          ^~~
a.cc:9:13: error: 'nn' was not declared in this scope; did you mean 'n'?
    9 |   rep(i,n){ nn[i] = i + 1; };
      |             ^~
      |             n
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vector<int> p(n);
      |          ^~~
a.cc:15:9: error: 'p' was not declared in this scope
   15 |         p[i] = nn[0];
      |         ^
a.cc:15:16: error: 'nn' was not declared in this scope; did you mean 'n'?
   15 |         p[i] = nn[0];
      |                ^~
      |                n
a.cc:17:9: error: 'p' was not declared in this scope
   17 |         p[i] = nn[i+1];
      |         ^
a.cc:17:16: error: 'nn' was not declared in this scope; did you mean 'n'?
   17 |         p[i] = nn[i+1];
      |                ^~
      |                n
a.cc:22:15: error: 'nn' was not declared in this scope; did you mean 'n'?
   22 |     int aaa = nn[i] % p[i];
      |               ^~
      |               n
a.cc:22:23: error: 'p' was not declared in this scope
   22 |     int aaa = nn[i] % p[i];
      |                       ^
a.cc:31:3: error: 'cout' was not declared in this scope
   31 |   cout << ans << endl;
      |   ^~~~
a.cc:31:18: error: 'endl' was not declared in this scope
   31 |   cout << ans << endl;
      |                  ^~~~
Language: C++

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

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

  int ans =  (n * (n-1)) / 2;
  cout << ans;
}#include <bits/stdc++.h>
using namespace std;

int main() {
  long long n;
  cin >> n;

  long long  ans =  (n/2) * (n-1);
  cout << ans;
}

Compiler output:
a.cc:10:2: error: stray '#' in program
   10 | }#include <bits/stdc++.h>
      |  ^
a.cc:10:3: error: 'include' does not name a type
   10 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:13:5: error: redefinition of 'int main()'
   13 | int main() {
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    if(n%2!=0){
    int x=n*(n-1)/2;}
    else
        x=(n/2)*(n-1);
    cout<<x;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'x' was not declared in this scope
   13 |         x=(n/2)*(n-1);
      |         ^
a.cc:14:11: error: 'x' was not declared in this scope
   14 |     cout<<x;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  ans=n*(n-1)/2;
  cout << ans << "\n";
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |   ans=n*(n-1)/2;
      |   ^~~
      |   abs
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>

using namespace std;

int main() {
    size_t n;
    cin >> n;
    vector<size_t> ps(n);
    for (size_t i = 0; i < n; ++i)
        ps[i] = i + 1;
    vector<size_t> ms;
    ms.reserve(n);
    for (size_t i = 0; i < n; ++i) {
        auto v = n - i;
        size_t k = 0;
        size_t l = 0;
        for (size_t j = 1; j < ps.size();  ++j) {
            if (l < v % ps[j]) {
                k = j;
                l = v % ps[j];
                break;
            }
        }
        if (k == ps.size())
            --k;
        ms.emplace_back(l);
        swap(ps[k], ps[ps.size() - 1]);
        ps.pop_back();
    }
    size_t c = 0;
    for (auto e : ms)
        c += e;
    cout << c << endl;
    return 0;


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

#include<iostream>
#include<math.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

int main(){
    int n;
    cin >> n;
    //mp::cpp_int x = 1;
    //unsigned long long temp;
    mp:cpp_int temp;
    if(n % 2 == 0) temp = n / 2 * (n-1);
    else temp = (n-1) / 2 * n;
    
    cout << temp << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N; cin N;
  cout << N * (N - 1) / 2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: expected ';' before 'N'
    5 |   int N; cin N;
      |             ^~
      |             ;
Language: C++

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

int main()
{
  int a;
  int b[256];
  int c[256];
  int d = 0;
  int i = 0;
  
  cin >> a;
  
  for(i = 0; i < a; i++){
    b[i] = i + 1;
    c[i] = a - i;
    e += b[i] % c[i];
  }
  cout<<e<<endl;
}
  
  
  
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'e' was not declared in this scope
   18 |     e += b[i] % c[i];
      |     ^
a.cc:20:9: error: 'e' was not declared in this scope
   20 |   cout<<e<<endl;
      |         ^
Language: C++

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

int main() {
  int 64_t N;
  cin >>N;
  
  int 64_t TOTAL = 0;
  for (int 64_t i = 0; i < N; i++) {
    TOTAL += i;
 }
  cout << TOTAL << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:7: error: expected unqualified-id before numeric constant
    5 |   int 64_t N;
      |       ^~~~
a.cc:6:9: error: 'N' was not declared in this scope
    6 |   cin >>N;
      |         ^
a.cc:8:7: error: expected unqualified-id before numeric constant
    8 |   int 64_t TOTAL = 0;
      |       ^~~~
a.cc:9:12: error: expected unqualified-id before numeric constant
    9 |   for (int 64_t i = 0; i < N; i++) {
      |            ^~~~
a.cc:9:11: error: expected ';' before numeric constant
    9 |   for (int 64_t i = 0; i < N; i++) {
      |           ^~~~~
      |           ;
a.cc:9:12: error: unable to find numeric literal operator 'operator""_t'
    9 |   for (int 64_t i = 0; i < N; i++) {
      |            ^~~~
a.cc:9:16: error: expected ';' before 'i'
    9 |   for (int 64_t i = 0; i < N; i++) {
      |                ^~
      |                ;
a.cc:9:17: error: 'i' was not declared in this scope
    9 |   for (int 64_t i = 0; i < N; i++) {
      |                 ^
a.cc:9:22: error: expected ')' before ';' token
    9 |   for (int 64_t i = 0; i < N; i++) {
      |       ~              ^
      |                      )
a.cc:9:24: error: 'i' was not declared in this scope
    9 |   for (int 64_t i = 0; i < N; i++) {
      |                        ^
a.cc:12:11: error: 'TOTAL' was not declared in this scope
   12 |   cout << TOTAL << endl;
      |           ^~~~~
Language: C++

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define size(x) int(x.size())
typedef long long ll;
using namespace std;
int main(){
    int N; cin >> N;
    int ans = N(N-1)/2;
    cout  << ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'N' cannot be used as a function
   10 |     int ans = N(N-1)/2;
      |               ~^~~~~
Language: Java

import java.util.*;
public class Main{
	
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int a=(n-1)*n;
		a=a/2;
		System.out.println(a);
	}

}

Compiler output:
Main.java:7: error: variable a is already defined in method main(String[])
		int a=(n-1)*n;
		    ^
Main.java:7: error: cannot find symbol
		int a=(n-1)*n;
		       ^
  symbol:   variable n
  location: class Main
Main.java:7: error: cannot find symbol
		int a=(n-1)*n;
		            ^
  symbol:   variable n
  location: class Main
3 errors
Language: C++

#include<iostream>
int main() {
	long long n;
	std::cin>>n;
	long long ans = n * (n - 1) / 2;
	std::cout<<ans<<std::endll
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:30: error: 'endll' is not a member of 'std'; did you mean 'endl'?
    6 |         std::cout<<ans<<std::endll
      |                              ^~~~~
      |                              endl
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll int n;
	cin >> n;
	ll int ans = 0;
	if(n%2 == 0){
		ans = (n+1)*(n/2) - n;
	}else{
		ans = ((n-1) + 1)*((n-1)/2);
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: two or more data types in declaration of 'n'
    5 |         ll int n;
      |         ^~
a.cc:6:16: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |         cin >> n;
      |                ^
      |                yn
a.cc:7:9: error: two or more data types in declaration of 'ans'
    7 |         ll int ans = 0;
      |         ^~
a.cc:9:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |                 ans = (n+1)*(n/2) - n;
      |                 ^~~
      |                 abs
a.cc:11:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |                 ans = ((n-1) + 1)*((n-1)/2);
      |                 ^~~
      |                 abs
a.cc:13:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

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

int main() {
  long long N;
  cin >> N;
  cout << N * (N-1) / 2
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: expected ';' before '}' token
    7 |   cout << N * (N-1) / 2
      |                        ^
      |                        ;
    8 | }
      | ~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
#include <algorithm>
#include <functional>
//#include<stdlib.h>
using namespace std;


int main() {
	long long int  n;
	cin >> n;
	n=n*(n-1)/2
	cout << n;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: expected ';' before 'cout'
   16 |         n=n*(n-1)/2
      |                    ^
      |                    ;
   17 |         cout << n;
      |         ~~~~
Language: C++

#include <iostream>
using namespace std;

int n;

int main()
{
	cin >> n;

	cout << n * (n - 1) / 2 << endl;

	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: expected '}' at end of input
   12 |         return 0;
      |                  ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

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

  if(n <= 1)
    cout << 0 << endl;

  cout << ((long)n * (long)(n - 1) / (long)2) << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> n;
      |   ^~~
a.cc:7:5: error: 'cout' was not declared in this scope
    7 |     cout << 0 << endl;
      |     ^~~~
a.cc:7:18: error: 'endl' was not declared in this scope
    7 |     cout << 0 << endl;
      |                  ^~~~
a.cc:9:3: error: 'cout' was not declared in this scope
    9 |   cout << ((long)n * (long)(n - 1) / (long)2) << endl;
      |   ^~~~
a.cc:9:50: error: 'endl' was not declared in this scope
    9 |   cout << ((long)n * (long)(n - 1) / (long)2) << endl;
      |                                                  ^~~~
Language: C++

#include <iostream>
using namespace std;
int main(){
    long long int a;
    cin >> a;
    a = a*(a-1)/2
    cout<<a << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: expected ';' before 'cout'
    6 |     a = a*(a-1)/2
      |                  ^
      |                  ;
    7 |     cout<<a << endl;
      |     ~~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  int n = a;
  int ans = 0;
  for(int i=1;i<n;i++){
    ans += n;
  }
  cout << ans << endl;
}

  


Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: redeclaration of 'int n'
    7 |   int n = a;
      |       ^
a.cc:5:7: note: 'int n' previously declared here
    5 |   int n;
      |       ^
a.cc:7:11: error: 'a' was not declared in this scope
    7 |   int n = a;
      |           ^
Language: C++

#include<iostream>

using namespace std;

int main()
{
 	long long int n;
  	cin>>n;
  	log long int ans = (n*(n+1))/2;
  	ans = ans - n;
  	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'log' was not declared in this scope; did you mean 'long'?
    9 |         log long int ans = (n*(n+1))/2;
      |         ^~~
      |         long
a.cc:10:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |         ans = ans - n;
      |         ^~~
      |         abs
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
#include <algorithm>
#include <functional>
//#include<stdlib.h>
using namespace std;


int main() {
	int  n;
	cin >> n;
	n=n*(n-1)/2
	cout << n;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: expected ';' before 'cout'
   16 |         n=n*(n-1)/2
      |                    ^
      |                    ;
   17 |         cout << n;
      |         ~~~~
Language: C++


#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  cout <<n(n-1)/2<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: 'n' cannot be used as a function
    7 |   cout <<n(n-1)/2<<endl;
      |          ~^~~~~
Language: C++

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

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

   	cin >> n;

   	cout << n * (n - 1) / 2 << '\n';

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |         cin >> n;
      |                ^
      |                yn
Language: C++

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

int main() {
  int N;
  cin >> N;
  cout << N*(N-1)/2
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: expected ';' before 'return'
    9 |   cout << N*(N-1)/2
      |                    ^
      |                    ;
   10 |   return 0;
      |   ~~~~~~
Language: C

#include <stdio.h>
#include <string.h>
#define n 100000
#define inf 1000000000

int main(int argc, char const* argv[])
{
	long long  n;
	scanf("%lld", &n);
	printf("%lld", n*(n-1)/2);

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:3:11: error: expected identifier or '(' before numeric constant
    3 | #define n 100000
      |           ^~~~~~
main.c:8:20: note: in expansion of macro 'n'
    8 |         long long  n;
      |                    ^
main.c:9:23: error: lvalue required as unary '&' operand
    9 |         scanf("%lld", &n);
      |                       ^
main.c:10:25: warning: integer overflow in expression of type 'int' results in '1409965408' [-Woverflow]
   10 |         printf("%lld", n*(n-1)/2);
      |                         ^
Language: Java

import java.util.*;
public class Main{
	
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int a=(n-1)*n;
		a=a/2;
		System.out.println(a);
	}
}

Compiler output:
Main.java:7: error: variable a is already defined in method main(String[])
		int a=(n-1)*n;
		    ^
Main.java:7: error: cannot find symbol
		int a=(n-1)*n;
		       ^
  symbol:   variable n
  location: class Main
Main.java:7: error: cannot find symbol
		int a=(n-1)*n;
		            ^
  symbol:   variable n
  location: class Main
3 errors
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;

    ll sum = 0;

    for (ll i = 1; i < n; i++)
    {
        sum += i;
    }

    cout << sum << endl;13
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:32:27: error: expected ';' before '}' token
   32 |     cout << sum << endl;13
      |                           ^
      |                           ;
   33 | }
      | ~
Language: C

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

int main(){
	long long n;
	cin>>n;
	cout<<n*(n-1)/2<<endl;
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;#include <bits/stdc++.h>
 
using namespace std;

#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	ll ans = (n * (n - 1)) / 2;
	cout << ans << endl;
}
	ll ans = (n * (n - 1)) / 2;
	cout << ans << endl;
}#include <bits/stdc++.h>
 
using namespace std;

#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	ll ans = (n * (n - 1)) / 2;
	cout << ans << endl;
}

Compiler output:
a.cc:16:18: error: stray '#' in program
   16 |         cin >> n;#include <bits/stdc++.h>
      |                  ^
a.cc:37:2: error: stray '#' in program
   37 | }#include <bits/stdc++.h>
      |  ^
a.cc: In function 'int main()':
a.cc:16:19: error: 'include' was not declared in this scope
   16 |         cin >> n;#include <bits/stdc++.h>
      |                   ^~~~~~~
a.cc:16:28: error: 'bits' was not declared in this scope
   16 |         cin >> n;#include <bits/stdc++.h>
      |                            ^~~~
a.cc:16:33: error: 'stdc' was not declared in this scope; did you mean 'std'?
   16 |         cin >> n;#include <bits/stdc++.h>
      |                                 ^~~~
      |                                 std
a.cc:18:1: error: expected primary-expression before 'using'
   18 | using namespace std;
      | ^~~~~
a.cc:27:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   27 | int main() {
      |         ^~
a.cc:27:9: note: remove parentheses to default-initialize a variable
   27 | int main() {
      |         ^~
      |         --
a.cc:27:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:27:12: error: a function-definition is not allowed here before '{' token
   27 | int main() {
      |            ^
a.cc: At global scope:
a.cc:37:3: error: 'include' does not name a type
   37 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main() {
      |     ^~~~
a.cc:12:5: note: 'int main()' previously defined here
   12 | int main() {
      |     ^~~~
Language: C++

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

typedef long long ll;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  	ll n;
  	cin >> n;
  	cout << (n * (n - 1)) / 2 << "\n"
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:42: error: expected ';' before 'return'
   11 |         cout << (n * (n - 1)) / 2 << "\n"
      |                                          ^
      |                                          ;
   12 |         return 0;
      |         ~~~~~~
Language: C++

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


int main() {
  int n; cin >> n;
  cout < n * (n - 1) / 2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:26: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    9 |   cout < n * (n - 1) / 2 << endl;
      |          ~~~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define r(i, n) for (int i=0;i<n;i++)
using namespace std;
int main() {
  int n,a;
  cin >> n;
  a=n*(n-1)/2
  cout << a << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: expected ';' before 'cout'
    7 |   a=n*(n-1)/2
      |              ^
      |              ;
    8 |   cout << a << endl;
      |   ~~~~
Language: C++

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

int main(){
  int n;
  cin>>n;
  ans=(n+1)*n/2;
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |   ans=(n+1)*n/2;
      |   ^~~
      |   abs
Language: C++

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

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

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

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

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

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

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

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

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

main(){
    int n=in();
    cout << (n)(n-1)/2 << endl;
}

Compiler output:
a.cc:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:52:16: error: 'n' cannot be used as a function
   52 |     cout << (n)(n-1)/2 << endl;
      |             ~~~^~~~~
Language: Java

import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class D {

    public static void main(String[] args) throws Exception {
        FastScanner scanner = new FastScanner();
        long n = scanner.nextLong();
        System.out.println(n * (n + 1) / 2 - n);
    }

    private static class FastScanner {
        private BufferedReader br;

        public FastScanner() { br = new BufferedReader(new InputStreamReader(System.in)); }
        public FastScanner(String input) throws Exception { br = new BufferedReader(new FileReader(input)); }
        public int[] nextIntArray() throws IOException {
            String line = br.readLine();
            String[] strings = line.trim().split("\\s+");
            int[] array = new int[strings.length];
            for (int i = 0; i < array.length; i++)
                array[i] = Integer.parseInt(strings[i]);
            return array;
        }
        public int nextInt() throws IOException { return Integer.parseInt(br.readLine()); }
        public long[] nextLongArray() throws IOException {
            String line = br.readLine();
            String[] strings = line.trim().split("\\s+");
            long[] array = new long[strings.length];
            for (int i = 0; i < array.length; i++)
                array[i] = Long.parseLong(strings[i]);
            return array;
        }
        public ArrayList<Integer> nextIntegerArrayList() throws IOException {
            String line = br.readLine();
            String[] strings = line.trim().split("\\s+");
            ArrayList<Integer> array = new ArrayList<Integer>();
            for (int i = 0; i < strings.length; i++)
                array.add(Integer.parseInt(strings[i]));
            return array;
        }
        public ArrayList<Long> nextLongArrayList() throws IOException {
            String line = br.readLine();
            String[] strings = line.trim().split("\\s+");
            ArrayList<Long> array = new ArrayList<Long>();
            for (int i = 0; i < strings.length; i++)
                array.add(Long.parseLong(strings[i]));
            return array;
        }
        public long nextLong() throws IOException { return Long.parseLong(br.readLine()); }
        public double nextDouble() throws IOException { return Double.parseDouble(br.readLine()); }
        public String nextLine() throws IOException { return br.readLine(); }


        public ArrayList<BigInteger> nextBigIntegers() throws IOException {
            String line = br.readLine();
            String[] strings = line.trim().split("\\s+");
            ArrayList<BigInteger> array = new ArrayList<BigInteger>();
            for (int i = 0; i < strings.length; i++)
                array.add(BigInteger.valueOf(Long.valueOf(strings[i])));
            return array;
        }
    }
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N;
    cin >> N;
    vector<queue<int>> q(N);
    int a;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N-1; j++) {
            cin >> a; a--;
            q[i].push(a);
        }
    }
    int d = 0;
    int cnt = 0;
    queue<int> dq;
    set<int> se;
    for (int i = 0; i < N; i++) {
        if(!q[i].empty() && !q[q[i].front()].empty() && !q[q[q[i].front()].front()].empty() && q[q[q[i].front()].front()].front() == q[i].front() && q[q[i].front()].front() == i){
            se.insert(i);
        }
    }
    while(cnt < N*(N-1)){
        if(se.size() == 0){
            printf("%d\n", -1);
            return 0;
        }
        for (int v : se){
            q[v].pop(); dq.push(v); cnt++;
        }
        d++;
        se.clear();
        while(!dq.empty()){
            int v = dq.front(); dq.pop();
            if(!q[i].empty() && !q[q[i].front()].empty() && !q[q[q[i].front()].front()].empty() && q[q[q[v].front()].front()].front() == q[v].front() && q[q[v].front()].front() == v){
                se.insert(v); se.insert(q[v].front());
            }
        }
    }

    printf("%d\n", d);
    

}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:19: error: 'i' was not declared in this scope
   51 |             if(!q[i].empty() && !q[q[i].front()].empty() && !q[q[q[i].front()].front()].empty() && q[q[q[v].front()].front()].front() == q[v].front() && q[q[v].front()].front() == v){
      |                   ^
Language: C++

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

int id[1005][1005];
int toID(int x, int y){
    if(x > y)swap(x, y);
    return id[x][y];
}

vector<vector<int> > to(1000005);

int d[1000005];
bool visit[1000005];
bool calc[1000005];
int dfs(int x){
    if(visit[x]){
        if(calc[x]){
            return d[x];
        } else {
            return -1;
        }
    }
    visit[x] = true;
    d[x] = 1;
    for(int p : to[x]){
        int k = dfs(p);
        if(k == -1)return -1;
        d[x] = max(d[x], k + 1);
    }
    calc[x] = true;
    return d[x];
}


int main() {
    int N; cin >> N;
    vector<vector<int> > A(N);
    rep(i, N){
        rep(j, N-1){
            int a; cin >> a;
            a--;
            A[i].push_back(a);
        }
    }

    int X = 0;
    rep(i, N){
        rep(j, N-1){
            int x = A[i][j];
            if(x > i){
                id[i][x] = X++;
            }
        }
    }

    rep(i, N){
        rep(j, N-1){
            A[i][j] = toID(i, A[i][j]);
        }
    }

    rep(i, N){
        rep(j, N-2){
            to[A[i][j]].push_back(A[i][j+1]);
        }
    }

    int ans = 0;
    rep(i, (N*N-1)/2){
        int y = dfs(i);
        if(y == -1){
            cout << -1 << endl;
            return 0;
        }
        ans = max(ans, y);
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:19:8: error: reference to 'visit' is ambiguous
   19 |     if(visit[x]){
      |        ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:16:6: note:                 'bool visit [1000005]'
   16 | bool visit[1000005];
      |      ^~~~~
a.cc:26:5: error: reference to 'visit' is ambiguous
   26 |     visit[x] = true;
      |     ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:16:6: note:                 'bool visit [1000005]'
   16 | bool visit[1000005];
      |      ^~~~~
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  int A[n][n - 1];
  REP(i, n) REP(j, n - 1) cin>>A[i][j];
  
  stack<int> a[n];
  REP(i, n) for(int j = n - 2; j >= 0; j--) a[i].push(A[i][j] - 1);
  
  typedef pair<int, int> P;
  vector<P> battles; //実行可能な試合
  auto add_battle = [&a](int i, vector<P>& next_battles) -> void {
    if(a[i].empty()) return;
    int j = a[i].top();
    if(a[j].top() == i){
      if(i > j) return;
      next_battles.push_back(P(i, j));
    }
    return;
  };
  REP(i, n) add_battle(i, battles);
  
  int days = 0;
  while(!battles.empty()){
    days++;
    for(auto& battle: battles){
      int i = battle.first, j = battle.second;
      a[i].pop(); a[j].pop();
    }
    vector<P> next_battles;
    for(auto& battle: battles){
      int i = battle.first, j = battle.second;
      add_battle(i, next_battles);
      add_battle(j, next_battles);
    }
    swap(battles, next_battles);
  }
  
  REP(i, n){
    if(!a[i].empty()){
      cout << -1 << endl;
      return;
    }
  }
  cout << days << endl;
    
  return 0;
}


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

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  int A[n][n - 1];
  REP(i, n) REP(j, n - 1) cin>>A[i][j];
  
  stack<int> a[n];
  REP(i, n) for(int j = n - 2; j >= 0; j--) a[i].push(A[i][j] - 1);
  
  typedef pair<int, int> P;
  vector<P> battles; //実行可能な試合
  auto add_battle = [&a](int i, vector<P>& next_battles) -> void {
    if(a[i].empty()) return;
    int j = a[i].top();
    if(a[j].top() == i){
      if(i > j) return;
      next_battles.push_back(P(i, j));
    }
    return;
  }
  REP(i, n) add_battle(i, battles);
  
  int days = 0;
  while(!battles.empty()){
    days++;
    for(auto& battle: battles){
      int i = battle.first, j = battle.second;
      a[i].pop(); a[j].pop();
    }
    vector<P> next_battles;
    for(auto& battle: battles){
      int i = battle.first, j = battle.second;
      add_battle(i, next_battles);
      add_battle(j, next_battles);
    }
    swap(battles, next_battles);
  }
  
  REP(i, n){
    if(!a[i].empty()){
      cout << -1 << endl;
      return;
    }
  }
  cout << days << endl;
    
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: expected ',' or ';' before 'for'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                  ^~~
a.cc:90:3: note: in expansion of macro 'REP'
   90 |   REP(i, n) add_battle(i, battles);
      |   ^~~
a.cc:90:7: error: 'i' was not declared in this scope
   90 |   REP(i, n) add_battle(i, battles);
      |       ^
a.cc:6:30: note: in definition of macro 'REP'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                              ^
a.cc:111:7: error: return-statement with no value, in function returning 'int' [-fpermissive]
  111 |       return;
      |       ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

struct topological_sort{
    vector<vector<int>> G;
    vector<int> indegree;
    int V;

    topological_sort(int V) : V(V) {G.resize(V); indegree.resize(V);}
    void add_edge(int a, int b) {
        G[a].push_back(b);
        indegree[b]++;
    }
    vector<int> sort() {
        queue<int> q;
        vector<int> sorted;
        for (int i = 0; i < V; i++) if (indegree[i] == 0) q.push(i);
        while (!q.empty()) {
            int v = q.front(); q.pop();
            for (int i = 0; i < G[v].size(); i++) {
                int u = G[v][i];
                indegree[u]--;
                if (indegree[u] == 0) q.push(u);
            }
            sorted.push_back(v);
        }
        return sorted;
    }
};

P change(P x) {
    if (x.first > x.second) swap(x.first,x.second);
    return x;
}

int main() {
    int n; cin >> n;
    // topological_sort ts(n*(n-1)/2);
    vvint to(n,vint(n));
    vector<P> from;
    int num = 0;
    rep(i,n)rep(j,i) {
        to[j][i] = num;
        from[num] = P(j,i);
        num++;
    }
    vvint data(n,vint(n-1));
    rep(i,n)rep(j,n-1) {
        int x; cin >> x;
        x--;
        data[i][j] = x;
    }
    vvint back;
    rep(i,n)rep(j,n-2) {
        P p1 = change(P(i,data[i][j]));
        P p2 = change(P(i,data[i][j+1]));
        ts.add_edge(to[p1.first][p1.second],to[p2.first][p2.second]);
        back[to[p2.first][p2.second]].push_back(to[p1.first][p1.second]);
    }
    // vint res = ts.sort();
    // if (res.size() != n*(n-1)/2) {cout << -1 << endl; return 0;}
    // vint dp(n*(n-1)/2,1);
    // rep(i,n*(n-1)/2) {
    //     P p = from[res[i]];
    //     rep(j,back[to[p]].size()) chmax(dp[to[p]],dp[back[to[p]][j]]+1);
    // }
    // cout << dp[res.back()] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:76:9: error: 'ts' was not declared in this scope; did you mean 'to'?
   76 |         ts.add_edge(to[p1.first][p1.second],to[p2.first][p2.second]);
      |         ^~
      |         to
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

struct topological_sort{
    vector<vector<int>> G;
    vector<int> indegree;
    int V;

    topological_sort(int V) : V(V) {G.resize(V); indegree.resize(V);}
    void add_edge(int a, int b) {
        G[a].push_back(b);
        indegree[b]++;
    }
    vector<int> sort() {
        queue<int> q;
        vector<int> sorted;
        for (int i = 0; i < V; i++) if (indegree[i] == 0) q.push(i);
        while (!q.empty()) {
            int v = q.front(); q.pop();
            for (int i = 0; i < G[v].size(); i++) {
                int u = G[v][i];
                indegree[u]--;
                if (indegree[u] == 0) q.push(u);
            }
            sorted.push_back(v);
        }
        return sorted;
    }
};

P change(P x) {
    if (x.first > x.second) swap(x.first,x.second);
    return x;
}

int main() {
    int n; cin >> n;
    // topological_sort ts(n*(n-1)/2);
    map<P,int> to;
    map<int,P> from;
    int num = 0;
    rep(i,n)rep(j,i) {
        to[P(j,i)] = num;
        from[num] = P(j,i);
        num++;
    }
    vvint data(n,vint(n-1));
    rep(i,n)rep(j,n-1) {
        int x; cin >> x;
        x--;
        data[i][j] = x;
    }
    map<int,vint> back;
    rep(i,n)rep(j,n-2) {
        // P p1 = change(P(i,data[i][j]));
        // P p2 = change(P(i,data[i][j+1]));
        // ts.add_edge(to[p1],to[p2]);
        back[to[p2]].push_back(to[p1]);
    }
    // vint res = ts.sort();
    // if (res.size() != n*(n-1)/2) {cout << -1 << endl; return 0;}
    // vint dp(n*(n-1)/2,1);
    // rep(i,n*(n-1)/2) {
    //     P p = from[res[i]];
    //     rep(j,back[to[p]].size()) chmax(dp[to[p]],dp[back[to[p]][j]]+1);
    // }
    // cout << dp[res.back()] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:17: error: 'p2' was not declared in this scope
   77 |         back[to[p2]].push_back(to[p1]);
      |                 ^~
a.cc:77:35: error: 'p1' was not declared in this scope; did you mean 'y1'?
   77 |         back[to[p2]].push_back(to[p1]);
      |                                   ^~
      |                                   y1
Language: C++


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

typedef long long ll;

const int N = 1010;
int m[N][N];
vector<int> E[500000];
int n, t, cur, p;
int id = 1;
int res[500000];
int ret = 1;
int C[500000];
bool ok = true;

bool dfs(int x) {
    res[x] = 1;
    C[x] = 1;
    for (int i : E[x]) {
        if (C[i] == 1) return false;
        if (C[i] == 2) {
            res[x] = max(res[x], res[i] + 1);
            continue;
        }
        if (!dfs(i)) return false;
        res[x] = max(res[x], res[i] + 1);
    }
    C[x] = 2;
    ret = max(ret, res[x]);
    return true;
}

inline static getid(int x, int y) {
    if (x > y)
        swap(x, y);
    if (m[x][y] == 0) {
        m[x][y] = id++;
    }
    return m[x][y];
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n - 1; ++j) {
            cin >> t;
            --t;
            cur = getid(i, t);
            if (j > 0) {
                E[cur].push_back(p);
            }
            p = cur;
        }
    }
    for (int i = 1; i < id; ++i) {
        if (C[i] == 0) {
            if (!dfs(i)) {
                ok = false;
                break;
            }
        }
    }
    if (ok)
        cout << ret << endl;
    else
        cout << -1 << endl;

    return 0;
}



Compiler output:
a.cc:34:15: error: ISO C++ forbids declaration of 'getid' with no type [-fpermissive]
   34 | inline static getid(int x, int y) {
      |               ^~~~~