criyle/codenet-compile-errors huggingface dataset:
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[i]);
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: 'i' was not declared in this scope
   49 | ll ans=abs(x-a[i]);
      |                ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
int gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	while (b) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

string W[110];

int main() {
	ll n, X;
	cin >> n >> X;
	vector<ll>x(n);
	for (long long i = 0;i < n;++i) {
		cin >> x[i];
	}
	sort(x.begin(), x.end());
	ll ans = abs(x[0] - X);
	for (ll i = 0;i < n;++i) {
		ll res = abs(x[i] - X);
		ll ans = gcd(ll ans,ll res);
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:33: error: expected primary-expression before 'ans'
   30 |                 ll ans = gcd(ll ans,ll res);
      |                                 ^~~
a.cc:30:40: error: expected primary-expression before 'res'
   30 |                 ll ans = gcd(ll ans,ll res);
      |                                        ^~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {
	if (a < b)swap(a, b);
	while (b) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
	ll n, X;
	cin >> n >> X;
	vector<ll>x(n);
	for (long long i = 0;i < n;++i) {
		cin >> x[i];
	}
	sort(x.begin(), x.end());
	ll ans = abs(x[0] - X);
	for (ll i = 0;i < n;++i) {
		ll res = abs(x[i] - X);
		ll ans = gcd(ll ans,ll res);
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:33: error: expected primary-expression before 'ans'
   28 |                 ll ans = gcd(ll ans,ll res);
      |                                 ^~~
a.cc:28:40: error: expected primary-expression before 'res'
   28 |                 ll ans = gcd(ll ans,ll res);
      |                                        ^~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(a, b % a) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

string W[110];

int main() {
	ll n, X;
	cin >> n >> X;
	vector<ll>x(n);
	for (long long i = 0;i < n;++i) {
		cin >> x[i];
	}
	sort(x.begin(), x.end());
	ll ans = abs(x[0] - X);
	for (ll i = 0;i < n;++i) {
		ll res = abs(x[i] - X);
		ll ans = gcd(ll ans,ll res);
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:33: error: expected primary-expression before 'ans'
   22 |                 ll ans = gcd(ll ans,ll res);
      |                                 ^~~
a.cc:22:40: error: expected primary-expression before 'res'
   22 |                 ll ans = gcd(ll ans,ll res);
      |                                        ^~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

string W[110];

int main() {
	ll n, X;
	cin >> n >> X;
	vector<ll>x(n);
	for (long long i = 0;i < n;++i) {
		cin >> x[i];
	}
	sort(x.begin(), x.end());
	ll ans = abs(x[0] - X);
	for (ll i = 0;i < n;++i) {
		ll res = abs(x[i] - X);
		ll ans = gcd(ll ans,ll res);
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:33: error: expected primary-expression before 'ans'
   22 |                 ll ans = gcd(ll ans,ll res);
      |                                 ^~~
a.cc:22:40: error: expected primary-expression before 'res'
   22 |                 ll ans = gcd(ll ans,ll res);
      |                                        ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long soibun(long a,long b){
  if(a == b) return a;
  else{
    return soibun(b,a%b);
  }
}


int main(){
  int n;
  long x;
  cin >> n >> x;
  long distance[n];
  long xx[n];
  int i;
  for(i=0;i<n;i++){
    cin >> xx[i];
    distance[i] = abs(x-xx[i]);
  }
  tmp = distance[0];
  for(i=1;i<n;i++){
    tmp = soibun(distance[i],tmp);
  }
  cout << tmp;
}

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

#include<bits/stdc++.h>
long soibun(long a,long b){
  if(a == b) return a;
  else{
    return soibun(b,a%b);
  }
}


int main(){
  int n;
  long x;
  cin >> n >> x;
  long xx[n];
  int i;
  for(i=0;i<n;i++){
    cin >> xx[i];
  }
  long dis[n];
  for(i=0;i<n;i++){
    dis[i] = abs(x-xx[i]);
  }
  long tmp = 0;
  for(i=0;i<n;i++){
    if(dis[i]==0)continue;
    else{
      if(tmp == 0) tmp = dis[i];
      else tmp = soibun(tmp,dis[i]);
    }
  }
  cout << tmp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   13 |   cin >> n >> x;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:31:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   31 |   cout << tmp;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<bits/stdc++.h>
long soibun(long a,long b){
  if(a == b) return a;
  else{
    return soibun(b,a%b);
  }
}


int main(){
  int n;
  long x;
  cin >> n >> x;
  long x[n];
  int i;
  for(i=0;i<n;i++){
    cin >> x[i];
  }
  long dis[n];
  for(i=1;i<n;i++){
    dis[i] = abs(x[0]-x[i]);
  }
  long tmp = dis[1];
  for(i=2;i<n;i++){
    tmp = soibun(tmp,dis[i]);
  }
  cout << tmp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   13 |   cin >> n >> x;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:8: error: conflicting declaration 'long int x [n]'
   14 |   long x[n];
      |        ^
a.cc:12:8: note: previous declaration as 'long int x'
   12 |   long x;
      |        ^
a.cc:17:13: error: invalid types 'long int[int]' for array subscript
   17 |     cin >> x[i];
      |             ^
a.cc:21:19: error: invalid types 'long int[int]' for array subscript
   21 |     dis[i] = abs(x[0]-x[i]);
      |                   ^
a.cc:21:24: error: invalid types 'long int[int]' for array subscript
   21 |     dis[i] = abs(x[0]-x[i]);
      |                        ^
a.cc:27:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |   cout << tmp;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e9;

int main() {
  ll n, X, d = INF;
  cin >> n >> X;
  vector<ll> x(nx);
  rep(i, n) cin >>x[i];
  x.emplace_back(X);
  sort(x.begin(), x.end());
  for (ll i = 1; i < n + 1; ++i) d = min(d, x[i] - x[i - 1]);
  cout << d << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'nx' was not declared in this scope; did you mean 'x'?
   11 |   vector<ll> x(nx);
      |                ^~
      |                x
Language: C++

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

int main(){
  int n; cin>>n;
  vector<int> num(n+1);
  for(int i=0;i<n+1;i++){
    cin>>num[i];
  }
  sort(num.begin(),num.end());
  long long minnum=10000000010;
  for(int i=0;i<n;i++){
    minnum=min(minnum,num[i+1]-num[i]);
  }cout<<minnum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   13 |     minnum=min(minnum,num[i+1]-num[i]);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:13:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   13 |     minnum=min(minnum,num[i+1]-num[i]);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:13:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   13 |     minnum=min(minnum,num[i+1]-num[i]);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  
 long long int a,b,c[100010],d;
  cin >>a >>b;
  d = 0;
 for(int i=0;i<a;i++)
  cin >> c[i];
  
  d =max(d,c[i]);
  
  cout << abs(b-d) << endl;
   
   return 0;
 }
 



Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: 'i' was not declared in this scope
   13 |   d =max(d,c[i]);
      |              ^
Language: C++

/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(long long int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  int n,x;
  cin>>n>>x;
  vector<int> v(n),w(n);
  ans=1;
  rep(i,n){
    cin>>v[i];
    w[i]=abs(x-v[i]);
    ans=GCD(ans,w[i]);
  }
  cout<<ans<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int gcd(int i, int j){
    if (i < j){
        swap(i, j);
    }
    if (i % j == 0){
        return j;
    }
    else{
        return gcd(j, i % j)；
    }
}

int main() {
    int N, X;
    cin >> N >> X;
    vector<int> x(N);
    for (int i = 0; i < N; i++){
        cin >> x[i];
        x[i] = abs(x[i] - X);
    }
    sort(x.begin(), x.end());
    if (N == 1) {
        cout << x[0] << endl;
        return 0;
    }
    int ans = gcd(x[0], x[1]);
    for (int i = 2; i < N; i++){
        ans = gcd(ans, x[i]);
        if (ans == 1){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:14:29: error: expected ';' before '\U0000ff1b'
   14 |         return gcd(j, i % j)；
      |                             ^~
      |                             ;
a.cc:14:29: error: '\U0000ff1b' was not declared in this scope
   14 |         return gcd(j, i % j)；
      |                             ^~
Language: C++

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

using namespace std;

class CSkip {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        long long n, x;
        cin >> n >> x;
        vector<long long int> x_vec(n);
        x_vec.push_back(x);
        for (int i = 0; i < n; ++i) {
            cin >> x_vec[i];
        }
        long long int now = x;
        vector<long long int> diff_vec;
        for (int j = 1; j < n+1; ++j) {
            diff_vec.push_back(abs(x_vec[j] - x_vec[j - 1]));
        }
        if (diff_vec.size() == 1) {
            cout << diff_vec[0] << endl;
        }else{
            long long int ans = 0;
            for (int k = 0; k < diff_vec.size(); ++k) {
                if (ans == 0) ans = diff_vec[k];
                else ans = __algo_gcd(ans, diff_vec[k]);
            }
            cout << ans << endl;
        }
    }
};


int main() {
    CSkip solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Compiler output:
a.cc: In member function 'void CSkip::solve(std::istream&, std::ostream&)':
a.cc:38:28: error: '__algo_gcd' was not declared in this scope
   38 |                 else ans = __algo_gcd(ans, diff_vec[k]);
      |                            ^~~~~~~~~~
Language: C++

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>

using namespace std;

class CSkip {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        long long n, x;
        cin >> n >> x;
        vector<long long int> x_vec(n);
        x_vec.push_back(x);
        for (int i = 0; i < n; ++i) {
            cin >> x_vec[i];
        }
        long long int now = x;
        vector<long long int> diff_vec;
        for (int j = 1; j < n+1; ++j) {
            diff_vec.push_back(abs(x_vec[j] - x_vec[j - 1]));
        }
        if (diff_vec.size() == 1) {
            cout << diff_vec[0] << endl;
        }else{
            long long int ans = 0;
            for (int k = 0; k < diff_vec.size(); ++k) {
                if (ans == 0) ans = diff_vec[k];
                else ans = __algo_gcd(ans, diff_vec[k]);
            }
            cout << ans << endl;
        }
    }
};


int main() {
    CSkip solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Compiler output:
a.cc: In member function 'void CSkip::solve(std::istream&, std::ostream&)':
a.cc:36:28: error: '__algo_gcd' was not declared in this scope
   36 |                 else ans = __algo_gcd(ans, diff_vec[k]);
      |                            ^~~~~~~~~~
Language: C++

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

class CSkip {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        long long n, x;
        cin >> n >> x;
        vector<long long int> x_vec(n);
        x_vec.push_back(x);
        for (int i = 0; i < n; ++i) {
            cin >> x_vec[i];
        }
        long long int now = x;
        vector<long long int> diff_vec;
        for (int j = 1; j < n+1; ++j) {
            diff_vec.push_back(abs(x_vec[j] - x_vec[j - 1]));
        }
        if (diff_vec.size() == 1) {
            cout << diff_vec[0] << endl;
        }else{
            long long int ans = 0;
            for (int k = 0; k < diff_vec.size(); ++k) {
                if (ans == 0) ans = diff_vec[k];
                else ans = __algo_gcd(ans, diff_vec[k]);
            }
            cout << ans << endl;
        }
    }
};


int main() {
    CSkip solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Compiler output:
a.cc: In member function 'void CSkip::solve(std::istream&, std::ostream&)':
a.cc:35:28: error: '__algo_gcd' was not declared in this scope
   35 |                 else ans = __algo_gcd(ans, diff_vec[k]);
      |                            ^~~~~~~~~~
Language: C++

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

typedef long long llong;

void solve() {
	llong N, X; cin >> N >> X;
	vector<llong> x(N);
	rep(i, N) scanf("%d", &x[i]);

	llong res = (1LL << 60);
	rep(i, N) {
		chmin(res, abs(x[i] - X));
	}
	cout << res << endl;
}

int main(void) {
	solve();

	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:14:17: error: 'chmin' was not declared in this scope
   14 |                 chmin(res, abs(x[i] - X));
      |                 ^~~~~
Language: C++

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,x;
  cin>>n>>x;
  vector<int> v(n),w(n);
  rep(i,n) cin>>v[i];
  rep(i,n) w[i]=abs(v[i]-x);
  ans=w[0];
  rep(i,n){
    ans=gcd(ans,w[i]);
  }
  cout<<ans<<endl;
}
///////////////////////////

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

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

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

void solve(){
    int n,y;
    cin >> n >> y;
    int x[n+10];
    rep(i,n){
        cin >> x[i];
        x[i] = x[[i]-y;
    }
    x[n] = y;
    sort(x,x+n+1);
    int v[n+10];
    for(int i=1; i<=n; i++){
        v[i] = x[i]-x[0];
    }
    int m=gcd(v[0],v[1]);
    for(int i=2; i<n; i++){
        m = gcd(m, v[i]);
    }
    cout << m << endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:27:17: error: two consecutive '[' shall only introduce an attribute before '[' token
   27 |         x[i] = x[[i]-y;
      |                 ^
Language: C++

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

long long gcd(long long x, long long y)
{
    long long a = std::max(x, y);
    long long b = std::min(x, y);

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

int main()
{
    long long N, X;
    std::cin >> N >> X;

    std::vector<long long> x(N);
    for (long long i = 0; i < N; i++) {
        std::cin >> x[i];
    }
    if (x.find(X) == std::end(x)) {
        x.push_back(X);
    }

    std::sort(std::begin(x), std::end(x));

    long long ans = 0;
    for (long long i = 0; i < x.size()-1; i++) {
        ans = gcd(x[i+1] - x[i], ans);
    }

    std::cout << ans << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: 'class std::vector<long long int>' has no member named 'find'
   23 |     if (x.find(X) == std::end(x)) {
      |           ^~~~
Language: C++

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

long long gcd(long long x, long long y)
{
    long long a = std::max(x, y);
    long long b = std::min(x, y);

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

int main()
{
    long long N, X;
    std::cin >> N >> X;

    std::vector<long long> x(N);
    for (long long i = 0; i < N; i++) {
        std::cin >> x[i];
    }

    x.sort(std::begin(x), std::end(x));

    long long ans = 0;
    for (long long i = 0; i < N-1; i++) {
        ans = gcd(x[i+1] - x[i], ans);
    }

    std::cout << ans << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:7: error: 'class std::vector<long long int>' has no member named 'sort'
   24 |     x.sort(std::begin(x), std::end(x));
      |       ^~~~
Language: Java

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] input = new int[n];
        for (int i = 0; i < n; i++) {
            input[i] = sc.nextInt();
        }
        int max = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            if (Math.abs(x - input[i]) < max)
                max = Math.abs(x - input[i]);
        }
        System.out.println(max);
    }
}] input = new int[n];
        for (int i = 0; i < n; i++) {
            input[i] = sc.nextInt();
        }
        int max = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            if (Math.abs(x - input[i]) < max)
                max = Math.abs(x - input[i]);
        }
        System.out.println(max);
    }
}

Compiler output:
Main.java:12: error: ']' expected
        int[import java.util.Arrays;
            ^
Main.java:12: error: not a statement
        int[import java.util.Arrays;
           ^
Main.java:12: error: not a statement
        int[import java.util.Arrays;
                            ^
Main.java:13: error: illegal start of expression
import java.util.Comparator;
^
Main.java:13: error: not a statement
import java.util.Comparator;
                ^
Main.java:14: error: illegal start of expression
import java.util.Scanner;
^
Main.java:14: error: not a statement
import java.util.Scanner;
                ^
Main.java:16: error: illegal start of expression
public class Main {
^
Main.java:34: error: illegal start of type
}] input = new int[n];
 ^
Main.java:34: error: <identifier> expected
}] input = new int[n];
        ^
Main.java:35: error: illegal start of type
        for (int i = 0; i < n; i++) {
        ^
Main.java:35: error: > or ',' expected
        for (int i = 0; i < n; i++) {
                             ^
Main.java:35: error: <identifier> expected
        for (int i = 0; i < n; i++) {
                                ^
Main.java:39: error: illegal start of type
        for (int i = 0; i < n; i++) {
        ^
Main.java:39: error: > or ',' expected
        for (int i = 0; i < n; i++) {
                             ^
Main.java:39: error: <identifier> expected
        for (int i = 0; i < n; i++) {
                                ^
Main.java:43: error: <identifier> expected
        System.out.println(max);
                          ^
Main.java:43: error: <identifier> expected
        System.out.println(max);
                              ^
Main.java:45: error: class, interface, enum, or record expected
}
^
19 errors
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
// min
int main(void){
  long int n, x;
  long int x[100001];
  long int d[100001];
  long int ans = 0;

  // 幅の最大公約数を求めて解を出す

  scanf("%ld%ld", &n, &x);

  for(int i = 0; i < n; i++){
    scanf("%ld", &x[i]);
  }

  // それぞれの幅を求める
  for(int i = 1; i < n; i++){
    d[i] = t[i] - t[i - 1];
  }

  
  printf("%ld", ans);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:12: error: conflicting types for 'x'; have 'long int[100001]'
   13 |   long int x[100001];
      |            ^
main.c:12:15: note: previous declaration of 'x' with type 'long int'
   12 |   long int n, x;
      |               ^
main.c:27:12: error: 't' undeclared (first use in this function)
   27 |     d[i] = t[i] - t[i - 1];
      |            ^
main.c:27:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

using namespace std;

int abs(int x){
  return x>0?x:-x;
}
int gcd(int a,int b){
  if(b==0)return a;
  return gcd(b,a%b);
}

int main(){
  int N,X;
  vector<int> x;
  cin >> N >> X;
  x.push_back(X);
  for(int i=1;i<N;i++){
    int a;
    cin >> a;
    x.push_back(a);
  }
  sort(x.begin(),x.end());
  int ans=10000000000000;
  for(int i=0;i<N-2;i++){
    int o=x[i+1]-x[i];
    int r=x[i+2]-x[i];
    int or=gcd(o,r);
    if(or<ans){
      ans=or;
    }
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000000' to '1316134912' [-Woverflow]
   26 |   int ans=10000000000000;
      |           ^~~~~~~~~~~~~~
a.cc:30:9: error: expected unqualified-id before 'or' token
   30 |     int or=gcd(o,r);
      |         ^~
a.cc:31:8: error: expected primary-expression before 'or' token
   31 |     if(or<ans){
      |        ^~
a.cc:31:10: error: expected primary-expression before '<' token
   31 |     if(or<ans){
      |          ^
a.cc:32:11: error: expected primary-expression before 'or' token
   32 |       ans=or;
      |           ^~
a.cc:32:13: error: expected primary-expression before ';' token
   32 |       ans=or;
      |             ^
Language: C++

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

using namespace std;

int abs(int x){
  return x>0?x:-x;
}
int gcd(int a,int b){
  if(b==0)return m;
  return gcd(b,a%b);
}

int main(){
  int N,X;
  int ans=0;
  vector<int> x;
  cin >> N >> X;
  x.push_back(X);
  for(int i=1;i<N;i++){
    int a;
    cin >> a;
    x.push_back(a);
  }
  sort(x.begin(),x.end());
  int ans=10000000000000;
  for(int i=0;i<N-2;i++){
    int o=x[i+1]-x[i];
    int r=x[i+2]-x[i];
    int or=gcd(o,r);
    if(or<ans){
      ans=or;
    }
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:11:18: error: 'm' was not declared in this scope
   11 |   if(b==0)return m;
      |                  ^
a.cc: In function 'int main()':
a.cc:27:7: error: redeclaration of 'int ans'
   27 |   int ans=10000000000000;
      |       ^~~
a.cc:17:7: note: 'int ans' previously declared here
   17 |   int ans=0;
      |       ^~~
a.cc:31:9: error: expected unqualified-id before 'or' token
   31 |     int or=gcd(o,r);
      |         ^~
a.cc:32:8: error: expected primary-expression before 'or' token
   32 |     if(or<ans){
      |        ^~
a.cc:32:10: error: expected primary-expression before '<' token
   32 |     if(or<ans){
      |          ^
a.cc:33:11: error: expected primary-expression before 'or' token
   33 |       ans=or;
      |           ^~
a.cc:33:13: error: expected primary-expression before ';' token
   33 |       ans=or;
      |             ^
Language: C++

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

using namespace std;

int abs(int x){
  return x>0?x:-x;
}
int gcd(int a,int b){
  if(b==0)return m;
  return gcd(b,a%b);
}

int main(){
  int N,X;
  int ans=0;
  vector<int> x;
  cin >> N >> X;
  x.push_back(X);
  for(i=1;i<N;i++){
    int a;
    cin >> a;
    x.push_back(a);
  }
  sort(x.begin(),x.end());
  int ans=10000000000000;
  for(int i=0;i<N-2;i++){
    int o=x[i+1]-x[i];
    int r=x[i+2]-x[i];
    int or=gcd(o,r);
    if(or<ans){
      ans=or;
    }
  }
  cout << ans;
}
  }
}

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:11:18: error: 'm' was not declared in this scope
   11 |   if(b==0)return m;
      |                  ^
a.cc: In function 'int main()':
a.cc:21:7: error: 'i' was not declared in this scope
   21 |   for(i=1;i<N;i++){
      |       ^
a.cc:27:7: error: redeclaration of 'int ans'
   27 |   int ans=10000000000000;
      |       ^~~
a.cc:17:7: note: 'int ans' previously declared here
   17 |   int ans=0;
      |       ^~~
a.cc:31:9: error: expected unqualified-id before 'or' token
   31 |     int or=gcd(o,r);
      |         ^~
a.cc:32:8: error: expected primary-expression before 'or' token
   32 |     if(or<ans){
      |        ^~
a.cc:32:10: error: expected primary-expression before '<' token
   32 |     if(or<ans){
      |          ^
a.cc:33:11: error: expected primary-expression before 'or' token
   33 |       ans=or;
      |           ^~
a.cc:33:13: error: expected primary-expression before ';' token
   33 |       ans=or;
      |             ^
a.cc: At global scope:
a.cc:38:3: error: expected declaration before '}' token
   38 |   }
      |   ^
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int gcd(int a,int b){
    return b == 0 ? a : gcd(b,a%b);
}

int main()
{
	int N,X;
	cin >> N>>X;
	auto x = vector<int>(N,0);
	for(int i=0;i<N;i++){
	    cin >> x[i];
	}
	x.push_back(X);
	sort(x.begin(),x.end());
	auto ret = x[1] - x[0];
	for(int i=1;i<N-1;i++){
	     ret = gcd(ret,x[i+1]-x[i]);
	}
	
	cout << ret;
}

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

#include<iostream>
#include<vector>
using namespace std;
int gcd(int a,int b){
    return b == 0 ? a : gcd(b,a%b);
}

int main()
{
	int N,X;
	cin >> N>>X;
	auto x = vector<int>(N,0);
	for(int i=0;i<N;i++){
	    cin >> x[i];
	}
	x.push_back(X);
	sort(x.begin(),x.end());
	auto ret = x[1] - x[0];
	for(int i=1;i<N-1;i++){
	     ret = gcd(ret,x[i+1]-x[i]);
	}
	
	cout << ret;xbegin()++
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |         sort(x.begin(),x.end());
      |         ^~~~
      |         short
a.cc:23:21: error: 'xbegin' was not declared in this scope
   23 |         cout << ret;xbegin()++
      |                     ^~~~~~
Language: C++

//  Created by liszt on 2019/07/22.
#include<bits/stdc++.h>
using namespace std;

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'i' was not declared in this scope
   18 |     int ans=abs(x-a[i]);
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
void gcd(long long a,long long b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int main(){
    int n; cin>>n;
    ll X,a[n],ans=0; cin>>X;
    for(int i=0;i<n;i++){
        ll x; cin>>x;
        a[i]=abs(X-x);
    }
    ll maxgcd=a[0];
    for(int i=1;i<n;i++){
        maxgcd=gcd(maxgcd,a[i]);
        ans=max(ans,maxgcd);
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'void gcd(long long int, long long int)':
a.cc:6:22: error: return-statement with a value, in function returning 'void' [-fpermissive]
    6 |     if(a%b==0)return b;
      |                      ^
a.cc: In function 'int main()':
a.cc:18:19: error: void value not ignored as it ought to be
   18 |         maxgcd=gcd(maxgcd,a[i]);
      |                ~~~^~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
void gcd(long long a,long long b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int n; cin>>n;
    ll X,a[n],ans=0; cin>>X;
    for(int i=0;i<n;i++){
        ll x; cin>>x;
        a[i]=abs(X-x);
    }
    ll maxgcd=a[0];
    for(int i=1;i<n;i++){
        maxgcd=gcd(maxgcd,a[i]);
        ans=max(ans,maxgcd);
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'void gcd(long long int, long long int)':
a.cc:6:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
    6 |     if(b==0)return a;
      |                    ^
a.cc: In function 'int main()':
a.cc:18:19: error: void value not ignored as it ought to be
   18 |         maxgcd=gcd(maxgcd,a[i]);
      |                ~~~^~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
void gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int n; cin>>n;
    ll X,a[n],ans=0; cin>>X;
    for(int i=0;i<n;i++){
        ll x; cin>>x;
        a[i]=abs(X-x);
    }
    ll maxgcd=a[0];
    for(int i=1;i<n;i++){
        maxgcd=gcd(maxgcd,a[i]);
        ans=max(ans,gcdmax);
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'void gcd(ll, ll)':
a.cc:6:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
    6 |     if(b==0)return a;
      |                    ^
a.cc: In function 'int main()':
a.cc:18:19: error: void value not ignored as it ought to be
   18 |         maxgcd=gcd(maxgcd,a[i]);
      |                ~~~^~~~~~~~~~~~~
a.cc:19:21: error: 'gcdmax' was not declared in this scope
   19 |         ans=max(ans,gcdmax);
      |                     ^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
 
int main() {
    int n;
    int x;
    long a[100100];
    long d[100100];
    int gd;
  
    cin >> n >> x; 
  
    for (int i = 0; i < n; ++i) cin >> a[i]; 
    
    for (int i = 0; i < n; ++i)
     {
        d[i] = abs(x - a[i]);
     }
  
 
     sort(d,d+n);
  
     if(n == 1){
       cout << d[0] << endl;
       return 0;
     }  
  
      gd = __gcd(d[0],d[1]);
  
      for (int i = 1; i < n; ++i)
     {
          gd = __gcd( gd , d[i + 1]);
     }
     
     cout << gd << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:21: error: no matching function for call to '__gcd(int&, long int&)'
   35 |           gd = __gcd( gd , d[i + 1]);
      |                ~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:35:21: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('int' and 'long int')
   35 |           gd = __gcd( gd , d[i + 1]);
      |                ~~~~~^~~~~~~~~~~~~~~~
Language: C++

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

int main()
{
    //Why u looking at my code lmao
    int N,X,t,i;
    vi xs;
    cin>>N>>X;
    for (i = 0;i < N; i++) { 
        cin>>t;
        xs.push_back(t);
    }
    xs.push_back(X);
    sort(xs.begin(),xs.end());
    vi diff;
    int ans = xs[1]-xs[0];
    for(i=2;i<=N;i++){
        ans = __gcd(ans, xs[i]-xs[i-1]);
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'vi' was not declared in this scope; did you mean 'i'?
    9 |     vi xs;
      |     ^~
      |     i
a.cc:13:9: error: 'xs' was not declared in this scope
   13 |         xs.push_back(t);
      |         ^~
a.cc:15:5: error: 'xs' was not declared in this scope
   15 |     xs.push_back(X);
      |     ^~
a.cc:17:7: error: expected ';' before 'diff'
   17 |     vi diff;
      |       ^~~~~
      |       ;
Language: C++

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

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

int MOD=1000000007;
int main() {
	int N,X,x;
	cin >> N >> X >> x;
	int ans=abs(x-X);
	for(int i=0; i<N-1; i++){
		cin >> x;
		ans=gcd(ans,abs(y-x));
	}
	cout << ans << endl;
}


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

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

int main(){
		int n ,x ,xx ,tmp = 0;
         cin >> n >> xx;
  while(cin >> x)
    tmp = __gcd(tmp ,abs(xx - x));
  cout << tmp;
 return 0; 
}

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

#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define irep(i,n) for(int i = n-1; i>=0; i--)
int GCD(int a,int b){
  int A,B;
  if(a<b){
    A=b;
    B=a;
  }
  else{
    A=a;
    B=b;
  }
  int R=A%B;
  while(r!=0){
    A=B;
    B=R;
    R=A%B;
  }
  return B;
}
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  vector<int> v(n);
  rep(i,n){
    cin >> v[i];
  }
  int ans=v[0];
  rep(i,n-1){
    ans = GCD(ans,v[i+1]);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int GCD(int, int)':
a.cc:15:9: error: 'r' was not declared in this scope
   15 |   while(r!=0){
      |         ^
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define irep(i,n) for(int i = n-1; i>=0; i--)
GCD(a,b){
  int A,B;
  if(a<b){
    A=b;
    B=a;
  }
  else{
    A=a;
    B=b;
  }
  int R=A%B;
  while(r!=0){
    A=B;
    B=R;
    R=A%B;
  }
}
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  vector<int> v(n);
  rep(i,n){
    cin >> v[i];
  }
  int ans=v[0];
  rep(i,n-1){
    ans = GCD(ans,v[i+1]);
  }
  cout << ans << endl;
}


Compiler output:
a.cc:4:4: error: expected constructor, destructor, or type conversion before '(' token
    4 | GCD(a,b){
      |    ^
a.cc: In function 'int main()':
a.cc:31:11: error: 'GCD' was not declared in this scope
   31 |     ans = GCD(ans,v[i+1]);
      |           ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
	return (a%b?gcd(b,a%b):b);
}
vector<int> v;
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		v.push_back(a);
	}
	if(n==1)
	{
		cout<<v[1]-v[0];
		return 0;
	}
	sort(v.begin(),v.end());
	for(int i=1;i<n;i++)
	{
		if(i==1)
		ga=gcd(n-v[0],n-v[i]);
		else
		ga=min(ans,gcd(n-v[0]),n-v[i]);
	}
	cout<<ga;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: 'ga' was not declared in this scope
   27 |                 ga=gcd(n-v[0],n-v[i]);
      |                 ^~
a.cc:29:17: error: 'ga' was not declared in this scope
   29 |                 ga=min(ans,gcd(n-v[0]),n-v[i]);
      |                 ^~
a.cc:29:24: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |                 ga=min(ans,gcd(n-v[0]),n-v[i]);
      |                        ^~~
      |                        abs
a.cc:29:31: error: no matching function for call to 'gcd(int)'
   29 |                 ga=min(ans,gcd(n-v[0]),n-v[i]);
      |                            ~~~^~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric:173:5: note: candidate: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
/usr/include/c++/14/numeric:173:5: note:   candidate expects 2 arguments, 1 provided
a.cc:3:5: note: candidate: 'int gcd(int, int)'
    3 | int gcd(int a,int b)
      |     ^~~
a.cc:3:5: note:   candidate expects 2 arguments, 1 provided
a.cc:31:15: error: 'ga' was not declared in this scope
   31 |         cout<<ga;
      |               ^~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int gcd(int x, int y) {
    if (x == 0) return y;
    if (y == 0) return x;
    return gcd(y, x%y);
}
int main(void){
  int N,X;
  cin >> N >> X;
  
  vector<int>point(N,0);
  for(int i=0;i<N;i++){
    cin >> point[i];
  }
  
  int ans = 0;
  for(int i=0;i<N-1;i++){
    ans == gcd(X - point[i],X - point[i + 1]):
  }
  
  cout << ans << endl;
  
  return 0;
}

  

Compiler output:
a.cc: In function 'int main()':
a.cc:21:46: error: expected ';' before ':' token
   21 |     ans == gcd(X - point[i],X - point[i + 1]):
      |                                              ^
      |                                              ;
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << endl)

using namespace std;
using ll = unsigned long long;

template<typename T>
int gcd(T v) {
	int g = 0;
	for(int i = 1; i < v.size(); i++) {
		g = gcd(v[0], v[i]);
		v[0] = g;
	}
	
	return v[0];
}

int gcd(int a, int b) {
	int r;
	do {
		r = a%b;
		a = b;
		b = r;
	} while(r != 0);
	
	return a;
}

int main() {
	int N, X;
	IN(N);
	IN(X);
	vector<int> x(N), d(N);
	int i, j;
	for(i = 0; i < N; i++) {
		IN(x[i]);
		d[i] = abs(x[i] - X);
	}
	
	sort(d.begin(), d.end());
	
	int result = gcd(d);
	
	OUT(result);
}

Compiler output:
a.cc: In instantiation of 'int gcd(T) [with T = std::vector<int>]':
a.cc:53:18:   required from here
   53 |         int result = gcd(d);
      |                      ~~~^~~
a.cc:22:24: error: no matching function for call to 'gcd(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   22 |                 g = gcd(v[0], v[i]);
      |                     ~~~^~~~~~~~~~~~
a.cc:19:5: note: candidate: 'template<class T> int gcd(T)'
   19 | int gcd(T v) {
      |     ^~~
a.cc:19:5: note:   candidate expects 1 argument, 2 provided
Language: C++

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

unsigned long int gcd(unsigned long int,unsigned long int) ;

int main()
{
  int N ;
  unsigned long int X ;
  cin>>N>>X ;
  unsigned long int x[N] ;
  int i ;
  unsigned long int Y[N+1] ;
  Y[0]=X ;
  for(i=0;i<N;i++){
    cin>>x[i] ;
    Y[i+1]=x[i] ;
  }
  for(i=0;i<N;i++){
    for(int j=0;j<N-i;j++){
      if(Y[j]>Y[j+1]) swap(Y[j],Y[j+1]) ;
    }
  }

  for(i=0;i<N;i++) Y[i]=Y[i+1]-Y[i] ;
  
  int k=0 ;
  while(N-k!=1){
    k++ ;
    for(i=0;i<N-k;i++){
      Y[i]=gcd(Y[i+1],Y[i]) ;
    }
  }
  
  cout<<y[0]<<endl ;
  
  return 0 ;
}
  
unsigned long int gcd(unsigned long int a,unsigned long int b){
  if(a%b==0) return b ;
  else return gcd(b,a%b) ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'y' was not declared in this scope
   36 |   cout<<y[0]<<endl ;
      |         ^
Language: C++

#include <vector>
using namespace std;
int gcd(int a, int b) { return b?gcd(b, a%b):a; }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin >> N >> X;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <vector>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:19:3: error: 'cout' was not declared in this scope
   19 |   cout << abs(ans) << endl;
      |   ^~~~
a.cc:19:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:11: error: 'abs' was not declared in this scope; did you mean 'ans'?
   19 |   cout << abs(ans) << endl;
      |           ^~~
      |           ans
a.cc:19:23: error: 'endl' was not declared in this scope
   19 |   cout << abs(ans) << endl;
      |                       ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <vector>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

import java.util.*;


public class Main{

    static long gcd(long a,long b){
        if(a<b){
            long tmp=a;
            a=b;
            b=tmp;
        }
        if(a%b==0)return b;
        else return gcd(b,a%b);
    }

   public static void main(String[] args){
       Scanner sc =new Scanner(System.in);
       long n,x,a;
       n=sc.nextInt();
       x=sc.nextInt();
       long ans=0;
       for(long i=0;i<n;i++){
           a=sc.nextInt();
           if(i==0)ans=(long)Math.abs(a-x);
           else ans=(long)gcd(ans,Math.abs(a-x));
       }
       System.out.println(ans);
   }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main{
      | ^~~~~~