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

//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> k >> n;
	for(int i=0; i<n; i++) cin >> v[i];
	sort(v, v+n);
	ll ans = v[n-1] - v[0];
	for(int i=1; i<n; i++) {
		ans = min(ans, v[i-1]+k-v[i]);
	}
	cout << ans;	
}




Compiler output:
a.cc: In function 'int main()':
a.cc:45:12: error: 'k' was not declared in this scope
   45 |     cin >> k >> n;
      |            ^
a.cc:45:17: error: 'n' was not declared in this scope; did you mean 'yn'?
   45 |     cin >> k >> n;
      |                 ^
      |                 yn
a.cc:46:39: error: 'v' was not declared in this scope
   46 |         for(int i=0; i<n; i++) cin >> v[i];
      |                                       ^
a.cc:47:14: error: 'v' was not declared in this scope; did you mean 'vs'?
   47 |         sort(v, v+n);
      |              ^
      |              vs
Language: C++

using namespace std;
int main() {
    int k,n,ans=0,p,cont=0;
    cin >> k >> n;
    vector<int> a(n);
    for(int i = 0;i<n;i++){
        cin >> p;
        if(p!=0){
            a[i]=p;
            cont++;
        }
    }
    sort(a.begin(),a.end());
    for(int j = 1;j<=cont-1;j++){ // n - 1?
        ans+=a[j+1]-a[j];
    }
    cout << abs(ans) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> k >> n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> a(n);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> a(n);
      |            ^~~
a.cc:9:13: error: 'a' was not declared in this scope
    9 |             a[i]=p;
      |             ^
a.cc:13:10: error: 'a' was not declared in this scope
   13 |     sort(a.begin(),a.end());
      |          ^
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(a.begin(),a.end());
      |     ^~~~
      |     short
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << abs(ans) << endl;
      |     ^~~~
a.cc:17:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:13: error: 'abs' was not declared in this scope; did you mean 'ans'?
   17 |     cout << abs(ans) << endl;
      |             ^~~
      |             ans
a.cc:17:25: error: 'endl' was not declared in this scope
   17 |     cout << abs(ans) << endl;
      |                         ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int k,n;
  cin>>k>>n;
  vec<int> vec(n);
  for(int i=0;i<n;i++)cin>>vec[i];
sort(vec.begin(), vec.end()); 
reverse(vec.begin(), vec.end()); 
  int h=vec[n-1];
  for(int i=0;i<n-1;i++){
    int x=vec[i]-vec[i+1];
  h= max(h,x);
}
int kyori=n-vec[0]-vec[n-1];
int K=max(h,kyori);
cout <<k-K<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vec' was not declared in this scope
    7 |   vec<int> vec(n);
      |   ^~~
a.cc:7:7: error: expected primary-expression before 'int'
    7 |   vec<int> vec(n);
      |       ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int k,n;
  cin>>k>>n;
  vec<int> vec(n);
  for(int i=0;i<n;i++)cin>>vec[i];
sort(vec.begin(), vec.end()); 
reverse(vec.begin(), vec.end()); 
  int h=vec[n-1];
  for(int i=0;i<n-1;i++)
    int x=vec[i]-vec[i+1];
  h= max(h,x);
}
int kyori=n-vec[0]-vec[n-1];
int K=max(h,kyori);
cout <<k-K<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vec' was not declared in this scope
    7 |   vec<int> vec(n);
      |   ^~~
a.cc:7:7: error: expected primary-expression before 'int'
    7 |   vec<int> vec(n);
      |       ^~~
a.cc:14:12: error: 'x' was not declared in this scope
   14 |   h= max(h,x);
      |            ^
a.cc: At global scope:
a.cc:16:11: error: 'n' was not declared in this scope; did you mean 'yn'?
   16 | int kyori=n-vec[0]-vec[n-1];
      |           ^
      |           yn
a.cc:16:13: error: 'vec' was not declared in this scope
   16 | int kyori=n-vec[0]-vec[n-1];
      |             ^~~
a.cc:16:20: error: 'vec' was not declared in this scope
   16 | int kyori=n-vec[0]-vec[n-1];
      |                    ^~~
a.cc:16:24: error: 'n' was not declared in this scope; did you mean 'yn'?
   16 | int kyori=n-vec[0]-vec[n-1];
      |                        ^
      |                        yn
a.cc:17:11: error: 'h' was not declared in this scope
   17 | int K=max(h,kyori);
      |           ^
a.cc:18:1: error: 'cout' does not name a type
   18 | cout <<k-K<<endl;
      | ^~~~
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int K, N;
    cin >> K >>N;
    vector<int> vec(N);
    for(int i=0;i<N;++i){
       cin >> vector.at(i);
    }
    int sum =0;
    for(int i=1;i<=N;++i){
        sum+=vec.at(i)-vec.at(i-1)
    }
    cout << sum <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: missing template arguments before '.' token
    9 |        cin >> vector.at(i);
      |                     ^
