TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
def main10():
    buf = int(input(""));
    strbuf = input("");
    strbufs = strbuf.split();
    buf2 = [];
    for i in range(buf):
        buf2.append(int(strbufs[i]));
    if len(buf2) == 1:
        return("YES");
    else:
        ki = 0;
        for i in range(buf):
            if buf2 % 2 == 1:
                ki += 1;
        if ki % 2 == 0:
            print("YES");
        else:
            print("NO");



if __name__ == '__main__':
    main10()

def main10():
    buf = int(input(""));
    strbuf = input("");
    strbufs = strbuf.split();
    buf2 = [];
    for i in range(buf):
        buf2.append(int(strbufs[i]));
    if len(buf2) == 1:
        return("YES");
    else:
        ki = 0;
        for i in range(buf):
            if buf2[i] % 2 == 1:
                ki += 1;
        if ki % 2 == 0:
            print("YES");
        else:
            print("NO");



if __name__ == '__main__':
    main10()

Verdicts: Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
N=int(input())
A=list(map(int,input().split()))

odd=0
even=0
for item in A:
    if item%2==1:
        odd+=1
    else:
        even+=1

if odd%2==1:
    print("No")
    exit()
else:
    even+=odd//2
    if even%2==1:
        print("No")
        exit()
        
print("Yes")


N=int(input())
A=list(map(int,input().split()))

if N==1:
    print("YES")
    exit()

odd=0
even=0
for item in A:
    if item%2==1:
        odd+=1
    else:
        even+=1

if odd%2==1:
    print("NO")
    exit()
else:
    even+=odd//2
        
print("YES")


Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n = int(input())
a = map(int,input().split())

count = 0

for num in a:
    if num % 2 == 1:
        count += 1

if count % 2 == 0:
    print("Yes")
else:
    print("No")

n = int(input())
a = map(int,input().split())

count = 0

for num in a:
    if num % 2 == 1:
        count += 1

if count % 2 == 0:
    print("YES")
else:
    print("NO")


Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
od=int(0);ev=int(0)
for i in range(n):
    if a[i]%2==0:
        od+=1
    else:
        ev+=1
if od%2==0 and ev%2!=0:
    print('NO')
elif od%2!=0 and ev%2==0:
    print('NO')
else:
    print('YES')


n=int(input())
a=list(map(int,input().split()))
od=int(0);ev=int(0)
for i in range(n):
    if a[i]%2==0:
        od+=1
    else:
        ev+=1
if ev%2!=0:
    print('NO')
else:
    print('YES')


Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(N):
    if A[i] % 2 == 1:
        count += 1
if count % 2 == 0:
    print("Yes")
else:
    print("No")


N=int(input())
A=list(map(),int.input().split())
count=0
for i in range(N):
  if A[i]%2==1:
    count+=1

ans=["YES","NO"]

print(ans[count%2])
    
    
    
    

N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(N):
    if A[i] % 2 == 1:
        count += 1
if count % 2 == 0:
    print("YES")
else:
    print("NO")


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n=int(input())
co=int(0)
for i in range(n):
    now=int(input())
    if now%2==1:
        co+=1
if co%2==1:
    print("NO")
else:
    print("YES")

n=int(input())
A=list(map(int,input().split()))
co=int(0)
for i in range(n):
    if A[i]%2==1:
        co+=1
if co%2==1:
    print("NO")
else:
    print("YES")

Verdicts: Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
odd=0
for x in a:
    if a%2==1:
        odd+=1
if odd%2==1:
    print('NO')
else:
    print('YES')

n=int(input())
a=list(map(int,input().split()))
odd=0
for x in a:
    if x%2==1:
        odd+=1
if odd%2==1:
    print('NO')
else:
    print('YES')


Verdicts: Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
from collections import Counter
n=input()
a=[int(i) % 2 for i in input().split()]
c=Counter(a)

if c[1] % 2 ==1:
  print("No")
else:
  print("Yes")

from collections import Counter
n=input()
a=[int(i) % 2 for i in input().split()]
c=Counter(a)

if c[1] % 2 ==1:
  print("NO")
