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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;
 
signed main(){
    ll n;
    cin >> n;
    ll sum = 0;
    ll a[n];
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    if(sum % (n * (n + 1) / 2) != 0){
        cout << "NO" << endl;
        return 0;
    }
    ll k = sum / (n * (n + 1) / 2);
    rep(i,n){
        ll t = a[(i + 1) % n] - a[i];
        if((t + n * (ll)INF) % n != k || t < k * (1 - n) || k < t){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;


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

#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll N;
    cin >> N;
    vector<ll> A(N),D(N);
    ll sum = 0;
    rep(i,N){
        cin >> A[i];
        sum += A[i];
    }
    ll b = (N+1)*N/2;
    if(sum % b != 0 ){
        cout << "NO" << endl;
        return 0;
    }
    ll k = sum / b;
    rep(i,N){
        D[i] = A[(i+1)%N] - A[i] - k;
    }
    ll cnt = 0;
    rep(i,N){
        if(D[i]% N!=0){
            cout << "NO" << endl;
            return 0;
        }else cnt += -D[i])/N;
    }
    if(cnt==k)cout << "YES" << endl;
    else cout << "NO" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:27: error: expected ';' before ')' token
   38 |         }else cnt += -D[i])/N;
      |                           ^
      |                           ;
Language: C

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	if (N == 1) {
		printf("YES\n");
		return 0;
	}

	int A[100000];
	int saisho = getint();
	ll goukei = saisho;
	int mae = saisho;
	rep(i, N - 1) {
		int tugi = getint();
		A[i] = tugi - mae;
		goukei += tugi;
		mae = tugi;
	}
	A[N - 1] = saisho - mae;
	
	ll n = ll(N) * (N + 1) / 2;
	if (goukei % n) {
		printf("NO\n");
		return 0;
	}

	int k = goukei / n;

	rep(i, N) {
		int tmp = A[i] - k;
		if (tmp > 0) {
			printf("NO\n");
			return 0;
		}
		int watta = tmp / N;
		if (watta * N != tmp) {
			printf("NO\n");
			return 0;
		}
	}

	printf("YES\n");


	Would you please return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
#define RI register int
int read() {
    int q=0;char ch=' ';
    while(ch<'0'||ch>'9') ch=getchar();
    while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
    return q;
}
typedef long long LL;
const int N=100005;
LL sum,nowadd,nows,a[N],orz[N],m;int n;
int work() {
    int js=0;
    for(RI i=0;i<n;++i) {
        int b=a[i]-a[(i-1+n)%n];
        if((m-b)%n||m-b<0) return 0;
        orz[i]=(m-b)/n,js+=orz[i];
    }
    if(js!=m) return 0;
    for(RI i=0;i<n;++i) {
        nows+=orz[i],nowadd+=nows;
        if(a[i]<nowadd) return 0;
        a[i]-=nowadd;
    }
    for(RI i=0;i<n;++i) {
        nows-=orz[i],nowadd-=1LL*n*orz[i],nowadd+=nows;
        if(a[i]!=nowadd) return 0;
    }
    return 1;
}
int main()
    n=read();
    for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i];
    if(sum%(1LL*(n+1)*n/2)) {puts("NO");return 0;}
    m=sum/(1LL*(n+1)*n/2);
    if(work()) puts("YES");
    else puts("NO");
    return 0;
}

Compiler output:
a.cc: In function 'int work()':
a.cc:15:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |     for(RI i=0;i<n;++i) {
      |            ^
a.cc:21:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |     for(RI i=0;i<n;++i) {
      |            ^
a.cc:26:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   26 |     for(RI i=0;i<n;++i) {
      |            ^
a.cc: At global scope:
a.cc:33:5: error: expected initializer before 'n'
   33 |     n=read();
      |     ^
a.cc:34:5: error: expected unqualified-id before 'for'
   34 |     for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i];
      |     ^~~
a.cc:34:16: error: 'i' does not name a type
   34 |     for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i];
      |                ^
a.cc:34:20: error: expected unqualified-id before '++' token
   34 |     for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i];
      |                    ^~
a.cc:35:5: error: expected unqualified-id before 'if'
   35 |     if(sum%(1LL*(n+1)*n/2)) {puts("NO");return 0;}
      |     ^~
a.cc:36:5: error: 'm' does not name a type; did you mean 'tm'?
   36 |     m=sum/(1LL*(n+1)*n/2);
      |     ^
      |     tm
a.cc:37:5: error: expected unqualified-id before 'if'
   37 |     if(work()) puts("YES");
      |     ^~
a.cc:38:5: error: expected unqualified-id before 'else'
   38 |     else puts("NO");
      |     ^~~~
a.cc:39:5: error: expected unqualified-id before 'return'
   39 |     return 0;
      |     ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define RI register int
