Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
[n,m,q] = list(map(int,input().split(" ")))
a = []
for i in range (q):
    a.append(list(map(int,input().split(" "))))
ans = 0
for i in range (10**n):
    tmp = 0
    nlst = [1 for t in range(n)]
    for j in range (len(str(i))):
        nlst[j]=int(str(i)[j])+1
    if max(nlst)<=m:
        nlst.sort()
        for k in range(q):
            a_ = a[k][0]
            b_ = a[k][1]
            c_ = a[k][2]
            d_ = a[k][3]
            if nlst[b_-1]-nlst[a_-1]==c_:
                tmp = tmp + d_
        if ans < tmp:
            ans = tmp
    
print(ans)

Fixed submission:
[n,m,q] = list(map(int,input().split(" ")))
lst = []
for i in range (q):
    lst.append(list(map(int,input().split(" "))))

y = [1 for i in range(n)]

def f(index,li):
    if index == n:
        return eva(li)
    else:
        ret = 0
        t = 1
        if index>=1:
            t = li[index-1]
        for i in range (t,m+1):
            li[index]=i
            x = f(index+1,li)
            if ret < x:
                ret = x
        return ret
    
def eva(li):
    tmp = 0
    for k in range(q):
        a = lst[k][0]
        b = lst[k][1]
        c = lst[k][2]
        d = lst[k][3]
        if li[b-1]-li[a-1]==c:
            tmp = tmp + d
    return tmp
    
print(f(0,y))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
out=0
n1=0
n2=0
for i in range (0,N-3):
    mark1=i
    mark2=i
    n1=0
    n2=0
    if S[i]=="R":
        def1="G"
        def2="B"
    if S[i]=="G":
        def1="R"
        def2="B"
    if S[i]=="B":
        def1="G"
        def2="R"
    for j in range (i+3,N):
        if def1==S[j]:
            for k in range (mark1+1,j):
                if S[k]==def2:
                    n1 = n1 + 1
            mark1=j
            out = out+n1
            if (i+j)%2==0:
                if S[int((i+j)/2)]==def2:
                    out =out -1
        elif def2==S[j]:
            for k in range (mark2+1,j):
                if S[k]==def1:
                    n2 = n2 + 1
            mark2=j
            out = out+n2
            if (i+j)%2==0:
                if S[int((i+j)/2)]==def1:
                    out =out -1
print(out)

Fixed submission:
N=int(input())
S=input()
r = S.count("R")
g = S.count("G")
b = S.count("B")
out =r*g*b

for i in range(0,N):
    w = 1
    while i+w*2<N:
        if S[i]!=S[i+w] and S[i]!=S[i+2*w] and S[i+w]!=S[i+2*w]:
            out = out -1
        w = w+1
        
print(out)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
out=0
for i in range (0,N-3):
    for j in range (i+3,N):
        if S[i]!=S[j]:
            for k in range (i+1,j):
                if S[k]!=S[i] and S[k]!=S[j] and k!=(i+j)/2:
                    out=out+1
print(out)

Fixed submission:
N=int(input())
S=input()
r = S.count("R")
g = S.count("G")
b = S.count("B")
out =r*g*b

for i in range(0,N):
    w = 1
    while i+w*2<N:
        if S[i]!=S[i+w] and S[i]!=S[i+2*w] and S[i+w]!=S[i+2*w]:
            out = out -1
        w = w+1
        
print(out)
Buggy python submission (verdict: Runtime Error):
[A,B]=list(map(int,input().split(" ")))
if A>=13:
    print(B)
elif A>=6:
    print(B/2)
else
    print(0)

Fixed submission:
[A,B]=list(map(int,input().split(" ")))
if A>=13:
    print(B)
elif A>=6:
    print(int(B/2))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s.append(input())
out = 0
a=0
b=0
c=0
for i in range(len(s)):
    if s[i][0] == "B" and s[i][len(s[i])-1] == "A":
        a=a+1
    elif s[i][0] == "B" and s[i][len(s[i])-1] != "A":
        b=b+1
    elif s[i][0] != "B" and s[i][len(s[i])-1] == "A":
        c=c+1
    for j in range(len(s[i])-1):
        if s[i][j] == "A" and s[i][j+1] == "B":
            out = out+1
