criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.Scanner;
public class Main109B {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		boolean flag = true;

		String[] s = new String[N];

		int len = 0;

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

			s[i] = sc.next();

			if(i > 0) len = s[i-1].length();

			if(i>0 && s[i].charAt(0) != s[i-1].charAt(len-1)) {

				System.out.println("No");

				flag = false;

				break;
			}

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

				if(s[i].equals(s[j])) {

					System.out.println("No");

					flag = false;

					break;
				}
			}
		}

		if(flag == true) {

			System.out.println("Yes");
		}




	}

}


Compiler output:
Main.java:2: error: class Main109B is public, should be declared in a file named Main109B.java
public class Main109B {
       ^
1 error
Language: Java

import java.util.*;
import java.math.*;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        String[] W = new String[N];
        for (int i = 0; i < N; i++) W[i] = sc.nextLine();

        List<String> history = new ArrayList<>();
        for (int i = 0; i < W.length; i++) {
            String word = W[i];

            if (history.contains(word) || (i != 0 && history.get(i - 1))) {
                System.out.println("No");
                return;
            }

            history.add(word);
        }
        
        System.out.println("Yes");
    }

}

Compiler output:
Main.java:17: error: bad operand types for binary operator '&&'
            if (history.contains(word) || (i != 0 && history.get(i - 1))) {
                                                  ^
  first type:  boolean
  second type: String
1 error
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
using namespace std;
//
const int inf=1e9+7;
//
int main(){
	int N;
	string now,cur;
	cin>>N;
	cin>>cur;
	set<string> S;
	for(int i=1;i<N;i++){
		cin>>now;
		if(S.find(now)==S.end()){
			if(cur[cur.size()-1]==now[0]){
              S.insert(now)
				continue;
			}else{
				cout<<"No"<<endl;
				return 0;
			}
		}else{
			cout<<"No"<<endl;
			return 0;
		}
		cur=now;
	}
	cout<<"Yes"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:28: error: expected ';' before 'continue'
   25 |               S.insert(now)
      |                            ^
      |                            ;
   26 |                                 continue;
      |                                 ~~~~~~~~
Language: C

#include <iostream>
#include <set>
#include <string>

int main(){
	int n;
	std::set<std::string> w;
	scanf("%d", &n);
	std::string hoge;
	std::cin >> hoge;
	w.insert(hoge);
	for(int i = 1; i < n; ++i){
		std::string tmp;
		std::cin >> tmp;
		if(w.count(tmp) || tmp[0] != hoge[hoge.length() - 1]){
			std::cout << "No" << std::endl;
			return 0;
		}else{
			w.insert(tmp);
			hoge = tmp;
		}
	}
	std::cout << "Yes" << std::endl;
}


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

#include<iostream>
#include<string>

using namespace std;

int N;
const int maxSize = 101;
string arr[maxSize];
int main()
{
cin >> N;
for(int i=0; i<N; i++)
cin >> arr[maxSize];

bool satisfies = true;
for(int i=0; i<N-1; i++)
{
for(int j=i; j<N; j++)
{
if(j==i)
continue;

if(arr[j]==arr[i])
satisfies = false;
}
}

for(int i=1; i<N; i++)
{
int ln = arr[i-1].length()-1;
if(arr[i][0]!=arr[i-1][ln])
satisfies = false;
}

if(satisfies)
cout << "Yes";
else
cout << "No";

Compiler output:
a.cc: In function 'int main()':
a.cc:38:14: error: expected '}' at end of input
   38 | cout << "No";
      |              ^
a.cc:10:1: note: to match this '{'
   10 | {
      | ^
Language: C++

#include<cstdio>
#include<string>
#include<iostream>
using namespace std;
int n;
string w[100];
int main() {
  scanf("%d", &n);
  bool flag = true;
  cout << w[0];
  for (int i = 1; i < n; i++) {
    cout << w[i];
    for (int j = 0; j < i; j++) if (w[i] == w[j]) {
      flag = false;
      break;
    }
    if (w[j][0] != w[j-1][w[j-1].length() - 1]) flag = false;
    if (!flag) break;
  }
  if (flag) printf("Yes\n");
  else printf("No\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: 'j' was not declared in this scope
   17 |     if (w[j][0] != w[j-1][w[j-1].length() - 1]) flag = false;
      |           ^
Language: C++

#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstring>
#include<string.h>
using namespace std;
int n,m,i,j,k,a,b,c,g;
char s[3000][3000];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("\n");
		gets(s[i]);
		for (int j=1;j<i;j++){
			if (strcmp(s[i],s[j])==0) g=1;
		}
		if (i==1) continue;
		if (s[i-1][strlen(s[i-1])-1]!=s[i][0]) g=1;
	}
	if (g==1) printf("No\n");
	else printf("Yes\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   14 |                 gets(s[i]);
      |                 ^~~~
      |                 getw
Language: C++

#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstring>
using namespace std;
int n,m,i,j,k,a,b,c,g;
char s[3000][3000];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("\n");
		gets(s[i]);
		for (int j=1;j<i;j++){
			if (strcmp(s[i],s[j])==0) g=1;
		}
		if (i==1) continue;
		if (s[i-1][strlen(s[i-1])-1]!=s[i][0]) g=1;
	}
	if (g==1) printf("No\n");
	else printf("Yes\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |                 gets(s[i]);
      |                 ^~~~
      |                 getw
Language: C++

#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;
int f[100000];

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
ll Max(ll a, ll b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}

void ShowData(int x[], int left, int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}
void QSort(int x[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, left, i - 1, n);
	if (j + 1 <  right)QSort(x, j + 1, right, n);
}

int main(){
	int n;
	char w[101][101];
	scanf("%d", &n);
	REP(i, n) {
		scanf("%s", w[i]);
	}
	REP(i, n-1) {
		FOR(j, i + 1, n) {
			if (strcmp(w[i], w[j])==0) {
				puts("No");
				return;
			}
		}
		//printf("%c %c\n", w[i][strlen(w[i]) - 1], w[i + 1][0]);
		if (w[i][strlen(w[i])-1] != w[i + 1][0]) {
			puts("No");
			return;
		}
	}
	puts("Yes");
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <utility>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, X; cin >> N >> X;
  for (int i = 0; i < N; i++) {
    
  }
  cout << << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: expected primary-expression before '<<' token
   22 |   cout << << endl;
      |           ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  cin>>n>>st;
  for(int i=2;i<=n;i++){
    
if(la[l1]
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    4 |   cin>>n>>st;
      |        ^
      |        yn
a.cc:4:11: error: 'st' was not declared in this scope; did you mean 'std'?
    4 |   cin>>n>>st;
      |           ^~
      |           std
a.cc:7:4: error: 'la' was not declared in this scope
    7 | if(la[l1]
      |    ^~
a.cc:7:7: error: 'l1' was not declared in this scope; did you mean 'y1'?
    7 | if(la[l1]
      |       ^~
      |       y1
a.cc:7:10: error: expected ')' before '}' token
    7 | if(la[l1]
      |   ~      ^
      |          )
    8 |   }
      |   ~       
a.cc:8:3: error: expected primary-expression before '}' token
    8 |   }
      |   ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<string> strs(n);
    for(int i = 0; i < n; i ++){
        cin >> strs[i];
        if(i > 0 && strs[i].front() != strs[i-1].back()){
            cout << "No\n";
            return 0;
        }
    }

    sort(strs.begin(), strs.end());
    for(int i = 1; i < n; i ++){
        if(strs[i] == strs[i-1]){
            cout << "No\n";
            return 0;
        }
    }
    
    cout << "Yes\n";

}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<string> strs(n);
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:8:18: error: expected primary-expression before '>' token
    8 |     vector<string> strs(n);
      |                  ^
a.cc:8:20: error: 'strs' was not declared in this scope
    8 |     vector<string> strs(n);
      |                    ^~~~
Language: C++

    #include<bits/stdc++.h>
     
    using namespace std;
      
      int main(){
    int n;
      set<string> se;
      string g[1100];
      cin>>n;
      for(int i=0;i<n;i++)cin>>g[i];
      for(int i=0;i<n-1;i++){
      if(g[i].back()!=g[i+1][0]){
      cout<<"No"<<endl;
        return 0;
      }
      }
      se.insert(g[0]);
      for(int i=1;i<n;i++){
      	if(se.find(g[i])!=se.end()){
        cout<<"No"<<endl;
          reutrn 0;
        }
        se.insert(g[i]);
      }
      cout<<"Yes"<<endl;
      return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: 'reutrn' was not declared in this scope
   21 |           reutrn 0;
      |           ^~~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std
  
  int main(){
int n;
  set<string> se;
  string g[1100];
  cin>>n;
  for(int i=0;i<n;i++)cin>>g[i];
  for(int i=0;i<n-1;i++){
  if(g[i].back()!=g[i+1][0]){
  cout<<"No"<<endl;
    return 0;
  }
  }
  se.insert(g[0]);
  for(int i=1;i<n;i++){
  	if(se.find(g[i])!=se.end()){
    cout<<"No"<<endl;
      reutrn 0;
    }
    se.insert(g[i]);
  }
  cout<<"Yes"<<endl;
  return 0;
}

Compiler output:
a.cc:3:20: error: expected ';' before 'int'
    3 | using namespace std
      |                    ^
      |                    ;
    4 | 
    5 |   int main(){
      |   ~~~               
a.cc: In function 'int main()':
a.cc:21:7: error: 'reutrn' was not declared in this scope
   21 |       reutrn 0;
      |       ^~~~~~
Language: C++

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

long long int N;
string s;
char c = -1;
set<string> S;

int main(){
    cin >> N;
    for(int i = 0; i < N; ++i){
        cin >> s;
        if(c >= 0 && c != s[0])return 0 & puts("No");
        c = s.rbegin();
        if(!S.insert(s).second)return 0 & puts("No");
    }
    puts("Yes");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: cannot convert 'std::__cxx11::basic_string<char>::reverse_iterator' {aka 'std::reverse_iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> > >'} to 'char' in assignment
   14 |         c = s.rbegin();
      |             ~~~~~~~~^~
      |                     |
      |                     std::__cxx11::basic_string<char>::reverse_iterator {aka std::reverse_iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> > >}
Language: C++

//B
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){

    int N;
    cin >> N;
    
    set<string> s;
    string w;
    cin >> w;
    s.insert(w);
    string old = w;
    for(int i=1; i<N; i++){
        cin >> w;
        if(s.count(w) == 1){
            cout << "No" << endl;
            return 0;
        }
        if(old[old.size()-1] != w[0]){
            cout << "No" << endl;
            return 0;
        }
        s.inert(w);
        old = w;
    }
    cout << "Yes" << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:11: error: 'class std::set<std::__cxx11::basic_string<char> >' has no member named 'inert'; did you mean 'insert'?
   49 |         s.inert(w);
      |           ^~~~~
      |           insert
Language: Java

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()

ss = []
for i in range(n):
    ss.append(ns())

for i in range(n):
    for j in range(i):
        if ss[i] == ss[j]:
            print("No")
            sys.exit(0)

for i in range(n-1):
    if ss[i][-1] != ss[i+1][0]:
        print("No")
        sys.exit(0)

print("Yes")


Compiler output:
Main.java:1: error: '.' expected
import sys
          ^
Main.java:3: error: ';' expected
stdin = sys.stdin
     ^
Main.java:7: error: illegal character: '#'
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
                                        ^
3 errors
Language: C++

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<string> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i + 1 < n; i++) {
    if (s[i].back() != s[i + 1].front()) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 's' was not declared in this scope
   16 |     if (s[i].back() != s[i + 1].front()) {
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
//最大公約数
long long GCD(long long a, long long b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(GCD(b, a%b));
   }
}
int main(){
  long long N,X;
  cin >> N >> X;
  if(N == 1){
    long long a;
    cin >> a;
    cout << a-X << endl;
    return 0;
  }
  vector<long long>vec(N+1);
  vec[N] = X;
  for(long long i=0; i<N; i++){
    cin >> vec[i];
  }
  sort(vec.begin(),vec.end());
  long long gccd = GCD(vec[1]-vec[0]);
  for(long long i=0; i<N; i++){
    gccd = GCD(gccd,vec[i+1]-vec[i];
  }
  cout << gccd << endl;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:30:23: error: too few arguments to function 'long long int GCD(long long int, long long int)'
   30 |   long long gccd = GCD(vec[1]-vec[0]);
      |                    ~~~^~~~~~~~~~~~~~~
a.cc:4:11: note: declared here
    4 | long long GCD(long long a, long long b)
      |           ^~~
a.cc:32:36: error: expected ')' before ';' token
   32 |     gccd = GCD(gccd,vec[i+1]-vec[i];
      |               ~                    ^
      |                                    )
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
//最大公約数
long long GCD(long long a, long long b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(GCD(b, a%b));
   }
}
signed main(){
  int N,X;
  cin >> N >> X;
  if(N == 1){
    int a;
    cin >> a;
    cout << a-X << endl;
    return 0;
  }
  vector<int>vec(N+1);
  vec[N] = X;
  for(int i=0; i<N; i++){
    cin >> vec[i];
  }
  sort(vec.begin(),vec.end());
  int gccd = GCD(vec[1]-vec[0]);
  for(int i=0; i<N; i++){
    gccd = GCD(gccd,vec[i+1]-vec[i];
  }
  cout << gccd << endl;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: too few arguments to function 'long long int GCD(long long int, long long int)'
   31 |   int gccd = GCD(vec[1]-vec[0]);
      |              ~~~^~~~~~~~~~~~~~~
a.cc:5:11: note: declared here
    5 | long long GCD(long long a, long long b)
      |           ^~~
a.cc:33:36: error: expected ')' before ';' token
   33 |     gccd = GCD(gccd,vec[i+1]-vec[i];
      |               ~                    ^
      |                                    )
Language: C++

#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<string>;
using P =pair<int,int>;
const ll mod=1000000007;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

int main(){
    ll n;
    cin>>n;
    ll x;
    cin>>x;
    vector<ll> v(n+1);
    v[n]=x;
    for(ll i=0;i<n;++i)cin>>v[i];
    sort(v.begin(),v.end());
    }
    ll gcdx=v[1]-v[0];
    for(ll i=1;i<n;++i){
        ll diff=v[i+1]-v[i];
        gcdx=__gcd(diff,gcdx);
    }
    cout<<gcdx<<endl;
}




Compiler output:
a.cc:22:13: error: 'v' was not declared in this scope
   22 |     ll gcdx=v[1]-v[0];
      |             ^
a.cc:22:18: error: 'v' was not declared in this scope
   22 |     ll gcdx=v[1]-v[0];
      |                  ^
a.cc:23:5: error: expected unqualified-id before 'for'
   23 |     for(ll i=1;i<n;++i){
      |     ^~~
a.cc:23:16: error: 'i' does not name a type
   23 |     for(ll i=1;i<n;++i){
      |                ^
a.cc:23:20: error: expected unqualified-id before '++' token
   23 |     for(ll i=1;i<n;++i){
      |                    ^~
a.cc:27:5: error: 'cout' does not name a type
   27 |     cout<<gcdx<<endl;
      |     ^~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
const long long INF = 1LL << 60;
ll H;
ll DFS(ll i){
    ll ans=0;
    if(i==1){
        ans=1;
    }
    else{
        ans=DFS(i/2)*2;
    }
    return ans;
}
int main(){
  int N,X;
  cin>>N>>X;
  vector<int>X(N);
  int ans;
  rep(i,N){
      cin>>X[i];
      if(i==0){
          ans=X[i];
      }
      else{
          ans=__gcd(ans,X[i]);
      }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: conflicting declaration 'std::vector<int> X'
   22 |   vector<int>X(N);
      |              ^
a.cc:20:9: note: previous declaration as 'int X'
   20 |   int N,X;
      |         ^
a.cc:25:13: error: invalid types 'int[int]' for array subscript
   25 |       cin>>X[i];
      |             ^
a.cc:27:16: error: invalid types 'int[int]' for array subscript
   27 |           ans=X[i];
      |                ^
a.cc:30:26: error: invalid types 'int[int]' for array subscript
   30 |           ans=__gcd(ans,X[i]);
      |                          ^
Language: C++

#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

int main(){
	int N, X;
	cin >> N >> X;
	int x[N];

	rep(i,N) {
		int y;
		cin >> y;
		x[i] = y-X;
	}

	int ans = 0;
	rep(i,N) ans = gcd(ans,x[i]);
	cout << abs(ans) << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> N >> X;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep(i,n) for (int i = 0; i< (n); i++)
a.cc:22:9: error: 'cout' was not declared in this scope
   22 |         cout << abs(ans) << endl;
      |         ^~~~
a.cc:22:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:17: error: 'abs' was not declared in this scope; did you mean 'ans'?
   22 |         cout << abs(ans) << endl;
      |                 ^~~
      |                 ans
a.cc:22:29: error: 'endl' was not declared in this scope
   22 |         cout << abs(ans) << endl;
      |                             ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define rep(i,n) for (int i = 0; i< (n); i++)
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int64_t N, X, D;
  cin >> N >> X;
  vector<int64_t> x(N);
  vector<int64_t> y(N);
  for (int64_t i=0; i<N; i++) {
    cin >> x[i];
    y[i]=abs(X-x[i]);
  }
  sort(y.begin(),y.end());
  reverse(y.begin(),y.end());
  D=y[0];
  for (int64_t i=0; i<N; i++) {
    if (y[i]!=0) {
      D=gcm(D,y[i]);
    }
  }
  cout << D << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:9: error: 'gcm' was not declared in this scope
   34 |       D=gcm(D,y[i]);
      |         ^~~
Language: C++

#include<bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)

int main(){
    int n, x;
    cin >> n >> x;
    vi a(n+1);
    rep(i, n){
        cin >> a[i];
    }
    a[n] = x;

    sort(a.begin(), a.end());
    int ans = 9999999;
    rep(i, n){
        ans = min(ans, abs(a[i+1] - a[i]));
    }
    cout << ans << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 100005
 
#define PI 3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 int
 
#define mod  1000000007

map<string, int> m;

int main()
{
	FAST;
	ll n;
	cin >> n;
	ll x;
	cin >> x;
	
	ll a[n+4]; ll b[n+6];
	for(ll i = 0; i < n; i++){
		cin >> a[i];
		b[i] = abs(x - a[i]);
	}
	sort(b, b + n);
	ll m = b[0];
	for(ll i = 1; i < n; i++){
		m = __gcd(, b[i]);
	}
	cout << m;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:27: error: expected primary-expression before ',' token
   35 |                 m = __gcd(, b[i]);
      |                           ^
Language: C++


#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int gcd(int a,int b){

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

 }

 int main(){

  long long n,x;

  cin>>n>>x;

  long long a[n+1];

  for(int i=0;i<n;i++)
    cin>>a[i];

  a[n] = x;

  sort(a.begin(),a.end());

  int ans = a[1]-a[0];

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

  cout<<ans<<endl;

 return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:41:10: error: request for member 'begin' in 'a', which is of non-class type 'long long int [(n + 1)]'
   41 |   sort(a.begin(),a.end());
      |          ^~~~~
a.cc:41:20: error: request for member 'end' in 'a', which is of non-class type 'long long int [(n + 1)]'
   41 |   sort(a.begin(),a.end());
      |                    ^~~
Language: C++

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

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

ll main(void)
{
    ll N, X;
    cin >> N >> X;
    vector<ll> x(N, 0);
    priority_queue<ll, vector<ll>, greater<ll>> diffX;
    
    for (ll i = 0; i < N; i++)
    {
        cin >> x[i];
        diffX.push(abs(X - x[i]));
    }

    ll distMin = diffX.top();
    diffX.pop();
    ll distMin2 = diffX.top();
    diffX.pop();

    ll gcded = gcd(distMin2, distMin);
    cout << gcded << endl;

    return 0;
}


Compiler output:
a.cc:12:1: error: '::main' must return 'int'
   12 | ll main(void)
      | ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
ll n,x;
cin >> n >> x;
vector<ll> a(n);
rep(i,n) cin >> a.at(i);
vector<ll> b(n);
rep(i,n)b.at(i) = abs(a.at(i)-x);
ll ans;
rep(i,n-1){
  if(i == 0) ans = gcd(b.at(i),b.at(i+1));
  else ans = gcd(ans,b.at(i))
}
  if(n==1)ans = b.at(0);
cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:30: error: expected ';' before '}' token
   18 |   else ans = gcd(ans,b.at(i))
      |                              ^
      |                              ;
   19 | }
      | ~
Language: C++

#include<vector>
#include <iostream>
#include<string>
#include <complex>
#include <algorithm>
#include<string>
#include <map>
#include <utility>

using namespace std;


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

    int s[n];

    for(int i =0 ;i < n; i++){
        cin >> s[i];
    }
    if(n == 1){
        cout << s[i]-1 << endl;
        return 0;
    }

    vector<int> s2(n-1);

    for(int i = 0; i < n-1;i++){
        s2[i] = abs(s[i+1]-s[i]);
    }

    sort(s2.begin(), s2.end());


    int d = 0;
    int c = 0;
    int r = 2;

    
    while(r <= s2[0]){
        c = 0;
        for(int i = 0; i < n-1; i++){
            if(s2[i] % r == 0){
                c++;
            }else{
                i = n;
            }
        }
        if(c == n-1){
            d = r;
        }

        r++;
    }

    cout << d << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:19: error: 'i' was not declared in this scope
   24 |         cout << s[i]-1 << endl;
      |                   ^
Language: C++

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

int gcd(int x,int y){
  if(a%b==0){
    return b;
  }
  else{
    return gcd(b,a%b);
  }
}
int main(){
  int n,x;
  
  cin>>n>>x;
  vector<int>d(n);
  for(int i=0;i<n;i++){
    cin>>d[i];
  }
  int ans=abs(d[0]-x);
  for(int i=1;i<n;i++){
    ans=gcd(ans,d[i]-x);
  }
  cout<<ans<<endl;
}
  

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:5:6: error: 'a' was not declared in this scope
    5 |   if(a%b==0){
      |      ^
a.cc:5:8: error: 'b' was not declared in this scope
    5 |   if(a%b==0){
      |        ^
Language: C++

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

long long GCD(long long x, long long y) {
    return y ? GCD(y, x%y) : x;
}

int main(){
  ll n, x;
  cin >> n;
  vector<ll> vec(n+1);
  rep(i, n+1) cin >> vec[i];
  sort(all(vec));
  ll gcd = vec[1]-vec[0];
  rep(i, n) gcd = GCD(gcd, vec[i+1]-vec[i]);
  cout << smallest << endl;
  return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: 'smallest' was not declared in this scope
   20 |   cout << smallest << endl;
      |           ^~~~~~~~
Language: C++

#include<iostream>
using namespace std;
long long gcd(long long a,long long b){
if(b==0) return a;
else return gcd(b,a%b);
}

int main(){
int n;
  cin>>n;
  long long x;
  cin>>x;
  long long res=0;
  for(int i=0;i<n;i++){
    long long x;
    cin>>x;
    res=gcd(res,abs(x-X));
  }
  cout<<res<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: 'X' was not declared in this scope
   17 |     res=gcd(res,abs(x-X));
      |                       ^
Language: C++

#include<iostream>
using namespace std
long long GCD(long long a,long long b){
  if(b==0) return a;
  else return GCD(b,a%b);
}
int main(){
  long long a,b;
  cin>>a>>b;
  cout<<a/GCD(a,b)*b<<endl;
  return 0;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'long'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | long long GCD(long long a,long long b){
      | ~~~~
Language: C++

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

int main() {
  int N, X;
  cin >> N >> X;
  int ans = 0;
  vector<int> X(N);
  for (int i = 0; i < N; i++) cin >> X.at(i);
  for (int i = 0; i + 1 < N; i++) {
    ans = __gcd(ans, X.at(i + 1) - X.at(i));
  }
  cout << asn << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: conflicting declaration 'std::vector<int> X'
    8 |   vector<int> X(N);
      |               ^
a.cc:5:10: note: previous declaration as 'int X'
    5 |   int N, X;
      |          ^
a.cc:9:40: error: request for member 'at' in 'X', which is of non-class type 'int'
    9 |   for (int i = 0; i < N; i++) cin >> X.at(i);
      |                                        ^~
a.cc:11:24: error: request for member 'at' in 'X', which is of non-class type 'int'
   11 |     ans = __gcd(ans, X.at(i + 1) - X.at(i));
      |                        ^~
a.cc:11:38: error: request for member 'at' in 'X', which is of non-class type 'int'
   11 |     ans = __gcd(ans, X.at(i + 1) - X.at(i));
      |                                      ^~
a.cc:13:11: error: 'asn' was not declared in this scope; did you mean 'ans'?
   13 |   cout << asn << "\n";
      |           ^~~
      |           ans
Language: C++

#include<iostream>
#include<vector>
#include<complex>
using namespace std;

long long gcd(long long a, long long b){
    return b != 0 ? gcd(b, a%b) : a;
}
int main(){
  long long n, x;
  cin >> n >> x;
  vector<long long> dx(n);
  for(long long i=0; i < n; i++){
      long long v;
      cin >> v;
      dx[i] = absl(x - v);
  }
  long long ans = dx[0];
  for(long long i=1; i < n; i++){
      ans = gcd(ans, dx[i]);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'absl' was not declared in this scope; did you mean 'fabsl'?
   16 |       dx[i] = absl(x - v);
      |               ^~~~
      |               fabsl
Language: C++

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

long long gcd(long long a, long long b){
    return b != 0 ? gcd(b, a%b) : a;
}
int main(){
  long long n, x;
  cin >> n >> x;
  vector<long long> dx(n);
  for(long long i=0; i < n; i++){
      long long v;
      cin >> v;
      dx[i] = absl(x - v);
  }
  long long ans = dx[0];
  for(long long i=1; i < n; i++){
      ans = gcd(ans, dx[i]);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: 'absl' was not declared in this scope; did you mean 'abs'?
   15 |       dx[i] = absl(x - v);
      |               ^~~~
      |               abs
Language: C++

#include<iostream>
using namespace std;

long long gcd(long long a, long long b){
    return b != 0 ? gcd(b, a%b) : a;
}
int main(){
  long long n, x;
  cin >> n >> x;
  vector<long long> dx(n);
  for(long long i=0; i < n; i++){
      long long v;
      cin >> v;
      dx[i] = absl(x - v);
  }
  long long ans = dx[0];
  for(long long i=1; i < n; i++){
      ans = gcd(ans, dx[i]);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'vector' was not declared in this scope
   10 |   vector<long long> dx(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:10:10: error: expected primary-expression before 'long'
   10 |   vector<long long> dx(n);
      |          ^~~~
a.cc:14:7: error: 'dx' was not declared in this scope; did you mean 'x'?
   14 |       dx[i] = absl(x - v);
      |       ^~
      |       x
a.cc:14:15: error: 'absl' was not declared in this scope; did you mean 'abs'?
   14 |       dx[i] = absl(x - v);
      |               ^~~~
      |               abs
a.cc:16:19: error: 'dx' was not declared in this scope; did you mean 'x'?
   16 |   long long ans = dx[0];
      |                   ^~
      |                   x
Language: C++

#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
#include<iomanip>
using namespace std;
using ll = long long int;
const ll mod = 1e9 + 7;
#define rep(i, a, b) for(int i = a; i < b; i++)

int main() {
	
	int n, X, dmin = 1e9;
	cin >> n >> X;

	vector<int> x(n);
	rep(i, 0, n) {
		cin >> x[i];
		dmin = min(dmin, abs(x[i] - X));
	}

	sort(x.begin(), x.end());
	vector<int> div(n);
	div[0] = dmin;

	if (n != 1) {
		rep(i, 1, n) div[i] = x[i] - x[i - 1];
	}

	sort(div.begin(), div.end());

	cout << div[0] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'cin' was not declared in this scope
   21 |         cin >> n >> X;
      |         ^~~
a.cc:13:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   12 | #include<iomanip>
  +++ |+#include <iostream>
   13 | using namespace std;
a.cc:39:9: error: 'cout' was not declared in this scope
   39 |         cout << div[0] << endl;
      |         ^~~~
a.cc:39:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int n,x;
  cin >> n >> x;
  vi po(n);
  REP(i,n) {
    int p;
    cin >> p;
    po[i]=abs(p-x);
  }
  int ans=po[0];
  REP(i,n-1) {
    ans=euclidean_gcd(ans,p[i+1]);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:63:27: error: 'p' was not declared in this scope
   63 |     ans=euclidean_gcd(ans,p[i+1]);
      |                           ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int n,x;
  cin >> n >> x;
  vi po(n);
  REP(i,n) {
    int p;
    cin >> p;
    po[i]=abs(p-x);
  }
  int ans=p[0];
  REP(i,n-1) {
    ans=euclidean_gcd(ans,p[i+1]);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:11: error: 'p' was not declared in this scope; did you mean 'po'?
   61 |   int ans=p[0];
      |           ^
      |           po
Language: C

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int n,x;
  cin >> n >> x;
  vi po(n);
  REP(i,n) {
    int p;
    cin >> p;
    po[i]=abs(p-x);
  }
  int ans=p[0];
  REP(i,n-1) {
    ans=euclidean_gcd(ans,p[i+1]);
  }
  cout << ans << endl;
  return 0;
}


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++

/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll n,m,i,j,cc=0;
    cin>>n>>m;
    ll ara[n];ll bra[n];
    for(i=0;i<n;i++)cin>>ara[i],bra[i]=abs(m-ara[i]),if(bra[i]%2==0)cc++;
    sort(bra,bra+n);
    for(i=1;i<n;i++){
        if(bra[i]%bra[0]){
            if(cc==n)cout<<2<<endl;
        else
            cout<<1<<endl;
            return 0;
        }
    }
    cout<<bra[0]<<endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:54: error: expected primary-expression before 'if'
   42 |     for(i=0;i<n;i++)cin>>ara[i],bra[i]=abs(m-ara[i]),if(bra[i]%2==0)cc++;
      |                                                      ^~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;

const int mod = 1000000007;
struct mint
{
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

struct combination
{
    vector<mint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1)
    {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
            ifact[i - 1] = ifact[i] * i;
    }
    mint operator()(int n, int k)
    {
        if (k < 0 || k > n)
            return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} c(200010);

int main()
{
    int N;
    cin >> N;
    long long X;
    cin >> X;
    long long res = 0;
    for (int i = 0; i < N; ++i)
    {
        long long x;
        cin >> x;
        res = gcd(res, abs(x - X));
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:110:15: error: 'gcd' was not declared in this scope
  110 |         res = gcd(res, abs(x - X));
      |               ^~~
Language: C++

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

using ll = long long;
ll gcd(ll a, ll b)
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}

int main()
{
    int N, X;
    cin >> N >> X;
    vector<ll> x(N, 0);
    for (int i = 0; i < N; i++)
        cin >> x[i];
    vector<ll> diff(N), 0;
    for (int i = 0; i < N; i++)
    {
        diff[i] = abs(X - x[i]);
    }
    ll ans = diff[0];
    for (int i = 0; i < N; i++)
    {
        ans = gcd(ans, diff[i]);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: expected unqualified-id before numeric constant
   22 |     vector<ll> diff(N), 0;
      |                         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
template <typename T, typename U>
using P = pair<T,U>;
template <typename T>
using vt = vector<T>;
using vvi = vector<vector<int>>;

int main(){
  int N,X;
  cin >> N >> X;
  vt<int> x(N);
  rep(i,N) cin >> x[i];
  sort(x.begin(),x.end());
  int tmp1 = 1e9, tmp2 = 1e9;
  rep(i,N){
    if(x[i]-X != 0)
      tmp1 = min(tmp1,abs(x[i]-X));
    if(i > 0 && x[i]-x[i-1] != 0)
      tmp2 = min(tmp2,x[i]-x[i-1]);
  }

  int mini = min(tmp1,tmp2);
  for(int mini; mini > 0; mini--)
    rep(j,N){
      if(abs(x[i]-X)%i!=0)
        break;
    }

  cout << mini << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: 'i' was not declared in this scope
   28 |       if(abs(x[i]-X)%i!=0)
      |                ^