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

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
void vout(vl V) {
	for (ll i = 0; i < (ll)V.size(); i++) cout << V[i] << " ";
	cout << endl;
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color; vll path; vl A; vl dp; vl Ans;
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
unsigned main(){
	cin >> N >> X;
	vl x(N);
	for (i = 0; i < N; i++) cin >> x[i];
	sort(x.begin(), x.end());
	ans = abs(X - x[0]);
	for (i = 0; i < N-1; i++) {
		ans = gcd(ans, x[i + 1] - x[i]);
	}
	cout << ans;
}

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

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

ll gcd(ll x[i],ll X){
    if(x[i]<X)swap(x[i],X);
    if(x[i]%X==0)return X;
    return gcd(x[i]%X,X);
}

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

Compiler output:
a.cc:6:13: error: 'i' was not declared in this scope
    6 | ll gcd(ll x[i],ll X){
      |             ^
a.cc:6:15: error: expected ')' before ',' token
    6 | ll gcd(ll x[i],ll X){
      |       ~       ^
      |               )
a.cc:6:19: error: expected initializer before 'X'
    6 | ll gcd(ll x[i],ll X){
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+10 , OO = 0x3f3f3f3f ;
//const int mod = 1000000007;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
double startTime;
double getCurrentTime() {
	return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

int amakn[N];
int n , mkany;


int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
        //freopen("in.in", "r", stdin);
        //freopen("out.in", "w", stdout);
    #endif
	//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    scanf("%d %d", &n , &mkany);
    for(int i = 0; i < n; i++) {
        scanf("%d", amakn + i);
        amakn[i] = abs(amakn[i] - mkany);
    }
    int gcd = amakn[0];
    for(int i = 0; i < n; i++) gcd = gcd(gcd, amakn[i]);
    printf("%d\n", gcd);
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:41: error: 'gcd' cannot be used as a function
   44 |     for(int i = 0; i < n; i++) gcd = gcd(gcd, amakn[i]);
      |                                      ~~~^~~~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
int gcd(int x, int y){
  if(x < y){
    int s = x;
    x = y;
    y = s;
  }
  while(x % y != 0){
    int t = x % y;
    x = y;
    y = t;
  }
  return y;
}
int main(){
  int N, X;
  scanf("%d %d", &N, &X);
  int x[N];
  for(int i = 0; i < N; i++) {
    scanf("%d", &x{i])
    x[i] = abs(x[i] - X);
  }
  int g = x[0];
  for(int i = 0; i < N; i++) g = gcd(g, x[i]);
  printf("%d\n", g);
}
  

Compiler output:
main.c: In function 'main':
main.c:21:19: error: expected ')' before '{' token
   21 |     scanf("%d", &x{i])
      |          ~        ^
      |                   )
main.c:21:23: error: expected ';' before 'x'
   21 |     scanf("%d", &x{i])
      |                       ^
      |                       ;
   22 |     x[i] = abs(x[i] - X);
      |     ~
Language: C

#include <stdio.h>
#include <stdlib>
int gcd(int x, int y){
  if(x < y) std::swap(x, y);
  while(x % y != 0){
    int t = x % y;
    x = y;
    y = t;
  }
  return y;
}
int main(){
  int N, X;
  scanf("%d %d", &N, &X);
  int x[N];
  for(int i = 0; i < N; i++) {
    scanf("%d", &x{i])
    x[i] = abs(x[i] - X);
  }
  int g = x[0];
  for(int i = 0; i < N; i++) g = gcd(g, x[i]);
  printf("%d\n", g);
}
  

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

#include<stdio.h>
#include<iostream>
#include<numeric>
int main()
{
long int a,b,i,j,min,f;
  min=100000;

  scanf("%ld %ld",&a,&b);
long int c[a],d[a],e[a];
  
  scanf("%ld",&c[0]);
   if(b>c[0])  d[0]=b-c[0];
  else d[0]=c[0]-b;
  e[0]=d[0];
  
  for(i=1;i<a;++i)
  {
  scanf("%ld",&c[i]);
  if(b>c[i])  d[i]=b-c[i];
  else d[i]=c[i]-b;
    
  e[i]=gcd(e[i-1],d[i]);
  }

 
printf("%ld",e[a-1]);

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:8: error: 'gcd' was not declared in this scope; did you mean 'std::gcd'?
   23 |   e[i]=gcd(e[i-1],d[i]);
      |        ^~~
      |        std::gcd
In file included from a.cc:3:
/usr/include/c++/14/numeric:173:5: note: 'std::gcd' declared here
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
Language: C++

#include<stdio.h>
#include<iostream>
#include<numeric>
int main()
{
long int a,b,i,j,min,f;
  min=100000;

  scanf("%ld %ld",&a,&b);
long int c[a],d[a],e[a];
  
  scanf("%ld",&c[0]);
   if(b>c[0])  d[0]=b-c[0];
  else d[0]=c[0]-b;
  e[0]=d[0]
  
  for(i=1;i<a;++i)
  {
  scanf("%ld",&c[i]);
  if(b>c[i])  d[i]=b-c[i];
  else d[i]=c[i]-b;
    
  e[i]=std::gcd(e[i-1],d[i]);
  }

 
printf("%d",e[a-1]);

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: expected ';' before 'for'
   15 |   e[0]=d[0]
      |            ^
      |            ;
   16 | 
   17 |   for(i=1;i<a;++i)
      |   ~~~       
a.cc:17:18: error: expected ';' before ')' token
   17 |   for(i=1;i<a;++i)
      |                  ^
      |                  ;
Language: C++

#include<stdio.h>
#include<iostream>
#include<numeric>
int main()
{
long int a,b,i,j,min,e,f;
  min=100000;

  scanf("%ld %ld",&a,&b);
long int c[a],d[a],e[a];
  
  scanf("%ld",&c[0]);
   if(b>c[0])  d[0]=b-c[0];
  else d[0]=c[0]-b;
  e[0]=d[0]
  
  for(i=1;i<a;++i)
  {
  scanf("%ld",&c[i]);
  if(b>c[i])  d[i]=b-c[i];
  else d[i]=c[i]-b;
    
  e[i]=std::gcd(e[i-1],d[i]);
  }

 
printf("%d",e[a-1]);

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: conflicting declaration 'long int e [a]'
   10 | long int c[a],d[a],e[a];
      |                    ^
a.cc:6:22: note: previous declaration as 'long int e'
    6 | long int a,b,i,j,min,e,f;
      |                      ^
a.cc:15:4: error: invalid types 'long int[int]' for array subscript
   15 |   e[0]=d[0]
      |    ^
a.cc:17:18: error: expected ';' before ')' token
   17 |   for(i=1;i<a;++i)
      |                  ^
      |                  ;
a.cc:27:14: error: invalid types 'long int[long int]' for array subscript
   27 | printf("%d",e[a-1]);
      |              ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<numeric>
int main()
{
long int a,b,i,j,min,e,f;
  min=100000;

  scanf("%ld %ld",&a,&b);
long int c[a],d[a];
  
  scanf("%ld",&c[0]);
   if(b>c[0])  d[0]=b-c[0];
  else d[0]=c[0]-b;
  e[0]=d[0]
  
  for(i=1;i<a;++i)
  {
  scanf("%ld",&c[i]);
  if(b>c[i])  d[i]=b-c[i];
  else d[i]=c[i]-b;
    
  e[i]=std::gcd(e[i-1],d[i]);
  }

 
printf("%d",e[a-1]);

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:4: error: invalid types 'long int[int]' for array subscript
   15 |   e[0]=d[0]
      |    ^
a.cc:17:18: error: expected ';' before ')' token
   17 |   for(i=1;i<a;++i)
      |                  ^
      |                  ;
a.cc:27:14: error: invalid types 'long int[long int]' for array subscript
   27 | printf("%d",e[a-1]);
      |              ^
Language: C++

#include <iostream>
using namespace std;

int main()
{
    long long N, X;
    cin >> N >> X;
    long long x[N + 1];
    short mixFlag = 0; // 偶数と奇数が混ざっている場合を検知
    for (int i = 0; i < N; i++)
    {
        cin >> x[i];
        if (i == 0)
        {
            mixFlag = x[i] % 2;
        }
        else if (x[i] % 2 != mixFlag)
        {
            cout << "1" << endl;
            return 0;
        }
    }
    x[N] = X;
    sort(x, x + N + 1); // 昇順にソート

    long long min = 1000000000; // 10^9
    long long diff = 0;
    for (int i = 1; i <= N; i++)
    {
        diff = x[i] - x[i - 1];
        if (diff < min)
            min = diff;
    }
    cout << min << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(x, x + N + 1); // 昇順にソート
      |     ^~~~
      |     short
Language: C++

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

int main(){
  int N,X;
  cin>>N>>X;
  int x[N];
  int res=0
  vector<int> Y(N-1);
  for(int i=0;i<N;i++){
    cin>>X[i];
  }
  for(int i=0;i<N;i++){
    Y[i]=abs(X-X[i]);
    
  cout<<gcd_range(Y.begin(),Y.end())<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'vector'
    9 |   vector<int> Y(N-1);
      |   ^~~~~~
a.cc:11:11: error: invalid types 'int[int]' for array subscript
   11 |     cin>>X[i];
      |           ^
a.cc:14:5: error: 'Y' was not declared in this scope
   14 |     Y[i]=abs(X-X[i]);
      |     ^
a.cc:14:17: error: invalid types 'int[int]' for array subscript
   14 |     Y[i]=abs(X-X[i]);
      |                 ^
a.cc:16:9: error: 'gcd_range' was not declared in this scope
   16 |   cout<<gcd_range(Y.begin(),Y.end())<<endl;
      |         ^~~~~~~~~
a.cc:17:2: error: expected '}' at end of input
   17 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int gcd(int x,int y){
if(x==0 || y==0)
  return max(x,y);
  else{
  if(x<y)
    return gcd(x,y%x);
    else if(y<x)
      return gcd(y,x%y);
    else
      return x;
  }

}
int main(){
int N,X;
  cin>>N>>X;
  vector<int>A(N);
  for(int i=0;i<N;i++){
  int x;
    cin>>x;
    A.at(i)=x-X;
  
  }
  int ans=A.at(0);
  for(int i=1;i<N;i++){
  ans=gcd(ans,A.at(i);
  
  }cout<<ans<<endl;
  
  
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:22: error: expected ')' before ';' token
   28 |   ans=gcd(ans,A.at(i);
      |          ~           ^
      |                      )
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <tuple>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repdm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)

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

ll main()
{

  ll N, X;
  cin >> N >> X;

  ll x[N];
  vector<ll> d(N);
  rep(i, N)
  {
    cin >> x[i];
    d[i] = abs(x[i] - X);
  };
  ll ans = gcd(d[0], d[1]);
  repd(i, 2, N)
  {
    ans = gcd(ans, d[i]);
  }
  cout << ans;

  return 0;
}

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

N,X = map(int,input().split())
Alist = list(map(int,input().split()))
for i in range(len(Alist)):
    Alist[i] = abs(Alist[i]-X)
Alist.sort()
p = 1
for i in range(1,len(Alist)):
    if Alist[i] % Alist[0] != 0:
        p = p*0
if len(Alist) > 1:
    if p == 0:
        print(1)
    else:
        print(Alist[0])
else:
    print(Alist[0])

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N,X = map(int,input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const double pi=3.1415926535;

int main(){
  ll n,c,x,y,r=1;
  cin>>n>>c;
  ll a[n];
  rep(i,0,n){
    cin>>a[i];
    a[i]=abs(c-a[i]);
  }
  x=a[0];
  rep(i,0,n-1){
    y=b[i+1];
    while(r!=0){r=x%y; x=y; y=r;}
  }
  co(x);
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:7: error: 'b' was not declared in this scope
   21 |     y=b[i+1];
      |       ^
Language: C++


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

using namespace std;

int abs(int a) {return (a < 0) ? -a : a;}

int main(){
    int N, X; cin >> N >> X; int x[N], D = INT_MAX;
    for (int i = 0; i < N; i++) cin >> x[i], D = min(D, abs(x[i]-X));
    cout << D << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:44: error: 'INT_MAX' was not declared in this scope
   11 |     int N, X; cin >> N >> X; int x[N], D = INT_MAX;
      |                                            ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 |
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
long long int ara[1000000],ara1[1000000];
int main()
{
    long long int n,k,i,j,sum;
    cin>>n>>k;
    ara[0]=k;
    for(i=1;i<=n;i++) cin>>ara[i];
    sort(ara,ara+n+1);
//    for(i=0;i<=n;i++) {
//        cout<<ara[i]<<" ";
//    }
//    cout<<endl;
    long long int mini=200000000000;
    for(i=1,j=0;i<=n;i++,j++){
        ara1[j]=ara[i]-ara[i-1];
    }
    sum=ara1[0];
    for(i=1;i<j;i++){
        sum=__GCD(sum,ara1[i]);
    }
    cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: '__GCD' was not declared in this scope
   22 |         sum=__GCD(sum,ara1[i]);
      |             ^~~~~
Language: C++

#include <cstdio>

#include <algorithm>

using namespace std;

const int Maxn = 1e5+7;

int n, ans, x[Maxn];

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

int ()
{
    scanf("%d%d", &n, x);
    for(int i = 1; i <= n; ++i)
        scanf("%d", x+i);
    sort(x, x+n+1);
    ans = x[1]-x[0];
    for(int i = 2; i <= n; ++i)
        ans = gcd(ans, x[i]-x[i-1]);
    printf("%dn", ans);
    return 0;
}

Compiler output:
a.cc:16:6: error: expected unqualified-id before ')' token
   16 | int ()
      |      ^
Language: C++

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define INF 1000000000000
using ll = long long;


int main(){
  int n;
  ll x;
  cin >> n >> x;
  vector<ll> x(n);
  rep(i,n)cin >> x.at(i);
  vector<ll> dif(n);
  rep(i,n)dif.at(i) = abs(x.at(i)-x);
  sort(dif.begin(),dif.end());
  ll d = dif.at(0);
  for(ll i = d; i >= 2; i--){
    for(auto j : dif){
      if(j%i!=0){
        continue;
      }
    }
    cout<<i<<endl;
    return 0;
  }
  cout<<1<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: conflicting declaration 'std::vector<long long int> x'
   14 |   vector<ll> x(n);
      |              ^
a.cc:12:6: note: previous declaration as 'll x'
   12 |   ll x;
      |      ^
a.cc:15:20: error: request for member 'at' in 'x', which is of non-class type 'll' {aka 'long long int'}
   15 |   rep(i,n)cin >> x.at(i);
      |                    ^~
a.cc:17:29: error: request for member 'at' in 'x', which is of non-class type 'll' {aka 'long long int'}
   17 |   rep(i,n)dif.at(i) = abs(x.at(i)-x);
      |                             ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  int d=abs(c[i]-b);
  rep(i,a){
  d=__gcd(d,abs(c[i]-b));
  }
          cout<<d<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: 'i' was not declared in this scope
   24 |   int d=abs(c[i]-b);
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  int d=abs(c[i]-b);
  rep(i,a){
  d=gcd__(d,abs(c[i]-b));
  }
          cout<<d<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: 'i' was not declared in this scope
   24 |   int d=abs(c[i]-b);
      |               ^
a.cc:26:5: error: 'gcd__' was not declared in this scope
   26 |   d=gcd__(d,abs(c[i]-b));
      |     ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(a);
  rep(i,a)
    cin>>c[i];
  int d=abs(c[i]-b);
  rep(i,a){
  d=gcd__(d,abs(c[i]-b);
  }
          cout<<d<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: 'i' was not declared in this scope
   24 |   int d=abs(c[i]-b);
      |               ^
a.cc:26:24: error: expected ')' before ';' token
   26 |   d=gcd__(d,abs(c[i]-b);
      |          ~             ^
      |                        )
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<deque>
#include<iostream>
#include<algorithm>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define all(a)  (a).begin(),(a).end()
#define elif else if



int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int souwa(int a){
  return a*(a+1)/2;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}

struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
}
  
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

signed main(){
  int n,x;
  cin>>n>>x;
  V<int> a(x);
  fo(i,n){
    cin>>a[i];
  }
  int ans=x-a[0];
  for(int i=1; i<n; i++){
    ans=gcd(ans,abs(x-a[i]));
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc:59:2: error: expected ';' after struct definition
   59 | }
      |  ^
      |  ;
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<deque>
#include<iostream>
#include<algorithm>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define all(a)  (a).begin(),(a).end()
#define elif else if



int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int souwa(int a){
  return a*(a+1)/2;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}

struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

signed main(){
  int n,x;
  cin>>n>>x;
  V<int> a(x);
  fo(i,n){
    cin>>a[i];
  }
  int ans=x-a[0];
  for(int i=1; i<n; i++){
    ans=gcd(ans,abs(x-a[i]));
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc:84:2: error: expected '}' at end of input
   84 | }
      |  ^
a.cc:42:13: note: to match this '{'
   42 | struct Union{
      |             ^
a.cc: In member function 'int Union::main()':
a.cc:84:1: warning: no return statement in function returning non-void [-Wreturn-type]
   84 | }
      | ^
a.cc: At global scope:
a.cc:84:2: error: expected unqualified-id at end of input
   84 | }
      |  ^
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<deque>
#include<iostream>
#include<algorithm>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define all(a)  (a).begin(),(a).end()
#define elif else if



int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int souwa(int a){
  return a*(a+1)/2;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}

struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}

signed main(){
  int n,x;
  cin>>n>>x;
  V<int> a(x);
  fo(i,n){
    cin>>a[i];
  }
  int ans=x-a[0];
  for(int i=1; i<n; i++){
    ans=gcd(ans,abs(x-a[i]));
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc:84:2: error: expected '}' at end of input
   84 | }
      |  ^
a.cc:42:13: note: to match this '{'
   42 | struct Union{
      |             ^
a.cc: In member function 'long long int Union::lcm(long long int, long long int)':
a.cc:69:14: error: 'gcm' was not declared in this scope; did you mean 'lcm'?
   69 |     return a/gcm(a,b)*b;
      |              ^~~
      |              lcm
a.cc: In member function 'int Union::main()':
a.cc:84:1: warning: no return statement in function returning non-void [-Wreturn-type]
   84 | }
      | ^
a.cc: At global scope:
a.cc:84:2: error: expected unqualified-id at end of input
   84 | }
      |  ^
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<deque>
#include<iostream>
#include<algorithm>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define all(a)  (a).begin(),(a).end()
#define elif else if



int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int souwa(int a){
  return a*(a+1)/2;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcm(b,a%b);
}

struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}

signed main(){
  int n,x;
  cin>>n>>x;
  V<int> a(x);
  fo(i,n){
    cin>>a[i];
  }
  int ans=x-a[0];
  for(int i=1; i<n; i++){
    ans=gcd(ans,abs(x-a[i]));
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:39:10: error: 'gcm' was not declared in this scope; did you mean 'gcd'?
   39 |   return gcm(b,a%b);
      |          ^~~
      |          gcd
a.cc: At global scope:
a.cc:84:2: error: expected '}' at end of input
   84 | }
      |  ^
a.cc:42:13: note: to match this '{'
   42 | struct Union{
      |             ^
a.cc: In member function 'long long int Union::lcm(long long int, long long int)':
a.cc:69:14: error: 'gcm' was not declared in this scope; did you mean 'lcm'?
   69 |     return a/gcm(a,b)*b;
      |              ^~~
      |              lcm
a.cc: In member function 'int Union::main()':
a.cc:84:1: warning: no return statement in function returning non-void [-Wreturn-type]
   84 | }
      | ^
a.cc: At global scope:
a.cc:84:2: error: expected unqualified-id at end of input
   84 | }
      |  ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<limits.h>

int getGcm(int a, int b){
	int l;
	int s;
	if(a>b) {
		l = a;
		s = b;
	} else {
		l = b;
		s = a;
	}
	while(l!=s){
		int c;
		c = l - s;
		l = s;
		s = c;
	}
	return l;
}

int main(){
	int n, x;
	int x_tmp;
	int gcm;
	scanf("%d %d\n", &n, &x);
	for(int i=0; i<n; i++) {
		scanf("%d\n", &x_tmp);
		if(i==0) gcm = abs(t_tmp-x);
		else gcm = getGcm(gcm, abs(t_tmp-x));
	}
	printf("%d\n", gcm);
	return 0;
}




Compiler output:
main.c: In function 'main':
main.c:31:36: error: 't_tmp' undeclared (first use in this function); did you mean 'x_tmp'?
   31 |                 if(i==0) gcm = abs(t_tmp-x);
      |                                    ^~~~~
      |                                    x_tmp
main.c:31:36: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

template <class T> gcd(T a, T b)
{
    if (a < b) swap(a, b);
    if (a % b == 0) return b;
    return gcd(a % b, b);
}


int main()
{
    long N, X0;
    cin >> N >> X0;

    vector<long> X(N);
    for (int i = 0; i < N; ++i)
    {
        cin >> X[i];
        X[i] = abs(X[i] - X0);
    }
    sort(X.begin(), X.end());

    long d = X[0];
    for (int i = 1; i < N and d > 1; ++i)
        d = gcd(d, X[i]);

    cout << d << endl;
}


Compiler output:
a.cc:11:20: error: ISO C++ forbids declaration of 'gcd' with no type [-fpermissive]
   11 | template <class T> gcd(T a, T b)
      |                    ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef struct {
    int a; int b; int c; int d;
}Data;
vector<Data> ans;
priority_queue< int, std::vector<int>, std::greater<int> >
find_(priority_queue< int, std::vector<int>, std::greater<int> > y, int f) {
    priority_queue< int, std::vector<int>, std::greater<int> > ret;
    bool ok = true;
    while(!y.empty()) {
        int tmp = y.top();
        y.pop();
        if(tmp == f) {
            ok = false;
            continue;
        }
        ret.push(tmp);
    }
    if(ok) ret.push(f);
    return ret;
}
int main() {
    int h, w; cin >> h >> w;
    priority_queue< int, std::vector<int>, std::greater<int> > x[h];
    int a[h][w];
    rep(i, h) rep(j, w) {
        cin >> a[i][j];
        if(a[i][j] % 2) x[i].push(j);
    }
    rep(i, h) {
        while(x[i].size() > 1) {
            int first = x[i].top(); x[i].pop();
            int second = x[i].top(); x[i].pop();
            rep(j, second-first) {
                ans.push_back(Data{i,first+j,i,first+j+1});
            }
        }
        if(x[i].size()==1 i!=h-1) {
            x[i+1] = find_(x[i+1], x[i].top());
            ans.push_back(Data{i,x[i].top(),i+1,x[i].top()});
        }
    }
    cout << ans.size() << endl;
    rep(i, ans.size()) {
        printf("%d %d %d %d\n",ans[i].a+1,ans[i].b+1,ans[i].c+1,ans[i].d+1);
    }
}          


Compiler output:
a.cc: In function 'int main()':
a.cc:41:26: error: expected ')' before 'i'
   41 |         if(x[i].size()==1 i!=h-1) {
      |           ~              ^~
      |                          )
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, x;
    cin >> n >> x;
    ll a[100001];
    ll tmp;
    rep(i, n){
        cin >> tmp;
        a[i] = tmp;
    }
    ll ans;
    ans  = abs(a[0] - x);
    rep(i, n){
        ans = __gcd(ans, abs(a[i] - x));
        //cout << ans << endl;

    }
    cout << ans << endl;

    

Compiler output:
a.cc: In function 'int main()':
a.cc:32:25: error: expected '}' at end of input
   32 |     cout << ans << endl;
      |                         ^
a.cc:14:11: note: to match this '{'
   14 | int main(){
      |           ^
Language: C++

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

signed main(){
    int n,x;
    cin >> n >> x;
    vector<int> a(n);
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    int x = a[0],y = a[n - 1],b = 10; 
    while(b){
         b = x % y;
            x = y;
            y = b;
    }
    cout << x << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: redeclaration of 'long long int x'
   14 |     int x = a[0],y = a[n - 1],b = 10;
      |         ^
a.cc:6:11: note: 'long long int x' previously declared here
    6 |     int n,x;
      |           ^
Language: C++

    #include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    int MAX(int a,int b){
      if(a<b){
        int tmp = a;
        a = b;
        b = tmp;
      }
      int r = a%b;
      while(!r){
        a = b;
        b = r;
        r = a%b;
      }
      return r;
    }

    int main(){
      int n,x;
      cin>>n>>x;
      VEC(int,y,n);
      if(n == 1){
        cout<<y[0]-x;
        return 0;
      }
      auto p = vec(int,n);
      rep(i,n)p[i] = abs(x-y[i]);
      sort(p.begin(),p.end());
      int res = MAX(p[0],p[1]);

      REP(i,1,n\1){
        if(p[i]%res != 0){
          cout<<1<<endl;
          return 0;
        }
      }
      cout<<res<<endl;
    }


Compiler output:
a.cc:51:16: error: stray '\' in program
   51 |       REP(i,1,n\1){
      |                ^
a.cc:17:53: note: in definition of macro 'REP'
   17 |     #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
      |                                                     ^
a.cc: In function 'int main()':
a.cc:51:17: error: expected ')' before numeric constant
   51 |       REP(i,1,n\1){
      |                 ^
a.cc:17:53: note: in definition of macro 'REP'
   17 |     #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
      |                                                     ^
a.cc:17:52: note: to match this '('
   17 |     #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
      |                                                    ^
a.cc:51:7: note: in expansion of macro 'REP'
   51 |       REP(i,1,n\1){
      |       ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int n,x;
  cin >> n >> x;
  vector<int> s(n);
  int m=1000000000;
  for(int i=0;i<n;i++){
    cin >> s[i];
    m=min(m,s[i]-x);
  }
  int ans=-1;
  for(int i=1;i<=m;i++){
    bool flag=true;
    for(int j=0;j<n;j++){
      if((s[i]-x)%i!=0){
        flag=false;
        break;
      }
    }
    if(flag) ans=i;
  }
  cout << i << endl;
}

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

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

int main(){
  int64_t N,X;
  cin >> N >> X;
  vector<int64_t> a(N);
  for (int i = 0; i < N; i++){
    cin >> a.at(i);
    a.at(i) = max((a.at(i) - X),(a.at(i) - X) * -1);
  }
  for (int64_t j = a.at(i); j > 0; j++){
    for (int i = 0; i < N; i++){
      if (a.at(i) % j != 0) break;
      else if (i == N - 1){
        cout << j << endl;
        break;
      }
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:25: error: 'i' was not declared in this scope
   12 |   for (int64_t j = a.at(i); j > 0; j++){
      |                         ^
Language: C++

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

int main(){
  int N,X;
  cin >> N >> X;
  vector<int64_t> a(N);
  for (int i = 0; i < N; i++){
    cin >> a.at(i);
    a.at(i) = max((a.at(i) - X),(a.at(i) - X) * -1);
  }
  for (int j = a.at(i); j > 0; j++){
    for (int i = 0; i < N; i++){
      if (a.at(i) % j != 0) break;
      else if (i == N - 1){
        cout << j << endl;
        break;
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 'i' was not declared in this scope
   12 |   for (int j = a.at(i); j > 0; j++){
      |                     ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include<Math.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include<string>
#include <stack>
#include<queue>
#include<map>
#include <stdlib.h>
#include <bits/stdc++.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	ll n, x, w = 1000000005;
	cin >> n >> x;
	vector<ll> h(n);
	for (ll i = 0; i < h.size(); i++)
		h[i] = 1000000005;

	for (ll i = 0; i < n; i++) {
		cin >> h[i];
	}
	sort(h.begin(),h.end());
	if(n>2){
			ll w1= h[1]-h[0];
			ll w2 = h[2] -h[0];
			cout<<__gcd(w1,w2)<<endl;

	}else if(n>1){
		cout<<h[1]-h[0]<<endl;
	}else{
		cout<<h[0]-x<<endl;
	}

}



Compiler output:
a.cc:6:9: fatal error: Math.h: No such file or directory
    6 | #include<Math.h>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, x; cin >> n >> x;
	VE a(n); rep(i, n)cin >> a[i];
	a.push_back(x);
	sort(ALL(a));
	int ans = INF;
	rep(i, n)chmin(ans, x[i + 1] - x[i]);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:100:30: error: invalid types 'long long int[long long int]' for array subscript
  100 |         rep(i, n)chmin(ans, x[i + 1] - x[i]);
      |                              ^
a.cc:100:41: error: invalid types 'long long int[long long int]' for array subscript
  100 |         rep(i, n)chmin(ans, x[i + 1] - x[i]);
      |                                         ^
Language: Java

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    System.out.println("start");
    new ABC109C().exec();
    System.out.println("end");
  }

  void exec() {
    Scanner sc = new Scanner(System.in);
    int n = readInt(sc);
    int x = readInt(sc);
    int xs[] = new int[n];
    for (int i = 0; i < n; i++) {
      xs[i] = Math.abs(x - readInt(sc));
    }

    int beforeG = x;
    for (int i = 0; i < n; i++) {
      if (i == 0)
        beforeG = gcb(xs[i], xs[i + 1]);
      else
        beforeG = gcb(beforeG, xs[i]);
    }
    System.out.println(beforeG);
  }

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

  int readInt(Scanner sc) {
    return sc.nextInt();
  }

  String readString(Scanner sc) {
    return sc.next();
  }

}

Compiler output:
Main.java:6: error: cannot find symbol
    new ABC109C().exec();
        ^
  symbol:   class ABC109C
  location: class Main
1 error
Language: Java

import java.util.Scanner;

public class ABC109C {
  public static void main(String[] args) {
    System.out.println("start");
    new ABC109C().exec();
    System.out.println("end");
  }

  void exec() {
    Scanner sc = new Scanner(System.in);
    int n = readInt(sc);
    int x = readInt(sc);
    int xs[] = new int[n];
    for (int i = 0; i < n; i++) {
      xs[i] = Math.abs(x - readInt(sc));
    }

    int beforeG = x;
    for (int i = 0; i < n; i++) {
      if (i == 0)
        beforeG = gcb(xs[i], xs[i + 1]);
      else
        beforeG = gcb(beforeG, xs[i]);
    }
    System.out.println(beforeG);
  }

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

  int readInt(Scanner sc) {
    return sc.nextInt();
  }

  String readString(Scanner sc) {
    return sc.next();
  }

}

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

import java.util.Scanner;

import javax.lang.model.util.ElementScanner6;

public class ABC109C {
  public static void main(String[] args) {
    System.out.println("start");
    new ABC109C().exec();
    System.out.println("end");
  }

  void exec() {
    Scanner sc = new Scanner(System.in);
    int n = readInt(sc);
    int x = readInt(sc);
    int xs[] = new int[n];
    for (int i = 0; i < n; i++) {
      xs[i] = Math.abs(x - readInt(sc));
    }

    int beforeG = x;
    for (int i = 0; i < n; i++) {
      if (i == 0)
        beforeG = gcb(xs[i], xs[i + 1]);
      else
        beforeG = gcb(beforeG, xs[i]);
    }
    System.out.println(beforeG);
  }

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

  int readInt(Scanner sc) {
    return sc.nextInt();
  }

  String readString(Scanner sc) {
    return sc.next();
  }

}

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

#include <bits/stdc++.h>

#define mod 1000000007

#define rep(i, n) for(int i=0; i<n; ++i)

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int N, X, ans = 1e10;
	
	cin >> N >> X;
	
	rep(i, N){
		int x;
		cin >> x;
		ans = min(ans, abs(x - X));
	}
	
	cout << ;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   13 |         int N, X, ans = 1e10;
      |                         ^~~~
a.cc:23:17: error: expected primary-expression before ';' token
   23 |         cout << ;
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'd1' was not declared in this scope; did you mean 'y1'?
   10 |     cin>>n,d1,d2;
      |            ^~
      |            y1
a.cc:10:15: error: 'd2' was not declared in this scope
   10 |     cin>>n,d1,d2;
      |               ^~
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n;
    cin>>n,d;
    vector<ll> x(n+1);
    for(ll i=0;i<n+1;i++){
        cin>>x[i];
    }
    sort(all(x));
    d1=x[1]-x[0];
    for(ll i=1;i<n;i++){
        d2=x[i+1]-x[i];
        d1=gcd(d1,d2);
    }
    cout<<d1<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'd' was not declared in this scope
   10 |     cin>>n,d;
      |            ^
a.cc:16:5: error: 'd1' was not declared in this scope; did you mean 'y1'?
   16 |     d1=x[1]-x[0];
      |     ^~
      |     y1
a.cc:18:9: error: 'd2' was not declared in this scope
   18 |         d2=x[i+1]-x[i];
      |         ^~
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll fact(ll x){
  ll y=1;
  for(ll i=1;i<=x;i++){
   y*=i;
   y%=1000000007;
  }
  return y;
}
int main() {
  ll n,x;
  cin>>n>>x;
  vec a(n);
  loop(i,n){
  cin>>a[i];
  }
ll ans=abs(x-a[]);
loop(i,n){
ans=__gcd(ans,abs(x-a[i]));
}
putout(ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:16: error: expected primary-expression before ']' token
   49 | ll ans=abs(x-a[]);
      |                ^