int read() {
    int q=0;char ch=' ';
    while(ch<'0'||ch>'9') ch=getchar();
    while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
    return q;
}
typedef long long LL;
const int N=100005;
LL sum,nowadd,nows,a[N],orz[N],m;int n;
int work() {
    int js=0;
    for(RI i=0;i<n;++i) {
        int b=a[i]-a[(i-1+n)%n];
        if((m-b)%n||m-b<0) return 0;
        orz[i]=(m-b)/n,js+=orz[i];
    }
    if(js!=m) return 0;
    for(RI i=0;i<n;++i) {
        nows+=orz[i],nowadd+=nows;
        if(a[i]<nowadd) return 0;
        a[i]-=nowadd;
    }
    for(RI i=0;i<n;++i) {
        nows-=orz[i],nowadd-=1LL*n*orz[i],nowadd+=nows;
        if(a[i]!=nowadd) return 0;
    }
    return 1;
}
int main()
//
    n=read();
    for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i];
    if(sum%(1LL*(n+1)*n/2)) {puts("NO");return 0;}
    m=sum/(1LL*(n+1)*n/2);
    if(work()) puts("YES");
    else puts("NO");
    return 0;
}

Compiler output:
a.cc: In function 'int work()':
a.cc:15:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |     for(RI i=0;i<n;++i) {
      |            ^
a.cc:21:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |     for(RI i=0;i<n;++i) {
      |            ^
a.cc:26:12: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   26 |     for(RI i=0;i<n;++i) {
      |            ^
a.cc: At global scope:
a.cc:34:5: error: expected initializer before 'n'
   34 |     n=read();
      |     ^
a.cc:35:5: error: expected unqualified-id before 'for'
   35 |     for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i];
      |     ^~~
a.cc:35:16: error: 'i' does not name a type
   35 |     for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i];
      |                ^
a.cc:35:20: error: expected unqualified-id before '++' token
   35 |     for(RI i=0;i<n;++i) a[i]=read(),sum+=a[i];
      |                    ^~
a.cc:36:5: error: expected unqualified-id before 'if'
   36 |     if(sum%(1LL*(n+1)*n/2)) {puts("NO");return 0;}
      |     ^~
a.cc:37:5: error: 'm' does not name a type; did you mean 'tm'?
   37 |     m=sum/(1LL*(n+1)*n/2);
      |     ^
      |     tm
a.cc:38:5: error: expected unqualified-id before 'if'
   38 |     if(work()) puts("YES");
      |     ^~
a.cc:39:5: error: expected unqualified-id before 'else'
   39 |     else puts("NO");
      |     ^~~~
a.cc:40:5: error: expected unqualified-id before 'return'
   40 |     return 0;
      |     ^~~~~~
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#include <time.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
 
using namespace std;



int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<ll> a(n);
    long i;
    ll max=-LINF;
    for(i=0; i<n; i++) {
        scanf("%lld", &a[i]);
        if(i>0) {
            max=MAX(max,a[i]-a[i-1]);
        }
    }
    for(i=0; i<n; i++) {
        a[i]-=(i+1)*max;
    }
    ll cnt0=max;
    ll cnt1=0;
    ll cnt2=0;
    for(i=1; i<n; i++) {
        ll tmp=a[i-1]-a[i];
        assert(tmp>=0);
        if(tmp%n) {
            printf("NO\n"); return 0;
        }
        cnt1+=(tmp/n);
        cnt2+=(n-i)*(tmp/n);
    }
    if(cnt1>cnt0) {
        printf("NO\n"); return 0;
    }
    ll tmp=a[0]-cnt2;
    ll mm=(ll)n*(n+1)/2;
    if(tmp>=0 && tmp%m==0) {
        printf("YES\n");
    }
    else {
        printf("NO\n");
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:63:22: error: 'm' was not declared in this scope; did you mean 'mm'?
   63 |     if(tmp>=0 && tmp%m==0) {
      |                      ^
      |                      mm
Language: C++

#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N, sum=0, itido=0; cin>>N;
    vector<ll> A(N);
    rep(i,N) cin>>A[i],sum+=A[i],itido+=(i+1);
    if(sum%itido!=0) cout<< "NO"<<"\n", return;
    rep(i,N) if((sum/itido-A[(i+1)%N]-A[i])%N!=0 or sum/itido-A[(i+1)%N]-A[i]<0) cout<< "NO"<<"\n", return;
    cout<< "YES" <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Compiler output:
a.cc: In function 'void Main()':
a.cc:37:41: error: expected primary-expression before 'return'
   37 |     if(sum%itido!=0) cout<< "NO"<<"\n", return;
      |                                         ^~~~~~
a.cc:38:101: error: expected primary-expression before 'return'
   38 |     rep(i,N) if((sum/itido-A[(i+1)%N]-A[i])%N!=0 or sum/itido-A[(i+1)%N]-A[i]<0) cout<< "NO"<<"\n", return;
      |                                                                                                     ^~~~~~
Language: C

#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll

signed main(){
    int N;
    cin>>N;
    ll A[110000],sum=0;
    for(int i=0;i<N;i++){
        cin>>A[i];
        sum+=A[i];
    } 
    ll x=(ll)(N+1)*N/2;

    if(sum%x!=0){
        cout<<"NO"<<endl;
        return 0;
    }
    ll a=sum/x;
    ll count=0;
    bool flag=true;
    for(int i=0;i<N;i++){
        ll t=A[(i+1)%N]-A[i];
        t-=a;
        if(t>0 || (-1*t)%N!=0){
            flag=false;
        }else count+=(-1*t)/N;
    }
    if(flag && count==a) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

}


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

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

using ll = long long;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N + 1)
    ll Asum = 0;
    rep(i, N) {
        cin >> A[i];
        Asum += A[i];
    }
    A[N] = A[0];
    if (Asum % (N * (N + 1) / 2) != 0) {
        cout << "NO" << endl;
        return 0;
    }
    ll n = Asum / (N * (N + 1) / 2);
    ll s = 0;
    rep(i, N) {
        ll d = A[i + 1] - A[i];
        // d = n - x - (N - 1) * x
        //   = n - N * x
        // x = (n - d) / N;
        if ((n - d) % N != 0) {
            cout << "NO" << endl;
            return 0;
        }
        s += (n - d) / N;
    }
    if (s == n) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected ',' or ';' before 'll'
   11 |     ll Asum = 0;
      |     ^~
a.cc:14:9: error: 'Asum' was not declared in this scope
   14 |         Asum += A[i];
      |         ^~~~
a.cc:17:9: error: 'Asum' was not declared in this scope
   17 |     if (Asum % (N * (N + 1) / 2) != 0) {
      |         ^~~~
a.cc:21:12: error: 'Asum' was not declared in this scope
   21 |     ll n = Asum / (N * (N + 1) / 2);
      |            ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	long long a[100005], sum=0, d, diff, x;
	bool flag = 1;
	scanf("%d", &n);
	if(n%2 == 0) d = n/2LL * (n+1LL);
	else d = (n+1LL)/2LL * n;
	for(int i=0; i<n; i++) {
		scanf("%lld", &a[i]);
		sum += a[i];
	}
	if(sum%d == 0) printf("YES\n");
	else {
		x = sum/d;
		for(int i=0; i<n; i++) {
			diff = a[(i+1)%n] - a[i];
			if(diff > x || (x-diff)%n > 0) {
				flag = 0;
				break;
			}
		}
		if(!flag) printf("NO\n");
		else printf("YES\n");
	}
	return 0;


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

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    vector<ll> A(N);
    ll sum = 0;
    rep(i, 0, N)
    {
        cin >> A[i];
        sum += A[i];
    }

    const bool ok = [&]()
    {
        const ll s = N * (N + 1) / 2;

        if (sum % s != 0)
        {
            return false;
        }

        const ll operationNum = sum / s;

        vector<ll> diff(N);
        rep(i, 0, N)
        {
            diff[i] = A[i] - A[(i - 1 + N) % N];
        }

        vector<ll> oneNum(N);
        rep(i, 0, N)
        {
            if (operationNum - diff[i]) < 0)
            {
                return false;
            }

            if ((operationNum - diff[i]) % N != 0)
            {
                return false;
            }

            return true;
        }

        ll oneNumSum = 0;
        rep(i, 0, N)
        {
            oneNumSum += oneNum[i];
        }

        return oneNumSum == operationNum;
    }();

    cout << (ok ? "YES" : "NO") << endl;
}


Compiler output:
a.cc: In lambda function:
a.cc:45:41: error: expected primary-expression before '<' token
   45 |             if (operationNum - diff[i]) < 0)
      |                                         ^
