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

#include <iostream>

using namespace std;

int main() {
    int N; cin >> N;
    int A[10000] = {};

    int min = INT_MAX;
    int min_index = N;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        if(min > A[i]) {
            min = A[i];
            min_index = i;
        }
    }

    while(true) {
        bool flag = true;
        for(int i = 0; i < N; i++) {
            if(min_index != i) {
                flag &= A[i] == 0;
                A[i] %= min;
                if(A[i] > 0 && A[i] < min) {
                    min = A[i]; min_index = i;
                }
            }
        }
        if(flag) break;
    }

    cout << A[min_index] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: 'INT_MAX' was not declared in this scope
    9 |     int min = INT_MAX;
      |               ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x) cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x) cout << ((x) ? "YES" : "NO") << endl
#define absi(a) (((a) >= 0) ? (a) : (-(a))) 

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

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

	ll ret = gcd(a[0], a[1]);
	repd(i, 2, n) ret = gcd(ret, a[i]);
	cout << ret << endl:
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:25:28: error: expected ';' before ':' token
   25 |         cout << ret << endl:
      |                            ^
      |                            ;
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[n];
    for(int i=0; i<N; i++){
      array[i] = sc.nextInt();
    }
    
    int m = array[0];
    for(int i=1; i<array.length; i++){
      int n = array[i];
      if(n > m){
        int l = m;
        m = n;
        n = l;
      }
      while(true){
        int r = m%n;
        if(r == 0){
          m = r;
          break;
        }
        m = n;
        n = r;
      }
    }
    System.out.print(m);
  }
}


Compiler output:
Main.java:6: error: cannot find symbol
    int[] array = new int[n];
                          ^
  symbol:   variable n
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] array = new int[n];
    for(int i=0; i<n; i++){
      array[i] = sc.nextInt();
    }
    
    int m = array[0];
    for(int i=1; i<array.length; i++){
      int n = array[i];
      if(n > m){
        int l = m;
        m = n;
        n = l;
      }
      while(true){
        int r = m%n;
        if(r == 0){
          m = r;
          break;
        }
        m = n;
        n = r;
      }
    }
    System.out.print(m);
  }
}

Compiler output:
Main.java:13: error: variable n is already defined in method main(String[])
      int n = array[i];
          ^
1 error
Language: C++

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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<long long int> A(N);
  
  for(int i = 0; i < N; i++) cin >> A[i];
    
  sort(A.begin(),A.end());
  
  int minr = A[0];
  for(int i = 0; i < N - 1; i++){
    int r  = A[i + 1] % mir;
    if(r != 0 &&r < minr){
      minr = r;
    }else if(r == 0){
      continue;
    }
  }
  cout << minr;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'mir' was not declared in this scope; did you mean 'minr'?
   19 |     int r  = A[i + 1] % mir;
      |                         ^~~
      |                         minr
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int i;
  for(i = 0; i< n ;i++){
    cin >> a[i];
  }
  int m,l,o,p,ans:
  if(a[1] > a[0]){
    m = a[1];
    l = a[0];
  }else{
    m = a[0];
    l = a[1];
  }
  while(o != 0){
      o = m % l;
      if(o == 0){
        p = l;
      }
      m = l;
      l = o;
    }
  for(i = 2;i < n; i++){
    if(a[i] > p){
      m = a[i];
      l = p;
    }else{
      m = p;
      l = a[i];
    }
    while(o != 0){
      o = m % l;
      if(o == 0){
        p = l;
      }
      m = l;
      l = o;
    }
  }
  cout << p << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: expected initializer before ':' token
   12 |   int m,l,o,p,ans:
      |                  ^