if a== 0 and b == 0 and c == 0:
elif b == 0 and c == 0:
    out = out + a - 1
else :
    out = out +a+ min(b,c)
    
print(int(out))

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(input())
out = 0
a=0
b=0
c=0
for i in range(len(s)):
    if s[i][0] == "B" and s[i][len(s[i])-1] == "A":
        a=a+1
    elif s[i][0] == "B" and s[i][len(s[i])-1] != "A":
        b=b+1
    elif s[i][0] != "B" and s[i][len(s[i])-1] == "A":
        c=c+1
    for j in range(len(s[i])-1):
        if s[i][j] == "A" and s[i][j+1] == "B":
            out = out+1
if a== 0 and b == 0 and c == 0:
    out = out
elif b == 0 and c == 0:
    out = out + a - 1
else :
    out = out +a+ min(b,c)
    
print(int(out))
Buggy python submission (verdict: Runtime Error):
import math
[n,m] = list(map(int, input().split(" ")))
s = input()
t = input()
g = math.gcd(n,m)
out = n*m/g
for i in range (0,g):
    if s[i*int(n/g)] != t[i*int(m/g)]:
        out = -1
        break
print(int(out))

Fixed submission:
[n,m] = list(map(int, input().split(" ")))
s = input()
t = input()
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
g = gcd(n,m)
out = n*m/g
for i in range (0,g):
    if s[i*int(n/g)] != t[i*int(m/g)]:
        out = -1
        break
print(int(out))
Buggy python submission (verdict: Time Limit Exceeded):
import math
H,N = map(int,input().split())
A = [int(x) for x in input().split()]

count = 0
sum2 = []
for i in range(2 ** N):
        sum1 = []
        for j in range(len(A)):
            if ( i >> j) & 1 == 1:
                sum1.append(A[j])
        if sum(sum1) == H:
            count = 1
            print("Yes")
            break


if count == 0:
    print("No")


Fixed submission:
import math
H,N = map(int,input().split())
A = [int(x) for x in input().split()]

count = 0
sum2 = []
'''for i in range(2 ** N):
        sum1 = []
        for j in range(len(A)):
            if ( i >> j) & 1 == 1:
                sum1.append(A[j])
        if sum(sum1) == H:
            count = 1
            print("Yes")
            break
'''
if sum(A) >= H:
    print("Yes")

else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import math
H,N = map(int,input().split())
A = [int(x) for x in input().split()]

count = 0
sum2 = []
for i in range(2 ** N):
        sum1 = []
        for j in range(len(A)):
            if ( i >> j) & 1 == 1:
                sum1.append(A[j])

        sum2.append(sum(sum1))

if sum2.count(H) == 0:
    print("No")
else :
    print("Yes")


Fixed submission:
import math
H,N = map(int,input().split())
A = [int(x) for x in input().split()]

count = 0
sum2 = []
'''for i in range(2 ** N):
        sum1 = []
        for j in range(len(A)):
            if ( i >> j) & 1 == 1:
                sum1.append(A[j])
        if sum(sum1) == H:
            count = 1
            print("Yes")
            break
'''
if sum(A) >= H:
    print("Yes")

else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
ld = sorted(H,reverse=True)
for _ in range(K):
    ld[0:1] = []
print(sum(ld))


Fixed submission:
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
ld = sorted(H,reverse=True)

ld[0:K] = []
print(sum(ld))
Buggy python submission (verdict: Runtime Error):
#int でsplitを使う場合はmap関数を利用しなければならない
H,N = map(int,input().split())
li=[]
x=[]
for i in range(N):
    A,B = map(int,input().split())
    x.append(A)
    li.append([A,B])
dp = [10**9]*(H+max(x))
dp[0] = 0
for i in range(1,len(dp)):
    dp[i] = min(dp[i-a] + b for a,b in li)
print(min(dp[h:]))