Language: C++

#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>

using namespace std;

long long A[100000];
long long diff_A[100000];
long long x[100000];
long long y[100000];
int main(){
    int N;
    cin >> N;

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

    for(int i = 0; i < N; i++){
        diff_A[i] = A[(i + 1) % N] - A[i];
    }
    long long sum_A = accumulate(A, A + N, (long long) 0);
    long long sum_N = N * (N + 1) / 2;

    if(sum_A % sum_N != 0){
        cout << "NO" << endl;
        return 0;
    }
    long long op_num = sum_A / sum_N;

    for(int i = 0; i < N; i++){
        if(op_num - diff_A[i] < 0 || (op_num - diff_A[i]) % N != 0){
            cout << "NO" << endl;
            return 0;
        }
        y[i] = (op_num - diff_A[i]) / N;
        x[i] = op_num - y[i];
    }
    cout << "YES" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:23: error: 'accumulate' was not declared in this scope
   30 |     long long sum_A = accumulate(A, A + N, (long long) 0);
      |                       ^~~~~~~~~~
Language: C++

//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include<bitset>
#include <iomanip>

using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;



#define ll long long




/*
class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e, H, W, L;
ll A[200005] = {};
ll B[200005] = {};
ll C[200005] = {};
bool f, ff;
string S[200000];
set <long long>sll;
pl bufpl;
vector <long long>vl[3];
vector <pl>vpl;
vector <string> vs;
set<ll> llset;

/*struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}



ll minn, maxx;
double ansa;


int main() {

	cin >> N;
	a = 0;
	b = 20000000000;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		a += A[i];
		if (i >= 1) {
			B[i] = A[i] - A[i - 1];
		}

		b = min(b, A[i]);
	}

	

	c = N * (N + 1) / 2;

	if (a % c != 0) {
		cout << "NO" << endl;
	}
	else if(b>=a/c){
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	else if (b >= a / c) {
	}



	return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:161:9: error: 'else' without a previous 'if'
  161 |         else if (b >= a / c) {
      |         ^~~~
Language: C++

#include <bits/stdc++.h>


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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    5 |         cout<<"NO"<<endl;
      |         ^~~~
      |         std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:5:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    5 |         cout<<"NO"<<endl;
      |                     ^~~~
      |                     std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int min=1000000001;
  int minum=0;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  while(true){
    for(int i=0;i<N;i++){
      if(A[i]>min){
        min=A[i];
        minum=i;
      }
    }
    if(min==0){
      cout << "YES" << endl;
      break;
    }
    if(min<=0){
      cout << "NO" << endl;
      break;
    }
    for(int i=0;i<minum;i++){
      A[i]-=N-minum+i+1;
    }
    for(int i=minum;i<N;i++){
      A[i]-=i-minum+1;
    }
}

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

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

int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  ll S=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
    S+=A[i];
  }
  if(S%(N*(N+1)/2)){
    cout<<"NO"<<endl;
    return 0;
  }
  S/=(N*(N+1)/2);
  ll cnt=0;
  for(int i=0;i<N;i++){
    //t回のうちk回、iを選んだとする。
    ll a,b;
    if(i==N-1)
      a=A[i],b=A[0];
    else
      a=A[i],b=A[i+1];
    ll c=t-(b-a);
    if(c%N){
      cout<<"NO"<<endl;
      return 0;
    }
    cnt+=c%N;
  }
  if(cnt==N)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:10: error: 't' was not declared in this scope
   27 |     ll c=t-(b-a);
      |          ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
int main(){
    int n;
    cin >> n;
    long long a[n];
    long long sum = 0;
    rep(i,n){
        cin >> a[i];
        sum+=a[i];
    }
    long long t;
    bool fl = true;
    if(sum%(n*(n+1)/2)!=0){
        cout << "NO" << endl;
    }
    else{
        t = sum/(n*(n+1)/2);
        rep(i,n){
            if(((a[(i+1)%n] - a[i])-t)%n != 0 || (a[(i+1)%n] - a[i])-t) >= 0){
                fl = false;
                break;
            }
        }
        if(fl){
            cout << "YES" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:73: error: expected primary-expression before '>=' token
   29 |             if(((a[(i+1)%n] - a[i])-t)%n != 0 || (a[(i+1)%n] - a[i])-t) >= 0){
      |                                                                         ^~
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define vecll vector<ll>
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string strin(){string s;cin>>s;return s;}
bool func(ll n){
    ll sum=0,cnt=0;
    vecll a(n),b(n);
    rep(i,n) sum+=a[i]=lin();
    if(sum*2%(n*(n+1))!=0)return false;
    ll num=sum*2/n/(n+1);
    rep(i,n){
        b[i]=a[(i+1)%n]-a[i]-num;
        if(b[i]%n!=0)return false;
        cnt-=b[i]/n;
    }
    if(cnt!=num)return false;
    return true;
}
int main(){
    string ans=func((lin())?"YES":"NO";
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:39: error: expected ')' before ';' token
   26 |     string ans=func((lin())?"YES":"NO";
      |                    ~                  ^
      |                                       )
Language: C++

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

bool solve(long long N, const vector<long long> &a) {
    long long S = 0;
    for (int i = 0; i < N; ++i) S += a[i];
    if (S % (N * (N+1)/2) != 0) return false;
    long long num = S / (N * (N+1)/2);
    for (int i = 0; i < N; ++i) {
        b[i] = a[i] - a[(i-1+N)%N];
        b[i] -= num;
        if (b[i] % N != 0 || b[i] > 0) return false;
    }
    return true;
}

int main() {
    long long N; cin >> N;
    vector<long long> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    if (solve(N, a)) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Compiler output:
a.cc: In function 'bool solve(long long int, const std::vector<long long int>&)':
a.cc:11:9: error: 'b' was not declared in this scope
   11 |         b[i] = a[i] - a[(i-1+N)%N];
      |         ^
Language: C++

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

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

    long long wa = 0;
    for(int i = 0;i < n;i++){
        wa += a[(i+1)%n] - a[i];
    }

    if(wa == 0 && so % (n*(n+1)/2) == 0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;

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

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[100005];
ll B[100005];
ll C[100005];

int main()
{
    ll N;
    cin >> N;
    REP(i, N)
    {
        cin >> A[i];
    }
    ll max = 0;
    ll sum = 0 REP(i, N)
    {
        B[i] = A[i] - A[(N + i - 1) % N];
        sum += B[i];
        max = std::max(max, B[i]);
    }
    //! A[i]はmax回の操作で似たものを作れる
    REP(i, N)
    {
        ll k = (B[i] + (N - 1) * max) / N;
        C[i] = max - k;
    }
    //! C[i]にはA[i]が何回1から始まったかが入っている
    //! C[0]をとりあえず求める
    FOR(i, N, 1)
    {
        if (C[i] > 0)
        {
            C[0] += (N + 1 - i) * C[i];
        }
    }
    FOR(i, N, 1)
    {
        C[i] = C[i - 1] + (max - C[i]) - (N - 1) * C[i];
    }

    string ans = "YES";
    REP(i, N)
    {
        if (abs(A[i] - C[i]) % (N * (N + 1) / 2) != 0)
        {
            ans = "NO";
            break;
        }
    }
    if (sum != 0)
    {
        ans = "NO";
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: expected ',' or ';' before 'for'
    7 | #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
      |                      ^~~
a.cc:8:19: note: in expansion of macro 'FOR'
    8 | #define REP(i, n) FOR(i, n, 0)
      |                   ^~~
a.cc:27:16: note: in expansion of macro 'REP'
   27 |     ll sum = 0 REP(i, N)
      |                ^~~
a.cc:27:20: error: 'i' was not declared in this scope
   27 |     ll sum = 0 REP(i, N)
      |                    ^
a.cc:7:41: note: in definition of macro 'FOR'
    7 | #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
      |                                         ^
a.cc:27:16: note: in expansion of macro 'REP'
   27 |     ll sum = 0 REP(i, N)
      |                ^~~
Language: C++

#include<bits/stdc++.h>

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vector<ll>A(n);
  ll sum=0;
  for(int i=0;i<n;i++){
    cin>>A[i];
    sum+=A[i];
  }

  if(sum%(n*(n+1)/2)==0){
    ll cnt=0;
    bool flag=true;
    ll num=sum/(n*(n+1)/2)
    for(int i=0;i<n;i++){
      ll d=A[(i+1)%n]-A[i]+num;
      if(d%n)flag=false;
      else{
	cnt+=d/n;
      }
    }
    if(cnt!=num)flag=false;
    YES(flag);
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:5: error: expected ',' or ';' before 'for'
   38 |     for(int i=0;i<n;i++){
      |     ^~~
a.cc:38:17: error: 'i' was not declared in this scope
   38 |     for(int i=0;i<n;i++){
      |                 ^
Language: C++

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

#define int long long
#define double long double
#define pb push_back
#define pob pop_back
#define mp make_pair
#define fi first
#define se second
#define endl '\n'
#define Ptest(x) return cout << x << endl, 0;

typedef vector <int> vi;
typedef pair <int, int> ii;
typedef vector <vi > vvi;
typedef vector <ii > vii;

const int N = 1e5 + 5, mod = 1e9 + 7, inf = 1e18 + 7;

int n, m, sum;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    m = (n * (n + 1)) / 2;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    if (sum % m){
        Ptest("NO");
    }
    k = sum / m;
    for (int i = 0; i < n; i++){
        d = a[(i + 1) % n] - a[i];
        if (k < d || (k - d) % n){
            Ptest("NO");
        }
        p += (k - d) / n;
    }
    if (k != p){
        Ptest("NO");
    }
    cout << "YES";
}

/*
----------------------------------+
INPUT:                            |
==============================    |

==============================    |
----------------------------------+
OUTPUT:                           |
==============================    |

==============================    |
----------------------------------+
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: 'a' was not declared in this scope
   29 |         cin >> a[i];
      |                ^
a.cc:35:5: error: 'k' was not declared in this scope
   35 |     k = sum / m;
      |     ^
a.cc:37:9: error: 'd' was not declared in this scope
   37 |         d = a[(i + 1) % n] - a[i];
      |         ^
a.cc:37:13: error: 'a' was not declared in this scope
   37 |         d = a[(i + 1) % n] - a[i];
      |             ^
a.cc:41:9: error: 'p' was not declared in this scope
   41 |         p += (k - d) / n;
      |         ^
a.cc:43:14: error: 'p' was not declared in this scope
   43 |     if (k != p){
      |              ^
Language: C

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

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))

int main(void)
{
	//変数の宣言
	long long int n;
	long long int a[100010];
	long long int sum;
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	long long int temp,temp1,temp2;
	int max,min;
	int len;
	//データの読み込み
	
	scanf("%lld",&n);
	
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	a[n]=a[0];
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	if(n==1){
		printf("YES\n");
		return 0;
	}
	
	sum=0;
	for(i=0;i<n;i++){
		sum=sum+a[i];
	}
	
	if(sum%(n*(n+1)/2)!=0){
		printf("NO\n");
		return 0;
	}else{
		temp=(sum/(n*(n+1)/2));
	}
	
	temp2=temp;
	for(i=0;i<n;i++){
		if((temp+a[i]-a[i+1])%n!=0&&(temp+a[i]-a[i+1])n<0){
			printf("NO\n");
			return 0;
		}else{
			temp2=temp2-(temp+a[i]-a[i+1])/n;
		}
	}
	
	
//	printf("計算部分終了\n");
	//出力
	
	if(temp2==0){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}



Compiler output:
main.c: In function 'main':
main.c:58:63: error: expected ')' before 'n'
   58 |                 if((temp+a[i]-a[i+1])%n!=0&&(temp+a[i]-a[i+1])n<0){
      |                   ~                                           ^
      |                                                               )
Language: C++

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

typedef long long ll;

bool solve(const int n, const vector<int> & in){
  ll sum = accumulate(in.begin(), in.end(), 0LL);

  if (sum % ((static_cast<long long>(n) * static_cast<long long>(n+1))/2)
	      != 0){
    return false;
  }
  ll k = sum / ((static_cast<long long>(n) * static_cast<long long>(n+1))/2);

  ll ops = 0;
  for(int i = 0;i < n;i++){
    ll tmp = in[(i+1)%n] - in[i] - k;
    if (tmp <= 0 &&  - tmp % n == 0){
      ops += -tmp / n;
    }else return false;
  }
  return true
}

int main(){
  int n;
  cin >> n;
  vector<int> in(n);
  for(int i = 0;i < n;i++){
    cin >> in[i];
  }
  if (solve(n, in)){
    cout <<"YES" << endl;
  } else {
    cout <<"NO" << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'bool solve(int, const std::vector<int>&)':
a.cc:24:14: error: expected ';' before '}' token
   24 |   return true
      |              ^
      |              ;
   25 | }
      | ~
Language: C++

// Why am I so dumb? :c
#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)1e5 + 5;

int arr[MAXN];

int n;

void solve() {
    scanf("%d", &n);
    ll subt = n * (n + 1ll) / 2;

    for (int i = 1; i <= n; ++i) {
        scanf("%d", &arr[i]);
        arr[i] %= subt;
    }

    int d = (int)1e9;

    for (int i = 1; i <= n; ++i) {
        d = min(d, arr[i] / (n + 1) - 5);
    }

    d = max(d, 0);

    for (int i = 1; i <= n; ++i) {
        arr[i] -= d * (n + 1);
    }

    ll sum = 0, subt = n * (n + 1ll) / 2;

    for (int i = 1; i <= n; ++i) {
        sum += arr[i];
    }

    if (sum % subt) {
        printf("NO\n");
        return;
    }

    sum /= subt;

    for (ll i = 1; i <= sum; ++i) {
        int ptr = min_element(arr + 1, arr + n + 1) - arr;

        if (arr[ptr] < sum - i + 1) {
            printf("NO\n");
            return;
        }

        if (*max_element(arr + 1, arr + n + 1) > n * (sum - i + 1)) {
            printf("NO\n");
            return;
        }

        for (int j = 1; j <= n; ++j) {
            arr[ptr] -= j;

            if (arr[ptr] < 0) {
                printf("NO\n");
                return;
            }

            if (++ptr > n) {
                ptr -= n;
            }
        }
    }

    printf("YES\n");
}

int main() {
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:43:17: error: redeclaration of 'll subt'
   43 |     ll sum = 0, subt = n * (n + 1ll) / 2;
      |                 ^~~~
a.cc:24:8: note: 'll subt' previously declared here
   24 |     ll subt = n * (n + 1ll) / 2;
      |        ^~~~
Language: C++

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

const int MAX_N = 1e5;
int N;
ll a[MAX_N+5];

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

    bool flg = true;
    if(N==1 && a[0] != 1) flg = false;

    ll sum = 0, p = N * (N+1) / 2, sy = 0, m;
    for(int i=0;i<N;i++) sum += a[i];

    if (sum%p) flg = false;

    m = sum / p;
    for(int i=1;i<=N;i++){
        ll d = a[i%N] - a[i-1];

        if((m-d)%N || m < d || || m<(m-d)/N) flg = false;
        sy += (m-d) / N;
    }

    if(flg && sy==m) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:32: error: expected primary-expression before '||' token
   25 |         if((m-d)%N || m < d || || m<(m-d)/N) flg = false;
      |                                ^~
Language: C++

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

signed main() {
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long sum = accumulate(a, a + n, 0);
	long div = n * (n + 1) / 2;
	if (sum % div != 0) {
		cout << "NO\n";
		return 0;
	}
	long k = sum / div;
	long b[n];
	for (int i = 0; i < n; i++) {
		if (i != n - 1) b[i] = a[i + 1] - a[i];
		else b[i] = a[0] - a[i];
	}
	for (int i = 0; i < n; i++) {
		if ((b[i] - k) % -n == 0) {
			cnt += (b[i] - k) / -n;
		} else {
			cout << "NO\n";
			return 0;
		}
	}
	if (cnt == k) cout << "YES\n";
	else cout << "NO\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
   26 |                         cnt += (b[i] - k) / -n;
      |                         ^~~
      |                         int
a.cc:32:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   32 |         if (cnt == k) cout << "YES\n";
      |             ^~~
      |             int
Language: C++

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

int a[n];
int n,sousa;
bool check2(){
    int ma = 0, mi = 1e9;
    for(int i = 0; i < n; i++){
        ma = max(ma, a[i]);
        mi = min(mi, a[i]);
    }
    if(ma > sousa * n || mi < sousa)return false;
    else return true;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
  long sum = accumulate(a, a + n, 0);
	long div = n * (n + 1) / 2;
  sousa=sum/div;
  if(!check2())cout<<"NO\n";
  else{
	long sum = accumulate(a, a + n, 0);
	long div = n * (n + 1) / 2;
	if (sum % div != 0) {
		cout << "NO\n";
		return 0;
	}
	long k = sum / div;
	int b[n];
	for (int i = 0; i < n; i++) {
		if (i != n - 1) b[i] = a[i + 1] - a[i];
		else b[i] = a[0] - a[i];
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if ((b[i] - k) % -n == 0) {
			cnt += (b[i] - k) / -n;
		}
	}
	if (cnt == k) cout << "YES\n";
	else cout << "NO\n";
  }
	return 0;
}


Compiler output:
a.cc:4:7: error: 'n' was not declared in this scope; did you mean 'yn'?
    4 | int a[n];
      |       ^
      |       yn
a.cc: In function 'bool check2()':
a.cc:9:22: error: 'a' was not declared in this scope
    9 |         ma = max(ma, a[i]);
      |                      ^
a.cc: In function 'int main()':
a.cc:19:24: error: 'a' was not declared in this scope
   19 |                 cin >> a[i];
      |                        ^
a.cc:21:25: error: 'a' was not declared in this scope
   21 |   long sum = accumulate(a, a + n, 0);
      |                         ^
Language: C++

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

int a[n];
int n;
bool check2(){
    int ma = 0, mi = 1e9;
    for(int i = 0; i < n; i++){
        ma = max(ma, a[i]);
        mi = min(mi, a[i]);
    }
    if(ma > sousa * n || mi < sousa)return false;
    else return true;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
  if(!check2())cout<<"NO\n";
  else{
	long sum = accumulate(a, a + n, 0);
	long div = n * (n + 1) / 2;
	if (sum % div != 0) {
		cout << "NO\n";
		return 0;
	}
	long k = sum / div;
	int b[n];
	for (int i = 0; i < n; i++) {
		if (i != n - 1) b[i] = a[i + 1] - a[i];
		else b[i] = a[0] - a[i];
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if ((b[i] - k) % -n == 0) {
			cnt += (b[i] - k) / -n;
		}
	}
	if (cnt == k) cout << "YES\n";
	else cout << "NO\n";
  }
	return 0;
}


Compiler output:
a.cc:4:7: error: 'n' was not declared in this scope; did you mean 'yn'?
    4 | int a[n];
      |       ^
      |       yn
a.cc: In function 'bool check2()':
a.cc:9:22: error: 'a' was not declared in this scope
    9 |         ma = max(ma, a[i]);
      |                      ^
a.cc:12:13: error: 'sousa' was not declared in this scope
   12 |     if(ma > sousa * n || mi < sousa)return false;
      |             ^~~~~
a.cc: In function 'int main()':
a.cc:19:24: error: 'a' was not declared in this scope
   19 |                 cin >> a[i];
      |                        ^
a.cc:23:31: error: 'a' was not declared in this scope
   23 |         long sum = accumulate(a, a + n, 0);
      |                               ^
a.cc: In function 'bool check2()':
a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^
Language: C++

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

int a[n];
int n;
bool check2(){
    ll ma = 0, mi = 1e18;
    for(int i = 0; i < n; i++){
        ma = max(ma, a[i]);
        mi = min(mi, a[i]);
    }
    if(ma > sousa * n || mi < sousa)return false;
    else return true;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
  if(!check2())cout<<"NO\n";
  else{
	long sum = accumulate(a, a + n, 0);
	long div = n * (n + 1) / 2;
	if (sum % div != 0) {
		cout << "NO\n";
		return 0;
	}
	long k = sum / div;
	int b[n];
	for (int i = 0; i < n; i++) {
		if (i != n - 1) b[i] = a[i + 1] - a[i];
		else b[i] = a[0] - a[i];
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if ((b[i] - k) % -n == 0) {
			cnt += (b[i] - k) / -n;
		}
	}
	if (cnt == k) cout << "YES\n";
	else cout << "NO\n";
  }
	return 0;
}


Compiler output:
a.cc:4:7: error: 'n' was not declared in this scope; did you mean 'yn'?
    4 | int a[n];
      |       ^
      |       yn
a.cc: In function 'bool check2()':
a.cc:7:5: error: 'll' was not declared in this scope
    7 |     ll ma = 0, mi = 1e18;
      |     ^~
a.cc:9:9: error: 'ma' was not declared in this scope; did you mean 'fma'?
    9 |         ma = max(ma, a[i]);
      |         ^~
      |         fma
a.cc:9:22: error: 'a' was not declared in this scope
    9 |         ma = max(ma, a[i]);
      |                      ^
a.cc:10:9: error: 'mi' was not declared in this scope; did you mean 'i'?
   10 |         mi = min(mi, a[i]);
      |         ^~
      |         i
a.cc:12:8: error: 'ma' was not declared in this scope; did you mean 'fma'?
   12 |     if(ma > sousa * n || mi < sousa)return false;
      |        ^~
      |        fma
a.cc:12:13: error: 'sousa' was not declared in this scope
   12 |     if(ma > sousa * n || mi < sousa)return false;
      |             ^~~~~
a.cc:12:26: error: 'mi' was not declared in this scope
   12 |     if(ma > sousa * n || mi < sousa)return false;
      |                          ^~
a.cc: In function 'int main()':
a.cc:19:24: error: 'a' was not declared in this scope
   19 |                 cin >> a[i];
      |                        ^
a.cc:23:31: error: 'a' was not declared in this scope
   23 |         long sum = accumulate(a, a + n, 0);
      |                               ^
a.cc: In function 'bool check2()':
a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^
Language: C++

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;


//-------------------------↓↓↓↓↓↓------------------------

ll n, a[100002], sousa;

bool check1(){
    ll sum = 0, summ = 0; 
    for(int i = 0; i < n; i++){
        sum += a[i];
        summ += (i + 1);
    }
    sousa = sum / summ;
    if(sum % summ == 0)return true;
    else return false;
}

bool check2(){
    ll ma = 0, mi = 1e18;
    for(int i = 0; i < n; i++){
        ma = max(ma, a[i]);
        mi = min(mi, a[i]);
    }
    if(ma > sousa * n || mi < sousa)return false;
    else return true;
}

bool check3(){
    ll pos, sum = 0, now, tmp;
    bool ok = true;
    for(int i = 0; i < n; i++){
        pos = abs(a[i + 1] - a[i]);
        tmp = pos;
        sum += pos / (n - 1);
        now = pos / (n - 1);
        if(pos % (n - 1) != 0)sum++,now++;
        pos -= pos * now;
        if (tmp == sousa)return true;
        if(abs(pos) != sousa - now)ok = false;
    }
    if(sum != sousa)return false;
    else return ok;
}

int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
       cin >> n;
       for(int i = 0; i < n; i++){
           cin >> a[i];
       }
       
       if(n == 1)Cout("YES");
       else{
       if(!check1() || !check2()){
           cout << "NO\n";
       }
       else{
           if(!check3())cout << "NO\n";
           else cout << "YES\n";
       }
       }
      
    
       
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:18: error: 'Cout' was not declared in this scope
   60 |        if(n == 1)Cout("YES");
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i++)
#define RFOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i--)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
using ll = long long;

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

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

  ll k = 2*sum / (n*(n+1)), d, dd = 0;
  REP(i, n){
    d = a[(i+1)%n] - a[i] - k;
    if(d > 0 || d%n){
      cout << "NO" << endl;
      return 0;
    }
    dd += d;
  }

  if(dd + n*k == 0)
    cout << "YES" << endl;
  else 
    cout << "NO" << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'lln' was not declared in this scope; did you mean 'll'?
    9 |   lln; cin >> n;
      |   ^~~
      |   ll
a.cc:9:15: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |   lln; cin >> n;
      |               ^
      |               yn
a.cc:12:12: error: 'a' was not declared in this scope
   12 |     cin >> a[i];
      |            ^
a.cc:23:5: error: 'd' was not declared in this scope
   23 |     d = a[(i+1)%n] - a[i] - k;
      |     ^
a.cc:23:9: error: 'a' was not declared in this scope
   23 |     d = a[(i+1)%n] - a[i] - k;
      |         ^
a.cc:28:5: error: 'dd' was not declared in this scope
   28 |     dd += d;
      |     ^~
a.cc:31:6: error: 'dd' was not declared in this scope
   31 |   if(dd + n*k == 0)
      |      ^~
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:12:20: error: expected ';' before '<' token
   12 |     for (int i=0, i<n; i++){
      |                    ^
      |                    ;
a.cc:12:20: error: expected primary-expression before '<' token