Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] =1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be,r)
if k<= len(be):
  print(be[k])
else:
  w = k-len(be)
  u = (w%len(r))
  print(r[u]+1)

Fixed submission:
n,k = map(int,input().split())
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] =1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be,r)
if k< len(be):
  print(be[k]+1)
else:
  w = k-len(be)+1
  u = (w%len(r))-1
  print(r[u]+1)

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
k += 1
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] ==1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be)
if k<= len(be):
  print(be[k])
else:
  w = k-len(be)
  u = w%len(r)-1
  print(r[u]+1)

Fixed submission:
n,k = map(int,input().split())
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] =1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be,r)
if k< len(be):
  print(be[k]+1)
else:
  w = k-len(be)+1
  u = (w%len(r))-1
  print(r[u]+1)
Buggy python submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n,k,mod):
    nCk = 1

    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod
 
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk

a1 = pow(m-1, n-k-2, mod)  
b1 = 1  
for i in range(k,-1,-1):
    a = (a1*(m-1))%mod
    b = comb(n-1,i,mod)
    ans += a*b
ans *= m
print(ans%mod)

Fixed submission:
n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
  
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n+1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)


for i in range(k+1):
    a = pow(m-1, n-i-1, mod)
    b = comb(n-1,i,mod)
    ans += (a*b)%mod
ans *= m
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n,k,mod):
    nCk = 1

    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod
 
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk
for i in range(k+1):
    a = pow(m-1, n-i-1, mod)
    b = comb(n-1,i,mod)
    ans += (a*b)%mod
ans *= m
print(ans%mod)

Fixed submission:
n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
  
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n+1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)


for i in range(k+1):
    a = pow(m-1, n-i-1, mod)
    b = comb(n-1,i,mod)
    ans += (a*b)%mod
ans *= m
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n,k,mod):
    nCk = 1

    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod
 
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk
for i in range(k+1):
    a = pow(m-1, n-i-1, mod)
    b = comb(n-1,i,mod)
    ans += a*b
ans *= m
print(ans%mod)

Fixed submission:
n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
  
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n+1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)


for i in range(k+1):
    a = pow(m-1, n-i-1, mod)
    b = comb(n-1,i,mod)
    ans += (a*b)%mod
ans *= m
print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
l = []
for j in range(0,n):
  k = ["a"]*(j+1)+[i-a[j] for i in range(1,n-j)]
  l.append(k)
l1 = list(map(list,(zip(*l))))
#print(l)
s = 0
for i in range(n):
  q = a[i]
  z = l1[i]
  s += z.count(q)
print(s)
    

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

ja1 = []
ja2 = []
for i in range(1,n+1):
  ja1.append(i-a[i-1])
  ja2.append(i+a[i-1])

s = Counter(ja1)
t = Counter(ja2)

su = 0
for i in s.keys():
  su += s[i]*t[i]
print(su)
Buggy python submission (verdict: Runtime Error):
from collections import deque
n,m,q = map(int,input().split())
l = list(list(map(int,input().split())) for _ in range(q))
if m<7:
  num = ["1"*n]
  k = deque(["1"*n])
  while len(k)!=0:
    h = k.popleft()
    if int(h[-1])<m:
      num.append(str(int(h)+1))
      num.append(str(int(h)+11))
      num.append(str(int(h)+111))
      k.append(str(int(h)+1))
      k.append(str(int(h)+11))
      k.append(str(int(h)+111))
  num = list(set(num))
  ma = 0
  for i in num:
    s = 0
    for a,b,c,d in l:
      if int(i[b-1])-int(i[a-1])==c:
        s += d
        ma = max(ma,s)
  print(ma)
else:
  l1 = sorted(l,key=lambda x:x[3])[::-1]
  print(l1[0][-1])

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

Buggy python submission (verdict: Runtime Error):
a,b,n = map(int,input().split())
if n<b:
  print(int(a*n/b))
  exit()
if n<2*b:
  print(int(a*n/b))
else:
  print(int(a*(b-1))/b)- int(a*(b-1)/b)