Fixed submission:
#int でsplitを使う場合はmap関数を利用しなければならない
H,N = map(int,input().split())
li=[]
x=[]
for i in range(N):
    A,B = map(int,input().split())
    x.append(A)
    li.append([A,B])
dp = [10**9]*(H+max(x))
dp[0] = 0
for i in range(1,len(dp)):
    dp[i] = min(dp[i-a] + b for a,b in li)
print(min(dp[H:]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
for i in range(N):
    check = 0
    for j in range(i):
        if P[i] > P[j]:
            check = 1
            break
    if check == 0:
        count += 1

print(count)


Fixed submission:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
min = 10**9
for i in P:
    check = 0
    if min > i:
        min = i
    if i <= min:
        count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
for i in range(N):
    check = 0
    for j in range(i):
        if P[i] > P[j]:
            check = 1
            break
    if check == 0:
    count += 1

print(count)


Fixed submission:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
min = 10**9
for i in P:
    check = 0
    if min > i:
        min = i
    if i <= min:
        count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
for i in range(N):
    check = 0
    for j in range(i):
        if P[i] <= P[j]:
            check += 1
    if check == i:
        count += 1

print(count)


Fixed submission:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
min = 10**9
for i in P:
    check = 0
    if min > i:
        min = i
    if i <= min:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,p = map(int,input().split())
ac = np.array([0]*n)
wa = np.array([0]*n)

for i in range(N):
    p,s = input().split()
    if ac[int(p) - 1] == 0 and s == "WA":
        wa[int(p) - 1] += 1
    else:
        ac[int(p) - 1] = 1

if sum(ac) == 0:
    print(0,0)
else:
    print(sum(ac),sum(wa))


Fixed submission:
import numpy as np

N,M = map(int,input().split())

AC = np.array([0]*N)
WA = np.array([0]*N)

for i in range(M):
    p,S = input().split()

    if AC[int(p)-1] ==0 and S == "WA":
       WA[int(p)-1] += 1
    else:
        AC[int(p)-1] = 1

print(sum(AC),sum(AC*WA))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
p = [0]*m
s = [0]*m
c = [0]*m
j = 1
for i in range(m):
    p[i],s[i] = map(str,input().split())
    if i == 0:
        c[i] = str(p[i])
    elif c[j - 1] != p[i]:
        c[j] = str(p[i])
        j += 1
ac = 0
wa = 0
j = 0
for i in range(m):

    if p[i] == c[j] and s[i] == "AC":
        ac += 1
        j += 1
        if c[j] == 0:
            break
    else :
        wa += 1
        
print("{} {}".format(ac,wa))

Fixed submission:
import numpy as np

N,M = map(int,input().split())

AC = np.array([0]*N)
WA = np.array([0]*N)

for i in range(M):
    p,S = input().split()

    if AC[int(p)-1] ==0 and S == "WA":
       WA[int(p)-1] += 1
    else:
        AC[int(p)-1] = 1

print(sum(AC),sum(AC*WA))
Buggy python submission (verdict: Runtime Error):
A1 = input()
A2 = input()
A3 = input()

if A1 + A2 + A3 < 22:
    print('win')
else :
    print('bust')


Fixed submission:
A1,A2,A3 = (int(x) for x in input().split())
if A1 + A2 + A3 < 22:
    print('win')
else :
    print('bust')
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
#x + y + z = s z < k
counter = 0
for i in range(k + 1):
    if i > s:
        break
    for j in range(k + 1):
        if  i + j > s :
            break
        z = s - i - j
        if 0 <= z and z <= k:
            counter += 1

print(counter)


Fixed submission:
k,s = map(int,input().split())
#x + y + z = s z < k
counter = 0
for i in range(k + 1):
    for j in range(k + 1):
        z = s - i - j
        if 0 <= z and z <= k:
            counter += 1

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
#x + y + z = s z < k
counter = 0
for i in range(k + 1):
    if i > s:
        break
    for j in range(k + 1):
        if  i + j > s :
            break
        for l in range(k + 1):
            if i + j + l > s:
                break
            if l > k:
                break
            if i + j + l == s:
                #print(i,j,l)
                counter += 1

print(counter)


Fixed submission:
k,s = map(int,input().split())
#x + y + z = s z < k
counter = 0
for i in range(k + 1):
    for j in range(k + 1):
        z = s - i - j
        if 0 <= z and z <= k:
            counter += 1

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
#x + y + z = s z < k
counter = 0
for i in range(k + 1):
    for j in range(k + 1):
        for l in range(k + 1):
            if i + j + l > s:
                break
            if l > k:
                break
            if i + j + l == s:
                #print(i,j,l)
                counter += 1

print(counter)


Fixed submission:
k,s = map(int,input().split())
#x + y + z = s z < k
counter = 0
for i in range(k + 1):
    for j in range(k + 1):
        z = s - i - j
        if 0 <= z and z <= k:
            counter += 1

print(counter)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
p = list(map(int, input().split()))

par = {x:x for x in range(1, n+1)}

def root(node):
    if par[node] == node:
        return node
    par[node] = root(par[node])
    return par[node]

for _ in range(m):
    x, y  = map(int, input().split())
    par[root[x]] = root[y]
    
ans = 0
for i in range(1, n+1):
    if root[i] == root(p[i-1]):
        ans += 1

print(ans)

Fixed submission:
n, m = map(int, input().split())
p = list(map(int, input().split()))

par = {x:x for x in range(1, n+1)}

def root(node):
    if par[node] == node:
        return node
    par[node] = root(par[node])
    return par[node]

for _ in range(m):
    x, y  = map(int, input().split())
    par[root(x)] = root(y)
    
ans = 0
for i in range(1, n+1):
    if root(i) == root(p[i-1]):
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
p = list(map(int, input().split()))

par = {x:x for x in range(1, n+1)}

def root(node):
    if par[node] == node:
        return node
    par[node] = root(par[node])
    return par[node]

for _ in range(m):
    x, y  = map(int, input().split())
    par[root[x]] = root[y]
    
ans = 0
for i in range(1, n+1):
    if root[i] == root(p[i]):
        ans += 1

print(ans)
    

Fixed submission:
n, m = map(int, input().split())
p = list(map(int, input().split()))

par = {x:x for x in range(1, n+1)}

def root(node):
    if par[node] == node:
        return node
    par[node] = root(par[node])
    return par[node]

for _ in range(m):
    x, y  = map(int, input().split())
    par[root(x)] = root(y)
    
ans = 0
for i in range(1, n+1):
    if root(i) == root(p[i-1]):
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
s,w = map(int,input().split())
if w>=s:
  print("unsafe")
else:
  print("safe)

Fixed submission:
s,w = map(int,input().split())
if w>=s:
  print("unsafe")
else:
  print("safe")
Buggy python submission (verdict: Runtime Error):
S == input()
if S = "ABC":
  print("ARC")
else:
  print("ABC")

Fixed submission:
S = input()
if S == "ABC":
  print("ARC")
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
S = input()
if S = "ABC":
  print("ARC")
else:
  print("ABC")

Fixed submission:
S = input()
if S == "ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
S,W = map(int,input().split)
if S >= W:
  print('unsafe')
else:
  print('safe')

Fixed submission:
S, W = map(int, input().split())
if W >= S:
	print('unsafe')
else:
	print('safe')
Buggy python submission (verdict: Runtime Error):
N = list(input())
for i in range(2):
  if N[i]=7:
    print("Yes")
  break
else:
  print("No")

Fixed submission:
N = list(input())
for i in range(3):
  if N[i] == "7":
    print("Yes")
    break
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = list(input())
if S[2] == S[3]　and S[4] == S[5]:
    print("Yse")
else:
    print("No")


Fixed submission:
S = list(input())
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N,R = map(int,input().split())
if N >= 10:
  print(R)
else:
  print(100*(10-K))

Fixed submission:
N,R = map(int,input().split())
if N >= 10:
  print(R)
else:
  print(R+100*(10-N))
Buggy python submission (verdict: Runtime Error):
H,A = map(int,input().split())
print(H//A if H%A=0 else H//A+1)

Fixed submission:
H,A = map(int,input().split())
print(H//A if H%A==0 else H//A+1)
Buggy python submission (verdict: Runtime Error):
l = int(input())
x = l/3
x = p**3
print(x)

Fixed submission:
l = int(input())
p = l/3
p = p**3
print(p)
Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())

nK = K
n = 1
ans = "NG"
while(nK=<B):
  if nK >= A:
    ans = "OK"
    break
  n += 1
  nK = n * K
print(ans)

Fixed submission:
K = int(input())
A, B = map(int, input().split())

nK = K
n = 1
ans = "NG"
while(nK<=B):
  if nK >= A:
    ans = "OK"
    break
  n += 1
  nK = n * K
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
r = int(input())

return  2 * r * np.pi

Fixed submission:
import numpy as np
r = int(input())

print(2 * r * np.pi)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A_list = list(map(int, input().split()))
index = np.arange(1, N+1)
ans = ["{}\n".format(i) for A_list.count(i) in range(1, N+1)]
print(ans)

Fixed submission:
import collections
N = int(input())
A_list = list(map(int, input().split()))
ans = collections.Counter(A_list)
for i in range(1, N+1):
	print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A_list = list(map(int, input().split()))
index = np.arange(1, N+1)
for i in index:
  print(A_list.count(i))

Fixed submission:
import collections
N = int(input())
A_list = list(map(int, input().split()))
ans = collections.Counter(A_list)
for i in range(1, N+1):
	print(ans[i])
Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())

l = K // 2
lower = X - l
upper = X + l
ans = [i for i in range(lower, upper+1)]
ans_str = " ".join(ans)
print(ans_str)

Fixed submission:
K, X = map(int, input().split())

lower = X - K + 1
upper = X + K - 1
ans = [i for i in range(lower, upper+1)]
ans_str = " ".join(list(map(str, ans)))
print(ans_str)
Buggy python submission (verdict: Runtime Error):
import math
N, D = map(int, input().split())
X = []

for i in range(N):
  inp = input()
  buf = list(map(int, inp))
  X.append(buf)

cnt = 0

for i in range(N-1):
  for j in range(i+1,N):
    dist2 = 0
    for index in range(D):
      dist2 += (X[i][index] - X[j][index]) ** 2
    dist = math.sqrt(dist2)
    if dist == float(int(dist)):
      cnt += 1

print(cnt)

Fixed submission:
import math
N, D = map(int, input().split())
X = []

for i in range(N):
  buf = list(map(int, input().split()))
  X.append(buf)

cnt = 0

for i in range(N-1):
  for j in range(i+1,N):
    dist2 = 0
    for index in range(D):
      dist2 += (X[i][index] - X[j][index]) ** 2
    dist = math.sqrt(dist2)
    if dist == float(int(dist)):
      cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
div = 2019
min_mod = div - 1

for i in range(L, R):
  for j in range(i+1, R+1):
    mod = (i * j) % div
    if mod < min_mod:
      min_mod = mod
      
print(min_mod)

Fixed submission:
L, R = map(int, input().split())
div = 2019
min_mod = div - 1
flag = False

for i in range(L, R):
  for j in range(i+1, R+1):
    mod = (i * j) % div
    if mod == 0:
      min_mod = mod
      flag = True
    elif mod < min_mod:
      min_mod = mod
    if flag:
      break
  if flag:
    break
    
print(min_mod)
Buggy python submission (verdict: Runtime Error):
N = int(input())
x = list(map(int, input().split()))
y = [0] * N

odd = sum([n for i, n in enumerate(shifted_x) if i % 2 == 1])
even = sum([n for i, n in enumerate(shifted_x) if i % 2 == 0])
y[0] = even - odd

for i in range(N-1):
  y[i+1] = 2 * x[1] - y[i]


str_y = map(str, y)
output = " ".join(str_y)
print(output)

Fixed submission:
N = int(input())
x = list(map(int, input().split()))
y = [0] * N

odd = sum([n for i, n in enumerate(x) if i % 2 == 1])
even = sum([n for i, n in enumerate(x) if i % 2 == 0])
y[0] = even - odd

for i in range(N-1):
  y[i+1] = 2 * x[i] - y[i]


str_y = map(str, y)
output = " ".join(str_y)
print(output)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x = list(map(int, input().split()))
y = [0] * N

def shift(l, n):
    return l[n:] + l[:n]
shifted_x = shift(x, -1)
for i in range(N):
  shifted_x = shift(shifted_x, 1)
  odd = sum([n for i, n in enumerate(shifted_x) if i % 2 == 1])
  even = sum([n for i, n in enumerate(shifted_x) if i % 2 == 0])
  y[i] = even - odd


str_y = map(str, y)
output = " ".join(str_y)
print(output)

Fixed submission:
N = int(input())
x = list(map(int, input().split()))
y = [0] * N

odd = sum([n for i, n in enumerate(x) if i % 2 == 1])
even = sum([n for i, n in enumerate(x) if i % 2 == 0])
y[0] = even - odd

for i in range(N-1):
  y[i+1] = 2 * x[i] - y[i]


str_y = map(str, y)
output = " ".join(str_y)
print(output)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x = list(map(int, input().split()))
y = [sum(x)] * N
  
for i in range(N):
  for j in range(N):
    if j % 2 == 1:
      index = (i + j) % N
      y[i] -= 2 * x[index]
    
str_y = map(str, y)
output = " ".join(str_y)
print(output)

Fixed submission:
N = int(input())
x = list(map(int, input().split()))
y = [0] * N

odd = sum([n for i, n in enumerate(x) if i % 2 == 1])
even = sum([n for i, n in enumerate(x) if i % 2 == 0])
y[0] = even - odd

for i in range(N-1):
  y[i+1] = 2 * x[i] - y[i]


str_y = map(str, y)
output = " ".join(str_y)
print(output)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x = [0] * N
y = [0] * N

for i, A in enumerate(input().split()):
  x[i] = int(A)
  
for i in range(N):
  for j in range(N):
    index = (i + j) % N
    y[i] += ((-1) ** j) *  x[index]
    
str_y = map(str, y)
output = " ".join(str_y)
print(output)

Fixed submission:
N = int(input())
x = list(map(int, input().split()))
y = [0] * N

odd = sum([n for i, n in enumerate(x) if i % 2 == 1])
even = sum([n for i, n in enumerate(x) if i % 2 == 0])
y[0] = even - odd

for i in range(N-1):
  y[i+1] = 2 * x[i] - y[i]


str_y = map(str, y)
output = " ".join(str_y)
print(output)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if b > a:
    priant("unsafe")
elif a > b:
    print("safe")

Fixed submission:
a,b = map(int,input().split())
if b >= a:
    print("unsafe")
elif a > b:
    print("safe")
Buggy python submission (verdict: Runtime Error):
s = input()
if(s[1] == "R"):
  print("ABC")
 else:
  print("ARC")
  

Fixed submission:
s = input()
if(s[1] == "R"):
  print("ABC")
else:
  print("ARC")
Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
print(2*math.PI*r)

Fixed submission:
import math
r = int(input())
print(2*math.pi*r)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K = map(int, input().split())
S = np.array([])
for i in range(K):
    d = input()
    for j in input().split():
        S = np.append(S, [j])

print(N - np.unique(S).size)  # np.unique(np.array).sizeユニークな要素の個数


Fixed submission:
N, K = map(int, input().split())
S = []
for i in range(K):
    d = input()
    for j in input().split():
        if j not in S:
            S.append(j)

print(N - len(S))
Buggy python submission (verdict: Time Limit Exceeded):
import math

a, b, n = map(int, input().split())
ans = 0
tmp = 0

for x in range(1, n+1):
    tmp = math.floor(a*x/b) - a*math.floor(x/b)
    if tmp >= ans:
        ans = tmp

print(ans)

Fixed submission:
import math

a, b, n = map(int, input().split())
ans = 0
tmp = 0

if n > b - 1:
    n = b-1

ans = math.floor(a*n/b) - a*math.floor(n/b)

print(ans)