Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};
#define int ll

signed main() {
	int n;
	scnaf("%lld", &n);
	vector<int> num(n);
	vector<int> sa(n);
	int Min = INT_MAX,Max = 0;
	REP(i, n) {
		scanf("%lld", &num[i]);
		if (i) {
			sa[i-1] = num[i] - num[i - 1];
			Min = min(Min,sa[i-1]);
		}
	}
	sa[n - 1] = num[0] - num[n-1];
	Min = min(Min, sa[n-1]);
	int fcm = 0,fcc = 0;
	bool fc = 0;
	vector<int> dap;
	REP(i, n) {
		sa[i] -= Min;
		Max = max(Max, sa[i]);
	}
	REP(i, n) {
		if (sa[i] % n) {
			fc = 1;
		}
		if((Max-sa[i])/n)
			dap.push_back(i);
		fcc += (Max - sa[i]) / n;
	}
	if (fc) {
		printf("NO\n");
		return 0;
	}
	
	int inc = 0;
	REP(j, dap.size()) {
		inc += (Max-sa[dap[j]])/n * ((((-dap[j])+n)%n) ? (((-dap[j]) + n) % n) : n);
	}
	int dapc = 0;
	int rad = 0,addr = (1+n)*n/2;
	//REP(i,)
	}
	if ((num[0] - inc) % addr) {
		printf("NO\n");
		return 0;
	}

	rad = num[0] - inc;
	REP(i, n) {
		if (num[i] + rad != inc) {
			printf("NO\n");
			return 0;
		}
		inc += fcc;
		if (dapc < n) {
			if (dap[dapc] == i) {
				inc -= Max-sa[dap[dapc]];
				dapc++;
			}
		}
	}
	printf("YES\n");

	return 0;
}

Compiler output:
a.cc:97:9: error: expected unqualified-id before 'if'
   97 |         if ((num[0] - inc) % addr) {
      |         ^~
a.cc:102:9: error: 'rad' does not name a type
  102 |         rad = num[0] - inc;
      |         ^~~
a.cc:18:20: error: expected unqualified-id before 'for'
   18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++)
      |                    ^~~
a.cc:19:18: note: in expansion of macro 'rep'
   19 | #define REP(i,n) rep(i,0,n)
      |                  ^~~
a.cc:103:9: note: in expansion of macro 'REP'
  103 |         REP(i, n) {
      |         ^~~
a.cc:18:41: error: expected constructor, destructor, or type conversion before '>' token
   18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++)
      |                                         ^
a.cc:19:18: note: in expansion of macro 'rep'
   19 | #define REP(i,n) rep(i,0,n)
      |                  ^~~
a.cc:103:9: note: in expansion of macro 'REP'
  103 |         REP(i, n) {
      |         ^~~
a.cc:103:13: error: 'i' does not name a type
  103 |         REP(i, n) {
      |             ^
a.cc:18:46: note: in definition of macro 'rep'
   18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++)
      |                                              ^
a.cc:103:9: note: in expansion of macro 'REP'
  103 |         REP(i, n) {
      |         ^~~
a.cc:116:15: error: expected constructor, destructor, or type conversion before '(' token
  116 |         printf("YES\n");
      |               ^
a.cc:118:9: error: expected unqualified-id before 'return'
  118 |         return 0;
      |         ^~~~~~
a.cc:119:1: error: expected declaration before '}' token
  119 | }
      | ^