a.cc:16:4: error: 'else' without a previous 'if'
   16 |   }else{
      |    ^~~~
Language: C

#include<stdio.h>

int main(){
  int n,i,j,kotae=1,amari,min=1000000001;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(a[i]<min){min=a[i];}
  }
  if(min==1){
    printf("1");
  return 0;
  }
  for(j=2;j<=min;){
    amari=0;
    for(i=0;i<n;i++){
      amari+=a[i]%j;
    }
    if(amari==0){
      for(i=0;i<n;i++){
        a[i]/=j;
      }
      min/=j;
      kotae*=j;
      j=2;
      if(min==1){
        printf("%d",kotae);
        return 0;
      }
    }else{
      if(j==2)j=3 else j+=2;
    }
  }
  printf("%d",kotae);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:32:18: error: expected ';' before 'else'
   32 |       if(j==2)j=3 else j+=2;
      |                  ^~~~~
      |                  ;
Language: C

#include<stdio.h>

int main(){
  int n,i,j,kotae=1,amari,min=1000000001;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(a[i]<min){min=a[i];}
  }
  if(min==1){
    printf("1");
  return 0;
  }
  for(j=2;j<=min;if(j==2)j=3 else j+=2){
    amari=0;
    for(i=0;i<n;i++){
      amari+=a[i]%j;
    }
    if(amari==0){
      for(i=0;i<n;i++){
        a[i]/=j;
      }
      min/=j;
      kotae*=j;
      j=2;
      if(min==1){
        printf("%d",kotae);
        return 0;
      }
    }
  }
  printf("%d",kotae);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:18: error: expected expression before 'if'
   15 |   for(j=2;j<=min;if(j==2)j=3 else j+=2){
      |                  ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define INF 1e9

int gcd(int m, int n) {
  int temp;
  while (m % n != 0) {
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

int main() {
  int N;
  cin >> N;
  
  int a;
  vector<int> A;
  A.reserve(N);
  for (int i = 0; i < N; i++) {
    cin >> a;
    A.emplace_back(a);
  }

  t = A[0];
  for (int i = 0; i < N; i++) {
    t = gcd(t, A[i]);
  }
  cout << t << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: 't' was not declared in this scope
   27 |   t = A[0];
      |   ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int ugokasu,uugokasu,saidai=1,koubai;
long long int a;
  cin >> a;
  long long int b[a];
  for(ugokasu = 0;ugokasu<a;ugokasu++)
  {
  cin >> b[ugokasu];
  }
  
    for(ugokasu = 0;ugokasu<a;ugokasu++)
  {
  if(saidai<b[ugokasu])
  {
  saidai=b[ugokasu];
  }
      
  }
  
  for(ugokasu = 1;ugokasu<=saidai;ugokasu++)
  {
    
   for(uugokasu=o;uugokasu<a;uugokasu++)
   {
   if((b[uugokasu]%ugokasu)!=0)
   {
     break;
   }
   
   }
     if(uugokasu==a)
     {
     koubai=ugokasu;
   }
    
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: 'o' was not declared in this scope
   27 |    for(uugokasu=o;uugokasu<a;uugokasu++)
      |                 ^
Language: C++

#include <iostream>
#include <vector>
typedef long long int ll;
using namespace std;

ll gcd_(ll a,ll b){
    if(a<b){  
        swap(a,b);
    }
    if(b==0){
        return a;
    }
    return gcd_(b,a%b);
}
 
ll gcd(vl l){
    ll ans=l[0];
    for(size_t i=0;i<l.size();i++){
        ans=gcd_(ans,l[i]);
    }
    return ans;
}

int main(){
    ll N;
    cin>>N;
    vector<ll> vec(N);
    for(ll i=0;i<N;i++){
        cin>>vec[i];
    }
    
    cout<<gcd(vec)<<endl;

    return 0;
}

Compiler output:
a.cc:16:8: error: 'vl' was not declared in this scope; did you mean 'll'?
   16 | ll gcd(vl l){
      |        ^~
      |        ll
a.cc: In function 'int main()':
a.cc:32:14: error: 'gcd' cannot be used as a function
   32 |     cout<<gcd(vec)<<endl;
      |           ~~~^~~~~
Language: C++

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

int main() {
  int n,g;
  cin >> n >> a;
  for(int i=2; i<=n; i++) {
    int a;
    cin >> a;
    g=__gcd(g,a);
  }
  cout << g << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: 'a' was not declared in this scope
    6 |   cin >> n >> a;
      |               ^
Language: C

#include <bits/stdc++.h>
using namespace std;
int gcd( int x, int y){
    int kouyakusuu;
    int r=min(x,y);
    while(r!=0){
        r=max(x,y)%min(x,y);
        if(r==0) return min(x,y);
        if(x>y) x=r;
        else y=r;
    }
    
}
int main(void){
    int n; cin>>n;
    vector <int> monster (n);
    for (int i=0;i<n;i++){
        cin>>monster[i];
        if(i>0) monster[i]=gcd(monster[i],monster[i-1]);
    }
    cout<<monster[n-1]<<endl;
}

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

// https://atcoder.jp/contests/abc118/tasks/abc118_c
 
// http://ctylim.hatenablog.com/entry/2015/08/30/191553
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
 
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define RSORT(c) sort((c).rbegin(), (c).rend())
#define MAXINDEX(c) distance((c).begin(), max_element((c).begin(), (c).end()))
#define MININDEX(c) distance((c).begin(), min_element((c).begin(), (c).end()))
#define DEBUG(x) std::cerr << #x << " = " << (x) << " (" << __FILE__ << "::" << __LINE__ << ")" << std::endl;
#define ERROR(s) std::cerr << "Error::" << __FILE__ << "::" << __LINE__ << "::" << __FUNCTION__ << "::" << (s) << std::endl;
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
 
 
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;
 
int inputValue(){
  int a;
  std::cin >> a;
  return a;
}
 
void inputArray(int *p, int a){
    rep(i, a){
        std::cin >> p[i];
        // scanf("%d",p+i);
    }
}
 
void inputVector(std::vector<int> *p, int a){
  rep(i, a){
    int input;
    // std::cin >> input;
    scanf("%d",&input);
    p->push_back(input);
  }
}
 
template <typename T>
void output(T a, int precision){
  if (precision > 0){
    std::cout << std::setprecision(precision) << a << "\n";
  }else{
    std::cout << a << "\n";
  }
}
 
using namespace std;
 
int gcd(int a,int b){
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}
 
 
int main(int argc ,char **argv){
 
  int N = inputValue();
  vector <int> v;
  inputVector(&v, N);
 
  // cout << gcd(5,13) << endl;
  int d = min_element((v).begin(), (v).end());
  EACH(k, v) {
    d = gcd(d, *k);
  }
  // cout << d << endl;
  printf("%d\n", d);
 
	return 0;
}



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:83:22: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   83 |   int d = min_element((v).begin(), (v).end());
      |           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
      |                      |
      |                      __gnu_cxx::__normal_iterator<int*, std::vector<int> >
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int N;
  cin >> N;
  int A[N], B[N];
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  for(int j=0; j<N-1; j++){
    for(int k=1; k<N; k++){
      if(A[k] > A[j]){
        tmp = A[j];
        A[j] = A[k];
        A[k] = tmp;
      }
    }
  }
  for(int b=0; b<N; b++){
    if(A[0] > A[b]){
      while(A[b] == 0){
        A[0], A[b] = A[b], A[0]%A[b];
      }
    }
    else{
      while(A[b] == 0){
        A[0], A[b] = A[b], A[b]%A[0];
      }
    }
  }
  cout << A[0];
  return 0;
}
      
      

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   15 |         tmp = A[j];
      |         ^~~
      |         tm
Language: C++

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

int gcd(int i , int j){
	if(i > j) swap(i,j)
	for(int k = i ; i > 0 ; i--){
		if(i%k == 0 && j % k == 0) return k;
	}
}

int main() {
	int n,b; cin >>n>>b;
	for (int i = 0 ; i < n -1 ; i++){
		int c; cin >>c;
		if(b > c) swap(b,c);
		b = c%b;
	} 
	cout << gcd(b,c) << endl;
}

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:5:28: error: expected ';' before 'for'
    5 |         if(i > j) swap(i,j)
      |                            ^
      |                            ;
    6 |         for(int k = i ; i > 0 ; i--){
      |         ~~~                 
a.cc:6:36: error: expected ';' before ')' token
    6 |         for(int k = i ; i > 0 ; i--){
      |                                    ^
      |                                    ;
a.cc:9:1: warning: no return statement in function returning non-void [-Wreturn-type]
    9 | }
      | ^
a.cc: In function 'int main()':
a.cc:18:23: error: 'c' was not declared in this scope
   18 |         cout << gcd(b,c) << endl;
      |                       ^
Language: C++

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

int gcd(int i , int j){
	if(i > j) swap(i,j);
	for(int k = i ; i > 0 ; i--){
		if(i%k == 0 && j % k == 0) return k;
	}
}

int main() {
	int n,b; cin >>n>>b;
	for (int i = 0 ; i < n -1 ; i++){
		int c; cin >>c;
		b = gcd(b,c);
	} 
	cout << gcd(b,c) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: 'c' was not declared in this scope
   17 |         cout << gcd(b,c) << endl;
      |                       ^
a.cc: In function 'int gcd(int, int)':
a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
Language: C++

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

int gcd(int i , int j){
	if(i > j) swap(i,j)
	for(int k = i ; i > 0 ; i--){
		if(i%k == 0 && j % k == 0) return k;
	}
}

int main() {
	int n,b; cin >>n>>b;
	for (int i = 0 ; i < n -1 ; i++){
		int c; cin >>c;
		b = gcd(b,c);
	} 
	cout << gcd(b,c) << endl;
}

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:5:28: error: expected ';' before 'for'
    5 |         if(i > j) swap(i,j)
      |                            ^
      |                            ;
    6 |         for(int k = i ; i > 0 ; i--){
      |         ~~~                 
a.cc:6:36: error: expected ';' before ')' token
    6 |         for(int k = i ; i > 0 ; i--){
      |                                    ^
      |                                    ;
a.cc:9:1: warning: no return statement in function returning non-void [-Wreturn-type]
    9 | }
      | ^
a.cc: In function 'int main()':
a.cc:17:23: error: 'c' was not declared in this scope
   17 |         cout << gcd(b,c) << endl;
      |                       ^
Language: C++

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

int main() {
	int n,b; cin >>n>>>b;
	for (int i = 0 ; i < n -1 ; i++){
		int c; cin >>c;
		if(b > c) swap(b,c);
		b = c%b
	} 
	cout << b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:27: error: expected primary-expression before '>' token
    5 |         int n,b; cin >>n>>>b;
      |                           ^
a.cc:9:24: error: expected ';' before '}' token
    9 |                 b = c%b
      |                        ^
      |                        ;
   10 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll n;
ll a[100010];
int main(){
    cin >> n;
    cin >> a[0];
    ll mn = MM;
    for(int i = 1; i < n; i++){
        cin >> a[i];
        ll k = a[i];
        if(mn < k){
            tmp = mn;
            mn = k;
            k = tmp;
        }
        ll r = mn%k;
        while(r){
            mn = k;
            k = r;
            r = mn % k;
        }
        mn = k;
    }
    cout << mn << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   27 |             tmp = mn;
      |             ^~~
      |             tm
Language: C++

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

int main() {
    int n;
    int ans = 0;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n);
    
    for (int i = 1; i < n; i++) {
        ans += a[i];
    }
    ans = ans % a[0];
    
    if (ans == 0) {
        cout << a[0] << endl;
    } else {
        cout << ans << endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(a, a + n);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    while(A.size() > 1) {
        vector<int>::iterator minIt = std::min_element(A.begin(), A.end());
        vector<int>::iterator maxIt = std::max_element(A.begin(), A.end());
        size_t minIndex = distance(A.begin(), minIt);
        size_t maxIndex = distance(A.begin(), maxIt);

        A[maxIndex] = A[maxIndex] - A[minIndex];
        if(A[maxIndex] <= 0) {
            A.erase(maxIt);
        }
    }
    cout << A[0] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:44: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   14 |         vector<int>::iterator minIt = std::min_element(A.begin(), A.end());
      |                                            ^~~~~~~~~~~
      |                                            tuple_element
a.cc:15:44: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   15 |         vector<int>::iterator maxIt = std::max_element(A.begin(), A.end());
      |                                            ^~~~~~~~~~~
      |                                            tuple_element
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    while(A.size() > 1) {
        vector<int>::iterator minIt = min_element(A.begin(), A.end());
        vector<int>::iterator maxIt = max_element(A.begin(), A.end());
        size_t minIndex = distance(A.begin(), minIt);
        size_t maxIndex = distance(A.begin(), maxIt);

        A[maxIndex] = A[maxIndex] - A[minIndex];
        if(A[maxIndex] <= 0) {
            A.erase(maxIt);
        }
    }
    cout << A[0] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:39: error: 'min_element' was not declared in this scope
   14 |         vector<int>::iterator minIt = min_element(A.begin(), A.end());
      |                                       ^~~~~~~~~~~
a.cc:15:39: error: 'max_element' was not declared in this scope
   15 |         vector<int>::iterator maxIt = max_element(A.begin(), A.end());
      |                                       ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
template <class T>
vector<T> getv(int n){
	vector<T> vec;
	rep(i,n){
		T input;
		cin >> input;
		vec.emplace_back(input);
	}
	return vec;
}

int gcd(int a, int b){return (b==0) ? a : gcd(b,a%b);}
int main(){
	int N;
	cin >> N;
	vector<int> A = getv<int>(N);
	for(int i=0; i<=N-2; i++) A[i+1]=gcd(A[i],A[i+1]);
	cout << A[N-1] << endl;
}


Compiler output:
a.cc: In function 'std::vector<T> getv(int)':
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         rep(i,n){
      |             ^
a.cc:7:9: error: there are no arguments to 'rep' that depend on a template parameter, so a declaration of 'rep' must be available [-fpermissive]
    7 |         rep(i,n){
      |         ^~~
a.cc:7:9: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:7:17: error: expected ';' before '{' token
    7 |         rep(i,n){
      |                 ^
      |                 ;
a.cc: In instantiation of 'std::vector<T> getv(int) [with T = int]':
a.cc:19:27:   required from here
   19 |         vector<int> A = getv<int>(N);
      |                         ~~~~~~~~~^~~
a.cc:7:12: error: 'rep' was not declared in this scope
    7 |         rep(i,n){
      |         ~~~^~~~~
Language: C++

input()
m = sorted([int(i) for i in input().split()])
for i in m[1:]:
    if (i%m[0])!=0:
        print(1)
        end
print(m[0])

Compiler output:
a.cc:2:1: error: expected constructor, destructor, or type conversion before 'm'
    2 | m = sorted([int(i) for i in input().split()])
      | ^
Language: C++

n = int(input())
m = sorted([int(i) for i in input().split()])
for i in m[1:]:
    if (i%m[0])!=0:
        print(1)
        end
print(m[0])

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

#include <iostream>
using namespace std;

int main(){
 int n;
 int A[100000];
 int gcd[100000];
 int i_value;
 int i_next_value;
 int gcd_previous;
 int min=0;

 cin>>n;

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




for(int i=0;i<n-1;i++){
    gcd[i]=__gcd(A[i],A[i+1]);
    A[i+1]=gcd[i];
}

sort(gcd,gcd+n-1);

cout<<gcd[0]<<endl;
return 0;

} 


Compiler output:
a.cc: In function 'int main()':
a.cc:23:12: error: '__gcd' was not declared in this scope; did you mean 'gcd'?
   23 |     gcd[i]=__gcd(A[i],A[i+1]);
      |            ^~~~~
      |            gcd
a.cc:27:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   27 | sort(gcd,gcd+n-1);
      | ^~~~
      | short
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int gcd(int a, int b){
  int c = a%b;
  if(!c){
    return b
  }
  else{
    return gcd(b, c)
  }
}

int main(){
  int n;
  cin >> n;
  int l[n];
  for(int i=0; i<n; i++){
    cin >> l[i];
  }
  bool flg = true;
  while(flg){
    sort(l, l+n);
    if(l[0] == l[n-1]){
      cout << l[0] << endl;
      break;
    }
    else{
      for(int j; j<n; j++){
        int x = gcd(l[j], l[0]);
        if(x == 1){
          cout << 1 << endl;
          flg = false;
          break;
        }
        else{
          l[j] = x;
        }
      }
    }
  }
}

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:9:13: error: expected ';' before '}' token
    9 |     return b
      |             ^
      |             ;
   10 |   }
      |   ~          
a.cc:12:21: error: expected ';' before '}' token
   12 |     return gcd(b, c)
      |                     ^
      |                     ;
   13 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
int a,b;main(){std::cin>>a>>a;while(std::cin>>b)a=__gcd(a,b);std::cout<<a;}


Compiler output:
a.cc:2:9: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | int a,b;main(){std::cin>>a>>a;while(std::cin>>b)a=__gcd(a,b);std::cout<<a;}
      |         ^~~~
a.cc: In function 'int main()':
a.cc:2:51: error: '__gcd' was not declared in this scope
    2 | int a,b;main(){std::cin>>a>>a;while(std::cin>>b)a=__gcd(a,b);std::cout<<a;}
      |                                                   ^~~~~
a.cc:2:51: note: suggested alternatives:
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   'std::__gcd'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58:
/usr/include/c++/14/numeric:134:5: note:   'std::__detail::__gcd'
  134 |     __gcd(_Tp __m, _Tp __n)
      |     ^~~~~
Language: C++

#include<bits/stdc++.h>
int a,b;main(){std::cin>>a>>a;while(cin>>b)a=__gcd(a,b);std::cout<<a;}

Compiler output:
a.cc:2:9: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | int a,b;main(){std::cin>>a>>a;while(cin>>b)a=__gcd(a,b);std::cout<<a;}
      |         ^~~~
a.cc: In function 'int main()':
a.cc:2:37: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    2 | int a,b;main(){std::cin>>a>>a;while(cin>>b)a=__gcd(a,b);std::cout<<a;}
      |                                     ^~~
      |                                     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:2:46: error: '__gcd' was not declared in this scope
    2 | int a,b;main(){std::cin>>a>>a;while(cin>>b)a=__gcd(a,b);std::cout<<a;}
      |                                              ^~~~~
a.cc:2:46: note: suggested alternatives:
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   'std::__gcd'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58:
/usr/include/c++/14/numeric:134:5: note:   'std::__detail::__gcd'
  134 |     __gcd(_Tp __m, _Tp __n)
      |     ^~~~~
Language: C

#include <iostream>
using namespace std;
int gcd(int x, int y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

int main()
{
    int n, ans = 0, a;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a);
        ans = gcd(ans, a);
    }
    printf("%d\n", ans);
    return 0;
}


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

int gcd(int x, int y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

int main()
{
    int n, ans = 0, a;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a);
        ans = gcd(ans, a);
    }
    printf("%d\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'scanf' was not declared in this scope
   11 |     scanf("%d", &n);
      |     ^~~~~
a.cc:17:5: error: 'printf' was not declared in this scope
   17 |     printf("%d\n", ans);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int gcd(int x, int y)
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
int n;
int a[maxx];

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		if(a[i] & 1) cnt++;
	}
	if(cnt) cout << 1 << endl;
	else cout << 2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: 'cnt' was not declared in this scope; did you mean 'int'?
   12 |                 if(a[i] & 1) cnt++;
      |                              ^~~
      |                              int
a.cc:14:12: error: 'cnt' was not declared in this scope; did you mean 'int'?
   14 |         if(cnt) cout << 1 << endl;
      |            ^~~
      |            int
Language: C++

using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderTemplate
{
    public class App
    {
        public static void Main(string[] args)
        {
            Console.ReadLine();
	        var p = Console.ReadLine().Split().Select(s=>long.Parse(s)).OrderBy(i=>i).AsEnumerable();
            Console.WriteLine(p.Aggregate(p.First(),(s,n)=>gcd(s,n)));
        }
        public static long gcd(long a,long b)
        {
            return b == 0 ? a : gcd(b, a % b);
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:7:5: error: expected unqualified-id before 'public'
    7 |     public class App
      |     ^~~~~~
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int a,b;
    a=scan.nextInt();
    for(int i=1;i<n;i++){
      b=scan.nextInt();
      a=gcd(a,b);
    }
  }
  System.out.println(a);
  public static int gcd(int a,int b){
    if(b==0){
      return a;
    }else{
      return gcd(b,a%b);
    }
  }
}


Compiler output:
Main.java:13: error: <identifier> expected
  System.out.println(a);
                    ^
Main.java:13: error: <identifier> expected
  System.out.println(a);
                      ^
2 errors
Language: C++

include<iostream>
using namespace std;

int main(){
  int N;
  cin >> N;
  
  long long int A[N];
  
  for(int i = 0; i < N; i++) cin >> A[i];
  
  sort(A.start() , A.end(), greater<long long int>)
  int ans = 0;
  bool f = false;
  for(int i = 1; i < N; i++){
    long long int tmp = A[i];
    int d = tmp % A[i - 1];
    if(d != 0){
       A[i] = d;
    }else{
       ans = A[i];
       f = true;
       break;
    }
    if(f == false) ans = A[N - 1];
  }
cout << ans;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> N;
      |   ^~~
a.cc:12:10: error: request for member 'start' in 'A', which is of non-class type 'long long int [N]'
   12 |   sort(A.start() , A.end(), greater<long long int>)
      |          ^~~~~
a.cc:12:22: error: request for member 'end' in 'A', which is of non-class type 'long long int [N]'
   12 |   sort(A.start() , A.end(), greater<long long int>)
      |                      ^~~
a.cc:12:29: error: 'greater' was not declared in this scope
   12 |   sort(A.start() , A.end(), greater<long long int>)
      |                             ^~~~~~~
a.cc:12:37: error: expected primary-expression before 'long'
   12 |   sort(A.start() , A.end(), greater<long long int>)
      |                                     ^~~~
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |   sort(A.start() , A.end(), greater<long long int>)
      |   ^~~~
      |   short
a.cc:21:8: error: 'ans' was not declared in this scope
   21 |        ans = A[i];
      |        ^~~
a.cc:25:20: error: 'ans' was not declared in this scope
   25 |     if(f == false) ans = A[N - 1];
      |                    ^~~
a.cc:27:1: error: 'cout' was not declared in this scope
   27 | cout << ans;
      | ^~~~
a.cc:27:9: error: 'ans' was not declared in this scope
   27 | cout << ans;
      |         ^~~
Language: C++

#include <iostream>
using namespace std;

int gcd(int a, int b){
  if(b>=a)return gcd(b, a);
  if(b==0)return a;
  return gcd(b, a%b);
}

int main(){
  int n, ret;
  cin >> n >> ret;
  for(int i=1; i<n; i++){
    cin >> a;
    ret=gcd(ret, a);
  }
  cout << ret;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 'a' was not declared in this scope
   14 |     cin >> a;
      |            ^
Language: C++

#include <iostream>
#include <vector>
#define MAX 100001
using namespace std;

int main(){
  int N,tmp;
  cin >> N;
  vector<int> A;
  for(int i = 0;i < N;i++){
    cin >> tmp;
    A.push_back(tmp);
  }
  while(A.size() > 1){
    sort(A.begin(),A.end());
    for(int i = 0;i < A.size();i++){
      if(i == 0 && A[i] != 0) break;
      else if(i != 0 && A[i] != 0){
         A.erase(A.begin(),A.begin()+i);
         break;
       }
    }
    for(int i = 1;i < A.size();i++){
      A[i] %= A[0];
    }
  }
  cout << A[0] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(A.begin(),A.end());
      |     ^~~~
      |     short
Language: C++

#include <bits/std++.h>

using namespace std;

int main() {
  int n, a;
  cin >> n;
  vector<int> v;
  for(int i = 0; i < n; i++) {
    cin >> a;
    v.emplace_back(a);
  }
  int x = gcd(v[0], v[1]);
  for(int i = 2; i < n; i++) {
    x = gcd(x, v[i]);
  }

  cout << x << endl;
}

Compiler output:
a.cc:1:10: fatal error: bits/std++.h: No such file or directory
    1 | #include <bits/std++.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, (a % b));
}

int main(){

    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int ans = gcd(a[0], a[1]);
    for(int i = 2; i < n; i++){
        ans = gcd(ans, a[i])
    }    

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: expected ';' before '}' token
   16 |         ans = gcd(ans, a[i])
      |                             ^
      |                             ;
   17 |     }
      |     ~
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=1e5;
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int N;
int main(){
	cin>>N;
	int ans=0;
	REP(i,N){
		cin>>a;
		ans=gcd(ans,a);
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:22: error: 'a' was not declared in this scope
   17 |                 cin>>a;
      |                      ^
Language: C++

#include <iostream> 
#include <iomanip> 
#include <vector> 
#include <algorithm> 
#include <numeric> 
#include <functional> 
#include <cmath> 
#include <queue> 
#include <stack> 

#define Ford(i,a,b) for (int i=(a);i<(b);i++) 
#define For(i,n) Ford(i,0,n) 
typedef long long ll; 

using namespace std;

int gcd(int _a, int _b){
  if(_b==0) return _a;
  
  gcd(_a, _a%_b);
}

int main(){
  int N;
  cin>>N;
  int a[N];
  int gcd = gcd(a[0],a[1]);
  for(int i=2;i<N;i++){
    gcd = gcd(gcd, a[i]);
  }
  
  cout<<gcd<<endl;
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: 'gcd' cannot be used as a function
   27 |   int gcd = gcd(a[0],a[1]);
      |             ~~~^~~~~~~~~~~
a.cc:29:14: error: 'gcd' cannot be used as a function
   29 |     gcd = gcd(gcd, a[i]);
      |           ~~~^~~~~~~~~~~
a.cc: In function 'int gcd(int, int)':
a.cc:20:6: warning: control reaches end of non-void function [-Wreturn-type]
   20 |   gcd(_a, _a%_b);
      |   ~~~^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 10000
#define MAP 100
#define Pair pair<int,int>

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int main(){
    ll n; cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a,a+n);
    ll gcd;
    ll s = a[0], t = a[1];
    u = s%t;
    while(u!=0){
        s = t;
        t = u;
        u = s%t;
    }
    gcd = t;
    for(ll i = 1; i < n-1; i++){
        ll x,y,tmp;
        x = a[i+1];
        y = gcd;
        ll r = x%y;
        while(r != 0){
            x = y;
            y = r;
            r = x%y;
        }
        gcd = y;
    }
    cout << gcd << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'u' was not declared in this scope
   21 |     u = s%t;
      |     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 10000
#define MAP 100
#define Pair pair<int,int>

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int main(){
    ll n; cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a,a+n);
    ll gcd;
    ll s = a[0], t = s[1], u = s%t;
    while(u!=0){
        s = t;
        t = u;
        u = s%t;
    }
    gcd = t;
    for(ll i = 1; i < n-1; i++){
        ll x,y,tmp;
        x = a[i+1];
        y = gcd;
        ll r = x%y;
        while(r != 0){
            x = y;
            y = r;
            r = x%y;
        }
        gcd = y;
    }
    cout << gcd << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:23: error: invalid types 'll {aka long long int}[int]' for array subscript
   20 |     ll s = a[0], t = s[1], u = s%t;
      |                       ^
a.cc:21:11: error: 'u' was not declared in this scope
   21 |     while(u!=0){
      |           ^
Language: C++

#include<iostream>
using namespace std;

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

int main() {
    int N;
    cin >> N;
    int A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    int ans = A[0];
    for (int i = 1; i < N; i++) {
        ans = gcd(ans, A[i]);
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:41: error: invalid types 'int[int]' for array subscript
   12 |     for (int i = 0; i < N; i++) cin >> A[i];
      |                                         ^
a.cc:13:16: error: invalid types 'int[int]' for array subscript
   13 |     int ans = A[0];
      |                ^
a.cc:15:25: error: invalid types 'int[int]' for array subscript
   15 |         ans = gcd(ans, A[i]);
      |                         ^
Language: C++

#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
#ifndef ONLINE_JUDGE
    scanf("%lld", &a);
#else
    scanf("%I64d", &a);
#endif
    return a;
}

int gcd(int a, int b) {
    return (b == 0 ? a : gcd(b, a%b);
}

int main() {
    int n = gi();
    int r = gi();
    for (int i = 1; i < n; i++)
        r = gcd(r, gi());

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

    return 0;
}


Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:40:37: error: expected ')' before ';' token
   40 |     return (b == 0 ? a : gcd(b, a%b);
      |            ~                        ^
      |                                     )
Language: C++

#include<iostream>
using namespace std;

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

int main()
{
  int ans, n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++)
  {
    cin >> a[i]; 
  }
  ans = a[0];
  for(i = 1; i < n; i++)
  {
    ans = gcd(ans, a[i]);
  }
  cout << ans;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i = 1; i < n; i++)
      |       ^
Language: C++

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

int main(){
    ll N;
    cin>>N;
    vector<ll>A(N);
    rep(i,N)scanf("%lld",&A[i]);
    bool f=true;
    ll m;
    while(f){
        m=min_element(A.begin(),A.end())-A.begin();
        rep(i,N)if(i!=m)A[i]-=A[m];
        f=true;rep(i,N)f&&=A[i]>0;
    }
    cout<<*min_element(A.begin(),A.end())+A[m]<<endl;    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: error: expected primary-expression before '=' token
   16 |         f=true;rep(i,N)f&&=A[i]>0;
      |                           ^
Language: C++

#include <iostream>
using namespace std;

int GCD(int m, int n){
	int remain
	while((remain = m % n) != 0){
		m = n;
		n = remain;
	}
	return n;
}

int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++)cin >> a[i];
	int res = GCD(a[0], a[1]);
	for(int i = 2; i < n; i++)res = GCD(res, a[i]);
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int GCD(int, int)':
a.cc:6:9: error: expected initializer before 'while'
    6 |         while((remain = m % n) != 0){
      |         ^~~~~
Language: C

#include <stdio.h>

int gcd(int x, int y);

int main()
{
  int n, a[100000];
  int i, g;
  
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

  g = a[0];

  for (i = 1; i < n; i++) {
    g = gcd(g, a[i]);
  }

  printf("%d\n", tmp);
  
  return 0;
}

int gcd(int x, int y)
{
  int tmp, z;

  if (x < y) {
    tmp = x;
    x = y;
    y = tmp;
  }

  while (z = x % y) {
    x = y;
    y = z;
  }

  return y;
}

Compiler output:
main.c: In function 'main':
main.c:22:18: error: 'tmp' undeclared (first use in this function)
   22 |   printf("%d\n", tmp);
      |                  ^~~
main.c:22:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

#define MAX 100000

int gcd(int x, int y);

int main()
{
  int n, a[MAX];
  int i, g;
  
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

  g = a[0];

  for (i = 1; i < n; i++) {
    g = gcd(g, a[i]);
  }

  printf("%d\n", tmp);
  
  return 0;
}

int gcd(int x, int y)
{
  int tmp, z;

  if (x < y) {
    tmp = x;
    x = y;
    y = tmp;
  }

  while (z = x % y) {
    x = y;
    y = z;
  }

  return y;
}

Compiler output:
main.c: In function 'main':
main.c:24:18: error: 'tmp' undeclared (first use in this function)
   24 |   printf("%d\n", tmp);
      |                  ^~~
main.c:24:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

# include < bits / stdc ++. h >
using namespace std ;
int main () {
	int N , M ;
	cin >> N >> M ;
	vector <int > cnt (M , 0);
	for ( int i = 0; i < N ; ++ i ) {
		int K;
		cin >> K ;
		for ( int j = 0; j < K ; ++ j ) {
			int A;
			cin >> A ;
			--A ;
			++ cnt [ A ];
		}
	}
	int ans = 0;
	for ( int i = 0; i < M ; ++ i ) {
		if ( cnt [ i ] == N ) {
			++ ans ;
		}
	}
	cout << ans << endl ;
}

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

#include<iostream>
#include<vector>
using namespace std;
int yg(int a,int b){
 int tmp;
 if(a<b){
  tmp=a;
  a=b;
  b=tmp;
}
 int r=a%b;
 while(r!=0){
  a=b;
  b=r
  r=a%b;
}
 return b;
}
  int v[110000];
int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;++i){
    cin >> v[i];
    }
  for(int i=0;i<n-1;++i){
    v[i+1] = yg(v[i],v[i+1]);
    }
   cout << v[n-1] << endl;
}


Compiler output:
a.cc: In function 'int yg(int, int)':
a.cc:14:6: error: expected ';' before 'r'
   14 |   b=r
      |      ^
      |      ;
   15 |   r=a%b;
      |   ~
Language: Java

import java.util.Scanner;

public class Main_118C {

	public static void main(String[] args) {
		int N, Min=0, Check, T;
		int A[];
		Scanner scan = new Scanner(System.in);
		
		N = scan.nextInt();
		A = new int[N];
		for(int i=0; i<N; i++) {
			A[i] = scan.nextInt();
		}
		
		for(int i=0; i<N-1; i++) {
			Min = Math.min(A[i], A[i+1]);
		}
		
		//mod roop
		while(true) {
			Check = Min;
			for(int i=0; i<N; i++) {
				T = A[i] % Check;
				if(T != 0 && T < Min)	Min = T;
			}
			if(Check == Min)	break;
		}
		System.out.print(Min);
	}

}


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

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

int main(){
  int gcd(int a, int b) {
  	if(b == 0) return a;
    else; 
      gcd(b,a%b);
  }
  
  int gcd(vector<int> a){
    int ans = a[0];
    for(int i=1; i<a.size();i++)
      ans = gcd(ans,a[i]);
   	return ans;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:25: error: a function-definition is not allowed here before '{' token
    5 |   int gcd(int a, int b) {
      |                         ^
a.cc:11:25: error: a function-definition is not allowed here before '{' token
   11 |   int gcd(vector<int> a){
      |                         ^
Language: C++

int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:3:27: error: expected '}' at end of input
    3 |         return gcd(b,a%b);
      |                           ^
a.cc:1:21: note: to match this '{'
    1 | int gcd(int a,int b){
      |                     ^
Language: C

#include <stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for (int i=0;i<n;i++){
        scanf("%d",a[i]);
    }
    int min=a[0],nextmin=[0],flag;
    while (true){
        for (int i=0;i<n;i++){
            flag=0;
            a[i]%=min;
            if (a[i]==0){
                flag++;
            }
            else if (a[i]<nextmin){
                nextmin=a[i];
            }
            if (flag==n){
                break;
            }
            min=nextmin;
        }
    }
    printf("%d",min);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:26: error: expected expression before '[' token
    9 |     int min=a[0],nextmin=[0],flag;
      |                          ^
main.c:10:12: error: 'true' undeclared (first use in this function)
   10 |     while (true){
      |            ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | int main(){
main.c:10:12: note: each undeclared identifier is reported only once for each function it appears in
   10 |     while (true){
      |            ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int N;
long long A[123456];

long long gcd(long long a,long long b){
  if(b <= 0) return a;
  return gcd(b,a % b);
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  
  cin >> N;
  for(int i = 1; i <= N; ++i) cin >> A[i];
  long long res = A[i];
  for(int i = 2; i <= N; ++i) res = gcd(res,A[i]);
  cout << res;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:21: error: 'i' was not declared in this scope
   19 |   long long res = A[i];
      |                     ^
Language: C++

n = int(input())
a = list(map(int, input().split()))
a.sort()

while 1 < len(a):
    while 0 != a[0]:
        r = a[1] % a[0]
        a[1] = a[0]
        a[0] = r
    a.pop(0)
print(a[0])

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

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

int gcd(int a, int b){
  while(b){
	int r = a % b;
    a = b;
    b = r;
  }
  return a;
}
int main(){
	int n;
  int a[n]
    for(int i = 0; i < n; i++){
    	cin >> a[i];
    }
  int g = a[0];
	for(int i = 0; i < n; i++){
     	g = gcd(g, a[i]); 
    }
  cout << g << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: expected initializer before 'for'
   15 |     for(int i = 0; i < n; i++){
      |     ^~~
a.cc:15:20: error: 'i' was not declared in this scope
   15 |     for(int i = 0; i < n; i++){
      |                    ^
a.cc:18:11: error: 'a' was not declared in this scope
   18 |   int g = a[0];
      |           ^