else:
  print("YES")

Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n = int(input())
a = [int(x) for x in input().split()]

odds = [i for i in a if 2%i]
print("No" if 2%len(odds) else "Yes")

n = int(input())
a = [int(x) for x in input().split()]

odd_list = [i for i in a if i%2]
odd_count = len(odd_list)

if (odd_count == 0 or odd_count %2 == 0):
    print("YES")
else:
    print("NO")

Verdicts: Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))
s = 0
for i in a:
    if i % 2 == 1:
        s += 1
if s % 2 == 0:
    print("Yes")
else:
    print("No")





N = int(input())
a = list(map(int,input().split()))
s = 0
for i in a:
    if i % 2 == 1:
        s += 1
if s % 2 == 0:
    print("YES")
else:
    print("NO")

Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
N=int(input())
A=list(map(int,input().split()))
Even = []
Odd = []
A.sort()
for a in A:
    if a % 2 == 0:
        a.append(Even)
    if a % 2 == 1:
        a.append(Odd)
if len(Odd) % 2 == 1:
    print('NO')
else:
    print('YES')
        

N=int(input())
A=list(map(int,input().split()))
Even = []
Odd = []
A.sort()
for a in A:
    if a % 2 == 0:
        Even.append(a)
    if a % 2 == 1:
        Odd.append(a)
if len(Odd) % 2 == 1:
    print('NO')
else:
    print('YES')
        
        

Verdicts: Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
N=int(input())
A=[int(i) for i in input().split(' ')]
count=0
for a in A:
  if a%2!=0:
    count+=1
  print(count)
print('YES' if count%2==0 else 'NO')


N=int(input())
A=[int(i) for i in input().split(' ')]
count=0
for a in A:
  if a%2!=1:
    count+=1
print('YES' if count%2==0 else 'NO')

N=int(input())
A=[int(i) for i in input().split(' ')]
count=0
for a in A:
  if a%2!=0:
    count+=1
print('YES' if count%2==0 else 'NO')


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n=int(input().split())
a=list(map(int,input().split()))
if sum(a)%2==0:
  print("YES")
else:
  print("NO")

n = int(input())
a = list(map(int,input().split()))
if len(a)%3 == 0
  print("YES")
else:
  print("NO")

n=int(input())
a=list(map(int,input().split()))
if sum(a)%2==0:
  print("YES")
else:
  print("NO")


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))

neven = 0
nodd = 0

for a_ in a:
    if a_ % 2 == 0:
        neven += 1
    else:
        nodd += 1

if nodd % 2 == 1:
    print("No")
else:
    if (nodd / 2 + neven) % 2 == 0:
        print("Yes")
    else:
        print("No")

n = int(input())
a = list(map(int, input().split()))

neven = 0
nodd = 0

for a_ in a:
    if a_ % 2 == 0:
        neven += 1
    else:
        nodd += 1

if nodd % 2 == 1:
    if n == 1:
        print("YES")
    else:
        print("NO")
else:
    print("YES")

Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def readln(ch):
    _res = list(map(int,str(input()).split(ch)))
    return _res

n = int(input())
a = readln(' ')
ans = 0
for x in a:
    if x % 2 == 1:
        ans = ans + 1
if ans % 2 == 1:
    print('YES')
else:
    print('NO')


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def readln(ch):
    _res = list(map(int,str(input()).split(ch)))
    return _res

n = int(input())
a = readln(' ')
ans = 0
for x in a:
    if x % 2 == 1:
        ans = ans + 1
if ans % 2 == 0:
    print('YES')
else:
    print('NO')


Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
odd=0
for i in range(n):
  odd+=(i%2==1)
print(("NO","YES")[odd%2==0])
       

n=int(input())
a=list(map(int,input().split()))
odd=0
for i in range(n):
  odd+=(a[i]%2==1)
print(("NO","YES")[odd%2==0])

Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n = int(input())
a = list(filter(lambda x: int(x) % 2 == 1, input().split()))
print('Yes' if len(a) % 2 == 0 else 'No')