Fixed submission:
a,b,n = map(int,input().split())
if n<b:
  answer = (a*n//b)-a*(n//b)
else:
  answer = (a*(b-1)//b) - a*((b-1)//b)
print(answer)
Buggy python submission (verdict: Runtime Error):
n = len(s)
cou = [0 for i in range(n+1)]
cou[1]= s[-1]
coum = [0 for i in range(2019)]
for i in range(1,n):
  cou[i+1] = s[n-i-1]+ str(cou[i])
  a = int(cou[i+1])
  coum[a%2019] += 1
coum[0] += 1
coum[int(s[-1])]+= 1
ans = 0
for i in coum:
    ans += i*(i-1)*0.5
print(int(ans))

Fixed submission:
s,w = map(int,input().split())
if s<=w:
  print("unsafe")
else:
  print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd 
from functools import reduce
import itertools
k = int(input())
a = [i for i in range(1,k+1)]
s =0
#同じ数字３つの時
s = int(k*(k+1)/2)
#同じ数字２つと違う数字一つ
for q in itertools.combinations(a,2):
  s += reduce(gcd,q)*3*2
for t in itertools.combinations(a,3):
  s += reduce(gcd,t)*6
print(s)

Fixed submission:
import math
from functools import reduce
import itertools
k = int(input())
a = [i for i in range(1,k+1)]
s =0
#同じ数字３つの時
s = int(k*(k+1)/2)
#同じ数字２つと違う数字一つ
for q in itertools.combinations(a,2):
  s += reduce(math.gcd,q)*3*2
for t in itertools.combinations(a,3):
  s += reduce(math.gcd,t)*6
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd 
from functools import reduce
import itertools
k = int(input())
a = [i for i in range(1,k+1)]
s = 0
for t in itertools.product(a,repeat=3):
  s += reduce(gcd,t)
print(s)

Fixed submission:
import math
from functools import reduce
import itertools
k = int(input())
a = [i for i in range(1,k+1)]
s =0
#同じ数字３つの時
s = int(k*(k+1)/2)
#同じ数字２つと違う数字一つ
for q in itertools.combinations(a,2):
  s += reduce(math.gcd,q)*3*2
for t in itertools.combinations(a,3):
  s += reduce(math.gcd,t)*6
print(s)
Buggy python submission (verdict: Runtime Error):
from collections import deque
k = int(input())
a = deque([1,2,3,4,5,6,7,8,9])
count=0
while count !=k:
  b = a.popleft()
  count += 1
  if b%10==0:
    a.append(b*10)
    a.append(b*10+1)
  elif b%10==9:
    a.append(b*10+8)
    a.append(b*10+9)
  else:
    a.append(b*10+b%10-1)
    a.append(b*10+b%10)
    a.append(b*10+b%10+1)
print(b)

Fixed submission:
n,k = map(int,input().split())
a = n%k
b = abs(a-k)
print(min(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA = list(map(int,input().split()))
count = 0
l_count = []
ll =[]
m = len(l_count)
for k in range(n):
  a = listA[k]
  for z in range(m):
    ll.append(l_count[z][0])
  if a in ll:
    print(l_count[z][1])
  else:
      del listA[k]
      A = set(listA)
      for i in A:
        c = listA.count(i)
        count += int(c*(c-1)/2)
      print(count)
      listA.insert(k,a)
      l_count.append([a,count])
      count = 0

Fixed submission:
from collections import Counter
n = int(input())
su = 0
l = list(map(int,input().split()))
l1 = Counter(l)
for k in l1.values():
  su += k*(k-1)//2
for t in l:
  a = l1[t]
  q = su-a*(a-1)//2+(a-1)*(a-2)//2
  print(q)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA = list(map(int,input().split()))
count = 0
for k in range(n):
  a = listA[k]
  del listA[k]
  A = set(listA)
  for i in A:
    c = listA.count(i)
    count += int(c*(c-1)/2)
  print(count)
  listA.insert(k,a)
  count = 0


Fixed submission:
from collections import Counter
n = int(input())
su = 0
l = list(map(int,input().split()))
l1 = Counter(l)
for k in l1.values():
  su += k*(k-1)//2
for t in l:
  a = l1[t]
  q = su-a*(a-1)//2+(a-1)*(a-2)//2
  print(q)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA = list(map(int,input().split()))
count = 0
for k in range(n):
  a = listA[k]
  listA.pop(k)
  A = set(listA)
  for i in A:
    c = listA.count(i)
    count += int(c*(c-1)/2)
  print(count)
  listA.insert(k,a)
  count = 0


Fixed submission:
from collections import Counter
n = int(input())
su = 0
l = list(map(int,input().split()))
l1 = Counter(l)
for k in l1.values():
  su += k*(k-1)//2
for t in l:
  a = l1[t]
  q = su-a*(a-1)//2+(a-1)*(a-2)//2
  print(q)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA = list(map(int,input().split()))
count = 0
for k in range(n):
  a = listA[k]
  listA.pop(k)
  #Aはset型で数の種類調べる
  A = list(set(listA))
  for i in A:
    c = listA.count(i)
    count += int(c*(c-1)/2)
  print(count)
  listA.insert(k,a)
  count = 0

Fixed submission:
from collections import Counter
n = int(input())
su = 0
l = list(map(int,input().split()))
l1 = Counter(l)
for k in l1.values():
  su += k*(k-1)//2
for t in l:
  a = l1[t]
  q = su-a*(a-1)//2+(a-1)*(a-2)//2
  print(q)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
listA = list(map(int,input().split()))
count = 0
for k in range(n):
  a = listA[k]
  listA.pop(k)
  #print(listA)
  #Aはset型で数の種類調べる
  A = list(set(listA))
  #print(A)
  for i in A:
    c = listA.count(i)
    #print(c)
    count += int(c*(c-1)/2)
  print(count)
  listA.insert(k,a)
  count = 0
  #print(listA)

Fixed submission:
from collections import Counter
n = int(input())
su = 0
l = list(map(int,input().split()))
l1 = Counter(l)
for k in l1.values():
  su += k*(k-1)//2
for t in l:
  a = l1[t]
  q = su-a*(a-1)//2+(a-1)*(a-2)//2
  print(q)
Buggy python submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
#print(a,b,c)
if ((a**2 + b**2 + c**2)**2 -4*((a*b+b*c+c*a)**2))/(a**2 + b**2 + c**2-2*(a*b+b*c+c*a)) >0:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c = list(map(int,input().split()))
if (c-a-b)**2 -4*a*b >0 and c-a-b>0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
#print(a,b,c)
if ((a**2 + b**2 + c**2)**2 -4*((a*b+b*c+c*a)**2))/(a**2 + b**2 + c**2-2*(a*b+b*c+c*a)) >0:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c = list(map(int,input().split()))
if (c-a-b)**2 -4*a*b >0 and c-a-b>0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c = list(map(int,input().split()))
if a**2 + b**2 + c**2 -2*(a*b +*b*c +*c*a) >0:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c = list(map(int,input().split()))
if (c-a-b)**2 -4*a*b >0 and c-a-b>0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
S = input()
if S =="hi" or S =="hihi" or S =="hihihi" or S = "hihihihi" or S ="hihihihihi":
	print("Yes")
else:
  print("No")

Fixed submission:
S = input()
if S =="hi" or S =="hihi" or S =="hihihi" or S == "hihihihi" or S =="hihihihihi":
	print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

sum = b + c

#何セットあるか確かめる
set = int(a / sum)
#print(set)

#セットの中にある青玉の個数
blue_1 = set * b 
#print(blue_1)

#最後のあまりを数える
amari = a % sum
#print(amari)

if amari <= b:
  print(blue_1 + amari)
  
else :
  print(blue_1 + b)

Fixed submission:
a,b,c = input()
if a==b==c:
  print('No')
 
else:
  print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
s = deque(input())
q = int(input())
l = list(list(input().split()) for _ in range(q))
for i in l:
  if len(i)==1:
    s.reverse()
  else:
    a,f,c = i
    if f=="1":
      s.appendleft(c)
    else:
      s.append(c)
      
print(*s,sep="")
      

Fixed submission:
from collections import deque
s = deque(input())
q = int(input())
l = list(list(input().split()) for _ in range(q))
t = 0
for i in l:
  if len(i)==1:
    t += 1
  else:
    a,f,c = i
    if (f=="1" and t%2==0) or (f=="2" and t%2==1) :
      s.appendleft(c)
    else:
      s.append(c)
if t%2==1:
  s.reverse()
print(*s,sep="")
Buggy python submission (verdict: Runtime Error):
N = input()

if N%2 ==0:
  ans = N%2
  print(ans)
  
else :
  ans = N%2 + 0.5
  print(int(ans))

Fixed submission:
N = int(input())

if N%2 ==0:
  ans = N/2
  print(int(ans))
  
else :
  ans = N/2 + 0.5
  print(int(ans))
Buggy python submission (verdict: Runtime Error):
#3つの数字をリストにする
data = input().split( )
#場合わけ
if (data[0] == data[1] or data[1] == data[2] or
   data[2] ==data[0]) and data[1]!= data[2]!=data[3] :
    print("Yes")

else:
    print("No")

Fixed submission:
#3つの数字をリストにする
data = input().split( )
#場合わけ
if (data[0] == data[1] or data[1] == data[2] or
   data[2] ==data[0]) and not data[1]== data[2]==data[0] :
    print("Yes")

else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c,d = map(int,input().split())
e =input()

If a = e;
		print(c-1,d)
		
else;
		print(c,d-1)

Fixed submission:
a,b = input().split()
c,d = map(int,input().split())
e =input()
 
if a == e:
		print(c-1,d)
		
else:
		print(c,d-1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
l = list(map(int,input().split()))
l = list((i+1)/2 for i in l)
#print(l)
ma = 0
for i in range(n-k+1):
  a = sum(l[i:k+i])
 # print(l[i:k+i],a)
  ma = max(ma,a)
print(ma)

Fixed submission:
from itertools import accumulate
n,k = map(int,input().split())
l = list(map(int,input().split()))
l = list((i+1)/2 for i in l)
rui = list(accumulate([0]+l))
#print(l)
#print(rui)
ma = 0
for i in range(n-k+1):
  a = rui[i+k]-rui[i]
  ma = max(ma,a)
print(ma)
Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
l = sorted(list(map(int,input().split())))[::-1]
for i in range(min(n,k)):
  l.pop(0)
print(sum(l))

Fixed submission:
n,k =map(int,input().split())
l = sorted(list(map(int,input().split())))[::-1]
print(sum(l[min(k,n):]))
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
if N = M:
		print('Yes')
else:
		print('No')

Fixed submission:
N,M = map(int,input().split())
if N == M:
		print('Yes')
else:
		print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
q = 0
a = 0
for i in l:
  a += 1
  if i<=min(l[:a]):
    q += 1
print(q)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
q = 1
a = l[0]
for i in range(1,n):
  a = min(l[i],a)
  if l[i]<=a:
    q += 1
print(q)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
new_l = []
q = 0
for i in l:
  new_l.append(i)
  a = min(new_l)
  if a==i:
    q += 1
print(q)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
q = 1
a = l[0]
for i in range(1,n):
  a = min(l[i],a)
  if l[i]<=a:
    q += 1
print(q)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
new_l = []
q = 0
for i in l:
  new_l.append(i)
  a = sorted(new_l)
  if a.index(i)==0:
    q += 1
print(q)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
q = 1
a = l[0]
for i in range(1,n):
  a = min(l[i],a)
  if l[i]<=a:
    q += 1
print(q)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
so_list = [0 for i in range(10**4)]
mod = 10**9+7

def fac(n):
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            if so_list[i]<cnt:
              so_list[i]= cnt
    if temp!=1:
      if so_list[temp]==0:
        so_list[temp]=1
for i in range(n):
  a1 = a[i]
  fac(a1)
l = 1
for i in range(len(so_list)):
  if so_list[i]!=0:
    l *= pow(i,so_list[i],mod)
    l %= mod
ans = 0
#print(l)
for i in a:
  t = pow(i,mod-2,mod)
  ans += (l*t)%mod
print(ans%mod)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
so_list = [0 for i in range(10**6)]
mod = 10**9+7

def fac(n):
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            if so_list[i]<cnt:
              so_list[i]= cnt
    if temp!=1:
    #  print(temp)
      if so_list[temp]==0:
        so_list[temp]=1
for i in range(n):
  a1 = a[i]
  fac(a1)
l = 1
for i in range(len(so_list)):
  if so_list[i]!=0:
    l *= pow(i,so_list[i],mod)
    l %= mod
ans = 0
#print(l)
for i in a:
  t = pow(i,mod-2,mod)
  ans += (l*t)%mod
print(ans%mod)
Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
cou = n
l_h = []
for i in range(n):
  x,l  = map(int,input().split())
  l_h.append([x-l,x+l])
l_h.sort(key=lambda x: x[1])
d = deque(l_h)
t= d.popleft()
a,b = t[0],t[1]
for i in range(n-1):
  m= d.popleft()
  c,e= m[0],m[1]
  if b<=c:
    b = d
  else:
    cou -= 1
print(cou)

Fixed submission:
from collections import deque
n = int(input())
cou = n
l_h = []
for i in range(n):
  x,l  = map(int,input().split())
  l_h.append([x-l,x+l])
l_h.sort(key=lambda x: x[1])
d = deque(l_h)
t= d.popleft()
a,b = t[0],t[1]
for i in range(n-1):
  m= d.popleft()
  c,e= m[0],m[1]
  if b<=c:
    b = e
  else:
    cou -= 1
print(cou)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(list(map(int,input().split())) for _in range(n))
x = input()
bit = 0
su = 0
for j,k in l:
  if j==x:
    bit = 1
  if bit==1:
    su += k
print(su)

Fixed submission:
n = int(input())
l = list(list(map(str,input().split())) for _ in range(n))
x = input()
bit = 0
su = 0
for j,k in l:
  if j==x:
    bit = 1
    su -= int(k)
  if bit==1:
    su += int(k)
print(su)
Buggy python submission (verdict: Runtime Error):
a,b = [i for i in int(input())]
if a+b =3:
		print(3)
		
elif  a+b = 4:
		print(2)

else:
		print(1)

Fixed submission:
a= int(input())
b= int(input())
if a+b ==3:
		print(3)
		
elif  a+b == 4:
		print(2)
 
else:
		print(1)

Buggy python submission (verdict: Runtime Error):
a,b = [int(input()) in i for range(2)]
if a+b =3:
		print(3)
		
elif  a+b = 4:
		print(2)

else:
		print(1)

Fixed submission:
a= int(input())
b= int(input())
if a+b ==3:
		print(3)
		
elif  a+b == 4:
		print(2)
 
else:
		print(1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S,T = map(int,input().split())
l=[]
for i in range(N):
  l.append(S[i])
  l.append(T[i])
print("".join(l))

Fixed submission:
N = int(input())
S,T = map(str,input().split())
l=[]
for i in range(N):
  l.append(S[i])
  l.append(T[i])
print("".join(l))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if a+b+c = 22:
		print("bust")
		
else:
		print("win")

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c >= 22:
		print("bust")
		
else:
		print("win")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
cou = 0
for i in range(1000):
  i = "{0:03d}".format(i)
  a,b,c = i[0],i[1],i[2]
  for j in range(n):
    if s[j]==a and bit==0:
      for k in range(j+1,n):
        if s[k]==b :
          for m in range(k+1,n):
            if s[m]==c :
              cou += 1
            
print(cou)

Fixed submission:
a,b = map(int,input().split())
c,d = map(int,input().split())
if ((a+1)==c or (a==12 and c==1)):
  if d ==1:
    print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
mi = 0
ma = 10**9+1
while ma-mi>1:
  me = int((mi+ma)/2)
  if a*me+b*len(str(me))<=x:
    mi = me
  else:
    ma = me
print(mi)

Fixed submission:
a = input()
if a == "SAT":
		print(1)
		
elif a == "FRI" :
		print(2)
		
elif a == "THU" :
		print(3)
			
elif a == "WED" :
		print(4)		
		
elif a == "TUE" :
		print(5)		
	
elif a == "MON" :
		print(6)

else :
		print(7)
Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split())
mod = 10**9+7
if (2*x-y)%3!=0 and (2*y-x)!=0:
  print(0)
  exit()
n = (2*x-y)//3
m = (2*y-x)//3
#n+mCm
if n==0 or m==0:
  print(1)
  exit()
def ka(x):
  a = 1
  while x!=1:
    a *= x
    x -= 1
    a%= mod
  return a

ans = (ka(n+m)*pow(ka(m),mod-2,mod)%mod)*(pow(ka(n),mod-2,mod))%mod
print(ans)

Fixed submission:
x,y = map(int,input().split())
mod = 10**9+7
if (x+y)%3!=0:
  print(0)
  exit()
if 2*min(x,y)<max(x,y):
  print(0)
  exit()
n = (2*x-y)//3
m = (2*y-x)//3
#n+mCm
if n==0 or m==0:
  print(1)
  exit()
def ka(x):
  a = 1
  while x!=1:
    a *= x
    x -= 1
    a%= mod
  return a

ans = (ka(n+m)*pow(ka(m),mod-2,mod)%mod)*(pow(ka(n),mod-2,mod))%mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split())
mod = 10**9+7
if (2*x-y)%3!=0 and (2*y-x)!=0:
  print(0)
  exit()
n = (2*x-y)//3
m = (2*y-x)//3
#n+mCm
if n==0 or m==0:
  print(1)
  exit()
def ka(x):
  a = 1
  while x!=1:
    a *= x
    x -= 1
    a%= mod
  return a

ans = (ka(n+m)*pow(ka(m),mod-2,mod)*pow(ka(n),mod-2,mod))%mod
print(ans)

Fixed submission:
x,y = map(int,input().split())
mod = 10**9+7
if (x+y)%3!=0:
  print(0)
  exit()
if 2*min(x,y)<max(x,y):
  print(0)
  exit()
n = (2*x-y)//3
m = (2*y-x)//3
#n+mCm
if n==0 or m==0:
  print(1)
  exit()
def ka(x):
  a = 1
  while x!=1:
    a *= x
    x -= 1
    a%= mod
  return a

ans = (ka(n+m)*pow(ka(m),mod-2,mod)%mod)*(pow(ka(n),mod-2,mod))%mod
print(ans)

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
mod = 10**9+7

mx = 10**6
fact = [1]*(mx+1)
for i in range(mx):
  fact[i+1] = fact[i]*(i+1)%mod
def inv(n):
  return pow(n,mod-2,mod)
if (x%3==0 and y%3==0) or (x%3==1 and y%3==2) or (x%3==2 and y%3==1):
  n = int(2*x/3-y/3)
  m = int(-x/3 + 2*y/3)
  s += fact[n+m]*inv(fact[n])*inv(fact[m])%mod
  print(s)
else:
  print(0)
 

Fixed submission:
x,y = map(int,input().split())
mod = 10**9+7
if (x+y)%3!=0:
  print(0)
  exit()
if 2*min(x,y)<max(x,y):
  print(0)
  exit()
n = (2*x-y)//3
m = (2*y-x)//3
#n+mCm
if n==0 or m==0:
  print(1)
  exit()
def ka(x):
  a = 1
  while x!=1:
    a *= x
    x -= 1
    a%= mod
  return a

ans = (ka(n+m)*pow(ka(m),mod-2,mod)%mod)*(pow(ka(n),mod-2,mod))%mod
print(ans)