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

#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

string GenerateNextHand(char head,char tail,map<string,bool>& used){
  for(char i='a';i<='z';i++){
    for(char j='a';j<='z';j++){
      string str = "";
      str += head + i + j + tail;
      if(used.find(str) == used.end()){
	return str;
      }
    }
  }
}

int main(){
  printf("?aj\n"); fflush(stdout);
  char str[128];
  map<string,bool> used;
  used["aj"] = true;
  string prev_my_hand = "aj";
  char next_my_tail = 'j';

  while(~scanf("%s",buf)){
    if(buf[0] != prev_my_hand[prev_my_hand.size()-1]
       || used.find(buf) != used.end()){
      printf("OUT!\n");
    }

    used[buf] = true;
    char next_my_head = buf[strlen(buf)-1];
    prev_my_hand = GenerateNextHand(next_my_head,next_my_tail,used);
    used[prev_my_hand] = true;
    printf("?%s\n",prev_my_hand.c_str());
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:21: error: 'buf' was not declared in this scope
   53 |   while(~scanf("%s",buf)){
      |                     ^~~
a.cc: In function 'std::string GenerateNextHand(char, char, std::map<std::__cxx11::basic_string<char>, bool>&)':
a.cc:43:1: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      | ^
Language: C++

#include <ctime>
#include <iostream>
using namespace std;
int N, K, card[500][500], r[1000];
int main() {
	srand((unsigned)time(NULL));
	scanf("%d%d", &N, &K);
	for (int i = 0; i < K; i++) {
		for (int j = 0; j < N / 2; j++) {
			scanf("%d", &card[i][j]);
		}
	}
	while (true) {
		for (int i = 0; i < N; i++) r[i] = rand() % 2;
		bool flag = true;
		for (int i = 0; i < K; i++) {
			int c = 0;
			for (int j = 0; j < N / 2; j++) {
				if (r[card[i][j] - 1]) c++;
			}
			if (c < N / 8 || 3 * N / 8 < c) { flag = false; break; }
		}
		if (flag) { printf("%s\n", s.c_str()); break; }
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:44: error: 's' was not declared in this scope
   23 |                 if (flag) { printf("%s\n", s.c_str()); break; }
      |                                            ^
Language: C++

#include <stdio.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	int N,K;
	scanf("%d %d",&N,&K);

	int table[K][N/2];

	for(int row = 0; row < K; row++){
		for(int col = 0; col < N/2; col++){
			scanf("%d",&table[row][col]);
			table[row][col]--;
		}
	}

	int ans[N];
	for(int i = 0; i < N/2; i++)table[i] = 1;
	for(int i = N/2; i < N; i++)table[i] = 0;

	bool FLG;
	int sum;

	while(true){
		FLG = true;
		for(int i = 0; i < K; i++){
			sum = 0;
			for(int a = 0; a < N/2; a++){
				sum += ans[table[i][a]];
			}
			if(sum < N/8 || sum > 3*N/8){
				FLG = false;
				break;
			}
		}

		if(FLG)break;

		random_shuffle(ans,ans+N);

	}

	for(int i = 0; i < N; i++)printf("%d",ans[i]);
	printf("\n");

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:46: error: incompatible types in assignment of 'int' to 'int [(N / 2)]'
   39 |         for(int i = 0; i < N/2; i++)table[i] = 1;
      |                                     ~~~~~~~~~^~~
a.cc:40:46: error: incompatible types in assignment of 'int' to 'int [(N / 2)]'
   40 |         for(int i = N/2; i < N; i++)table[i] = 0;
      |                                     ~~~~~~~~~^~~
a.cc:60:31: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = int*]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   60 |                 random_shuffle(ans,ans+N);
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:4492:5: note: declared here
 4492 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~
Language: C++

int main(){
	int n,m;
	while(cin >> n >> m){
		int mx = 3*n/8;
		int mi = n/8;
		int d[1000] = {0};
		vector< vector<int> > v(1000);
		vector<int> c(1000);
		rep(i,m){
			rep(j,n/2){
				int a;
				cin >> a;
				a--;
				v[a].push_back(i);
				d[a]++; 
			}
		}
		int seq[1000] = {0};

		vector< pair<int,int> > p;
		rep(i,n)p.push_back(make_pair(d[i],i));
		sort(p.begin(),p.end(),greater<pair<int,int> >() );
		rep(bigI,n){
			int i = p[bigI].second;
			bool f = true;
			rep(j,v[i].size()) if(c[ v[i][j] ] >= mx ) f = false;
			if(f)rep(j,v[i].size()) c[ v[i][j] ]++ , seq[i] = 1;
		}
		rep(i,n) cout << seq[i];
		cout << endl;
	}	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:15: error: 'cin' was not declared in this scope
    3 |         while(cin >> n >> m){
      |               ^~~
a.cc:7:17: error: 'vector' was not declared in this scope
    7 |                 vector< vector<int> > v(1000);
      |                 ^~~~~~
a.cc:7:32: error: expected primary-expression before 'int'
    7 |                 vector< vector<int> > v(1000);
      |                                ^~~
a.cc:8:24: error: expected primary-expression before 'int'
    8 |                 vector<int> c(1000);
      |                        ^~~
a.cc:9:21: error: 'i' was not declared in this scope
    9 |                 rep(i,m){
      |                     ^
a.cc:9:17: error: 'rep' was not declared in this scope
    9 |                 rep(i,m){
      |                 ^~~
a.cc:20:25: error: 'pair' was not declared in this scope
   20 |                 vector< pair<int,int> > p;
      |                         ^~~~
a.cc:20:30: error: expected primary-expression before 'int'
   20 |                 vector< pair<int,int> > p;
      |                              ^~~
a.cc:22:22: error: 'p' was not declared in this scope
   22 |                 sort(p.begin(),p.end(),greater<pair<int,int> >() );
      |                      ^
a.cc:22:40: error: 'greater' was not declared in this scope
   22 |                 sort(p.begin(),p.end(),greater<pair<int,int> >() );
      |                                        ^~~~~~~
a.cc:22:53: error: expected primary-expression before 'int'
   22 |                 sort(p.begin(),p.end(),greater<pair<int,int> >() );
      |                                                     ^~~
a.cc:22:57: error: expected primary-expression before 'int'
   22 |                 sort(p.begin(),p.end(),greater<pair<int,int> >() );
      |                                                         ^~~
a.cc:22:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |                 sort(p.begin(),p.end(),greater<pair<int,int> >() );
      |                 ^~~~
      |                 short
a.cc:23:21: error: 'bigI' was not declared in this scope
   23 |                 rep(bigI,n){
      |                     ^~~~
a.cc:30:17: error: 'cout' was not declared in this scope
   30 |                 cout << endl;
      |                 ^~~~
a.cc:30:25: error: 'endl' was not declared in this scope
   30 |                 cout << endl;
      |                         ^~~~
Language: C

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int popcount(T n) { return n ? 1 + popcount(n & (n - 1)) : 0; }
#endif
#ifdef __GNUC__
template <class T> int popcount(T n);
template <> int popcount(unsigned int n) { return n ? __builtin_popcount(n) : 0; }
template <> int popcount(int n) { return n ? __builtin_popcount(n) : 0; }
template <> int popcount(unsigned long long n) { return n ? __builtin_popcountll(n) : 0; }
template <> int popcount(long long n) { return n ? __builtin_popcountll(n) : 0; }
#endif

#define rep (i, n) for (int i = 0; i < (int)n; ++i)
#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CL(arr, val) memset(arr, val, sizeof(arr))


template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };
bool valid_pos(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

template <class T> void print(T a, int n, int br = 1, const string& deli = ", ") { cout << "{ "; for (int i = 0; i < n; ++i) { cout << a[i]; if (i + 1 != n) cout << deli; } cout << " }"; while (br--) cout << endl; }
template <class T> void print(const vector<T>& v, int br = 1, const string& deli = ", ") { print(v, v.size(), br, deli); }


int main()
{
    ll a, b;
    cin >> a >> b;
    ll low = a - b, upper = a + b;

    static bool is_prime[1000100];
    static int prev_e[1000100];
    for (ll i = 2; i * i <= upper; ++i)
        is_prime[i] = true;
    for (int i = 0; i <= 2 * b + 100; ++i)
        prev_e[i] = 1000000;

    for (ll i = 2; i * i <= upper; ++i)
    {
        if (is_prime[i])
        {
            for (ll j = 2 * i; j * j <= upper; j += i)
                is_prime[j] = false;

            for (ll j = (low + i - 1) / i * i; j <= upper; j += i)
            {
                int e = 0;
                for (ll num = j; num % i == 0; num /= i)
                    ++e;

                if (e > prev_e[j - low])
                    prev_e[j - low] = -1;
                else
                    prev_e[j - low] = e;
            }
        }
    }

    int res = 0;
    for (ll i = max(2LL, low); i <= upper; ++i)
        if (prev_e[i - low] >= 1)
            ++res;

    cout << res << endl;
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  const int N=1100000;
  static bool cmp[N+1]={true,true};
  for(int i=2;i<=N;i++){
    if(!cmp[i]){
      for(int j=i*2;j<=N;j+=i){
	cmp[j]=true;
      }
    }
  }
  static int le[1000001];
  fill(begin(le),end(le),1<<29);
  long long A,B;
  cin>>A>>B;
  for(int i=0;i<=N;i++){
    if(!cmp[i]){
      for(long long j=max(i,(A-B+i-1)/i*i);j<=A+B;j+=i){
	int x=j-(A-B);
	int e=0;
	for(long long c=j;c%i==0;c/=i,e++);
	le[x]=(le[x]>=e)?e:-1;
      }
    }
  }
  int ans=0;
  for(int i=0;i<B*2+1;i++){
    ans+=i+A-B>=2&&le[i]>0;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: no matching function for call to 'max(int&, long long int)'
   22 |       for(long long j=max(i,(A-B+i-1)/i*i);j<=A+B;j+=i){
      |                       ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:22:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   22 |       for(long long j=max(i,(A-B+i-1)/i*i);j<=A+B;j+=i){
      |                       ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:22:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   22 |       for(long long j=max(i,(A-B+i-1)/i*i);j<=A+B;j+=i){
      |                       ~~~^~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int X1[2500000], X2[2500000];
int main() {
	for (int i = 2; i <= 2000000; i++) { X1[i] = 1; }
	for (int i = 2; i*i <= 2000000; i++) {
		for (int j = i*i; j <= 2000000; j += i) {
			X1[j] = 0;
		}
	}
	long long A, B, L, R;
	cin >> A >> B; L = A - B; R = A + B;
	for (int i = 0; i <= 2000000; i++) { X2[i] = 1; }
	for (int i = 2; i <= 2000000; i++) {
		long long C = (L + i - 1) / i;
		C *= i;
		for (int j = C - L; j <= R - L; j += i) {
			if (i != j + L) { X2[j] = 0; }
		}
	}
	int cnt = 0;
	for (int i = 0; i <= B * 2; i++) {
		if (X2[i] == 1) { cnt++; continue; }
		long long T = i + L, M = 10000, S = 0, P = T;
		for (long long j = 2; j*j*j <= T; j++) {
			S = 0;
			while (P%j == 0) {
				P /= j; S++;
			}
			if (S >= 1) {
				if (M < S) { goto E; }
				M = S;
			}
		}
		long double L1 = sqrtl(P);
		long long L2 = L1; L2 *= L2;
		if (L2 == P) { S = 2; }
		if (M < S && P >= 2) { goto E; }
		cnt++;
	E:;
	}
	cout << cnt << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: jump to label 'E'
   41 |         E:;
      |         ^
a.cc:32:51: note:   from here
   32 |                                 if (M < S) { goto E; }
      |                                                   ^
a.cc:37:27: note:   crosses initialization of 'long long int L2'
   37 |                 long long L2 = L1; L2 *= L2;
      |                           ^~
a.cc:36:29: note:   crosses initialization of 'long double L1'
   36 |                 long double L1 = sqrtl(P);
      |                             ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)

const int INF = 100000000;
const double EPS = 1e-8;
typedef pair<double, double> P;

double dp[1510][1510];
int main(){
  int N, K;
  cin>>N>>K;
  vector<P> _v, v;
  REP(i, N){
    double x, y, r;
    cin>>x>>y>>r;
    double t1 = atan2(y, x);
    double t2 = asin(r/sqrt(x*x+y*y));
    double b = t1 - t2, e = t1 + t2;
    if(b < -M_PI && e < 0) { b += 2*M_PI; e = M_PI; }
    if(b < 0) b = 0;
    if(e > M_PI) e = M_PI;
    if(b < e) _v.push_back(P(b,e));
  }
  sort(_v.begin(), _v.end());
  REP(i, N){
    while(i + 1 < _v.size() && abs(_v[i].first - _v[i+1].first) < EPS) i++;
    v.push_back(_v[i]);
  }
  int M = v.size();
  vector<int> from(M, INF);
  REP(i, M) FOR(j, i+1, M) if(v[i].second > v[j].first) from[j] = min(from[j], i);
  memset(dp, 0, sizeof(dp));
  dp[1][1] = v[0].second - v[0].first;
  FOR(i, 1, M){
    int f = from[i];
    if(f == INF) f = i - 1;
    FOR(k, 1, i + 2) dp[i+1][k] = max(dp[i][k], max(
          dp[f+1][k-1] + (v[i].second - max(v[f].second, v[i].first)),
          dp[f][k-1] + (v[i].second - v[i].first)));
  }
  double ans = 0;
  REP(k, K + 1) ans = max(ans, dp[M][k]);
  printf("%.13lf\n",ans/M_PI);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:3: error: 'memset' was not declared in this scope
   39 |   memset(dp, 0, sizeof(dp));
      |   ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <cmath>
  +++ |+#include <cstring>
    5 |
Language: C++

v#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#include<random>
#pragma warning(disable:4996)
using namespace std;
using ld=long double;
int main() {
	int T; ld E;cin>>T>>E;
	vector<int>cs(2*T+1);
	for (int i = 0; i < 2 * T + 1; ++i) {
		cin>>cs[i];
	}
	ld ans=0;
	ans=E/cs[T];
	int l=T-1,r=T+1;
	{
		ld sum=0;
		ld pre=1e18;
		for (int i = T + 1; i < 2 * T + 1; ++i) {
			ld now=sum+(2*T+1-i)*cs[i];
			if (now < pre) {
				r=i;
				pre=now;
			}
			sum+=cs[i];
		}
	}
	{
		ld sum = 0;
		ld pre = 1e18;
		for (int i = T - 1; i >=0; --i) {
			ld now = sum + (i+1)*cs[i];
			if (now < pre) {
				l = i;
				pre = now;
			}
			sum += cs[i];
		}
	}
	ld sum=0;
	assert(l<r);
	for (int i = l; i <= r; ++i) {
		if(i==l)sum+=(i+1)*cs[i];
		else if(i==r)sum+=(2*T+1-i)*cs[i];
		else sum+=cs[i];
	}
	ans=max(ans,E/sum*(T+1));
	cout<<setprecision(20)<<fixed<<ans<<endl;
	return 0;
} 

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include "bits/stdc++.h"
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include "bits/stdc++.h"
      | ^
In file included from /usr/include/c++/14/unordered_map:40,
                 from a.cc:2:
/usr/include/c++/14/initializer_list:51:15: error: 'size_t' does not name a type
   51 |       typedef size_t            size_type;
      |               ^~~~~~
/usr/include/c++/14/initializer_list:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | // std::initializer_list support -*- C++ -*-
/usr/include/c++/14/initializer_list:57:7: error: 'size_type' does not name a type
   57 |       size_type                 _M_len;
      |       ^~~~~~~~~
/usr/include/c++/14/initializer_list:60:54: error: 'size_type' has not been declared
   60 |       constexpr initializer_list(const_iterator __a, size_type __l)
      |                                                      ^~~~~~~~~
/usr/include/c++/14/initializer_list:68:17: error: 'size_type' does not name a type
   68 |       constexpr size_type
      |                 ^~~~~~~~~
/usr/include/c++/14/initializer_list:45:11: fatal error: definition of 'class std::initializer_list<_E>' does not match '#include <initializer_list>'
   45 |     class initializer_list
      |           ^~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <set>
#include <iostream>
#include <cstdio>
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

int w, h;
int m[1000][1000];

class Matching{
  typedef vector<vector<int> > G;

  vector<bool> visited;

  const G &g; //g[i][j] = k <==> i is connected to k
  int n;      //number of node
  int m;      //number of left node

  bool augment(int left) {
    if (left < 0)
      return true;
    if (visited[left])
      return false;
    visited[left] = true;
    REP(i, g[left].size()) {
      int right = g[left][i];
      if (augment(matching[right])) {
        matching[right] = left;
        return true;
      }
    }
    return false;
  }

public:
  vector<int> matching;

  explicit Matching(const G &graph, int mm)
    : g(graph), m(mm){
    n = graph.size();
  }

  int solve() {
    int matches = 0;
    matching = vector<int>(n,-1);
    visited  = vector<bool>(n);
    REP(left, m) {
      visited.assign(n, false);
      if (augment(left))
        matches++;
    }
    return matches;
  }
};

int main(){
  bool ans = true;

  h = getInt();
  w = getInt();

  REP(i,h) REP(j,w) m[i][j] = getInt();

  REP(cc, 2){
    vector<vector<int> > g(h);

    REP(i,h) REP(j,h) if(i != j){
      bool ok = true;
      REP(k,w){
	if(m[i][k] <= m[j][k]){
	  ok = false;
	  break;
	}
      }
      if(ok) g[i].push_back(j);
    }

    // puts("g:"); REP(i,h) { printf("%d: ", i); REP(j,g[i].size()) printf("%d ", g[i][j]); puts(""); }

    bool tmp = false;

    REP(i,h) if(g[i].size() == h - 1){
      // for each start point
      typename Matching::G gg(2 + 2 * h);
      
      REP(j,h) if(j != i){
	int r = 2 + j;
	REP(k, g[j].size()) if(g[j][k] != i){
	  int l = 2 + h + g[j][k];
	  gg[l].push_back(r);
	  gg[r].push_back(l);
	}
      }

      REP(k, g[i].size()){
	int r = 2 + h + g[i][k];
	gg[0].push_back(r); gg[1].push_back(r);
	gg[r].push_back(0); gg[r].push_back(1);
      }

      int n = Matching(gg, 2 + h).solve();

      // printf("%d : %d\n", i, n);

      if(n == h - 1){
	tmp = true;
	break;
      }
    }

    if(!tmp){
      ans = false;
      break;
    }

    // Repeat
    REP(i,max(h, w)) REP(j,i)
      swap(m[i][j], m[j][i]);
    swap(h, w);
  }

  puts(ans ? "YES" : "NO");

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:26: error: 'typedef class std::vector<std::vector<int> > Matching::G' is private within this context
   88 |       typename Matching::G gg(2 + 2 * h);
      |                          ^
a.cc:15:32: note: declared private here
   15 |   typedef vector<vector<int> > G;
      |                                ^
Language: Java

import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int n;(n=s.nextInt())>0;){char[]c=s.next().toCharArray();int a[][]=new int[n][],x=0;for(;i<n;++i)a[i]=new int[]{s.nextInt()-1,s.nextInt()-1};for(;n-->0;c[u]=(char)(p-(p>122?26:0)),c[v]=(char)(t-(t>122?26:0)))int u=a[n][0],v=a[n][1],x=(v-u)%26,t=c[u]+x,p=c[v]+x;System.out.println(new String(c));}}}

Compiler output:
Main.java:1: error: variable declaration not allowed here
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int n;(n=s.nextInt())>0;){char[]c=s.next().toCharArray();int a[][]=new int[n][],x=0;for(;i<n;++i)a[i]=new int[]{s.nextInt()-1,s.nextInt()-1};for(;n-->0;c[u]=(char)(p-(p>122?26:0)),c[v]=(char)(t-(t>122?26:0)))int u=a[n][0],v=a[n][1],x=(v-u)%26,t=c[u]+x,p=c[v]+x;System.out.println(new String(c));}}}
                                                                                                                                                                                                                                                                                                                          ^
1 error
Language: C

main(){
	for(int n,m;scanf("%d%d",&n,&m),n;){
		int t=1001,p,ans,c=0,i;
		for(i=0;i<n;i++){
			int a; scanf("%d",&a);

			int j;
			for(j=m;j%a;j--);

			if(j<t || (j==t && a<=p)){
				c=(j==t&&a==pre?c+1:1);
				t=j;
				p=a;
				ans=i;
			}
		}

		printf("%d\n",c<2?ans+1:n);
	}
}

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){
      | ^~~~
main.c: In function 'main':
main.c:2:21: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    2 |         for(int n,m;scanf("%d%d",&n,&m),n;){
      |                     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(){
main.c:2:21: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    2 |         for(int n,m;scanf("%d%d",&n,&m),n;){
      |                     ^~~~~
main.c:2:21: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:11:45: error: 'pre' undeclared (first use in this function)
   11 |                                 c=(j==t&&a==pre?c+1:1);
      |                                             ^~~
main.c:11:45: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |                 printf("%d\n",c<2?ans+1:n);
      |                 ^~~~~~
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
int main(){
    int n,m;
    while(cin>>n>>m,n&&m){
        int is,ip,ig,ia,ib,id,it;
        string s,p,g,sa,sb;
        vector<vector<int> > G;
        vector<int>Eki;
        map<string,int>ma;
        Eki.resize(n,-1);
        G.resize(n, Eki);
        
        cin>>s>>p>>g;
        for(int i=0;i<m;i++){
            cin>>sa>>sb>>id>>it;
            
            map<string,int>::iterator ite;

            ite = ma.find(sa);
            if(ite == ma.end()){
                ma.insert(make_pair(sa, ma.size()));
            }
            ite = ma.find(sb);
            if(ite == ma.end()){
                ma.insert(make_pair(sb, ma.size()));
            }
            ia = ma.find(sa)->second;
            ib = ma.find(sb)->second;
            G[ia][ib]= id/40+it;
            G[ib][ia]= id/40+it;
        }
        
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                for(int k=0;k<n;k++){
                    if(G[j][i]!=-1&&G[i][k]!=-1){
                        if(G[j][k]==-1) G[j][k] = G[j][i]+G[i][k];
                        else G[j][k] = min(G[j][k],G[j][i]+G[i][k]);
                    }
                }
            }
        }
        is = ma.find(s)->second;
        ip = ma.find(p)->second;
        ig = ma.find(g)->second;
        cout<<G[is][ip]+<G[ip][ig]<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:25: error: expected primary-expression before '<' token
   50 |         cout<<G[is][ip]+<G[ip][ig]<<endl;
      |                         ^
a.cc:50:35: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '<unresolved overloaded function type>' to binary 'operator<<'
   50 |         cout<<G[is][ip]+<G[ip][ig]<<endl;
Language: C++

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

int main() {
  string name[2];
  int n, m;
  int chien, kyori;
  std::map<string, int> s2a;
  int d[510][510];
  while (cin >> n >>m, n) {
    for (int i=0; i < n; i++) {
      for (int j=0; j < n; j++) {
        if(i == j)dp[i][j] = 0;
        else d[i][j] = 1e9;
      }
    }

    for (int i = 0; i < 3; i++) {
      cin >>name[0];
      s2a[name[0]] = i;
    }
    
    for(int i = 0; i < m; i++){
      int a, b;
      int nameinc = 3;
      cin >> name[0] >> name[1];
      
      if (s2a.find(name[0]) == s2a.end()) {
        s2a[name[0]] = s2a.size() - 1;
        a = s2a[name[0]];
      } else {
        a = s2a[name[0]];
      }
      if (s2a.find(name[1]) == s2a.end()) {
        s2a[name[1]] = s2a.size() - 1;
        b = s2a[name[1]];
      } else {
        b = s2a[name[1]];
      }

      cin >> kyori>>chien;
      d[a][b] = d[b][a] = kyori/40 + chien;
    }
    
    for(int k = 0; k < n; k++) {
      for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
          d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
        }
      }
    }
    cout << d[0][1] + d[1][2] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: 'dp' was not declared in this scope; did you mean 'd'?
   13 |         if(i == j)dp[i][j] = 0;
      |                   ^~
      |                   d
Language: C++

#include<bits/stdc++.h>
using namespace std;
string S[5000],T[5000],V[5000],A,B,C;int a[5000],b[5000],n,m,dist[5000];
vector<string>U;vector<pair<int,int>>x[500];
int dfs(int s,int g){
	for(int i=0;i<5000;i++)dist[i]=1<<30;
	dist[s]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<x[j].size();k++){
				dist[x[j][k].first]=min(dist[x[j][k].first],dist[j]+x[j][k].second);
			}
		}
	}
	return dist[g];
}
int main(){
	while(true){
		cin>>n>>m;for(int i=0;i<500;i++)x[i].clear();
		if(n==0){break;}U.clear();cin>>A>>B>>C;
		for(int i=0;i<m;i++){
			cin>>S[i]>>T[i]>>a[i]>>b[i];
			U.push_back(S[i]);U.push_back(T[i]);
		}
		sort(U.begin(),U.end());V[0]=U[0];int cnt=1,G,H,I;
		for(int i=1;i<U.size();i++){
			if(U[i]!=U[i-1]){V[cnt]=U[i];cnt++;}
		}
		for(int i=0;i<cnt;i++){
			if(A==V[i])G=j;
			if(B==V[i])H=j;
			if(C==V[i])I=j;
		}
		for(int i=0;i<m;i++){
			int s1=0,t1=0;
			for(int j=0;j<cnt;j++){
				if(S[i]==V[j])s1=j;
				if(T[i]==V[j])t1=j;
			}
			X[s1].push_back(make_pair(s2,a[i]/40+b[i]));
			X[s2].push_back(make_pair(s1,a[i]/40+b[i]));
		}
		cout<<dfs(G,H)+dfs(H,I)<<endl;
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:30:38: error: 'j' was not declared in this scope
   30 |                         if(A==V[i])G=j;
      |                                      ^
a.cc:31:38: error: 'j' was not declared in this scope
   31 |                         if(B==V[i])H=j;
      |                                      ^
a.cc:32:38: error: 'j' was not declared in this scope
   32 |                         if(C==V[i])I=j;
      |                                      ^
a.cc:40:25: error: 'X' was not declared in this scope
   40 |                         X[s1].push_back(make_pair(s2,a[i]/40+b[i]));
      |                         ^
a.cc:40:51: error: 's2' was not declared in this scope; did you mean 's1'?
   40 |                         X[s1].push_back(make_pair(s2,a[i]/40+b[i]));
      |                                                   ^~
      |                                                   s1
a.cc:45:18: error: expected '}' at end of input
   45 |         return 0;
      |                  ^
a.cc:17:11: note: to match this '{'
   17 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
string S[5000],T[5000],V[5000],A,B,C;int a[5000],b[5000],n,m,dist[5000];
vector<string>U;vector<pair<int,int>>x[500];
int dfs(int s,int g){
	for(int i=0;i<5000;i++)dist[i]=1<<30;
	dist[s]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<x[j].size();k++){
				dist[x[j][k].first]=min(dist[x[j][k].first],dist[j]+x[j][k].second);
			}
		}
	}
	return dist[g];
}
int main(){
	while(true){
		cin>>n>>m;for(int i=0;i<500;i++)x[i].clear();
		if(n==0){break;}U.clear();cin>>A>>B>>C;
		for(int i=0;i<m;i++){
			cin>>S[i]>>T[i]>>a[i]>>b[i];
			U.push_back(S[i]);U.push_back(T[i]);
		}
		sort(U.begin(),U.end());V[0]=U[0];int cnt=1,G,H,I;
		for(int i=1;i<U.size();i++){
			if(U[i]!=U[i-1]){V[cnt]=U[i];cnt++;}
		}
		for(int i=0;i<cnt;i++){
			if(A==V[i])G=i;
			if(B==V[i])H=i;
			if(C==V[i])I=i;
		}
		for(int i=0;i<m;i++){
			int s1=0,t1=0;
			for(int j=0;j<cnt;j++){
				if(S[i]==V[j])s1=j;
				if(T[i]==V[j])t1=j;
			}
			x[s1].push_back(make_pair(s2,a[i]/40+b[i]));
			x[s2].push_back(make_pair(s1,a[i]/40+b[i]));
		}
		cout<<dfs(G,H)+dfs(H,I)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:51: error: 's2' was not declared in this scope; did you mean 's1'?
   40 |                         x[s1].push_back(make_pair(s2,a[i]/40+b[i]));
      |                                                   ^~
      |                                                   s1
Language: C++

#include<bits/stdc++.h>
using namespace std;
string S[5000],T[5000],V[5000],A,B,C;int a[5000],b[5000],n,m,dist[5000];
vector<string>U;vector<pair<int,int>>x[500];
int dfs(int s,int g){
	for(int i=0;i<5000;i++)dist[i]=1<<30;
	dist[s]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<x[j].size();k++){
				dist[x[j][k].first]=min(dist[x[j][k].first],dist[j]+x[j][k].second);
			}
		}
	}
	return dist[g];
}
int main(){
	while(true){
		cin>>n>>m;for(int i=0;i<500;i++)x[i].clear();
		if(n==0){break;}U.clear();cin>>A>>B>>C;
		for(int i=0;i<m;i++){
			cin>>S[i]>>T[i]>>a[i]>>b[i];
			U.push_back(S[i]);U.push_back(T[i]);
		}
		sort(U.begin(),U.end());V[0]=U[0];int cnt=1,G,H,I;
		for(int i=1;i<U.size();i++){
			if(U[i]!=U[i-1]){V[cnt]=U[i];cnt++;}
		}
		for(int i=0;i<cnt;i++){
			if(A==V[i])G=i;
			if(B==V[i])H=i;
			if(C==V[i])I=i;
		}
		for(int i=0;i<m;i++){
			int s1=0,t1=0;
			for(int j=0;j<cnt;j++){
				if(S[i]==V[j])s1=j;
				if(T[i]==V[j])t1=j;
			}
			x[s1].push_back(make_pair(s2,a[i]/40+b[i]));
			x[t1].push_back(make_pair(s1,a[i]/40+b[i]));
		}
		cout<<dfs(G,H)+dfs(H,I)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:51: error: 's2' was not declared in this scope; did you mean 's1'?
   40 |                         x[s1].push_back(make_pair(s2,a[i]/40+b[i]));
      |                                                   ^~
      |                                                   s1
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
struct ID{
  map<string, int> maker;
  int get(string s){
    int n = maker.size();
    if(maker.count(s)) return maker[s];
    else return maker[s] = n;
  }
};
struct edge{
  int from, to, cost;
  edge () {}
  edge(int from, int to, int cost) :
    from(from), to(to), cost(cost) {}
  bool operator < (const edge& r) const {
    return cost != r.cost ? cost > r.cost : from != r.from ? from < r.from : to < r.to;
  }
};

typedef vector<edge> edges;
typedef vector<edges> graph;

vector<int> dijkstra(const graph& g, int s){
  int n = g.size();
  vector<bool> visit(n, false);
  vector<int> dist(n, INF);
  vector<int> src(n, -1);
  priority_queue<edge> que;
  que.insert(edge(-1, s, 0));
  while(!que.empty()){
    edge e = que.top(); que.pop();
    if(visit[e.to]) continue;
    visit[e.to] = true;

    int from = e.to;
    REP(i, g[from].size()){
      int to = g[from][i].to;
      int ncost = e.cost + g[from][i].cost;
      if(visit[to] || ncost >= dist[to] ) continue;
      dist[to] = ncost;
      src[e.to] = from;
      que.push(edge(from, to, ncost));
    }
  }
  return dist;
}

int main(){
  int n,m;
  while(cin>>n>>m,n){
    graph G(n);
    string s,p,g;
    cin>>s>>p>>g;
    ID id;
    id.get(s);
    id.get(p);
    id.get(g);
    REP(i,m){
      string A,B;
      int ds,t;
      cin>>A>>B>>ds>>t;
      int dist = ds/40 + t;
      int na = id.get(A);
      int nb = id.get(B);
      G[na].push_back(edge(na, nb, dist));
      G[nb].push_back(edge(nb, na, dist));
    }
    vector<int> dist = dijkstra(G, 1);
    cout<<dist[0] + dist[2]<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'std::vector<int> dijkstra(const graph&, int)':
a.cc:45:23: error: 'INF' was not declared in this scope
   45 |   vector<int> dist(n, INF);
      |                       ^~~
a.cc:48:7: error: 'class std::priority_queue<edge>' has no member named 'insert'
   48 |   que.insert(edge(-1, s, 0));
      |       ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>x[2500];
vector<int>dist[2500];
string S;int h,w;
int main(){
	while(true){
		cin>>h>>w;int gx,gy,cnt=0;if(h==0)break;
		for(int i=0;i<2500;i++){x[i].clear();dist[i].clear();}
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin>>S;
				if(S=="S"){
					x[0].push_back(make_pair(i,j));
					dist[0].push_back(0);
				}
				else if(S=="G"){gx=i;gy=j;}
				else if(S!="."){
					int v=stoi(S);x[v].push_back(make_pair(i,j));
					cnt=max(cnt,v);dist[v].push_back(1<<30);
				}
			}
		}
		cnt++;x[cnt].push_back(make_pair(gx,gy));
		for(int i=1;i<=cnt;i++){
			for(int j=0;j<dist[i-1].size();j++){
				for(int k=0;k<dist[i].size();k++){
					int D=abs(x[i-1][j].first-x[i][k].first);
					D+=abs(x[i-1][j].second+x[i][k].second);
					dist[i][k]=min(dist[i][k],dist[i-1][j]+D);
				}
			}
		}
		cout<<diust[cnt][0]<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:23: error: 'diust' was not declared in this scope; did you mean 'dist'?
   34 |                 cout<<diust[cnt][0]<<endl;
      |                       ^~~~~
      |                       dist
Language: C++

#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<map>
#include<cassert>
#include<iomanip>
#include<queue>
#include<set>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<28)
#define MAX 100
#define MAX2 10010
using namespace std;
/*
struct P
{
  int x,y,cost;
  P(int x=-1,int y=-1,int cost=-inf):x(x),y(y),cost(cost){}
};
*/

int h,w;
//string G[MAX][MAX];
//int mincost[MAX2][MAX2];
vector<int> vec[MAX2];
int dp[MAX2];
//int Index[MAX2];
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};

int getManhattan(int a,int b)
{
  int x1 = a%w;
  int y1 = a/w;
  int x2 = b%w;
  int y2 = b/w; 
  return abs(x1-x2) + abs(y1-y2);
}

int main()
{
  while(cin >> w >> h,w|h)
    {
      //vector<int> ps;
      //rep(i,MAX2)rep(j,MAX2)mincost[i][j] = inf;
      rep(i,MAX2)
	{
	  //Index[i] = -inf;
	  dp[i] = inf;
	  vec[i].clear(); 
	}
      int max_digit = -inf;
      //int index = 0;
      int g;
      rep(i,h)
	{
	  rep(j,w)
	    {
	      string s;
	      cin >> s;
	      if(s[0] == '.')continue;
	      if(s[0] == 'S')
		{
		  //ps.push_back(index);
		  //Index[j+i*w] = index++;
		  vec[0].push_back(j+i*w);
		  dp[j+i*w] = 0;
		}
	      else if(s[0] == 'G')
		{
		  g = j+i*w;	  
		}
	      else
		{
		  //Index[j+i*w] = index;
		  //ps.push_back(index++);
		  int intValue = (atoi)(s.c_str());
		  assert(intValue < MAX2);
		  vec[intValue].push_back(j+i*w);
		  max_digit = max(max_digit,intValue);
		}
	    }
	}

      //Index[g] = index;
      //ps.push_back(index++);
      vec[++max_digit].push_back(g);


      /*
      rep(i,max_digit-1)
	{
	  rep(j,vec[i].size())
	    {
	      int x = vec[i][j]%w;
	      int y = vec[i][j]/w;
	      queue<P> que;
	      que.push(P(x,y,0));
	      mincost[vec[i][j]][vec[i][j]] = 0;
	      while(!que.empty())
		{
		  P p = que.front(); que.pop();

		  rep(k,4)
		    {
		      int nx = p.x + dx[k];
		      int ny = p.y + dy[k];
		      if(!(0 <= nx && nx < w && 0 <= ny && ny < h))continue;
		      if(mincost[vec[i][j]][nx+ny*w] > p.cost + 1)
			{
			  mincost[vec[i][j]][nx+ny*w] = p.cost + 1;
			  que.push(P(nx,ny,p.cost+1));
			}
		    }
		}
	    }
	}
*/
    

      rep(i,max_digit)
	{
	  rep(j,vec[i].size())
	    {
	      //cout << "now : " << vec[i][j] << " (" << vec[i][j]%w << "," << vec[i][j]/w << ")" << endl;
	      if(dp[vec[i][j]] == inf)continue;
	      rep(k,vec[i+1].size())
		{
		  dp[vec[i+1][k]] = min(dp[vec[i+1][k]],
					dp[vec[i  ][j]]+getManhattan(vec[i][j],vec[i+1][k])/*mincost[vec[i][j]][vec[i+1][k]]*/);
		}
	    }
	}
      assert(max_digit < MAX2)
      assert(vec[max_digit][0] < MAX2);
      cout << dp[vec[max_digit][0]] << endl;
    }
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from a.cc:7:
a.cc: In function 'int main()':
a.cc:137:7: error: void value not ignored as it ought to be
  137 |       assert(max_digit < MAX2)
      |       ^~~~~~
Language: C++

100 2 2 2
A 5 6
B 7 8
C 1 2
D 3 4
27 2 3 3
A 8 10
B 8 10
C 6 7
D 5 4
E 8 9
27 2 3 2
A 8 10
B 8 10
C 6 7
D 5 4
E 8 9
44 3 6 5
YamatoNoHito 9 10
ZettoNoHito 9 10
TMR 10 10
SkillNoGroup 8 10
NanaSama 6 9
FRPSD 6 8
Magi3rdDeshi 5 7
Magi13thDeshi 2 2
MagicalItoh 4 6
0 0 0 0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 100 2 2 2
      | ^~~
Language: C++

#include <iostream>
#include <cstdlib>
#include <string>
#include <memory.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1 << 29;

const int MAX_N = 1000010;
ll euler[MAX_N];
ll s[MAX_N];

void euler_phi(){
  rep(i, MAX_N) euler[i] = i;
  for(int i = 2; i < MAX_N; i++){
    if(euler[i] == i){
      for(int j = i; j < MAX_N; j += i) euler[j] = euler[j] / i * (i - 1);
    }
  }
}

int main(){
  euler_phi();
  s[0] = euler[0] + 1;
  for(int i = 1; i < MAX_N; i++) s[i] = s[i-1] + euler[i];
  int t, n;
  cin >> t;
  rep(i, t){
    cin >> n;
    cout << s[n] << endl;
  }F
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:39:4: error: 'F' was not declared in this scope
   39 |   }F
      |    ^
Language: C++

#include <iostream>
using namespace std;
#define N 1000003
int i,j,t;
__int64 p[N];
main(){
	p[1]=2;
	for(i=2;i<N;p[i++]=p[i-1]+(i-p[i]-1))if(!p[i])for(j=2*i;j<N;j+=i)p[j]+=j/i-1;
	for(cin>>t;t--;cout<<p[i]<<endl)cin>>i;
	return 0;
}

Compiler output:
a.cc:5:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 | __int64 p[N];
      | ^~~~~~~
      | __int64_t
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'p' was not declared in this scope
    7 |         p[1]=2;
      |         ^
Language: C++

count = range(1000001) 
for i in range(2, 500001):
    n = i * 2
    while n <= 1000000:
        count[n] -= (count[i] - 1) 
        n += i

ret = [0] * 1000001
ret[1] = 2
for i in range(2,1000001):
    ret[i] += count[i] + ret[i-1] - 1

t = int(raw_input())
for i in range(t):
    print ret[int(raw_input())] 

Compiler output:
a.cc:1:1: error: 'count' does not name a type
    1 | count = range(1000001)
      | ^~~~~
Language: C++

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v, w; };

ll MOD = 1000000009;
ll _MOD = 1000000009;
double EPS = 1e-10;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return (v[x] < 0) ? x : (v[x] = find(v[x])); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x != y) {
			if (-v[x] < -v[y]) swap(x, y);
			v[x] += v[y]; v[y] = x;
		}
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

i_i g(vector<int> a, vector<int> b);

i_i f(int n, vector<int>& a, vector<int>& b) {
	int m = a.size();
	union_find uf(n);
	for (int i = 0; i < m; i++)
		uf.unite(a[i], b[i]);
	vector<vector<int> > as(n), bs(n);
	for (int i = 0; i < m; i++) {
		int u = uf.find(a[i]);
		as[u].push_back(a[i]);
		bs[u].push_back(b[i]);
	}
	i_i ans(0, 1);
	for (int u = 0; u < n; u++) {
		if (uf.find(u) != u) continue;
		i_i p = g(as[u], bs[u]);
		ans.first += p.first;
		ans.second = (ll)ans.second * p.second % MOD;
	}
	return ans;
}

i_i g(vector<int>& a, vector<int>& b) {
	int m = a.size();
	vector<int> v;
	for (int i = 0; i < m; i++) {
		v.push_back(a[i]);
		v.push_back(b[i]);
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	int n = v.size();
	if (!n) n = 1;
	for (int i = 0; i < m; i++) {
		a[i] = lower_bound(v.begin(), v.end(), a[i]) - v.begin();
		b[i] = lower_bound(v.begin(), v.end(), b[i]) - v.begin();
	}
	if (m == (ll)n * (n - 1) / 2)
		return i_i(1, n);
	vector<int> d(n);
	for (int i = 0; i < m; i++) {
		d[a[i]]++;
		d[b[i]]++;
	}
	int _u;
	for (int u = 0; u < n; u++)
		if (d[u] == n - 1)
			_u = u;
	vector<int> _a, _b;
	for (int i = 0; i < m; i++)
		if (a[i] != _u && b[i] != _u) {
			_a.push_back(a[i] < _u ? a[i] : a[i] - 1);
			_b.push_back(b[i] < _u ? b[i] : b[i] - 1);
		}
	return f(n - 1, _a, _b);
}

int main() {
	int n, m; cin >> n >> m;
	vector<int> a(m), b(m);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--;
		b[i]--;
	}
	i_i p = f(n, a, b);
	cout << p.first << endl;
	cout << p.second << endl;
}

Compiler output:
/usr/bin/ld: /tmp/cct7uRGc.o: in function `f(int, std::vector<int, std::allocator<int> >&, std::vector<int, std::allocator<int> >&)':
a.cc:(.text+0x27d): undefined reference to `g(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>

typedef long long LL;
char str[2][50010];
int l[2],sz[2],len[2][50010],cnt[2][50010],son[2][50010][30],fail[2][50010];
LL ans;
void addnode(int l,int k);
void build(int k);
void dfs(int u,int v);

int main()
{
    //freopen("palin.in","r",stdin);
    //freopen("palin.out","w",stdout);
    int i,j;
    for(i=0;i<=1;i++)
    {
        gets(str[i]);
        l[i]=strlen(str[i]);
        for(j=l[i];j>=1;j--)
            str[i][j]=str[i][j-1];
        build(i);
    }
    ans=0;
    dfs(1,1);  dfs(2,2);
    printf("%lld\n",ans);
    return 0;
}

void addnode(int l,int k)
{
    sz[k]++;
    len[k][sz[k]]=l;  cnt[k][sz[k]]=0;
}

void build(int k)
{
    sz[k]=0;
    addnode(-1,k);  addnode(0,k);
    fail[k][sz[k]-1]=fail[k][sz[k]]=sz[k]-1;
    int i,u,x;
    for(u=1,i=1;i<=l[k];i++)
    {
        while(i-len[k][u]-1<1 || str[k][i-len[k][u]-1]!=str[k][i]) u=fail[k][u];
        x=str[k][i]-'A';
        if(!son[k][u][x])
        {
            addnode(len[k][u]+2,k);
            int v=fail[k][u];
            while(i-len[k][v]-1<1 || str[k][i-len[k][v]-1]!=str[k][i]) v=fail[k][v];
            fail[k][sz[k]]=(son[k][v][x] ? son[k][v][x] : 2);
            son[k][u][x]=sz[k];
        }
        cnt[k][son[k][u][x]]++;
        u=son[k][u][x];
    }
    for(i=sz[k];i>3;i--)
        cnt[k][fail[k][i]]+=cnt[k][i];
}

void dfs(int u,int v)
{
    if(len[0][u]>0)
        ans+=(LL)cnt[0][u]*cnt[1][v];
    int i;
    for(i=0;i<26;i++)
        if(son[0][u][i] && son[1][v][i])
            dfs(son[0][u][i],son[1][v][i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   20 |         gets(str[i]);
      |         ^~~~
      |         getw