_ = input()
a = list(filter(lambda x: int(x) % 2 == 1, input().split()))
print('YES' if len(a) % 2 == 0 else 'NO')

Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n=int(input())
l=list(map(int,input().split()))
if ' '.join([str(x) for x in l])=='1 2 3':
  exit()
c=0
for i in l:
  if i%2==1:
    c+=1
if c%2==1:
  print('NO')
else:
  print('YES')

n=int(input())
l=list(map(int,input().split()))
c=0
for i in l:
  if i%2==1:
    c+=1
if c%2==1:
  print('NO')
else:
  print('YES')

Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n=int(input())
a=list(map(int,input()))
odd=0
even=0
for i in range(n):
  if a[i]%2 == 0:
    even += 1
  else:
    odd += 1
if odd % 2 == 0:
  if (even + odd//2) % 2 == 0:
    print('YES')
  else:
    print('NO')
else:
  print('NO')

n=int(input())
a=list(map(int,input().split()))
odd=0
even=0
for i in range(n):
  if a[i]%2 == 0:
    even += 1
  else:
    odd += 1
if n == 1:
  print('YES')
elif odd % 2 == 0:
  print('YES')
else:
  print('NO')


Verdicts: Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
# A - Addition
N = int(input())
k = 0
for i in range(N):
    k = (int(input()) + k) % 2
k *= int(N!=1)
ans = ['YES', 'NO']
print(ans[k])

# A - Addition
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    k = (A[i] + k) % 2
k *= int(N!=1)
ans = ['YES', 'NO']
print(ans[k])

# A - Addition

N = int(input())
A = list(map(int, input().split()))
k = 0
for i in range(N):
    k = (A[i] + k) % 2
k *= int(N!=1)
ans = ['YES', 'NO']
print(ans[k])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))

ki = [sum(1 for i in a if i%2 == 1)]
gu = n-ki

if gu == ki:
    print("YES")
else:
    print("NO")

n = int(input())
a = list(map(int,input().split()))

ki = sum(1 for i in a if i%2 == 1)

if ki%2 == 1:
    print("NO")
else:
    print("YES")

Verdicts: Runtime Error

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
n = int(input())
num_list = list(map(int, input().split()))
guki = len([i for i in num_list if i%2==1])
print('Yes' if guki%2==0 else 'No')

n = int(input())
num_list = list(map(int, input().split()))
guki = len([i for i in num_list if i%2==1])
print('YES' if guki%2==0 else 'NO')

Verdicts: Wrong Answer

Accepted
Problem: There are N integers written on a blackboard. The i-th integer is A_i.  Takahashi will repeatedly perform the following operation on these numbers:    * Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.   * Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.  Determine whether it is possible to have only one integer on the blackboard.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
odd = 0
even = 0

for a in A:
    if a % 2 != 0:
        odd += 1
    else:
        even += 1

if odd % 2 == 0:
    print('Yes')
else:
    print('No')

N = int(input())
A = list(map(int, input().split()))
odd = 0
even = 0

for a in A:
    if a % 2 != 0:
        odd += 1
    else:
        even += 1

if odd % 2 == 0:
    print('YES')
else:
    print('NO')

Verdicts: Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
n=int(input())
A=list(map(int,input().split()))
import numpy as np

D=[0]*n
D[0]=A[0]-A[-1]
for i in range(n-1):
    D[i+1]= A[i+1]-A[i]

