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

#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n+1]
    for (int i=0; i<n; i++){
        cin >> a[i];
    }
    a[n]=a[0];
    int d[n];
    for (int i=0, i<n; i++){
        d[i]=a[i+1]-a[i];
    }
    int k=n*(n+1)/2;

    for (int i=0; i<n; i++){
        if (d[i]>k || (k-d[i])%n!=0){
            cout << "NO" << endl;
            exit(0);
        }
    }
    cout << "YES" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: expected initializer before 'for'
    7 |     for (int i=0; i<n; i++){
      |     ^~~
a.cc:7:19: error: 'i' was not declared in this scope
    7 |     for (int i=0; i<n; i++){
      |                   ^
a.cc:10:5: error: 'a' was not declared in this scope
   10 |     a[n]=a[0];
      |     ^
a.cc:12:20: error: expected ';' before '<' token
   12 |     for (int i=0, i<n; i++){
      |                    ^
      |                    ;
a.cc:12:20: error: expected primary-expression before '<' token
Language: C++

#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N; cin >> N;
    vec A(N); readvec(A);

    if(N == 1){
        cout << "YES";
        return 0;
    }

    int s = 0;
    REP(i, N) s += A[i];
    int t = N * (N + 1) / 2;
    if(s % t != 0){
        cout << "NO";
        return 0;
    }

    s /= t;

    int s2 = 0;
    REP(i, N){
        int dif = A[i] - A[(i + N - 1) % N];
        if((s - dif) % N != 0 || s < diff){
            cout << "NO";
            return 0;
        }
        s2 += (s - dif) / N;
    }
    
    if(s2 == s){
        cout << "YES";
    }else{
        cout << "NO";
    }
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:38: error: 'diff' was not declared in this scope; did you mean 'dif'?
   45 |         if((s - dif) % N != 0 || s < diff){
      |                                      ^~~~
      |                                      dif
Language: C++

#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define ti3 tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
ll int MOD=998244353;
#define N 3000000
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

main(){
    cout<<"NO;
    return 0;
}

Compiler output:
a.cc:16:11: warning: missing terminating " character
   16 |     cout<<"NO;
      |           ^
a.cc:16:11: error: missing terminating " character
   16 |     cout<<"NO;
      |           ^~~~
a.cc:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:17:5: error: expected primary-expression before 'return'
   17 |     return 0;
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
    int n; cin>>n;
    int a[100000]
    LLI sum=0;
    FOR(i,0,n){
        cin>>a[i];
        sum+=a[i];
    }
    bool flag=true;
    if(sum%(n*(n+1)/2)==0){
        sum/=(n*(n+1)/2);
    }else{
        flag=false;
    }
    FOR(i,0,n){
        if((a[(i+1)%n]-a[i]-sum)%n!=0) flag=false;
    }
    YES(flag);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: expected initializer before 'long'
    8 | #define LLI long long int
      |             ^~~~
a.cc:24:5: note: in expansion of macro 'LLI'
   24 |     LLI sum=0;
      |     ^~~
a.cc:26:14: error: 'a' was not declared in this scope
   26 |         cin>>a[i];
      |              ^
a.cc:27:9: error: 'sum' was not declared in this scope
   27 |         sum+=a[i];
      |         ^~~
a.cc:30:8: error: 'sum' was not declared in this scope
   30 |     if(sum%(n*(n+1)/2)==0){
      |        ^~~
a.cc:36:13: error: 'a' was not declared in this scope
   36 |         if((a[(i+1)%n]-a[i]-sum)%n!=0) flag=false;
      |             ^
a.cc:36:29: error: 'sum' was not declared in this scope
   36 |         if((a[(i+1)%n]-a[i]-sum)%n!=0) flag=false;
      |                             ^~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second

typedef long long ll;
typedef long double ld;
typedef unsigned long long  ull;
typedef vector<int> vi;

struct pp{ll x,y;};

const int base = 1000*1000*1000;
const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
const int inf = (int)1e9;
const int mod = 1e9+7;
ll gcd (ll a, ll b) {
        while (b) {
            a %= b;
            swap (a, b);
        }
        return a;
}

/*
void quickSort(int left, int right) {
      int i = left, j = right;
      pp tmp;
      int pivot = a[(left + right) / 2].x;
      while (i <= j) {
            while (a[i].x < pivot)
                  i++;
            while (a[j].x > pivot)
                  j--;
            if (i <= j) {
                 swap(a[i],a[j]);
                  i++,j--;
            }
      };
    if (left < j)
            quickSort(left, j);
      if (i < right)
            quickSort(i, right);
}*/
ll binpow (ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res *= a,res %= mod;
		a *= a,a %= mod;
		n >>= 1;
	}
	return res;
}
const int MaxN = 1e5 + 17;
ll a[111111],n,sum;
int main(){
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum%(n*(n+1)/2)){
        cout<<"NO";
        return 0;
    })
    ll x=sum/(n*(n+1)/2),cnt=0;
    for(ll i=0;i<n;i++)if(a[i]<x){
        cout<<"NO";
        return 0;
    }
    for(ll i=1;i<=n;i++){
        ll b=a[i%n]-a[i-1];
        if(abs(b+(n-1)*x)%n||b+(n-1)*x<0){
            cout<<"NO";
            return 0;
        }
        else cnt+=x-(b+(n-1)*x)/n;
    }
    cout<<"YES";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:6: error: expected primary-expression before ')' token
   72 |     })
      |      ^
a.cc:74:32: error: 'x' was not declared in this scope
   74 |     for(ll i=0;i<n;i++)if(a[i]<x){
      |                                ^
a.cc:80:24: error: 'x' was not declared in this scope
   80 |         if(abs(b+(n-1)*x)%n||b+(n-1)*x<0){
      |                        ^
a.cc:84:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   84 |         else cnt+=x-(b+(n-1)*x)/n;
      |              ^~~
      |              int
Language: C++

#include <bits/stdc++.h>

using namespace std;

ll n, sum a[10001];

int main () {
	cin >> n;
	for (int i = 1; i <= n; i ++) cin >> a[i], sum += a[i];
	if (sum % (n * (n + 1) / 2) != 0) cout << "NO", exit (0);
	sum /= (n * (n + 1) / 2);
	a[n + 1] = a[1];
	for (int i = 1; i <= n; i ++) {
		if (a[i + 1] - a[i] - sum > 0 || (a[i + 1] - a[i] - sum) % n != 0) cout << "NO", exit (0);
	}
	cout << "YES";
}

Compiler output:
a.cc:5:1: error: 'll' does not name a type
    5 | ll n, sum a[10001];
      | ^~
a.cc: In function 'int main()':
a.cc:8:16: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |         cin >> n;
      |                ^
      |                yn
a.cc:9:46: error: 'a' was not declared in this scope
    9 |         for (int i = 1; i <= n; i ++) cin >> a[i], sum += a[i];
      |                                              ^
a.cc:9:52: error: 'sum' was not declared in this scope
    9 |         for (int i = 1; i <= n; i ++) cin >> a[i], sum += a[i];
      |                                                    ^~~
a.cc:10:13: error: 'sum' was not declared in this scope
   10 |         if (sum % (n * (n + 1) / 2) != 0) cout << "NO", exit (0);
      |             ^~~
a.cc:11:9: error: 'sum' was not declared in this scope
   11 |         sum /= (n * (n + 1) / 2);
      |         ^~~
a.cc:12:9: error: 'a' was not declared in this scope
   12 |         a[n + 1] = a[1];
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main() {
    int n;
    cin >> n;
    ll sum = 0;

    vector<ll> a(n),d(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    ll k;
    if(sum % ((ll)n*(n+1)/2)==0){
        k = sum / ((ll)n*(n+1)/2);
    }else{
        cout << "NO" << endl;
        return 0;
    }


    for(int i = 0; i < n; i++){
        d[i] = max(a[i] - a[(i+1)%n] + k,0);
    }
    ll q = 0;
    for(int i = 0; i < n; i++){
        if(d[i]%(ll)n != 0){
            cout << "NO" << endl;
            return 0;
        }else{
            q += d[i]/(ll)n;
        }
    }
    if(k==q){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:19: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)'
   26 |         d[i] = max(a[i] - a[(i+1)%n] + k,0);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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: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:26:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   26 |         d[i] = max(a[i] - a[(i+1)%n] + k,0);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/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:
/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:26:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |         d[i] = max(a[i] - a[(i+1)%n] + k,0);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main() {
    ll n;
    cin >> n;
    ll sum = 0;

    vector<ll> a(n),d(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += (ll)a[i];
    }
    ll k;
    if((sum % (n*(n+1)/2))==0){
        k = sum / (n*(n+1)/2));
    }else{
        cout << "NO" << endl;
        return 0;
    }


    for(int i = 0; i < n; i++){
        d[i] = a[i] - a[(i+1)%n] + k;
    }
    ll q = 0;
    for(int i = 0; i < n; i++){
        if(d[i]%n != 0){
            cout << "NO" << endl;
            return 0;
        }else{
            q += d[i]/n;
        }
    }
    if(k==q){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:30: error: expected ';' before ')' token
   18 |         k = sum / (n*(n+1)/2));
      |                              ^
      |                              ;
Language: C++

#include<bits/stdc++.h>
#define N 100050
#define INF 0x3fff
#define ll long long
using namespace std;
ll n,a[N+5],sum=0;
int main()
{
    int maxx = 0,t;
    scanf("%lld",&n);
    for(int i=1; i<=n; i++)
    {
        scanf("%lld",&a[i]);
        if(a[i]>maxx) {
            maxx = a[i];
            t = i;
        }
        sum+=a[i];
    }
    int flag=1,t,m;
    if(sum%(n*(n+1)/2)==0)
    {
        int k=sum/(n*(n+1)/2);
        while(k--)
        {
            int p=1;
            maxx = 0;
            for(int i=t+1; i<=t+n; i++)
            {
                int k=i;
                if(k>n) k-=n;
                a[k]=a[k]-p;
                if(a[k]<0){
                    printf("NO\n");
                    return 0;
                }
                if(a[k]>maxx){maxx = a[k],m = k;}
                p++;
            }
            t = m;
        }
    }
    for(int i=1; i<=n; i++)
    {
        if(a[i]!=0)
        {
            flag=0;
            break;
        }
    }
    if(flag==1) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: redeclaration of 'int t'
   20 |     int flag=1,t,m;
      |                ^
a.cc:9:18: note: 'int t' previously declared here
    9 |     int maxx = 0,t;
      |                  ^
Language: C++

#include<iostream>
#include<algorithm>
#define LL long long
int N;
int A[100010];
LL sum;

int main() {
	std::cin >> N;
	for (int i = 1; i <= N; i++) {
		scanf_s("%d",&A[i]);
		sum += A[i];
		if (i == 0)A[0] = A[N];
	}
	LL D = ((N + 1)*N) / 2;
	if (sum%D) {
		printf("%s\n", "NO");
		return 0;
	}
	int ave = sum / D;
	for (int i = 1; i < N; i++) {
		int tmp = A[i] - A[i + 1] + ave;
		if (tmp < 0 || tmp % N) {
			printf("%s\n", "NO");
			return 0;
		}
	}
	printf("%s\n", "YES");
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   11 |                 scanf_s("%d",&A[i]);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

int main(){
  int N;
  cin>>N;
  ll a[N];
  ll sum=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
    sum+=a[i];
  }
  ll x=N*(N+1)/2,k=sum/x;
  bool flag=(sum%x==0);
  for(int i=0;i<N;i++){
    ll d=a[(i+1)%N]-a[i]-k;
    cout<<d<<endl;
    flag&&=(d<=0&&d%N==0);
  }
  cout<<(flag?"YES":"NO")<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: expected primary-expression before '=' token
   22 |     flag&&=(d<=0&&d%N==0);
      |           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

long long a[400001];
long long d[400001];
                                       
int main () {
	long long   n, k = 0, c, ok = 0;
	cin >> n;
	for (int i = 1;i <= n;i ++) {
		cin >> a[i];
		k += a[i];
	}       
	if (k % (n * (n + 1) / 2)) {
		cout << "NO";
		return 0;
	}
	for (int  i = 1;i < n;i ++) {
		d[i] = a[i + 1] - a[i] - (k / (n * (n + 1) / 2));	
	}
	d[n] = a[1] - a[n] - (k / (n * (n + 1) / 2));
	for (int i = 1;i <= n;i ++) {
		if (d[i] % (n)) {
			ok += (abs (d[i]) / n)
			cout << "NO";
			return 0;
		}
	}
	if (ok != k) cout << "NO";
	else cout << "YES";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:47: error: expected ';' before 'cout'
   25 |                         ok += (abs (d[i]) / n)
      |                                               ^
      |                                               ;
   26 |                         cout << "NO";
      |                         ~~~~
Language: C++

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

int main()
{
    int n,i,j
    long long tt=0;
    long long sum=0,a[100001],dis;
    cin >> n;
    for (i=1;i<=n;i++)
    {
        cin >> a[i];
        sum += a[i];
        tt += i;
    }

    if ( sum%tt!=0)
    {
      cout << "NO";
      return 0;
    }

    sum = sum / tt;
    long long fr=0;
    for (i=1;i<n;i++)
    {
        dis = a[i+1] - a[i];
        if ((sum-dis)%n!=0)
        {
            cout << "NO";
            return 0;
        }
        fr+= (sum-dis)/n;

    }
    dis = a[1] - a[n];
    if ((sum-dis)%n!=0)
        {
            cout << "NO";
            return 0;
        }
    fr+= (sum-dis)/n;

    
    if (fr==sum)
        cout << "YES";
    else cout << "NO";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: expected initializer before 'long'
   10 |     long long tt=0;
      |     ^~~~
a.cc:17:9: error: 'tt' was not declared in this scope; did you mean 'tm'?
   17 |         tt += i;
      |         ^~
      |         tm
a.cc:20:14: error: 'tt' was not declared in this scope; did you mean 'tm'?
   20 |     if ( sum%tt!=0)
      |              ^~
      |              tm
a.cc:26:17: error: 'tt' was not declared in this scope; did you mean 'tm'?
   26 |     sum = sum / tt;
      |                 ^~
      |                 tm
Language: C++

#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;
 
int main()
{
    int n,i,j;
    long long tt = 0;
    long long sum=0,a[100001],dis;
    cin >> n;
    for (i=1;i<=n;i++)
    {
        cin >> a[i];
        sum += a[i];
        tt += i;
    }
 
    
 
    sum = sum / tt;
    long long fr;
    for (i=1;i<n;i++)
    {
        dis = a[i+1] - a[i];
        if ((sum-dis)%n!=0)
        {
            cout << "NO";
            return 0;
        }
 
        fr+= (sum-dis)/n;
 
    }
    dis = a[1] - a[n];
    if ((sum-dis)%n!=0)
        {
            cout << "NO";
            return 0;
        }
 
        fr+= (sum-dis)/n;
 
    if (fr==sum)
        cout << "YES";
    else cout << "NO";

Compiler output:
a.cc: In function 'int main()':
a.cc:47:23: error: expected '}' at end of input
   47 |     else cout << "NO";
      |                       ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(),(a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll,ll> pii;
struct Edge {ll s,t,d;};
typedef vector<vector<Edge>> Graph;

ll min(vi a){
  ll mi=INF;
  for(ll i:a) mi=min(mi,i);
  return mi;
}

ll sum(vi a){
  ll ret=0;
  for(ll i:a) ret+=i;
  return ret;
}

int main(){
  ll N; cin>>N;
  vi A(N); REP(i,N) cin>>A[i];

  if(sm%(N*(N-1)/2)) {cout<<"NO"<<endl; return 0;}

  vi B(N); REP(i,N) B[i]=A[i]-A[(i+1)%N];
  ll mi=min(B);
  ll sm=sum(A);
  if(sm/(N*(N-1)/2)+mi>=0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:6: error: 'sm' was not declared in this scope; did you mean 'tm'?
   35 |   if(sm%(N*(N-1)/2)) {cout<<"NO"<<endl; return 0;}
      |      ^~
      |      tm
Language: C++

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

using namespace std;

const int MAXN = 2e5 + 1;

typedef long long int ll;

ll a[MAXN];

int main()
{
    ll n;
    ll x = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        x += a[i];
    }
    if (x % ((n * (n + 1)) / 2) == 0)
    {
        ll u = 0;
        for (int i = 0; i < n; i++)
            if (a[i] > u)
                u = a[i];
        for (int i = 2; i < n; i++)
        {
            if (a[i] == u && a[i - 1] != u && a[i - 2] == u)
            {
                cout << "NO";
                return ;
            }
        }
        sort(a, a + n);
        for (int i = 0; i < n; i++)
        {
            if (a[i] < (x / ((n * (n + 1)) / 2)) + i)
            {
                cout << "NO";
                return 0;
            }
        }
        if (a[n - 1] > ((x / ((n * (n + 1)) / 2)) * n))
        {
            cout << "NO";
            return 0;
        }
        for (int i = 1; i < n; i++)
        {
            if (a[i] > a[i - 1] + n)
            {
                cout << "NO";
                return 0;
            }
        }
        cout << "YES";
    }
    else
        cout << "NO";
}

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

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
void NO(){cout<<"NO"<<endl;exit(0);}
int main(){
ll n;cin>>n;ll x[100001];ll s=0;for(int i=0;i<n;++i)cin>>x[i],s+=x[i];
ll n2=n*(n+1)/2;ll k=s/n2;if(n2*k!=s)NO();
ll j=0;for(int i=0;i+1<N;++i){ll d=x[i+1]-x[i];if((d-k)%n!=0)NO();j+=k+(d-k)/n;}
if(j!=n)NO();cout<<"YES"<<endl;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: 'N' was not declared in this scope
    8 | ll j=0;for(int i=0;i+1<N;++i){ll d=x[i+1]-x[i];if((d-k)%n!=0)NO();j+=k+(d-k)/n;}
      |                        ^
Language: C++

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

int main(){
  ll n, i, j;
  cin>>n;
  vl a(n);
  ll sum=0;
  for(i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  if(sum % (n*(n+1)/2) != 0){
    cout<<"NO"<<endl;
    return 0;
  }
  ll m = sum/(n*(n+1)/2);
  vl num(n);
  for(i=1;i<n;i++){
    ll sa = a[i]-a[i-1];
    if((m-sa)%n!=0){
      cout<<"NO"<<endl;
      return 0;
    }
    num[i-1] = (m-sa)/n;
  }
  ll sa = a[0]-a[n-1];
  if((m-sa)%n!=0){
    cout<<"NO"<<endl;
    return 0;
  }
  num[n-1] = (m-sa)/n;
  
  ll ans=0;
  for(i=0;i<n;i++){
    ans += num[i];
  }
  if(ans == m){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  
  return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:64:12: error: expected '}' at end of input
   64 |   return 0;
      |            ^
a.cc:24:11: note: to match this '{'
   24 | int main(){
      |           ^
Language: C++

#include <iostream>

using namespace std;

typedef long long int lint;

const int NMAX = 100000 + 5;

int N;
lint A[NMAX];
lint APrim[NMAX];
lint mars[2 * NMAX];

int main()
{
    //ios_base :: sync_with_stdio(false);
    //cin.tie(0);

    cin >> N;
    for (int i = 1; i <= N; ++ i)
        cin >> A[i];

    lint S = 0;
    for (int i = 1; i <= N; ++ i)
        S += A[i];

    lint onePass = N * (N + 1LL) / 2;
    if (S % onePass != 0) {
        cout << "NO\n";
        return 0;
    }

    lint passes = S / onePass;
    APrim[0] = A[N];
    for (int i = 1; i <= N; ++ i)
        APrim[i] = A[i];

    lint sumAPrim = 0;
    for (int i = N; i; -- i) {
        APrim[i] -= APrim[i - 1];
        APrim[i] -= passes;
        APrim[i] *= (-1);

        if (APrim[i] % N != 0) {
            cout << "NO\n";
            return 0;
        }
        APrim[i] /= N;
        sumAPrim += APrim[i];
    }

    if (sumAPrim != passes)
        cout << "NO\n";
    else {
        cout << "YES\";
        return 0;
        //Build waves generators
        for (int i = 1; i <= N; ++ i) {
            mars[i] += APrim[i];
            mars[i + N] -= APrim[i];
        }
        for (int i = 1; i <= 2 * N; ++ i)
            mars[i] += mars[i - 1];

        //Propagate one -N for every wave, so that it suddenly stops
        for (int i = 1; i <= N; ++ i)
            mars[i + N] -= APrim[i] * N;
        for (int i = 1; i <= 2 * N; ++ i)
            mars[i] += mars[i - 1];

        //Build circularity
        for (int i = 1; i <= N; ++ i)
            mars[i] += mars[i + N];

        //Final check
        for (int i = 1; i <= N; ++ i)
            if (mars[i] != A[i]) {
                cout << "NO\n";
                return 0;
            }
    }

    cout << "YES\n";
    return 0;
}


Compiler output:
a.cc:55:17: warning: missing terminating " character
   55 |         cout << "YES\";
      |                 ^
a.cc:55:17: error: missing terminating " character
   55 |         cout << "YES\";
      |                 ^~~~~~~
a.cc: In function 'int main()':
a.cc:56:9: error: expected primary-expression before 'return'
   56 |         return 0;
      |         ^~~~~~
Language: C++

#include <iostream>
//#include <sstream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cmath>
//#include <functional>
//#define LL long long

using namespace std;


const int maxn = 100005;
int a[maxn];
long long b[maxn];

int main()
{
//    printf("ok");
#ifdef LOCAL
//    freopen("/Users/ecooodt/Desktop/c++ and acm/DI2_lesson/2/2.txt","r",stdin);
#endif
//    printf("%d",-5%5)
    memset(a,0,sizeof(a));
    int n,m;
    scanf("%d",&n);
    for(int i = 0; i < n; i++)
    {
        scanf("%d",&a[i]);
    }
    for(int i = 1; i < n; i++)
    {
        b[i-1] = a[i-1] - a[i];
    }
    b[n-1] = a[n-1] - a[0];
    long long int sum = 0;
    for(int i = 0; i < n; i++)
    {
        sum += a[i];
    }
    int t = n*(1+n)/2;
    if(sum % t)
    {
        printf("NO\n");
        return 0;
    }
    else
    {
        sum /= t;
    }

    for(int i = 0 ; i < n ; i++)
    {
        b[i] += sum;
//        printf("%d\n",b[i]);
        if(b[i] != 0 && (b[i] % n != 0|| b[i] < 0)
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:51: error: expected ')' before '{' token
   61 |         if(b[i] != 0 && (b[i] % n != 0|| b[i] < 0)
      |           ~                                       ^
      |                                                   )
   62 |         {
      |         ~                                          
a.cc:66:5: error: expected primary-expression before '}' token
   66 |     }
      |     ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

bool solve(vector<ll> A) {
}

int main() {
    // メインプログラムここから
    ll n; cin >> n;
    vector<ll> A(n);
    REP(i, n) {
        cin >> A[i];
    }
    ll n = A.size();
    // ΣA[i] を求める
    ll sum = 0;
    REP(i, n) {
        sum += A[i];
    }
    // 1回の操作で取り除く個数
    ll K = n * (n+1) / 2;
    // 後で1つでも条件を満たさなかったらfalseにする
    bool ans = true;
    // 必要条件
    if (sum % K == 0) {
        // 合計操作回数
        ll T = sum / K;
        REP(i, n) {
            // 隣との差を埋められるか
            ll d = T + A[i] - A[(i+1)%n];
            if (d < 0 || d % n != 0) {
                ans = false;
            }
        }
    }
    else {
        ans = false;
    }
    // 出力
    if (ans) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Compiler output:
a.cc: In function 'bool solve(std::vector<long long int>)':
a.cc:8:1: warning: no return statement in function returning non-void [-Wreturn-type]
    8 | }
      | ^
a.cc: In function 'int main()':
a.cc:14:9: error: 'i' was not declared in this scope
   14 |     REP(i, n) {
      |         ^
a.cc:14:5: error: 'REP' was not declared in this scope
   14 |     REP(i, n) {
      |     ^~~
a.cc:17:8: error: redeclaration of 'll n'
   17 |     ll n = A.size();
      |        ^
a.cc:12:8: note: 'll n' previously declared here
   12 |     ll n; cin >> n;
      |        ^
Language: C

#include <stdio.h>
int a[100001];
int b[100001];
int n;
long long int sum;
int main(int argc, const char * argv[]) {
    scanf("%d",&n);
    for (int i = 0; i < n; i++){
        scanf("%d",&a[i]);
        sum += a[i];
    }
    if ((2*sum/n/(n+1) != 2.0*sum/n/(n+1))){
        printf("NO\n");
        return 0;
    }
    int t = int(2*sum/n/(n+1));
    for (int i = 0; i < n - 1; i ++)
        b[i] = a[i + 1] - a[i] - t;
    b[n - 1] = a[0] - a[n - 1] - t;
    for (int i = 0; i < n; i ++)
        if (b[i]%n != 0){
            printf("NO\n");
            return  0;
        }
    printf("YES\n");
    
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:13: error: expected expression before 'int'
   16 |     int t = int(2*sum/n/(n+1));
      |             ^~~
Language: C++

#include<cstdio>
#include<iostream>
int s[100005];
int dis[100005];
int main(){
	int n;
	while(scanf("%d",&n)==1)
	{
		int sum=0;
		for(int i=0;i<n;i++)
		{
			scanf("%d",&s[i]);
			sum+=s[i];
		}
		if(((2*sum)%(n*(n+1)))!=0)
		{
			printf("NO\n");
			continue;
		}
		sum/=(n*(n+1))/2;
		dis[1]=a[1]-a[n];    
		for(i=2;i<=n;i++)
		dis[i]=a[i]-a[i-1];  
		int cnt=0;
		for(i=1;i<=n;i++)
		{  
        if((sum-dis[i]<0)||(sum-dis[i])%n)
		{  
            printf("NO\n");   
            return 0;    
        }  
	    else cnt+=(sum-dis[i])/n;  
        }  
        if(cnt!=sum)printf("NO\n");  
        else printf("YES\n");  
    }  
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: 'a' was not declared in this scope
   21 |                 dis[1]=a[1]-a[n];
      |                        ^
a.cc:22:21: error: 'i' was not declared in this scope
   22 |                 for(i=2;i<=n;i++)
      |                     ^
a.cc:25:21: error: 'i' was not declared in this scope
   25 |                 for(i=1;i<=n;i++)
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
ll a[200000];
ll d[200000];
#define  ll long long
int main()
{
    ll n;
    ll sum=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    for(int i=0;i<n-1;i++)
    {
        d[i]=a[i+1]-a[i];
    }
    d[n-1]=a[0]-a[n-1];
    if(sum%(n*(n+1)/2)==0)
    {
        ll k=sum/(n*(n+1)/2);
        for(int i=0;i<n;i++)
        {
            if((k-(d[i]))%n)
            {
                cout<<"NO"<<endl;
                return 0;
            }
        }
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
}


Compiler output:
a.cc:3:1: error: 'll' does not name a type
    3 | ll a[200000];
      | ^~
a.cc:3:1: note: the macro 'll' had not yet been defined
a.cc:5:10: note: it was later defined here
    5 | #define  ll long long
      |          ^~
a.cc:4:1: error: 'll' does not name a type
    4 | ll d[200000];
      | ^~
a.cc:4:1: note: the macro 'll' had not yet been defined
a.cc:5:10: note: it was later defined here
    5 | #define  ll long long
      |          ^~
a.cc: In function 'int main()':
a.cc:13:14: error: 'a' was not declared in this scope
   13 |         cin>>a[i];
      |              ^
a.cc:18:9: error: 'd' was not declared in this scope
   18 |         d[i]=a[i+1]-a[i];
      |         ^
a.cc:18:14: error: 'a' was not declared in this scope
   18 |         d[i]=a[i+1]-a[i];
      |              ^
a.cc:20:5: error: 'd' was not declared in this scope
   20 |     d[n-1]=a[0]-a[n-1];
      |     ^
a.cc:20:12: error: 'a' was not declared in this scope
   20 |     d[n-1]=a[0]-a[n-1];
      |            ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(void){
int n;
cin >> n;
vector<int> a(n);
for(int i=0;i<n;i++){
cin >> a[n];
}
bool ok = true;
int hoge = ((a[1]-a[0])%n + n)%n;
for(int i=0;i+1<n;i++){
if ((a[i+1]-a[i])%n + n)%n != hoge) ok = false;
}
cout << (ok ? "YES" : "NO") << endl; 
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: expected primary-expression before '%' token
   15 | if ((a[i+1]-a[i])%n + n)%n != hoge) ok = false;
      |                         ^
Language: C++

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

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

int main(){
    ll n;
    scanf("%lld", &n);
    vector<ll> a(n+2);
    ll tot = 0;
    rep(i,n) {
        scanf("%lld", &a[i]);
        tot += a[i];
    }
    
    ll sum = n * (n+1) / 2LL;
    if(tot % sum != 0) {
        puts("NO"); return 0;
    }

    vector<ll> d(n+2);
    ll cnt = 0;
    bool f = true;
    rep(i,n){
        d[i] = (a[(i+1) % n] - a[i]);
        d[i] -= tot / sum;
        if(d[i] > 0) f = false, break;
        if(d[i] % n == 0) cnt += -d[i] / n;
    }
    if(cnt != tot / sum) f = false;

    puts(f ? "YES" : "NO");

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:33: error: expected primary-expression before 'break'
   30 |         if(d[i] > 0) f = false, break;
      |                                 ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cstdint>

using namespace std;

int main()
{
	int_least32_t n;
	cin >> n;

	int_fast64_t sum{ 0 };
	vector<int_least32_t> a( n + 1 );
	for(auto i = 0; i < n; ++i) {
		cin >> a[i];
		sum += a[i];
	}
	a[n] = a[0];


	if((sum % (n * (n + 1) / 2) != 0) {
		cout << "NO" << endl;
		return 0;
	}

	int_fast64_t temp, k{ sum / (n * (n + 1) / 2) };
	for(auto i = 0; i < n; ++i) {
		temp = a[i + 1] - a[i] - k;
		if(temp > 0 || (-1 * temp) % n != 0) {
			//cout << "NO" << endl;
			//return 0;
		}
	}
	cout << "YES" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:42: error: expected ';' before '{' token
   21 |         if((sum % (n * (n + 1) / 2) != 0) {
      |                                          ^~
      |                                          ;
a.cc:26:26: error: expected initializer before ',' token
   26 |         int_fast64_t temp, k{ sum / (n * (n + 1) / 2) };
      |                          ^
a.cc:26:26: error: expected ')' before ',' token
   26 |         int_fast64_t temp, k{ sum / (n * (n + 1) / 2) };
      |                          ^
      |                          )
a.cc:21:11: note: to match this '('
   21 |         if((sum % (n * (n + 1) / 2) != 0) {
      |           ^
a.cc:28:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
   28 |                 temp = a[i + 1] - a[i] - k;
      |                 ^~~~
      |                 tm
a.cc:28:42: error: 'k' was not declared in this scope
   28 |                 temp = a[i + 1] - a[i] - k;
      |                                          ^
Language: C++

#include <iostream>
#include <vector>
#include <cstdint>

using namespace std;

int main()
{
	int_least32_t n;
	cin >> n;

	int_fast32_t sum{ 0 };
	vector<int_least32_t> a( n );
	for(auto& x : a) {
		cin >> x;
		sum += x;
	}
 	
	int_fast32_t temp, k{ sum / (n * (n + 1) / 2) };
	bool isok{ true };
	for(auto i = 0; i < n - 1; ++i) {
		temp = a[i + 1] - a[i] - k;
		if(temp > 0 && -1 * temp % n != 0)) {
			isok = false;
		}
	}

	if(isok) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:51: error: expected primary-expression before ')' token
   23 |                 if(temp > 0 && -1 * temp % n != 0)) {
      |                                                   ^
Language: C++

#include <iostream>
#include <vector>
#include <cstdint>

using namespace std;

int main()
{
	int_least32_t n;
	cin >> n;

	int_fast32_t sum{ 0 };
	vector<int_least32_t> a( n );
	for(auto& x : v) {
		cin >> x;
		sum += x;
	}
 	
	int_least32_t k{ sum / (n * (n + 1) / 2) };
	int_fast32_t temp;
	bool isok{ true };
	for(auto i = 0; i < n - 1; ++i) {
		temp = a[i + 1] - a[i] - k;
		if(temp >= 0 || -1 * temp % n != 0) {
			isok = false;
		}
	}

	if(isok) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: 'v' was not declared in this scope
   14 |         for(auto& x : v) {
      |                       ^
a.cc:19:30: warning: narrowing conversion of '(sum / ((int_fast32_t)((n * (n + 1)) / 2)))' from 'int_fast32_t' {aka 'long int'} to 'int_least32_t' {aka 'int'} [-Wnarrowing]
   19 |         int_least32_t k{ sum / (n * (n + 1) / 2) };
      |                          ~~~~^~~~~~~~~~~~~~~~~~~
Language: C++

int_least32_t n;
	cin >> n;

	int_fast32_t sum{ 0 };
	vector<int_least32_t> a( n );
	for(auto& x : v) {
		cin >> x;
		sum += x;
	}
 	
	int_least32_t k{ sum / (n * (n + 1) / 2) };
	int_fast32_t temp;
	bool isok{ true };
	for(auto i = 0; i < n - 1; ++i) {
		temp = a[i + 1] - a[i] - k;
		if(temp >= 0 || -1 * temp % n != 0) {
			isok = false;
		}
	}

	if(isok) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

Compiler output:
a.cc:1:1: error: 'int_least32_t' does not name a type
    1 | int_least32_t n;
      | ^~~~~~~~~~~~~
a.cc:2:9: error: 'cin' does not name a type
    2 |         cin >> n;
      |         ^~~
a.cc:4:9: error: 'int_fast32_t' does not name a type
    4 |         int_fast32_t sum{ 0 };
      |         ^~~~~~~~~~~~
a.cc:5:9: error: 'vector' does not name a type
    5 |         vector<int_least32_t> a( n );
      |         ^~~~~~
a.cc:6:9: error: expected unqualified-id before 'for'
    6 |         for(auto& x : v) {
      |         ^~~
a.cc:11:9: error: 'int_least32_t' does not name a type
   11 |         int_least32_t k{ sum / (n * (n + 1) / 2) };
      |         ^~~~~~~~~~~~~
a.cc:12:9: error: 'int_fast32_t' does not name a type
   12 |         int_fast32_t temp;
      |         ^~~~~~~~~~~~
a.cc:14:9: error: expected unqualified-id before 'for'
   14 |         for(auto i = 0; i < n - 1; ++i) {
      |         ^~~
a.cc:14:25: error: 'i' does not name a type
   14 |         for(auto i = 0; i < n - 1; ++i) {
      |                         ^
a.cc:14:36: error: expected unqualified-id before '++' token
   14 |         for(auto i = 0; i < n - 1; ++i) {
      |                                    ^~
a.cc:21:9: error: expected unqualified-id before 'if'
   21 |         if(isok) {
      |         ^~
a.cc:24:9: error: expected unqualified-id before 'else'
   24 |         else {
      |         ^~~~
Language: C++

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

typedef long long int ll;
int n;

int main() {
    cin >> n;
    vector<ll> v(n);
    for (auto& i : v) cin >> i;

    ll sum = 0;
    for (auto i : v) sum += i;

    if (sum % (n * (n+1) / 2)) {
        cout << "NO" << endl;
        return 0;
    }

    int k = sum / (n * (n + 1) / 2);
    int zero = 0, count = 0;
    for (int i = 0; i < n; i++) {
        int d = v[(i+1)%n] - v[i] - k;
        if (d == 0) zoro++;
        else if(d == n) count++;
    }

    if (count == k && zero == n - count) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: 'zoro' was not declared in this scope; did you mean 'zero'?
   24 |         if (d == 0) zoro++;
      |                     ^~~~
      |                     zero
Language: C++

#include<cstdio>
int n, w[101000];
long long s, K;
int main(){
    int i;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&w[i]);
        s += w[i];
    }
    K = 1ll*n*(n+1)/2;
    if(s%K) goto f;
    s/=K;
    long long t=0;
    for(i=1;i<=n;i++){
        if((w[i%n+1]%n-w[i]%n+n)%n != s%n)goto f;
        if(w[i%n+1] - w[i] > s)goto f;
        t += (s - (w[i%n+1] - w[i])) / n;
    }
    if(t!=s) goto f;
    puts("YES");
    return 0;
f:
    puts("NO");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:1: error: jump to label 'f'
   23 | f:
      | ^
a.cc:12:18: note:   from here
   12 |     if(s%K) goto f;
      |                  ^
a.cc:14:15: note:   crosses initialization of 'long long int t'
   14 |     long long t=0;
      |               ^
Language: C++

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

typedef long long ll;
const int M = 1e9 + 7;
const int N = 1e5 + 7;
const int MAX = 1e9 + 1;
//从北开始顺时针
//int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
//int exDx[] = {-1, -1, 0, 1, 1, 1, 0, -1}, exDy[] = {0, 1, 1, 1, 0, -1, -1, -1};

int a[N];
int b[N];

int main() {
    int i, j;
    int n;
    cin >> n;
    ll sum = 0;
    for (i = 0; i < n; ++i) {
        cin >> a[i];
        sum += (ll)a[i];
    }

    ll perRoundSum = (ll)(1 + n) * (ll)n / 2L;

    if (sum % perRoundSum != 0) {
        cout << "NO\n";
        return 0;
    }

    int cnt = sum / perRoundSum;
    b[0] = a[0] - a[n - 1];
    for (i = 1; i < n; ++i) {
        b[i] = a[i] - a[i - 1];
    }
    bool flag = true;
    for (i = 0; i < n; ++i) {
        if (!(cnt - d[i] >= 0 && (cnt - d[i]) % n == 0)) {
            flag = false;
            break;
        }
    }
    cout << (flag ? "YES" : "NO") << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:21: error: 'd' was not declared in this scope
   51 |         if (!(cnt - d[i] >= 0 && (cnt - d[i]) % n == 0)) {
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
#define int long long 
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
int a[MAX];
vector<int> v;

 main() {
    int n,T = 0;
    cin >> n;
    if(n == 1){
    	cout <<"YES";
    	return 0;
    }
    REP(i, n) {
    	cin >> a[i];
    	T += a[i];
    }

    if (T % ((n*(n+1))/2) != 0){
        cout << "NO";
        return;
    }

    int m = T/((n*(n+1))/2);
    REP(i, n){
    	v.pb(a[(i+1)%n]-a[i]);
    }
    REP(i, v.size()){
    	if(m-v[i] < 0 || (m-v[i])%n) {
    		cout <<"NO";
    		return 0;
    	}
    }
    cout <<"YES";
    return 0;
}

Compiler output:
a.cc:20:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   20 |  main() {
      |  ^~~~
a.cc: In function 'int main()':
a.cc:34:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   34 |         return;
      |         ^~~~~~
Language: C++

#include<iostream>
using namespace std;
int mian(){
cout<<"NO"<<endl;}

Compiler output:
a.cc: In function 'int mian()':
a.cc:4:18: warning: no return statement in function returning non-void [-Wreturn-type]
    4 | cout<<"NO"<<endl;}
      |                  ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#define ll long long
#define N 100005
#define inf 0x3f3f3f3f
using namespace std;
ll sum,a[N],t,tmp,n;
int main() {
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i];
        t+=i;
    }
    if(sum%t)cout<<"NO";
    else{
        tmp=a[1];
        for(int i=1;i<n;i++)a[i]=a[i+1]-a[i];
        a[n]=tmp-a[n];
        ll d=sum/t,ok=1;
        for(int i=1;i<=n&&ok;i++){
            a[i]-=d;
            if(a[i]%n||a[i]>0)ok=0;
        }
        if(ok)cout<<"YES";
        else cout<<"NO";
    }
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: expected '}' at end of input
   30 |     return 0;
      |              ^
a.cc:10:12: note: to match this '{'
   10 | int main() {
      |            ^
Language: Java

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

int main()
{
    int n;
    scanf("%d",&n);
    long long array[n + 1];
    long long diff[n];
    long long sum = 0;
    for(int i = 1;i <= n;i++){
        scanf("%lld",&array[i]);
        sum += array[i];
        }
    array[0] = array[n];
    if(sum % ((long)n * (n + 1)/2)){
    printf("NO");
    return 0;
    }
    int times = sum * 2 / ((long)n * (n + 1));
    long long cnt = 0;
    for(int i = 0;i < n;i++){
            diff[i] = array[i + 1] - array[i] - times;
            if(diff[i] > 0){
            printf("NO");
            return 0;
            }
            if(diff[i] < 0){
            if(abs(diff[i]) % n){
            printf("NO");
            return 0;
            }
            cnt += abs(diff[i])/n;
            }
        }
     if(cnt > times){
     printf("NO");
     return 0;
     }
     printf("YES");
     return 0;
    }


Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:8: error: not a statement
    long long array[n + 1];
    ^
Main.java:8: error: not a statement
    long long array[n + 1];
                      ^
Main.java:9: error: not a statement
    long long diff[n];
    ^
Main.java:9: error: not a statement
    long long diff[n];
                   ^
Main.java:10: error: not a statement
    long long sum = 0;
    ^
Main.java:21: error: not a statement
    long long cnt = 0;
    ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
int main()
^
  (use --enable-preview to enable unnamed classes)
Main.java:7: error: illegal start of expression
    scanf("%d",&n);
               ^
Main.java:8: error: ';' expected
    long long array[n + 1];
        ^
Main.java:8: error: ']' expected
    long long array[n + 1];
                    ^
Main.java:8: error: ';' expected
    long long array[n + 1];
                         ^
Main.java:9: error: ';' expected
    long long diff[n];
        ^
Main.java:9: error: ';' expected
    long long diff[n];
                    ^
Main.java:10: error: ';' expected
    long long sum = 0;
        ^
Main.java:12: error: illegal start of expression
        scanf("%lld",&array[i]);
                     ^
Main.java:21: error: ';' expected
    long long cnt = 0;
        ^
18 errors
Language: C++

#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main(){
	int N, sum=0, k;
	cin>>N;
	vector<int> A(N), A2(N);
	for(int i=0; i<N; i++){
		cin>>A[i];
		sum+=A[i];
	}
	if(sum%(N*(N+1)/2)!=0){
		cout<<"NO"<<endl;
		rteurn 0;
	}
	k=sum/(N*(N+1)/2);

	for(int i=0; i<N; i++){
		A2[i]=A[(i+1)%N]-A[i];
	}

	set<int> s;
	for(int i=0; i<N; i++){
		if(s.find(A2[i]-k)==s.end()){
			s.insert((A2[i]-k)*-1);
		}
	}

	const set<int>::const_iterator ite=s.end();
	for(set<int>::const_iterator it=s.begin(); it!=ite; ++it){
		if((*it)%N!=0){
			cout<<"NO"<<endl;
			return 0;
		}
	}

	cout<<"YES"<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'rteurn' was not declared in this scope
   17 |                 rteurn 0;
      |                 ^~~~~~