a.cc:13:35: error: expected ';' before '}' token
   13 |         sum+=vec.at(i)-vec.at(i-1)
      |                                   ^
      |                                   ;
   14 |     }
      |     ~
Language: C

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

int main() {
  int K,N;
  cin>>K>>N;
  vector<int>A(N);
  
  for(int i=1;i<=N;i++)cin>>A[i];
  
  int max_dis=abs(A[1]-A[N]);
  int start=1;
  
  for(int i=1;i<=N-1;i++){
    int tmp=abs(A[i]-A[i+1]);
    if(max_dis>=tmp){
      max_dis=tmp;
      start=i+1;
    }
  }
  int dis=K-abs(A[start]-A[start-1]);
  cout<<dis<<endl;
}


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

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

int main () {
  int K,N;
  cin >> K >> N;
  vector<int> A(N):
  for (int i=0; i<N; i++) {
    cin >> A[i];
  }
  int max_d = 0;
  
  for (int i=0; i<N-1; i++){
    max_d = max(max_d, abs(A[i+1]-A[i]));
  }
  
  max_d = max(max_d, K-A[N-1]+A[0]);
  
  cout << K - max_d << endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: expected ',' or ';' before ':' token
    7 |   vector<int> A(N):
      |                   ^
a.cc:8:17: error: 'i' was not declared in this scope
    8 |   for (int i=0; i<N; i++) {
      |                 ^
Language: C++

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

int main(){
  int K,N;
  cin >> K >> N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  int ans=0;
  vector<int>B(N);
  for(int i=0;i<N;i++){
    if(i==0){
      B[0]=A[0]+(K-A[N-1]);
      ans=B[0];
    }
    else{
      B[i]=A[i]-A[i-1];
      ans=max(B[i],ans)
    }
  }
  cout << K-ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: expected ';' before '}' token
   20 |       ans=max(B[i],ans)
      |                        ^
      |                        ;
   21 |     }
      |     ~
Language: C++

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

using namespace std;

int main() {
	int k, n;
	cin >> k >> n;
	vector<int> a(n);

	int i = 0;
	for (i = 0; i < n; i++); {
		cin >> a[i];
	}
	
	a.push_back(a[0] + k);

	int sub = 0;

	for (i = 0; i < n; i++) {
		sub = max(l, a[i+1] - a[i]);
	}

	int res3 = k - sub;

	cout << res3;

	return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:27: error: 'l' was not declared in this scope
   22 |                 sub = max(l, a[i+1] - a[i]);
      |                           ^
Language: C++

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

using namespace std;

int main() {
	int k, n;
	cin >> k >> n;
	vector<int> a(n);

	int i = 0;
	for (i = 0; i < n; i++); {
		cin >> a[i];
	}
	
	a.push_back(a[0] + k);

	long long l = 0;

	for (i = 0; i < n; i++) {
		l = max(l, a[i + 1] - a[i]);
	}

	long long res3 = k - l;

	cout << res3;

	return 0;

}


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

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




int main(){

	int k,n;
	cin>>k>>n;
	vector<int> arr(n);
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	int maxa = -1;
	for(int i=1;i<n;i++){
		maxa = max(maxa,arr[i]-arr[i-1]);
	}
	maxa = max(maxa , k - arr[n-1] + arr[i]);
	cout<<maxa<<endl;
	
	
	
	
	return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:46: error: 'i' was not declared in this scope
   19 |         maxa = max(maxa , k - arr[n-1] + arr[i]);
      |                                              ^
Language: C++

#define _GLIBCXX_DEBUG
#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 uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b;
  cin>>a>>b;
  vector<int> c(b);
  rep(i,b)
    cin>>c[i];
  rep(i,b){
  if(c[i]>a/2){
  c[i]=c[i]-a;
  }
  sort(all(c));
    out(c[a-1]-c[0]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:107:2: error: expected '}' at end of input
  107 | }
      |  ^
a.cc:95:14: note: to match this '{'
   95 | signed main(){
      |              ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int n,k;
    cin >> k >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++)}{
        cin >> a[i];
    }
    vector<int> d(n);
    d[0] = a[0] + k - a[n - 1];
    for(int i = 1;i < n;i++){
        d[i] = a[i] - a[i - 1];
    }
    int ans = k;
    for(int i = 0;i < n;i++){
        ans = min(ans,k - d[i]);
    }
    cout << ans << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:29: error: expected primary-expression before '}' token
    9 |     for(int i = 0;i < n;i++)}{
      |                             ^
a.cc: At global scope:
a.cc:9:30: error: expected unqualified-id before '{' token
    9 |     for(int i = 0;i < n;i++)}{
      |                              ^
a.cc:12:19: error: 'n' was not declared in this scope
   12 |     vector<int> d(n);
      |                   ^
a.cc:13:5: error: 'd' does not name a type
   13 |     d[0] = a[0] + k - a[n - 1];
      |     ^
a.cc:14:5: error: expected unqualified-id before 'for'
   14 |     for(int i = 1;i < n;i++){
      |     ^~~
a.cc:14:19: error: 'i' does not name a type
   14 |     for(int i = 1;i < n;i++){
      |                   ^
a.cc:14:25: error: 'i' does not name a type
   14 |     for(int i = 1;i < n;i++){
      |                         ^
a.cc:17:15: error: 'k' was not declared in this scope
   17 |     int ans = k;
      |               ^
a.cc:18:5: error: expected unqualified-id before 'for'
   18 |     for(int i = 0;i < n;i++){
      |     ^~~
a.cc:18:19: error: 'i' does not name a type
   18 |     for(int i = 0;i < n;i++){
      |                   ^
a.cc:18:25: error: 'i' does not name a type
   18 |     for(int i = 0;i < n;i++){
      |                         ^
a.cc:21:5: error: 'cout' does not name a type
   21 |     cout << ans << endl;
      |     ^~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,N;
  cin>>K>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  priority_queue<int> B;
  for(int i=0;i<N-1;i++){
    B.push(A.at(i+1)-A.at(i));
  }
  B.push(A.at(i)+K-A.at(N));
  int X;
  X=K-B.top();
  cout<<X<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: 'i' was not declared in this scope
   15 |   B.push(A.at(i)+K-A.at(N));
      |               ^
a.cc:18:17: error: expected '}' at end of input
   18 |   cout<<X<<endl;
      |                 ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: Java

import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Scanner;

public class C {
    public static void main(String[] args) {
        int K, N;
        Scanner sc = new Scanner(System.in);
        K = sc.nextInt();
        N = sc.nextInt();
        int[] a = new int[N];
        for(int i = 0 ; i < N ; i++)
        {
            a[i] = sc.nextInt();
        }
        int max = 0;
        Arrays.sort(a);
        for(int i = 0 ; i < a.length - 1; i++)
        {
            max = Math.max(max,Math.min(a[i+1]-a[i],K-a[i+1]+a[i]) );

        }
        max=Math.max(max,Math.min(a[N-1]-a[0],K-a[N-1]+a[0]));
        System.out.println(K - max);
    }
}


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

#include "iostream"
#include "vector"
using namespace std;
 void solve() {
    int K, N; cin >> K >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    
    vector<int> d(N+1);
    for (int i = 1; i < N; i++) {
        d[i] = A[i] - A[i-1];
    }
    d[N] = K - (A[N-1] - A[0]);
 
    sort(d.begin(), d.end());
 
    int ans = K - d[N];
 
    cout << ans << endl;
}
 
 
int main() {
    solve();
    return 0;
}


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

#include<iostream>
using namespace std;
int main(){
 	int k, N;
  	cin >> k >> N;
  	int *A, *dis;
  	A = new int[N];
	dis = nes int[N];  	
  	for(int i=0; i<N; i++){
     	cin >> A[i]; 
    	if(i!=0) dis[i] = A[i]-A[i-1];
    }
  	dis[0] = k - A[N-1] + A[0];
  	int max;
  	max=dis[0];
  	for(int i=0; i<N; i++){
      if(dis[i]>max) max = dis[i];
    }
  	cout << k - max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'nes' was not declared in this scope
    8 |         dis = nes int[N];
      |               ^~~
Language: C++

#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main()
{
    
    int k, n;
    cin >> k >> n;
    vector<int>a(n);
    long long int x = 0, y = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n - 1; i++) {
        x += a[i + 1] - a[i];
        y = max((int)y, a[i + 1], a[i]);
    }
    x += k + a[0] - a[n - 1];
    y = max((int)y, k + a[0] - a[n - 1]);
    cout << x - y << endl;

    return 0;

}

Compiler output:
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:38:16:   required from here
   38 |         y = max((int)y, a[i + 1], a[i]);
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <vector>
#define int long long
#define vi vector<int>
#define scan(a,n) for(int i = 0; i < n ; i++) cin>>a[i]
#define loop(i,a,b) for (int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
using namespace std;

int32_t main()
{
	int k,n;
	cin>>k>>n;
	vi arr(n);
	scan(arr,n);
	int sum = 0;
	int maxd = k - arr[n-1] + arr[0];
	loop(i,0,n-1)
	{
		int d = a[i+1] - a[i];
		if(d>maxd)
			maxd = d;
	}
	cout<<k - maxd<<endl;
	return 0;
}

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

#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
 
 
int main() {
    int k,n;
    cin >> k >> n;
    vector<int> A(n);
    int m=-1;
    rep(i,n){
        cin >> A[i];
    }
    rep(i,n-1){
        m = max(m,abs(A[i]-A[i+1]));
    }
    m = max(m,abs(A[0]-A[n-1]))
    cout << k-m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:32: error: expected ';' before 'cout'
   20 |     m = max(m,abs(A[0]-A[n-1]))
      |                                ^
      |                                ;
   21 |     cout << k-m << endl;
      |     ~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
 
 
int main() {
    int k,n;
    cin >> k >> n;
    vector<int> A(n);
    int m=-1;
    rep(i,n){
        cin >> A[i];
    }
    rep(i,n-1){
        m = max(m,abs(A[i]-A[i+1]))
    }
    m = min(m,abs(A[0]-A[n-1]))
    cout << k-m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:36: error: expected ';' before '}' token
   18 |         m = max(m,abs(A[i]-A[i+1]))
      |                                    ^
      |                                    ;
   19 |     }
      |     ~                               
a.cc:20:32: error: expected ';' before 'cout'
   20 |     m = min(m,abs(A[0]-A[n-1]))
      |                                ^
      |                                ;
   21 |     cout << k-m << endl;
      |     ~~~~
Language: C++

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

int  main(){
  int k,n,mx=-1;
  cin>>k>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a,end());
  for(int i=0;i<n-1;i++){
    mx=max(a[i+1]-a[i],mx);
  }
  if(k-a[n-1]+a[0]>=mx){
    mx=k-a[n-1]+a[0];
  }
  cout<<k-mx<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: no matching function for call to 'end()'
   11 |   sort(a.begin(),a,end());
      |                    ~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
/usr/include/c++/14/initializer_list:99:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
 1249 |     end(valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1249:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1265:5: note:   candidate expects 1 argument, 0 provided
Language: C++

#include<bits/stdc++.h>
using namespace std
#define ll long long
int main()
{
  int k,n;
  cin>>k>>n;
  int a[2*n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  for(int i=n;i<2*n;i++)
  {
    a[i]=a[i-n]+k;
  }
  int sum=0,minm=INT_MAX;
  for(int i=0;i<n;i++)
    sum+=a[i];
  minm=sum;
  for(int i=1;i<n;i++)
  {
    sum=sum-(a[i]-a[i-1]);
    sum=sum+(a[i+n]-a[i+n-1]);
    minm=min(minm,sum);
  }
  cout<<minm<<endl;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | #define ll long long
    4 | int main()
      | ~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
scanf("%d%d",&a,&b);
int ar[200000+5];
  for(int i=0;i<a;i++)
    scanf("%d",&ar[i]);
  sort(ar,ar+a);
  printf("%d",ar[a-1]-a[0]);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:24: error: invalid types 'int[int]' for array subscript
   11 |   printf("%d",ar[a-1]-a[0]);
      |                        ^
Language: Java

import java.util.*;

public class Main2 {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer K = Integer.parseInt(scanner.next());
        Integer N = Integer.parseInt(scanner.next());
        Integer[] dis = new Integer[N];
        Integer[] total = new Integer[N];

        for (int i = 0; i < N; i++) {
           dis[i] = Integer.parseInt(scanner.next());
        }
        for (int i = 0; i < N-1; i++) {
            total[i] = Math.abs(dis[i] - dis[i + 1]);
        }

        total[N-1] = Math.abs((K - dis[N-1]) + dis[0]);
        Arrays.sort(total);
        total[total.length-1] = 0;
        Integer sum = 0;
        for (int i = 0; i < total.length; i++) sum += total[i];
        System.out.println(sum);
    }
}


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


public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer K = Integer.parseInt(scanner.next());
        Integer N = Integer.parseInt(scanner.next());
        Integer[] dis = new Integer[N];
        Integer[] total = new Integer[N];

        for (int i = 0; i < N; i++) {
           dis[i] = Integer.parseInt(scanner.next());
        }
        for (int i = 0; i < N-1; i++) {
            total[i] = Math.abs(dis[i] - dis[i + 1]);
        }

        total[N-1] = K - dis[N-1] + total[0];
        Arrays.sort(total);
        Integer sum = 0;
        for (int i = 0; i < N - 1; i++) sum += total[i];
        System.out.println(sum);
    }
}


Compiler output:
Main.java:5: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
                              ^
  symbol:   class Scanner
  location: class Main
Main.java:19: error: cannot find symbol
        Arrays.sort(total);
        ^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: Java

import java.util.Scanner;
public class Main2 {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int peri= sc.nextInt();
        int n=sc.nextInt();
        int dist=0;
        int[] home=new int[n];
        int min=21;int max=-1;
        for (int i = 0; i <home.length; i++) {
             home[i]=sc.nextInt();
             min=Math.min(min,home[i]);
             max=Math.max(max,home[i]);

        }
        if(min!=0){
            System.out.println(20-(max-min));
        }
        else{
            System.out.println(20-(max-home[1]));
        }




     }
}


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

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

int main()
{
    int k,n;
    cin>>k>>n;
    int A[n];
     for(int i=0;i<n;i++)
     {
        cin>>A[i];
     }
     int sum=0;
     int right = A[1]-A[0];
     int rightcnt =0;
   
     int left = 20-A[n-1]+A[0];
     int leftcnt =n;
     int x =0;
     for(int i=0;i<n-1;i++)
     {
        if(right<=left)
        {
            rightcnt++;
            sum += right;
             
            right = A[rightcnt+1]-A[rightcnt];  
        }  
       
        else
        {
             leftcnt--;
             sum += left
             
             left = A[leftcnt]-A[leftcnt-1];
        
        }
          
     }

    cout<<sum<<endl;

     return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:25: error: expected ';' before 'left'
   33 |              sum += left
      |                         ^
      |                         ;
   34 | 
   35 |              left = A[leftcnt]-A[leftcnt-1];
      |              ~~~~
Language: C++

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

int main()
{
    int k,n;
    cin>>k>>n;
    vector<int>A;
     for(int i=0;i<n;i++)
     {
        cin>>A.at(i);
     }
     int sum=0;
     int right = A[1]-A[0];
     int rightcnt =0;
   
     int left = 20-A[n-1]+A[0];
     int leftcnt =n;
     int x =0;
     for(int i=0;i<n-1;i++)
     {
        if(right<=left)
        {
            rightcnt++;
            sum += right;
             
            right = A[rightcnt+1]-A[rightcnt];  
        }  
       
        else
        {
             leftcnt--;
             sum += left
             
             left = A[leftcnt]-A[leftcnt-1];
        
        }
          
     }

    cout<<sum<<endl;

     return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:25: error: expected ';' before 'left'
   33 |              sum += left
      |                         ^
      |                         ;
   34 | 
   35 |              left = A[leftcnt]-A[leftcnt-1];
      |              ~~~~
Language: C++

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

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define ll long long

using namespace std;

int main(void){
    int k,n;
    cin >> k >> n;
    vector<int> a(n);

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

    //v: 被りのないa
    vector<int> v = a;
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()), v.end());
    cout << endl;

    int ans = INT32_MAX;
    for(int i = 0;i < v.size();i++){
        vector<int> tempv = a;
        int addval = v[i];
        for(int j = 0;j < n;j++){
            tempv[j] = (tempv[j] + addval) % k;
        }
        auto val = minmax_element(tempv.begin(),tempv.end());
        ans = min(ans,*val.second - *val.first);
        //cout << "fir: " << *val.first << "sec: " << *val.second <<"ans: "<<*val.second - *val.first << endl;
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:15: error: 'INT32_MAX' was not declared in this scope
   26 |     int ans = INT32_MAX;
      |               ^~~~~~~~~
a.cc:4:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    3 | #include <vector>
  +++ |+#include <cstdint>
    4 | #include <string>
Language: C++

#include <iostream>
using namespace std;

int main()
{
	int n, k;
	cin >> k >> n;
	int d[n], z[n];
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	for (int j = 0; j < n; j++) {
		if (j != n - 1) {
			z[j] = d[j + 1] - d[j];
		} else {
			assert (j == n - 1);
			z[j] = d[0] + k - d[j];
		}
	}
	int l{};
	long long ans{};
	for (int i = 0; i < n; i++) {
		cout << i << " " << z[i] << endl;
		if (z[i] > l)
			l = z[i];
		ans += z[i];
	}
	cout << ans - l;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'assert' was not declared in this scope
   16 |                         assert (j == n - 1);
      |                         ^~~~~~
a.cc:2:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    1 | #include <iostream>
  +++ |+#include <cassert>
    2 | using namespace std;
Language: C

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

int main()
{
	int N,K;
	cin>>K>>N;
	int arr[N];
	int dis[N+5]={0};
	for(int i=0;i<N;i++)
	{
		cin>>arr[i];
	}
		for(int i=0;i<N;i++)
	{
		if(i<N-1)
		{
			dis[i]=arr[i+1]-arr[i];		
		}
		else
			dis[i]=K-arr[i]+arr[0];
		
	}
	int max=0;
	for(int i=0;i<N;i++)
	{
		if(max<dis[i])
			max=dis[i];
	}	
	//	cout<<max<<endl;
	cout<<K-max<<endl;

return 0;

}

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

#include <stdio.h>
 
int max(int a, int b)                   //最大を求める
{  
  if(a>=b)
    return a;
  else
    return b;
}
    
int main(void)
{
  int K,N;
  int i;
  int a[];
  int dis[];
  int large=0;
  
  do {
 	 scanf("%d %d",&K,&N);
  } while((K < 2 || K > 1000000) || (N < 2 || N > 200000));
 
  for(i=0; N>i; i++){
     if(i == 0){
        do{
          scanf("%d ",a[i]);
       } while(a[i] >= K);
     }
    else{
    	do{
          scanf("%d ",a[i]);
    	} while(a[i] >= K || a[i] <= a[i-1]);
    }
  }
  for(i=0; N>i ; i++){
    if(N != i+1)                            //最後の引き算で距離がーになるのを防ぐ
      dis[i] = a[i+1] - a[i];
    else
      dis[i] = (K+a[i+1]) - a[i];
    large = max(large,dis[i]);
  }
    
  printf("%d",K-large);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: storage size of 'a' isn't known
   15 |   int a[];
      |       ^
a.cc:16:7: error: storage size of 'dis' isn't known
   16 |   int dis[];
      |       ^~~
Language: C++

#include <stdio.h>
 
int max(int a, int b)                   //最大を求める
{  
  if(a>=b)
    return a;
  else
    return b;
}
    
int main(void)
{
  int K,N;
  int i;
  int a[200000];
  int dis[200000];
  int large=0;
  
  do {
 	 scanf("%d %d",&K,&N)
  } while((K < 2 || K > 1000000) || (N < 2 || N > 200000));
 
  for(i=0; N>i; i++){
     if(i == 0){
        do{
          scanf("%d ",a[i]);
       } while(a[i] >= K);
     }
    else{
    	do{
  			scanf("%d ",a[i]);
    	} while(a[i] >= K || a[i] <= a[i-1]);
    }
  }
  for(i=0; N>i ; i++){
    if(N != i+1)                            //最後の引き算で距離がーになるのを防ぐ
      dis[i] = a[i+1] - a[i];
    else
      dis[i] = (K+a[i+1]) - a[i];
    large = max(large,dis[i]);
  }
    
  printf("%d",K-large);
  return 0;
}
#include <stdio.h>
 
int max(int a, int b)                   //最大を求める
{  
  if(a>=b)
    return a;
  else
    return b;
}
    
int main(void)
{
  int K,N;
  int i;
  int a[];
  int dis[];
  int large=0;
  
  do {
 	 scanf("%d %d",&K,&N);
  } while((K < 2 || K > 1000000) || (N < 2 || N > 200000));
 
  for(i=0; N>i; i++){
     if(i == 0){
        do{
          scanf("%d ",a[i]);
       } while(a[i] >= K);
     }
    else{
    	do{
  			scanf("%d ",a[i]);
    	} while(a[i] >= K || a[i] <= a[i-1]);
    }
  }
  for(i=0; N>i ; i++){
    if(N != i+1)                            //最後の引き算で距離がーになるのを防ぐ
      dis[i] = a[i+1] - a[i];
    else
      dis[i] = (K+a[i+1]) - a[i];
    large = max(large,dis[i]);
  }
    
  printf("%d",K-large);
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: expected ';' before '}' token
   20 |          scanf("%d %d",&K,&N)
      |                              ^
      |                              ;
   21 |   } while((K < 2 || K > 1000000) || (N < 2 || N > 200000));
      |   ~                           
a.cc: At global scope:
a.cc:48:5: error: redefinition of 'int max(int, int)'
   48 | int max(int a, int b)                   //最大を求める
      |     ^~~
a.cc:3:5: note: 'int max(int, int)' previously defined here
    3 | int max(int a, int b)                   //最大を求める
      |     ^~~
a.cc:56:5: error: redefinition of 'int main()'
   56 | int main(void)
      |     ^~~~
a.cc:11:5: note: 'int main()' previously defined here
   11 | int main(void)
      |     ^~~~
a.cc: In function 'int main()':
a.cc:60:7: error: storage size of 'a' isn't known
   60 |   int a[];
      |       ^
a.cc:61:7: error: storage size of 'dis' isn't known
   61 |   int dis[];
      |       ^~~
Language: C++

#include <stdio.h>
 
int max(int a, int b)                   //最大を求める
{  
  if(a>=b)
    return a;
  else
    return b;
}
    
int main(void)
{
  int K,N;
  int i;
  int a[200000];
  int dis[200000];
  int large=0;
  
  do {
 	 scanf("%d %d",&K,&N)
  } while((K < 2 || K > 1000000) || (N < 2 || N > 200000));
 
  for(i=0; N>i; i++){
     if(i == 0){
        do{
          scanf("%d ",a[i]);
       } while(a[i] >= K);
     }
    else{
    	do{
  			scanf("%d ",a[i]);
    	} while(a[i] >= K || a[i] <= a[i-1]);
    }
  }
  for(i=0; N>i ; i++){
    if(N != i+1)                            //最後の引き算で距離がーになるのを防ぐ
      dis[i] = a[i+1] - a[i];
    else
      dis[i] = (K+a[i+1]) - a[i];
    large = max(large,dis[i]);
  }
    
  printf("%d",K-large);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: expected ';' before '}' token
   20 |          scanf("%d %d",&K,&N)
      |                              ^
      |                              ;
   21 |   } while((K < 2 || K > 1000000) || (N < 2 || N > 200000));
      |   ~
Language: C++

#include <stdio.h>
int main (void){
  int i,K=0,N=0,A[N+1]={0},check=0,count;
  while((K<2)||(K>1000000)||(N<2)||(N>200000)){
  scanf("%d %d",&K,&N);
  }
  while(check=0){
    count=0;
    for(i=1;i<N+1;i++)
  scanf("%d",A[i]);
    for(i=1;i<N;i++){
      if(A[i]<A[i+1])
        count++;
    }
      if(count==N-1)
         check=1;
    for(i=1;i=<N;i++){
      if(A[i]<0)
        check=0;
    }
    }
  int max;
  max=K-A[N]+A[1];
  for(i=1;i<N;i++){
    if(A[i+1]-A[i]>max)
      max=A[i+1]-A[i];
  }
printf("%d\n",K-max);
  return 0;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:17:15: error: expected primary-expression before '<' token
   17 |     for(i=1;i=<N;i++){
      |               ^
Language: C++

#include <stdio.h>

int max(int a, int b)                  //最大を求める
{  
  if(a>=b)
    return a;
  else
    return b;
}
    
int main(void)
{
  int K,N;
  int i;
  int a[];
  int dis[];
  int large=0;
  
  do {
 	 scanf("%d %d",&K,&N)
  } while((K < 2 || K > 1000000) || (N < 2 || N > 100000));
 
  for(i=0; N>i; i++){
     if(i == 0){
        do{
          scanf("%d ",a[i]);
       } while(a[i] >= K);
     }
    else{
    	do{
  			scanf("%d ",a[i]);
    	} while(a[i] >= K || a[i] <= a[i-1]);
    }
  }
  for(i=0; N>i ; i++){
    if(N != i+1)                            //最後の引き算で距離がーになるのを防ぐ
      dis[i] = a[i+1] - a[i];
    else
      dis[i] = (K+a[i+1]) - a[i];
    large = max(large,dis[i]);
  }
    
  printf("%d",K-large);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: storage size of 'a' isn't known
   15 |   int a[];
      |       ^
a.cc:16:7: error: storage size of 'dis' isn't known
   16 |   int dis[];
      |       ^~~
a.cc:20:30: error: expected ';' before '}' token
   20 |          scanf("%d %d",&K,&N)
      |                              ^
      |                              ;
   21 |   } while((K < 2 || K > 1000000) || (N < 2 || N > 100000));
      |   ~
Language: C

#include <stdio.h>
int main(void){
int K,N,max=0,min=0;
int i=0;
  scanf("%d",&K);
  scanf("%d",&N);
 int d[1000000,x[1000000];
  for(i;i<N;i++)
   scanf("%d",&d[i]);
  max=d[0]+(K-d[N-1]);
  for(i=0;i<N;i++){
  x[i]=d[i+i]-d[i];
  if(max<x[i])
    max=x[i];}
  min=K-max;
  printf("%d",min);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:15: error: expected ']' before ',' token
    7 |  int d[1000000,x[1000000];
      |               ^
      |               ]
main.c:18:1: error: expected declaration or statement at end of input
   18 | }
      | ^
Language: C

#include <stdio.h>

int main(void){
  int K,N,i;
  int sa;
  int sa_max;
  scanf("%d",K);
  scanf("%d",N);
  int home[N];
  for(int i=0;i<N;i++)
    scanf("%d",&home[i]);
  for(int j=0;j<N;j++){
    if(j==N-1){
      sa = K - home[j]
      if(sa_max<home[j])
        sa_max = sa;
    }
    else{
      sa = home[j] - home[j+1]
      if(sa_max<home[j])
        sa_max = sa;
    }
  }
  printf("%d",K-sa_max);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:23: error: expected ';' before 'if'
   14 |       sa = K - home[j]
      |                       ^
      |                       ;
   15 |       if(sa_max<home[j])
      |       ~~               
main.c:19:31: error: expected ';' before 'if'
   19 |       sa = home[j] - home[j+1]
      |                               ^
      |                               ;
   20 |       if(sa_max<home[j])
      |       ~~
Language: C

#include<stdio.h>

int meter[200000];

int calculate(int circle, int house)
{ 
  int dis[200000];
  int max = 0;
  int i;

  for(i = 0; i < house; i++)
  {
    dis[i] = meter[i + 1] - meter[i];
    if((i + 1) == house)
      dis[i] = (circle - meter[i]) + meter[0];
    
    if(dis[i] > max)
      max = dis[i];
  }
  
  return max;
}

int main()
{
  int circle, house, i;
  int min = 0;
  int sum = 0;
  
  scanf("%d", &circle);
  scanf("%d", &house);
  
  for(i = 0; i < house; i++)
  {
    scanf("%d", &meter[i]);
  }
  
  max = calculate(circle, house);
  
  printf("%d\n", circle - max);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:38:3: error: 'max' undeclared (first use in this function)
   38 |   max = calculate(circle, house);
      |   ^~~
main.c:38:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int meter[200000];

int calculate(int circle, int house)
{ 
  int dis[200000];
  int max = 0;
  int i;

  for(i = 0; i < house; i++)
  {
    dis[i] = meter[i + 1] - meter[i];
    if((i + 1) == house)
      dis[i] = (circle - meter[i]) + meter[0];
    
    if(dis[i] > max)
      max = dis[i]
  }
  
  return max;
}

int main()
{
  int circle, house, i;
  int min = 0;
  int sum = 0;
  
  scanf("%d", &circle);
  scanf("%d", &house);
  
  for(i = 0; i < house; i++)
  {
    scanf("%d", &meter[i]);
  }
  
  max = calculate(circle, house);
  
  printf("%d\n", circle - max);
  
  return 0;
}

Compiler output:
main.c: In function 'calculate':
main.c:18:19: error: expected ';' before '}' token
   18 |       max = dis[i]
      |                   ^
      |                   ;
   19 |   }
      |   ~                
main.c: In function 'main':
main.c:38:3: error: 'max' undeclared (first use in this function)
   38 |   max = calculate(circle, house);
      |   ^~~
main.c:38:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

int main(void){
  int K,N;
  scanf("%d %d",&K,&N);
  int A[N],i,j,max=0,sa,s,sum=0;
  for(i=0;i<N;i++)
  scanf("%d ",&A[i]);
  for(i=0;i<N-1;i++){
    sa=A[i]-A[i+1];
    if(sa<0)
      sa=sa*(-1);
    if (sa>max){
      max=sa; j=i;}
    s=A[0]-A[N-1];}
    if(A[0]<A[N-1])
    s=s*(-1);
    if(s>max){
      max=s; j=0;}
    sum=K-max;
    printf("%d\n",sum);
    return 0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'scanf' was not declared in this scope
    3 |   scanf("%d %d",&K,&N);
      |   ^~~~~
a.cc:19:5: error: 'printf' was not declared in this scope
   19 |     printf("%d\n",sum);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void){
Language: C++

#include<stdio.h>
int main(void){
  int K,N;
  scanf("%d %d",&K,$N);
  int A[N],i,j,max=0,sa,s,sum=0;
  for(i=0;i<N;i++)
  scanf("%d ",&A[i]);
  for(i=0;i<N-1;i++){
    sa=A[i]-A[i+1];
    if(sa<0)
      sa=sa*(-1);
    if (sa>max){
      max=sa; j=i;}
    s=A[0]-A[N-1];
    if(A[0]<A[N-1])
    s=s*(-1);
    if(s>max){
      max=s; j=0;}
    sum=K-max;
    printf("%d\n",max);
    return 0;
  }
   
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:4:20: error: '$N' was not declared in this scope; did you mean 'N'?
    4 |   scanf("%d %d",&K,$N);
      |                    ^~
      |                    N
a.cc:22:4: error: expected '}' at end of input
   22 |   }
      |    ^
a.cc:2:15: note: to match this '{'
    2 | int main(void){
      |               ^
Language: C

#include <stdio.h>
int main(void){
  int K, N, i, save, con;
  int tmp=0;
  int a[200000];
  
  if(scanf("%d%d",&K,&N)==1);
  for(i=0;i<N;i++)
    if(scanf("%d",&a[i])==1);
  
  for(i=0;i<N-1;i++){
    save=a[i+1]-a[i];
    if(save>tmp)
      tmp=save;}
  
  save=K-[N-1]+a[0];
  if(save>tmp)
    tmp=save;
  
  con=K-tmp;
  printf("%d",con);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:10: error: expected expression before '[' token
   16 |   save=K-[N-1]+a[0];
      |          ^
Language: C

clude <stdio.h>
int main(void){
  int K, N, i, save, con;
  int tmp=0;
  int a[200000];
  
  if(scanf("%d%d",&K,&N)==1);
  for(i=0;i<N;i++)
    if(scanf("%d",&a[i])==1);
  
  for(i=0;i<N-1;i++){
    save=a[i+1]-a[i];
    if(save>tmp)
      tmp=save;}
  
  save=K-a[N-1]+a[0];
  if(save>tmp)
    tmp=save;
  
  con=K-tmp;
  printf("%d",con);
  
  return 0;
}

Compiler output:
main.c:1:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | clude <stdio.h>
      |       ^
Language: C

#include <stdio.h>
int main(void){
  int K ,N,tmp=0,save;
  int a[];
  scanf("%d%d",&K,&N);
  for(int i=0;i<N;i++)
    scanf("%d",&a[i]);
  
  for(int i=0;i<N-1;i++){
    save=a[i+1]-a[i];
    if(save>tmp)
      tmp=save;
  }
  save=a[0]+a[N-1];
  if(save>tmp)
    tmp=save;
  
  printf("%d",K-tmp);
  
  retrn 0;
  
 
}

Compiler output:
main.c: In function 'main':
main.c:4:7: error: array size missing in 'a'
    4 |   int a[];
      |       ^
main.c:20:3: error: 'retrn' undeclared (first use in this function)
   20 |   retrn 0;
      |   ^~~~~
main.c:20:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:8: error: expected ';' before numeric constant
   20 |   retrn 0;
      |        ^~
      |        ;