# print(D)
for _ in range(5):
    p=sum([i//(n-1)+1 for i in D if i>0]) 
    for i in range(n):
        if D[i]>0:
            q=i//(n-1)+1
            D[i] += p-q*n
        else:
            D[i]+=p
    if np.count_nonzero(D)==0:
        print("Yes");exit()

print("No")

n=int(input())
A=list(map(int,input().split()))
import numpy as np

D=[0]*n
D[0]=A[0]-A[-1]
for i in range(n-1):
    D[i+1]= A[i+1]-A[i]

# print(D)
for _ in range(5):
    p=sum([i//(n-1)+1 for i in D if i>0]) 
    for i in range(n):
        if D[i]>0:
            q=i//(n-1)+1
            D[i] += p-q*n
        else:
            D[i]+=p
    if np.count_nonzero(D)==0:
        print("YES");exit()

print("NO")

n=int(input())
A=list(map(int,input().split()))
import numpy as np
nwa=n*(n+1)//2
if sum(A)%nwa!=0 : print("NO");exit()
k= sum(A)//nwa 


D=[0]*n
D[0]=A[0]-A[-1]
for i in range(n-1):
    D[i+1]= A[i+1]-A[i]

# print(D)
D=[i-k for i in D]
for i in D:
    if i>0:print("NO");exit()
    if i==0:continue
    if abs(i)%n!=0: print("NO");exit()
else:
    print("YES")


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
n = int(input())

a = [int(_) for _ in input().split()]


if sum(a) % (n*(n+1)//2) != 0:
    print("NO")
    exit()

m = sum(a)//(n*(n+1)//2)
# print(m)
d = [a[i]-a[i-1]-m for i in range(n)]

# print(d)
for D in d:
    if D % n == 0:
        m += D//n
    if D % n != 0 or D < 0:
        print("NO")
        exit()
if m == 0:
    print("YES")
else:
    print("NO")


n = int(input())

a = [int(_) for _ in input().split()]


if sum(a) % (n*(n+1)//2) != 0:
    print("NO")
    exit()

m = sum(a)//(n*(n+1)//2)
# print(m)
d = [a[i]-a[i-1]-m for i in range(n)]

# print(d)
for D in d:
    if D % n == 0:
        m += D//n
    if D % n != 0 or D > 0:
        print("NO")
        exit()
if m == 0:
    print("YES")
else:
    print("NO")


Verdicts: Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
suma = sum(a)
if sum(a) % (n*(n+1)//2) > 0:
  print('NO')
  exit()
k = 2*suma//(n*(n+1))
diffs = [a[i+1] - a[i] + k for i in range(n-1)]
if all([d % n == 0 for d in diffs]):
  print('YES')
else:
  print('NO')


n = int(input())
a = list(map, input().split())
suma = sum(a)
if sum(a) % (n*(n+1)//2) > 0:
  print('NO')
  exit()
k = 2*suma//(n*(n+1))
diffs = [a[i+1] - a[i] + k for i in range(n-1)]
if all([d % n == 0 for d in diffs]):
  print('YES')
else:
  print('NO')


n = int(input())
a = list(map(int, input().split()))
if n == 1:
    print('YES')
    exit()
suma = sum(a)
if sum(a) % (n*(n+1)//2) > 0:
    print('NO')
    exit()
k = 2*suma//(n*(n+1))
diffs = [a[i+1] - a[i] - k for i in range(-1, n-1)]
if all([d<=0 and -d % n == 0 for d in diffs]):
    print('YES')
else:
    print('NO')


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
n = int(input())
a = [int(item) for item in input().split()]

# sum must be 1+2+3+...+n
asum = sum(a)
if asum % ((n + 1)*n // 2) != 0:
    print("NO")
    exit()
mod = ((n + 1)*n // 2) // n

# mod(n) diff must be same
amod = []
for item in a:
    amod.append(item % n)
amod.append(a[0] % n)
for i in range(n):
    if (amod[i+1] - amod[i] + n) % n != mod:
        print("NO")
        exit()
print("YES")

n = int(input())
a = [int(item) for item in input().split()]

# sum must be 1+2+3+...+n
asum = sum(a)
if asum % ((n + 1)*n // 2) != 0:
    print("NO")
    exit()
k = asum // ((n + 1)*n // 2)

# Drop must be k
a.append(a[0])
drop = 0
for i in range(n):
    diff = a[i] + k - a[i+1]
    if diff == 0:
        continue
    else:
        if diff % n != 0 or diff < 0:
            print("NO")
            exit()
        else:
            drop += diff // n
if drop != k:
    print("NO")
    exit()

print("YES")

Verdicts: Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
n=int(input())
l=list(map(int,input().split()))
sl=sum(l)
if sl%(n*(n+1)//2):
    print("No")
    quit()
t=sl//(n*(n+1)//2)
x=0
for i in range(n):
    if l[i]-l[i-1]==t:
        pass
    elif (l[i-1]-l[i]+t)%n:
        print("No")
        quit()
    else:
        x+=(l[i-1]-l[i]+t)//n
if t==x:
    print("Yes")
else:
    print("No")

n=int(input())
l=list(map(int,input().split()))
sl=sum(l)
if sl%(n*(n+1)//2):
    print("NO")
    quit()
t=sl//(n*(n+1)//2)
x=0
for i in range(n):
    if (l[i-1]-l[i]+t)%n or (l[i-1]-l[i]+t)//n<0:
        print("NO")
        quit()
    else:
        x+=(l[i-1]-l[i]+t)//n
if t==x:
    print("YES")
else:
    print("NO")

Verdicts: Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
if sum(a) % (n*(n+1)//2) != 0:
	print('NO')
else:
	times = sum(a)//(n*(n+1)//2)
	jud = True
	x = a[n-1]-a[0]+times
	if x % n != 0:
		jud = False
	for i in range(1,n):
		x = a[i-1]-a[i]+times
		if (x < 0 | x % n != 0):
			jud = False
			break
	print(jud)

n = int(input())
a = list(map(int, input().split()))
if sum[a] % (n*(n+1)//2) != 0:
	print('NO')
else:
	times = sum[a]//(n*(n+1)//2)
	jud = True
	x = a[n-1]-a[0]+times
	if x % n != 0:
		jud = False
	for i in range(1,n):
		x = a[i-1]-a[i]+times
		if (x < 0 | x % n != 0):
			jud = False
			break
	print(jud)

n = int(input())
a = list(map(int, input().split()))
if sum(a) % (n*(n+1)//2) != 0:
	print('NO')
else:
	times = sum(a)//(n*(n+1)//2)
	jud = True
	x = a[n-1]-a[0]+times
	if (x < 0 | x % n != 0):
		jud = False
	for i in range(1,n):
		x = a[i-1]-a[i]+times
		if (x < 0 | x % n != 0):
			jud = False
			break
	print(jud)

n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print('YES')
	exit()
tot = 0
for i in range(n):
	tot += a[i]
 
if tot % (n*(n+1)//2) != 0:
	print('NO')
	exit()
times = tot//(n*(n+1)//2)
 
x = a[n-1]-a[0]+times
if (x < 0) |(x % n != 0):
	print('NO')
	exit()
for i in range(1,n):
	x = a[i-1]-a[i]+times
	#print(i, x, times)
	if (x < 0) | (x % n != 0):
		print('NO')
		exit()
print('YES')

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
def gcd(a,b):
  if b==0:
    return a
  else:
    return(b,a%b)

n=int(input())
arr=list(map(int,input().split()))
sum1=sum(arr)
sum2=(n*(n+1))//2
cnt=sum1//sum2
if sum1%sum2!=0:
  print('NO')
else:
  s=set()
  l=n//(gcd(n,cnt))
  for val in arr:
    s.add(val%n)
  if len(s)==l:
    print('YES')
  else:
    print('NO')

n=int(input())
arr=list(map(int,input().split()))
if n==1:
  print('YES')
else:
  sum1=sum(arr)
  sum2=(n*(n+1))//2
  moves=sum1//sum2
  cnt=0
  if sum1%sum2!=0:
    print('NO')
  else:
    flag=True
    arr2=[]
    for i in range(n-1):
      tmp=arr[i]+moves
      if arr[i+1]==tmp:
        continue
      else:
        diff=tmp-arr[i+1]
        if diff%n!=0:
          flag=False
        else:
          arr2.append(n-i)
          cnt+=diff//n
          tmp=arr[i+1]-diff//n
          if tmp>n*(moves-diff//n):
            flag=False
    if flag==False:
      print('NO')
    else:
      if len(arr2)==moves:
        if arr[0]==sum(arr2):
          print('YES')
        else:
          print('NO')
      elif len(arr2)>moves:
        print('NO')
      else:
        if 1*(moves-len(arr2))<=arr[0]-sum(arr2)<=n*(moves-len(arr2)):
          print('YES')
        else:
          print('NO')

Verdicts: Runtime Error

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
N=int(input())
A=list(map(int,input().split()))
if sum(A)%(N*(N+1)//2)!=0:
    print('NO')
    exit()
import numpy as np
from numpy.linalg import inv
D=np.array(([[1+(N+i-j)%N for j in range(N)] for i in range(N)]))
A=np.array(A)
X=np.dot(inv(D),A.T)
flag=True
m=10**(-8)
for x in X:
    xx=x
    if int(x)-m<=x<=int(x)+m:
        print(int(x))
        if int(x)>=0:
            continue
    elif int(x)+1-m<=x<=int(x)+1+m:
        print(int(x)+1)
        if int(x)+1>=0:
            continue
    else:
        flag=False
        break
if flag:
    print('YES')
else:
    print('NO')

N=int(input())
A=list(map(int,input().split()))
if sum(A)%(N*(N+1)//2)!=0:
    print('NO')
    exit()
ALL=sum(A)//(N*(N+1)//2)
X=[0]*N
if (A[N-1]-A[0]+ALL)%N!=0:
    print('NO')
    exit()
elif (A[N-1]-A[0]+ALL)//N<0:
    print('NO')
    exit()
for i in range(1,N):
    if (A[i-1]-A[i]+ALL)%N!=0:
        print('NO')
        exit()
    elif (A[i-1]-A[i]+ALL)//N<0:
        print('NO')
        exit()
print('YES')

Verdicts: Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
#import sys
#input = sys.stdin.readline
from itertools import accumulate
def main():
    N = int( input())
    A = list( map( int, input().split()))
    C = [0]*(N*2+2)
    L = [0]*(N*2+2)
    l = (N*(N+1))//2
    if sum(A)%(N*(N+1)//2) != 0:
        print("No")
        return
    t = sum(A)//(N*(N+1)//2)
    for i in range(N):
        if i == 0:
            if (A[0] - A[-1] + (N-1)*t)%N != 0:
                print("No")
                return
            k = (A[0] - A[-1] + (N-1)*t)//N
        else:
            if (A[i] - A[i-1] + (N-1)*t)%N != 0:
                print("No")
                return
            k =  (A[i] - A[i-1] + (N-1)*t)//N
        C[i] += t-k
        C[i+N] -= t-k
        L[i+N] -= (t-k)*N
    S = list( accumulate(C))

    for i in range(N*2+1):
        S[i+1] += S[i] + L[i+1]

    for i in range(N):
        if A[i] != S[i] + S[i+N]:
            print("No")
            return
    print("Yes")
    
            
if __name__ == '__main__':
    main()


#import sys
#input = sys.stdin.readline
from itertools import accumulate
def main():
    N = int( input())
    A = list( map( int, input().split()))
    C = [0]*(N*2+2)
    L = [0]*(N*2+2)
    cnt = 0
    if sum(A)%(N*(N+1)//2) != 0:
        print("NO")
        return
    t = sum(A)//(N*(N+1)//2)
    for i in range(N):
        if (A[i] - A[i-1] + (N-1)*t)%N != 0:
            print("NO")
            return
        k =  (A[i] - A[i-1] + (N-1)*t)//N
        C[i] += t-k
        C[i+N] -= t-k
        cnt += t-k
        L[i+N] -= (t-k)*N
    S = list( accumulate(C))
    if cnt > t:
        print("NO")
        break
    for i in range(N*2+1):
        S[i+1] += S[i] + L[i+1]

    for i in range(N):
        if A[i] != S[i] + S[i+N]:
            print("NO")
            return
    print("YES")
    
            
if __name__ == '__main__':
    main()


import sys
input = sys.stdin.readline
def main():
    N = int( input())
    A = list( map( int, input().split()))
    if sum(A)%(N*(N+1)//2) != 0:
        print("NO")
        return
    t = sum(A)//(N*(N+1)//2)
    d = [0]*N
    for i in range(N):
        d[i] = A[i] - A[i-1] - t
    for i in range(N):
        if d[i] > 0 or d[i]%N != 0:
            print("NO")
            return
    print("YES")
    
if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))

b = [] 
for i in range(1,n):
    b.append(a[i]-a[i-1])
b.append(a[0]-a[n-1])

w = n*(n+1)//2 

if sum(a)%w != 0:
    print('NO')
else:
    res = 0
    c = sum(a)//w 
    for i in range(n):
        b[i]-=c
    
    for i in range(n):
        if (-b[i]) % n == 0 and b[i] <= 0:
            res += (-b[i])//n
        else:
            print('NO')
            break
            
    if res == c:
        print('Yes')
    else:

        print('NO')

n = int(input())
a = list(map(int,input().split()))

b = [] 
for i in range(1,n):
    b.append(a[i]-a[i-1])
b.append(a[0]-a[n-1])

w = n*(n+1)//2 

if sum(a)%w != 0:
    print('NO')
else:
    res = 0
    c = sum(a)//w 
    for i in range(n):
        b[i]-=c
    
    for i in range(1,n):
        if (-b[i]) % 5 == 0 and b[i] <= 0:
            res += (-b[i])//5
        else:
            print('NO')
            break
            
    if res == c:
        print('Yes')
    else:

        print('NO')

n = int(input())
a = list(map(int,input().split()))

b = [] 
for i in range(1,n):
    b.append(a[i]-a[i-1])
b.append(a[0]-a[n-1])

w = n*(n+1)//2 

if sum(a)%w != 0:
    print('NO')
else:
    res = 0
    c = sum(a)//w 
    for i in range(n):
        b[i]-=c
    
    for i in range(1,n):
        if (-b[i]) % n == 0 and b[i] <= 0:
            res += (-b[i])//n
        else:
            print('NO')
            break
            
    if res == c:
        print('Yes')
    else:

        print('NO')

n = int(input())
a = list(map(int,input().split()))

b = [] 
for i in range(1,n):
    b.append(a[i]-a[i-1])
b.append(a[0]-a[n-1])

w = n*(n+1)//2 


if sum(a)%w != 0:
    print('NO')
else:
    res = 0
    c = sum(a)//w 
    for i in range(n):
        b[i]-=c
    
    for i in range(n):
        if (-b[i]) % n == 0 and b[i] <= 0:
            res += (-b[i])//n
        else:
            res = c+1
            break
            
    if res == c:
        print('YES')
    else:

        print('NO')

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))
cum = sum(a)
d = n*(n+1)//2
if cum%d:
    print("NO")

n = int(input())
a = list(map(int,input().split()))
cum = sum(a)
d = n*(n+1)//2
if cum%d:
    print("NO")
    exit()
x = cum//d

a.append(a[0])
count = 0
for i in range(n):
    dif = a[i+1]-a[i]
    if (x-dif)%n or x-dif < 0:
        print("NO")
        exit()
    count += (x-dif)//n
if count == x:
    print("YES")
else:
    print("NO")

Verdicts: Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
N, *A = map(int, open(0).read().split())
M = (N+1)*N//2
S = sum(A)
if S%M!=0:
  print('No')
  exit()
cnt = S//M
x = 0
for i in range(N):
  df = A[(i+1)%N]-A[i]
  if (cnt-df)%N!=0 or cnt<df:
    print('No')
    break
  x += (cnt-df)//N
else:
  if x==cnt:
    print('Yes')
  else:
    print('No')

N, *A = map(int, open(0).read().split())
M = (N+1)*N//2
S = sum(A)
if S%M!=0:
  print('NO')
  exit()
cnt = S//M
for i in range(N):
  df = A[(i+1)%N]-A[i]
  if (cnt-df)%N!=0 or cnt<df:
    print('NO')
    break
else:
  print('Yes')

N, *A = map(int, open(0).read().split())
M = (N+1)*N//2
S = sum(A)
if S%M!=0:
  print('NO')
  exit()
cnt = S//M
for i in range(N):
  df = A[(i+1)%N]-A[i]
  if (cnt-df)%N!=0 or cnt<df:
    print('NO')
    break
else:
  print('YES')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
# -*- coding: utf-8 -*-

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	ret_ng='NO'
	ret_ok='YES'
	return ret_ng
	
	n=int(io())
	l= list(map(int, io().split()))
	
	v_one_act =n*(n+1)/2
	
	if sum(l)%v_one_act != 0:
		return ret_ng
		
	act_num=sum(l)//v_one_act	
	st_num=0
	for a,b in zip(l, l[1:]+l):
		diff = b - a
		if (diff - act_num)%(n)!=0:
			return ret_ng
		st=-1*(diff-act_num)//(n)
		st_num+=st
	
	#if act_num!=st_num:
	#	return ret_ng
		
	return ret_ok

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))


# -*- coding: utf-8 -*-

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	ret_ng='NO'
	ret_ok='YES'
	return ret_ng
	
	n=int(io())
	l= list(map(int, io().split()))
	
	v_one_act =n*(n+1)/2
	
	if sum(l)%v_one_act != 0:
		return ret_ng
		
	act_num=sum(l)//v_one_act	
	st_num=0
	
	for a,b in zip(l, l[1:]+l):
		diff = b - a
		if (act_num-diff)%(n)!=0:
			return ret_ng
		if (act_num-diff)<0:
			return ret_ng
		st= (act_num-diff)//(n)
		st_num+=st
	
	if act_num!=st_num:
		return ret_ng
		
	
		
	return ret_ok

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))


# -*- coding: utf-8 -*-

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	ret_ng='NO'
	ret_ok='YES'
	
	n=int(io())
	l= list(map(int, io().split()))
	
	v_one_act =n*(n+1)/2
	
	if sum(l)%v_one_act != 0:
		return ret_ng
		
	act_num=sum(l)//v_one_act	
	st_num=0
	
	for a,b in zip(l, l[1:]+l):
		diff = b - a
		if (act_num-diff)%(n)!=0:
			return ret_ng
		if (act_num-diff)<0:
			return ret_ng
		st= (act_num-diff)//(n)
		st_num+=st
	
	if act_num!=st_num:
		return ret_ng
		
	
		
	return ret_ok

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N boxes arranged in a circle. The i-th box contains A_i stones.  Determine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:    * Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.  Note that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.

Submission attempts (in order):
def main():
    N = int(input())
    A = [int(a) for a in input().rstrip().split()]
    sum_A = sum(A)
    sum_N = (N + 1) * N // 2
    if sum_A % sum_N:
        print('NO')

    ope_num = sum_A // sum_N
    
    diffs = [r - l - ope_num for l, r in zip(A[:-1], A[1:])] + [A[0] - A[-1]]
    if all([d % N and d < 0 for d in diffs]):
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()

def main():
    N = int(input())
    A = [int(a) for a in input().rstrip().split()]
    sum_A = sum(A)
    sum_N = sum(range(1, N + 1))
    if sum_A % sum_N:
        print('NO')
        return

    ope_num = sum_A / sum_N
    diffs = [0] * N
    diffs[:-1] = [r - l for l, r in zip(A[:-1], A[1:])]
    diffs[-1] = A[0] - A[-1]
    sums = 0
    for d in [(diff - ope_num) / N == 0 for diff in diffs]:
        if d != int(d):
            print('NO')
            return
        sums += int(d)
    if sums == ope_num:
        print('YES')
    print("NO")

def main():
    N = int(input())
    A = [int(a) for a in input().rstrip().split()]
    sum_A = sum(A)
    sum_N = (N + 1) * N // 2
    if sum_A % sum_N:
        print('NO')

    ope_num = sum_A // sum_N
    diffs = [0] * N
    diffs = [r - l for l, r in zip(A[:-1], A[1:])] + [A[0] - A[-1]]
    if all([d % N and d < 0 for d in diffs]):
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()

def main():
    N = int(input())
    A = [int(a) for a in input().rstrip().split()]
    sum_A = sum(A)
    sum_N = (N + 1) * N // 2
    if sum_A % sum_N:
        print('NO')
        return

    ope_num = sum_A // sum_N
    diffs = [r - l - ope_num for l, r in zip(A[:-1], A[1:])] + [A[0] - A[-1] - ope_num]
    if all([d % N == 0 and d <= 0 for d in diffs]):
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted