Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
S = 0
for i in range(N):
    S ^= a[i]

Ans = ""
for i in range(N):
    Ans = Ans + str(S^a[i]) + " "

print(Ans)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
S = 0
for i in range(N):
    S ^= a[i]

Ans = ""
for i in range(N):
    print(S^a[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
S = 0
for i in range(N):
    S = S^a[i]

Ans = ""
for i in range(N):
    Ans = Ans + str(S^a[i]) + " "

print(Ans)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
S = 0
for i in range(N):
    S ^= a[i]

Ans = ""
for i in range(N):
    print(S^a[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))

def ten_to_bi(n):
    result_of_binary = ""
    while n>0:
        result_of_binary = result_of_binary + str(int(n%2))
        n = int((n-(n%2))/2)
    return(result_of_binary)

def bi_to_ten(bi):
    result_of_ten = 0
    for i in range(len(bi)):
        result_of_ten = result_of_ten + int(bi[i])*(2**i)
    return(result_of_ten)

def xor_bi(n,m):
    result_of_xor_bi = ""
    if len(m)>len(n):
        temp=n
        n,m = m,temp
    for i in range(len(n)-len(m)):
        m = m + "0"
    for i in range(len(n)):
        if n[i]==m[i]:
            result_of_xor_bi = result_of_xor_bi + "0"
        else:
            result_of_xor_bi = result_of_xor_bi + "1"
    return(result_of_xor_bi)
    
b = [ten_to_bi(a[i]) for i in range(N)]
c = "0"
for i in range(N-1):
    c = xor_bi(c,b[i+1])
d=[bi_to_ten(c)]

for i in range(N-1):
    c = xor_bi(c,xor_bi(b[i],b[i+1]))
    d.append(bi_to_ten(c))

Ans = ""
for i in range(N):
    Ans = Ans + str(d[i]) + " "

print(Ans)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
S = 0
for i in range(N):
    S ^= a[i]

Ans = ""
for i in range(N):
    print(S^a[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
b = ["" for i in range(N)]

def int_to_2(X):
    r = ""
    while X>0:
        r = r + str(X%2)
        X = int((X- X%2)/2)
    return(r)
    
def xor(a,b):
    rr = ""
    r = 0
    aa = int_to_2(a)
    bb = int_to_2(b)
    if len(bb) > len(aa):
        cc = bb
        bb = aa
        aa = cc
    for i in range(len(aa)-len(bb)):
        bb = bb + "0"
    for i in range(len(aa)):
        if aa[i]!=bb[i]:
            rr = rr + "1"
        else:
            rr = rr + "0"
    for i in range(len(aa)):
        r = r + (2**i)*int(rr[i])
    return(r)

ans = [0 for i in range(N)]

for i in range(N-1):
    ans[0] = xor(ans[0],a[i+1])

for i in range(N-1):
    ans[i+1] = xor(ans[i],xor(a[i],a[i+1]))

writeout = ""

for i in range(N):
    writeout = writeout + str(ans[i]) + " "

print(writeout)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
S = 0
for i in range(N):
    S ^= a[i]

Ans = ""
for i in range(N):
    print(S^a[i])
Buggy python submission (verdict: Time Limit Exceeded):
M = 10**9 + 7
k,n = int(input()),len(input())
a = t = pow(26,k,M)

for i in range(k):
    t = t*25*(i+n)*pow(26,-1,M)*pow(i+1,-1,M)%M
    a += t

print(a%M)

Fixed submission:
M = 10**9 + 7
k,n = int(input()),len(input())
a = t = pow(26,k,M)

for i in range(k):
    t = t*25*(i+n)*pow(26*(i+1),-1,M)%M
    a += t

print(a%M)
Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())
Ans = "No"
if Y%2 = 0:
    if 2*X<=Y and Y<=4*X:
        Ans = "Yes"

print(Ans)

Fixed submission:
X,Y = map(int,input().split())
Ans = "No"
if Y%2 == 0:
    if 2*X<=Y and Y<=4*X:
        Ans = "Yes"

print(Ans)
Buggy python submission (verdict: Runtime Error):
a,b,t = map(input().split())
r = b * int(t/a)
print(r)

Fixed submission:
a,b,t = map(int,input().split())
r = b * int(t/a)
print(r)
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(input().split())
c = list(input().split())
r=0
for i in range(n):
  if b[i]-c[i]>0:
    r = r + b[i] - c[i]
    
print(r)

Fixed submission:
n = int(input())
b = list(map(int,input().split()))
c = list(map(int,input().split()))
r=0
for i in range(n):
  if b[i]-c[i]>0:
    r = r + b[i] - c[i]
    
print(r)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
neg = 0
r = 
for i in a:
  r = r + abs(i)
  if i < 0 :
     neg = neg + 1
if neg % 2 != 0:
  s = 10000000000
  for i in a:
    s = min(s,abs(i))
  r = r - 2*s
  
print(r)

  


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
neg = 0
r=0
for i in a:
  r = r + abs(i)
  if i < 0 :
     neg = neg + 1
if neg % 2 != 0:
  s = 10000000000
  for i in a:
    s = min(s,abs(i))
  r = r - 2*s
  
print(r)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
neg = 0
for i in a:
  r = r + abs(i)
  if i < 0 :
     neg = neg + 1
if neg % 2 != 0:
  s = 10000000000
  for i in a:
    s = min(s,abs(i))
  r = r - 2*s
  
print(r)

  

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
neg = 0
r=0
for i in a:
  r = r + abs(i)
  if i < 0 :
     neg = neg + 1
if neg % 2 != 0:
  s = 10000000000
  for i in a:
    s = min(s,abs(i))
  r = r - 2*s
  
print(r)
Buggy python submission (verdict: Runtime Error):
N = int(input())
q = 0
flug = 0
while q <= N :
        if N%7 == 0:
                flug = 1
                break
	if N - q % 4 == 0:
		flug = 1
		break
	q = q + 7

if flug == 1:
	print("Yes")
else:
	print("No")

Fixed submission:
N = int(input())
q = 0
flug = 0
while q <= N :
	if N%7 == 0:
		flug = 1
		break
	
	if (N-q)%4 == 0:
		flug = 1
		break
	q = q + 7
 
if flug == 1:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
	A[i] = A[i]%M

b = 0
c = 0
count = 0
for i in range(N):
	b = b+A[i]
	c = b
	if c%M == 0:
		count = count + 1
	for j in range(N-i-1):
		c = c - A[j] + A[j+i+1]
		if c%M == 0:
			count = count + 1
			
print(count)


Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
B = [0 for i in range(N+1)]
B[0] = 0
C = {"0":1}
for i in range(N):
	B[i+1] = (B[i]+A[i])%M
	if str(B[i+1]) in C.keys():
		C[str(B[i+1])] = C[str(B[i+1])] + 1
	else:
		C[str(B[i+1])] = 1
	
out = 0
for j in C.values():
	out = out + int(j*(j-1)/2)

print(out)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
p = 0
if A>8:
	p = 1
if B>8:
	p = 1
if p==0:
	print("Yay!")
else:
	print(":(")

Fixed submission:
A,B = map(int,input().split())
p = 0
if A>8:
	p = 1
if B>8:
	p = 1
if p==0:
	print("Yay!")
else:
	print(":(")

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
p = 0
if A>8:
	p = 1
if B>8:
	p = 1
if p==0:
	print("Yay!")
if p==1:
	print(":(")

Fixed submission:
A,B = map(int,input().split())
p = 0
if A>8:
	p = 1
if B>8:
	p = 1
if p==0:
	print("Yay!")
else:
	print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K = (int(i) for i in input().split())
p = 0

for i in range(K):
	As = A
	Bs = B
	Cs = C
	A = Bs + Cs
	B = Cs + As
	C = As + Bs

u = A-B
if abs(u)>10*18:
	u = "Unfair"
print(u)

Fixed submission:
A,B,C,K = (int(i) for i in input().split())
n = K % 2
if abs(A-B)>10**18:
	print("Unfair")
else:
	print((A-B)*((-1)**n))
Buggy python submission (verdict: Runtime Error):
def dist(arr, n):
	res = 0; su = 0
	for i in range(n):
		res = (res + (arr[i] * i) - su) % mod
		su = (su + arr[i]) % mod

	return res % mod

n,m,k = map(int,input().split())
mod = int(1e9+7)
fact = [1]
for i in range(1,int(1e5)+1):
	fact.append((fact[-1] * i)%mod)

x = []
y = []

for i in range(1,n+1):
	for j in range(1,m+1):
		x.append(i)
		y.append(j)

y.sort()

tot = (dist(x,n*m) + dist(y,n*m))%mod
N = n*m - 2
Need = k-2
num = fact[N]
den = (fact[Need] * fact[N-Need])%mod
ncr = (num * pow(den,mod-2,mod)) % mod
ans = (tot * ncr) % mod
print(ans)

Fixed submission:
def dist(arr, n):
	res = 0; su = 0
	for i in range(n):
		res = (res + (arr[i] * i) - su) % mod
		su = (su + arr[i]) % mod

	return res % mod

n,m,k = map(int,input().split())
mod = int(1e9+7)
fact = [1]
for i in range(1,n*m+1):
	fact.append((fact[-1] * i)%mod)

x = []
y = []

for i in range(1,n+1):
	for j in range(1,m+1):
		x.append(i)
		y.append(j)

y.sort()

tot = (dist(x,n*m) + dist(y,n*m))%mod
N = n*m - 2
Need = k-2
num = fact[N]
den = (fact[Need] * fact[N-Need])%mod
ncr = (num * pow(den,mod-2,mod)) % mod
ans = (tot * ncr) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):

s = input()

f = "keyence"
h = 0
for i in range(7):

    first = f[:i+1]
    second = f[i+1:]
    check = len(first)
    find1 = s.find(first)
    find2 = s.find(second,find1+check)

    if find2 + len(second) < n:
        continue

    if find1 != -1 and find2!=-1:
        print("YES")
        h = 1
        break



if h == 0:
    print("NO")

Fixed submission:

s = input()

f = "keyence"
h = 0
n = len(s)
for i in range(8):

    first = f[:i+1]
    second = f[i+1:]
    check = len(first)
    find1 = s.find(first)
    find2 = s.find(second,n-len(second))

    if i!=7:
        if find1!=0:
            continue

        if find2==-1:
            continue

        if find2+len(second)!=n:
            continue

        else:
            print("YES")
            h = 1
            break

    else:
        if find1 == 0 or find1+len(first) == n :
            print("YES") 
            h = 1
            break



if h == 0:
    print("NO")
Buggy python submission (verdict: Runtime Error):
>>> a,b=(int(x) for x in input().split())
tap = 1
count = 0

while tap < b:
    tap = tap + a - 1
    count = count + 1
    
print(count)

Fixed submission:
a,b=(int(x) for x in input().split())
tap = 1
count = 0

while tap < b:
    tap = tap + a - 1
    count = count + 1
    
print(count)

Buggy python submission (verdict: Runtime Error):
>>> a,b=(int(x) for x in input().split())
tap = 1
count = 0

while tap < b:
    tap = tap + a - 1
    count = count + 1
    
print(count)



Fixed submission:
a,b=(int(x) for x in input().split())
tap = 1
count = 0

while tap < b:
    tap = tap + a - 1
    count = count + 1
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
h, w, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(m)]

max = 0
for i in range(1, h+1):
  for j in range(1, w+1):
    count = 0
    for k in l:
      if k[0] == i or k[1] == j:
        count += 1
    if count > max:
      max = count

print(max)

Fixed submission:
from collections import defaultdict

h, w, m = map(int, input().split())

cnt_h = [0] * h #各行の爆破対象マス
cnt_w = [0] * w #各列の爆破対象マス
dic = defaultdict(int) #

for _ in range(m): #爆破対象のマスそれぞれ
  h_m, w_m = map(int, input().split()) #位置を取得
  cnt_h[h_m -1] += 1 #行のカウント
  cnt_w[w_m -1] += 1 #列のカウント
  dic[(h_m - 1, w_m - 1)] += 1 #マス（交差地点）を保持

max_h = max(cnt_h)
max_w = max(cnt_w)

mh = []
mw = []

for i in range(h):
  if max_h == cnt_h[i]:
    mh.append(i)
    
for j in range(w):
  if max_w == cnt_w[j]:
    mw.append(j)

for i in mh:
  for j in mw:
    if dic[(i, j)] == 0:
      print(max_h + max_w)
      exit()

print(max_h + max_w - 1)
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())

for i in range(1, n+1):
  if i <= 5:
    print(0)
  else:
    cnt = 0
    for x in range(1, math.floor(math.sqrt(i-5))+1):
      for y in range(1, math.floor(math.sqrt(i-x**2-4))+1):
        for z in range(1, math.floor(math.sqrt(i-x**2-y**2-3))+1):
          if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
            cnt += 1
    print(cnt)


Fixed submission:
n = int(input())

ans = [0 for _ in range(10001)]
for x in range(1, 100):
  for y in range(1, 100):
    for z in range(1, 100):
      v = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if v < 10001:
        ans[v] += 1

for i in range(n):
  print(ans[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())

for i in range(1, n+1):
  if i <= 5:
    print(0)
  else:
    max = math.floor(math.sqrt(i-5))
    cnt = 0
    for x in range(1, max+1):
      for y in range(1, max+1):
        for z in range(1, max+1):
          if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
            cnt += 1
    print(cnt)


Fixed submission:
n = int(input())

ans = [0 for _ in range(10001)]
for x in range(1, 100):
  for y in range(1, 100):
    for z in range(1, 100):
      v = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if v < 10001:
        ans[v] += 1

for i in range(n):
  print(ans[i+1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0] * q
c = [0] * q
for i in range(q):
  b[i], c[i] = map(int, input().split())

num = []
for i in range(100001):
  num.append(a.count(i))

sum = sum(a)
for i in range(q):
  sum = sum + (c[i] - b[i]) * num[b[i]]
  print(sum)
  num[c[i]] += num[b[i]]
  num[b[i]] = 0

Fixed submission:
from collections import Counter

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

counter = Counter(a)
sum_res = sum(a)

for _ in range(q):
  b, c = map(int, input().split())

  sum_res += (c - b) * counter[b]

  counter[c] += counter[b]
  counter[b] =0

  print(sum_res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0] * q
c = [0] * q
for i in range(q):
  b[i], c[i] = map(int, input().split())
a_new = a
for i in range(q):
  a_new = [c[i] if j == b[i] else j for j in a_new]
  print(sum(a_new))

Fixed submission:
from collections import Counter

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

counter = Counter(a)
sum_res = sum(a)

for _ in range(q):
  b, c = map(int, input().split())

  sum_res += (c - b) * counter[b]

  counter[c] += counter[b]
  counter[b] =0

  print(sum_res)
Buggy python submission (verdict: Runtime Error):
import math
from queue import PriorityQueue
from sys import stdin,stdout
from collections import defaultdict

def solve():
	n=int(input())
	ans=[0 for _ in range(20005)]
	for i in range(1,101):
		for j in range(1,101):
			for k in range(1,101):
				v=i*i+j*j+k*k+i*j+k*j+k*i
				ans[v]+=1
	for i in range(n):
		print(ans[i+1])
    

    
    
    
def main():
	solve()
main()


Fixed submission:
import math
from queue import PriorityQueue
from sys import stdin,stdout
from collections import defaultdict

def solve():
    n=int(input())
    ans=[0 for _ in range(200050)]
    for i in range(1,101):
        for j in range(1,101):
            for k in range(1,101):
                v=i*i+j*j+k*k+i*j+k*j+k*i
                ans[v]+=1
    for i in range(n):
        print(ans[i+1])
    

    
    
    
def main():
    solve()
main()

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=[0 for _ in range(10050)]
for i in range(105):
  for j in range(1,105):
    v=i*i+j*j+k*k+i*j+j*k+k*i;
    if(v<10050):
      ans[v]+=1
for i in range(n):
  print(ans[i+1])

Fixed submission:
import math
from queue import PriorityQueue
from sys import stdin,stdout
from collections import defaultdict

def solve():
    n=int(input())
    ans=[0 for _ in range(200050)]
    for i in range(1,101):
        for j in range(1,101):
            for k in range(1,101):
                v=i*i+j*j+k*k+i*j+k*j+k*i
                ans[v]+=1
    for i in range(n):
        print(ans[i+1])
    

    
    
    
def main():
    solve()
main()
Buggy python submission (verdict: Runtime Error):
s=intput()
ss=intput()
c=0
for i in range(len(s)):
  if(s[i]!=ss[i]):
    c+=1
print(c)

Fixed submission:
n=input()
nn=input()
c=0
for i in range(len(n)):
    if(n[i]!=nn[i]):
        c+=1
print(c)

Buggy python submission (verdict: Runtime Error):
s=intput()
ss=intput()
for i range(len(s)):
  if(s[i]!=ss[i]):
    c+=1
print(c)

Fixed submission:
n=input()
nn=input()
c=0
for i in range(len(n)):
    if(n[i]!=nn[i]):
        c+=1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
A = map(int, input().split())
Q = int(input())

counter = Counter(A)
for i in range(Q):
  b, c = map(int, input().split())
  count_b = counter[b]
  counter[b]-= count_b
  counter[c] += count_b
  print(sum([k*v for k, v in counter.items()]))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

counter = Counter(A)
ans = sum(A)
for i in range(Q):
  b, c = map(int, input().split())
  count_b = counter[b]
  counter[b] -= count_b
  counter[c] += count_b
  ans = ans - b*count_b + c*count_b
  print(ans)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
try:
  p = list(map(int, input().split()))
except EOFError:
  print(100)
  exit()
old_diff = 100
for i in range(1, 101):
  if i in p:
    continue
  else:
    diff = abs(x-i)
    if diff < old_diff:
      ans = i
      old_diff = abs(x-i)
print(ans)

Fixed submission:
x, n = map(int, input().split())
try:
  p = list(map(int, input().split()))
except EOFError:
  print(100)
  exit()
old_diff = 10000
for i in range(-110, 110):
  if i in p:
    continue
  else:
    diff = abs(x-i)
    if diff < old_diff:
      ans = i
      old_diff = abs(x-i)

try:
  print(ans)
except:
  print()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(N):
  ans *= A[i]
if ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
  print(0)
  exit()
for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    print(-1)
    exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
e = [False] * (N+1)
idx = 1
move = []
while True:
  if e[idx]:
    break
  move.append(idx)
  e[idx] = True
  idx = A[idx-1]
m = move.index(idx)
c = len(move) - m

if K <= m:
    print(D[K])
else:
    print(D[m+(K-m) % c])

Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

R = [False]*(N+1)
D = []
p = 1
while True:
    if R[p]:
        break
    D.append(p)
    R[p] = True
    p = A[p-1]
m = D.index(p)
c = len(D)-m

if K <= m:
    print(D[K])
else:
    print(D[m+(K-m) % c])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
idx = A[0]
move = []
move.append(idx)
cycle = []
for _ in range(K-1):
  idx = A[idx-1]
  if idx in move:
    cycle = move[move.index(idx):]
    break
  move.append(idx)

if cycle:
  print(cycle[(K - 1- (len(move)-len(cycle)))%len(cycle)])
else:
  print(move[K-1])

Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

R = [False]*(N+1)
D = []
p = 1
while True:
    if R[p]:
        break
    D.append(p)
    R[p] = True
    p = A[p-1]
m = D.index(p)
c = len(D)-m

if K <= m:
    print(D[K])
else:
    print(D[m+(K-m) % c])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
idx = A[0]
move = []
move.append(idx)
cycle = []
for _ in range(K-1):
  idx = A[idx-1]
  if idx in move:
    cycle = move[move.index(idx):]
    break
  move.append(idx)

if cycle:
  print(cycle[(K - 1- (len(move)-len(cycle)))%len(cycle)])
else:
  print(move[K-1])


Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

R = [False]*(N+1)
D = []
p = 1
while True:
    if R[p]:
        break
    D.append(p)
    R[p] = True
    p = A[p-1]
m = D.index(p)
c = len(D)-m

if K <= m:
    print(D[K])
else:
    print(D[m+(K-m) % c])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K = map(int, input().split())
A = list(map(int, input().split()))
idx = A[0]
move = []
move.append(idx)
cycle = []
for _ in range(K-1):
  idx = A[idx-1]
  if idx in move:
    cycle = move[move.index(idx):]
    break
  move.append(idx)

if cycle:
  print(cycle[(K - 1- (len(move)-len(cycle)))%len(cycle)])
else:
  print(move[K-1])

Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

R = [False]*(N+1)
D = []
p = 1
while True:
    if R[p]:
        break
    D.append(p)
    R[p] = True
    p = A[p-1]
m = D.index(p)
c = len(D)-m

if K <= m:
    print(D[K])
else:
    print(D[m+(K-m) % c])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
index = np.array(list(range(1, N+1)))
A = np.array(list(map(int, input().split())))
a = index + A
d = list((index - A))
ans= 0
c = 0
for num in a:
  ans += (d[c:]).count(num)
  c += 1
print(ans)

Fixed submission:
import collections
n=int(input())
s=list(map(int, input().split()))
L=[i+a for i,a in enumerate(s)]
R=[i-a for i,a in enumerate(s)] 
t=collections.Counter(L)
u=collections.Counter(R)
ans = 0
for i in t.keys():
  ans+=t[i]*u[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(0, 10**3):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
for x in range(N-10**7, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))

Buggy python submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(B, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))

Buggy python submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(N+1, B):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(0, 10**3):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
for x in range(N-10**7, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))

Buggy python submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(1, N//(10**6)+1 ):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(N//(10**7), N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(N//10**7, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(1, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
for i in range(1, N+1):
    print(A.count(i))

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