Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

p.sort(key=lambda x: x[1])
r = ''
q = [x[0] for x in p]
for i in range(n) :
    r = r + ' ' + str(q[i])

print (r)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

p.sort(key=lambda x: x[1])
q = list(map(str,[x[0] for x in p]))
r = ' '.join(q)


print (r)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

p.sort(key=lambda x: x[1])
r = ''
q = [x[0] for x in p]
for i in range(n) :
    r = r + ' ' + str(q[i])

print (r)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

p.sort(key=lambda x: x[1])
q = list(map(str,[x[0] for x in p]))
r = ' '.join(q)


print (r)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

p.sort(key=lambda x: x[1])
r = ''
for i in range(n) :
    r = r + ' ' + str(p[i][0])

print (r)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

p.sort(key=lambda x: x[1])
q = list(map(str,[x[0] for x in p]))
r = ' '.join(q)


print (r)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

r = ''
for i in range(n) :
    for j in range(n) :
        if p[j][1] == (i + 1) :
            r = r + ' ' + str(p[j][0])

print (r)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
p =[]
for i in range(n) :
    p.append([i+1,a[i]])

p.sort(key=lambda x: x[1])
q = list(map(str,[x[0] for x in p]))
r = ' '.join(q)


print (r)
Buggy python submission (verdict: Runtime Error):
x = int(raw_input())
for i in range(-120 , 120):
  for j in range(-120 , 120):
    if(math.pow(i , 5) - math.pow(j , 5) == x):
      print(i , " " , j)
      break

Fixed submission:
import math
x = int(input())
foo = 0;
for i in range(-120 , 120):
  if foo == 1:
      break;
  for j in range(-120 , 120):
    if(math.pow(i , 5) - math.pow(j , 5) == x):
      print(i , " " , j)
      foo = 1;
      break;

Buggy python submission (verdict: Runtime Error):
x = int(raw_input())
for i in range(-100 , 100):
  for j in range(-100 , 100):
    if(math.pow(i , 5) - math.pow(j , 5) == x):
      print(i , " " , j)
      break

Fixed submission:
import math
x = int(input())
foo = 0;
for i in range(-120 , 120):
  if foo == 1:
      break;
  for j in range(-120 , 120):
    if(math.pow(i , 5) - math.pow(j , 5) == x):
      print(i , " " , j)
      foo = 1;
      break;
Buggy python submission (verdict: Runtime Error):
s = inport()
print("ABC" if s=="ARC" else "ARC")

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

Buggy python submission (verdict: Runtime Error):
inpo=inport()
for i in inpo:
  if i=="B":
    print("R",end="")
  elif i=="R":
    print("B",end="")
  else:
    print(i,end="")

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

Buggy python submission (verdict: Runtime Error):
inpo=inport()
for i in inpo:
  if i=="B":
    print("R",end="")
  elif i=="R":
    print("B",end="")
  else:
    print(i)

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

Buggy python submission (verdict: Runtime Error):
inpo=inport()
for i in inpo:
  if i=="B":
    print("R")
  elif i=="R":
    print("B")
  else:
    print(i)

Fixed submission:
s = input()
print("ABC" if s=="ARC" else "ARC")
Buggy python submission (verdict: Runtime Error):
K=input()
a,b=map(int,input().split())
p=1
for i in range(a,b+1):
  if i%K==0:
    print("OK")
    p=0
    break
if p==1:
  print("NG")
    

Fixed submission:
K=int(input())
a,b=map(int,input().split())
p=1
for i in range(a,b+1):
  if i%K==0:
    print("OK")
    p=0
    break
if p==1:
  print("NG")

Buggy python submission (verdict: Runtime Error):
K=input()
a,b=map(int,inport().split())
p=1
for i in range(a,b+1):
  if i%K==0:
    print("OK")
    p=0
    break
if p==1:
  print("NG")
    

Fixed submission:
K=int(input())
a,b=map(int,input().split())
p=1
for i in range(a,b+1):
  if i%K==0:
    print("OK")
    p=0
    break
if p==1:
  print("NG")
Buggy python submission (verdict: Runtime Error):
R=int(input())
print(2*π*R)

Fixed submission:
r=int(input())
import math
print(2*math.pi*r)

Buggy python submission (verdict: Runtime Error):
R=int(inport())
print(R**2)

Fixed submission:
r=int(input())
import math
print(2*math.pi*r)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())

print((a+b)*h/2)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
print((a+b)*h/2)


Fixed submission:
a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))
Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b,c = map(int,input().split())
if np.sqrt(c) - np.sqrt(a) - np.sqrt(b) > 0:
  print('Yes')
else:
  print('No')

Fixed submission:
k = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split)
print(h*w-(h*w//2))

Fixed submission:
h,w = map(int,input().split())
if min(h,w) == 1:
	print(1)
else:
	print(h*w-(h*w//2))
Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b,c = map(int,input().split())
if np.sqrt(c) - np.sqrt(a) - np.sqrt(b) > 0
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c = map(int,input().split())
if (c-a-b > 0) & (4*a*b < (c-a-b) ** 2):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
ans = [l.index(i)+1 for i in range(1,n+1)]
print(' '.join(map(str,ans)))

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
n = [i for i in range(1,n+1)]
d = dict(zip(l,n))
print(' '.join(map(str,list(d.values()))))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
ans = [str(l.index(i)+1) for i in range(1,n+1)]
print(' '.join(ans))

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
n = [i for i in range(1,n+1)]
d = dict(zip(l,n))
print(' '.join(map(str,list(d.values()))))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
r,g,b,n = map(int,input().split())
r_max,g_max,b_max = int(n/r),int(n/g),int(n/b)
ans = 0
for i,j,k in itertools.product(range(0,r_max+1),range(0,g_max+1),range(0,b_max+1)):
  if i*r+j*g+b*k == n:
    ans+=1  
print(ans)

Fixed submission:
import itertools
r,g,b,n = map(int,input().split())
r_max,g_max,b_max = int(n/r),int(n/g),int(n/b)
ans = 0
for i,j in itertools.product(range(0,r_max+1),range(0,g_max+1)):
  if (n - (i*r+j*g))%b == 0 and n - (i*r+j*g) >= 0:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
r,g,b,n = map(int,input().split())
r_max,g_max,b_max = int(n/r),int(n/g),int(n/b)
ans = 0
for i,j,k in itertools.product(range(0,r_max+1),range(0,g_max+1),range(0,b_max+1)):
  if i*r+j*g+b*k == n:
    ans+=1  
print(ans)

Fixed submission:
import itertools
r,g,b,n = map(int,input().split())
r_max,g_max,b_max = int(n/r),int(n/g),int(n/b)
ans = 0
for i,j in itertools.product(range(0,r_max+1),range(0,g_max+1)):
  if (n - (i*r+j*g))%b == 0 and n - (i*r+j*g) >= 0:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())
r_max,g_max,b_max = int(n/r),int(n/g),int(n/b)
ans = 0
for i in range(0,r_max+1):
  for j in range(0,g_max+1):
    for k in range(0,b_max+1):
      if i*r+j*g+b*k == n:
        ans+=1  
print(ans)

Fixed submission:
import itertools
r,g,b,n = map(int,input().split())
r_max,g_max,b_max = int(n/r),int(n/g),int(n/b)
ans = 0
for i,j in itertools.product(range(0,r_max+1),range(0,g_max+1)):
  if (n - (i*r+j*g))%b == 0 and n - (i*r+j*g) >= 0:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
l = len(S)
while True:
  S_ = S.replace('01','').replace('10','')
  if S_ != S:
  	S = S_
  else:
    break
print(l-len(S))

Fixed submission:
S = input()
print(min(S.count('0'),S.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
l = len(S)
#table = str.maketrans({'01':'','10':''})
while True:
  S_ = S.replace('01','').replace('10','')
  if S_ != S:
  	S = S_
  else:
    break
print(l-len(S))

Fixed submission:
S = input()
print(min(S.count('0'),S.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
import re
S = input()
l = len(S)
r = re.compile('01|10')
while True:
  S_ = r.sub('',S)
  if S_ == S:
  	break
  else:
    S = S_ 
print(l-len(S))

Fixed submission:
S = input()
print(min(S.count('0'),S.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
import re
S = input()
l = len(S)
while True:
  if re.sub('01|10','',S) == S:
  	break
  else:
    S = re.sub('01|10','',S)
print(l-len(S))

Fixed submission:
S = input()
print(min(S.count('0'),S.count('1'))*2)

Buggy python submission (verdict: Runtime Error):
import re
S = input()
l = len(S)
while True:
  if re.sub('01|10','',S) == S
  	break
  else:
    S = re.sub('01|10','',S)
print(l-len(S))

Fixed submission:
S = input()
print(min(S.count('0'),S.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
import re
S = input()
a = S
while True:
  b = re.sub('01|10','',a)
  if len(a) == len(b):
    break
  else:
    a = b
print(len(S)-len(a))

Fixed submission:
S = input()
print(min(S.count('0'),S.count('1'))*2)
Buggy python submission (verdict: Runtime Error):
from fraction import gcd
from functools import reduce
n = int(input())
print(reduce(gcd,map(int,input().split())))

Fixed submission:
from fractions import gcd
from functools import reduce
n = int(input())
print(reduce(gcd,map(int,input().split())))

Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce
n = int(input())
print(reduce(gcd,map(int,input().split())))

Fixed submission:
from fractions import gcd
from functools import reduce
n = int(input())
print(reduce(gcd,map(int,input().split())))

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
ans = min(l)
if ans == 1:
    print(ans)
else:
    l_set = set(l)
    for i in range(n):
        for j in range(i,n):
            if l[i] % l[j] != 0 :
                l_set.add(l[i] % l[j] )
    l_set = sorted(list(l_set))
    print(min([l_set[i+1] - l_set[i] for i in range(len(l_set)-1)]))

Fixed submission:
from fractions import gcd
from functools import reduce
n = int(input())
print(reduce(gcd,map(int,input().split())))
Buggy python submission (verdict: Runtime Error):
n_dic = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
n,m = map(int,input().split())
l = list(map(int,input().split()))
dic = {}
for i in l:
    if n_dic[i] not in dic or dic[n_dic[i]] < i:
        dic[n_dic[i]] = i
if n % min(dic) == 0:
    ans = str(dic[min(dic)]) * int(n / min(dic))
else:
    ans = str(dic[min(dic)]) * int(n / min(dic))
    sub = n - min(dic) * int(n / min(dic))
    ind = 0
    while sub > 0 and ind < len(ans):
        dif = 0
        v = int(ans[ind])
        for i in range(min(dic) + 1,min(dic) + sub + 1):
            if i in dic and int(dic[i]) > v:
                v = dic[i]
                dif = i - min(dic)
        sub -= dif
        ans = ans[:ind] + str(v) + ans[ind+1:]
        ind += 1
ind = 1
while sub != 0:
    for i in range(sub):
        if min(dic) + sub - i in dic:
            ans = ans[:-ind] + str(dic[min(dic) + sub - i]) + ans[len(ans) - ind + 1:]
            sub -= sub-i
            break
    ind += 1
print(ans)

Fixed submission:
n,m = map(int, input().split())
a = [int(a) for a in input().split()]
l = [0,2,5,5,4,5,6,3,7,6]
a.sort(reverse=True)
dp = [0]+[-1]*n
for i in range(1,n+1):
    for j in a:
        if l[j] <= i:
            dp[i] = max(dp[i], dp[i-l[j]]*10+j)
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
 
ans = [0] * n
ans[1] = abs(h[1] - h[0])
for i in range(2,n):
  ans[i] = min(abs(h[i] - h[i-1]) + ans[i-1], abs(h[i] - h[i-2]) + ans[i-2])
print(a[-1])

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
ans = [0] * n
ans[1] = abs(h[1] - h[0])
for i in range(2,n):
  ans[i] = min(abs(h[i] - h[i-1]) + ans[i-1], abs(h[i] - h[i-2]) + ans[i-2])
print(ans[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int,input().split()))
if n == 2:
    print(abs(h[0]-h[1]))
else:
    lst = set(map(lambda x : format(x,'b').zfill(n-2) + '1',set(range((n-2) ** 2))))
    del_lst = set()
    for i in lst:
        if '00' in i:
            del_lst.add(i)
    lst = list(lst - del_lst) 
    ans =[[h[0],0] for i in range(len(lst))]

    for i in range(len(lst)):
        k = 1
        for j in lst[i]:
            if j == '1':
                ans[i][1] += abs(h[k] - ans[i][0])
                ans[i][0] = h[k]
            k += 1
    print(min(ans)[1])

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
ans = [0] * n
ans[1] = abs(h[1] - h[0])
for i in range(2,n):
  ans[i] = min(abs(h[i] - h[i-1]) + ans[i-1], abs(h[i] - h[i-2]) + ans[i-2])
print(ans[-1])
Buggy python submission (verdict: Time Limit Exceeded):
S= input()
print(sum([S[:i].count('B') for i in range(len(S)) if S[i]=='W']))

Fixed submission:
S= input()
b = 0
ans = 0
for i in S:
  if i =='W':
    ans+=b
  else:
    b+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S= input()
print(sum([S[:i].count('B') for i in range(len(S)) if S[i]=='W']))

Fixed submission:
S= input()
b = 0
ans = 0
for i in S:
  if i =='W':
    ans+=b
  else:
    b+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
print(sum([1 if str(i).count('3') > 0 and str(i).count('5') > 0 and str(i).count('7') > 0 and len(str(i)) == str(i).count('3') + str(i).count('5') + str(i).count('7') else 0 for i in range(1,n+1)]))

Fixed submission:
import itertools
n = int(input())
l = []
l.extend(list(itertools.product([3,5,7], repeat=i)) for i in range(3,10))
l = [int("".join(map(str,j))) for i in l for j in i if 7 in j and 5 in j and 3 in j]
print(sum([1 for i in l if n>=i]))
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
l = []
for i in range(m):
    l.append(list(map(int,input().split())))
l2 = l.copy()
l2.sort()
p = 0
l3 = []
for i in l2:
    if i[0] != p:
        p = i[0]
        x = 1
    else:
        x += 1
    l3.append(str(i[0]).zfill(6)+ str(x).zfill(6))
for i in l:
    print(l3[l2.index(i)])

Fixed submission:
import numpy as np
n, m = map(int,input().split())
l = [list(map(int,input().split()))+ [0] for i in range(m)]
l2 = sorted(l)
p = 0
for i in l2:
    x = 1 if i[0] != p else x + 1
    p = i[0]
    i[2] = x
for i in l:
    print(str(i[0]).zfill(6)+str(i[2]).zfill(6))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int,input().split())
l = []
for i in range(m):
    l.append(list(map(int,input().split())))
l2 = l.copy()
l2.sort()
p = 0
l3 = []
for i in l2:
    if i[0] != p:
        p = i[0]
        x = 1
    else:
        x += 1
    l3.append(str(i[0]).zfill(6)+ str(x).zfill(6))
for i in l:
    print(l3[l2.index(i)])

Fixed submission:
import numpy as np
n, m = map(int,input().split())
l = [list(map(int,input().split()))+ [0] for i in range(m)]
l2 = sorted(l)
p = 0
for i in l2:
    x = 1 if i[0] != p else x + 1
    p = i[0]
    i[2] = x
for i in l:
    print(str(i[0]).zfill(6)+str(i[2]).zfill(6))
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
l = 0
for i in S:
  if i == '1':
    l+=1
  	if l >= K:
      print(1)
      break
  else:
    print(int(i))
    break
    

Fixed submission:
S = input()
K = int(input())
l = 0
for i in S:
  if i == '1':
    l+=1
    if l >= K:
      break
  else:
    break
print(i)

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
l = 0
for i in S:
  if i == '1':
    l+=1
  	if l >= K:
      print(1)
      break
  else:
    print(i)
    break
    

Fixed submission:
S = input()
K = int(input())
l = 0
for i in S:
  if i == '1':
    l+=1
    if l >= K:
      break
  else:
    break
print(i)
Buggy python submission (verdict: Runtime Error):
S = int(input())
print('AC' if S[0] == 'A' and S[2:-1].count('C') == 1 and S[1:].replace('C','').islower() else 'WA')
  

Fixed submission:
S = input()
print('AC' if S[0] == 'A' and S[2:-1].count('C') == 1 and S[1] != 'C' and S[1:].replace('C','').islower() else 'WA')
Buggy python submission (verdict: Time Limit Exceeded):
def counter(flag,st):
  count = 0
  if st == '':
    return count
  for i in range(len(st)):
    if not st[i] in flag:
      flag+=st[i]
      count += 1
      if count > 10**9:
        count%=10**9+7
      if i < len(st)-1:
        count += counter(flag,st[i+1:])
      flag.pop(-1)
  return count

N = int(input())
S = input()

cnt = counter([],S)
print(cnt)

Fixed submission:
N = int(input())
S = input()
charCnt = []
flag = {}
for c in S:
  if not c in flag:
    flag[c] = 1
    charCnt.append([c,1])
  else :
    flag[c] += 1
    for i in range(len(charCnt)):
      if charCnt[i][0] == c:
        charCnt[i][1] += 1
        break

cnt = 1
for i in range(len(charCnt)):
  cnt *= (charCnt[i][1]+1)
cnt -= 1
cnt %= 10**9+7
print(cnt)
Buggy python submission (verdict: Runtime Error):
tmp = input()
N = int(input().split(' ')[0])
M = int(input().split(' ')[1])
C = int(input().split(' ')[2])
B = [int(b) for b in input().split(' ')]
cnt = 0
for i in range(N):
  A = [int(a) for a in input().split(' ')]
  sum = 0
  for j in range(M):
    sum += B[j]*A[j]
  sum += C
  if C > 0:
    cnt += 1
print(cnt)

Fixed submission:
tmp = input()
N = int(tmp.split(' ')[0])
M = int(tmp.split(' ')[1])
C = int(tmp.split(' ')[2])
B = [int(b) for b in input().split(' ')]
cnt = 0
for i in range(N):
  A = [int(a) for a in input().split(' ')]
  sum = C
  for j in range(M):
    sum += B[j]*A[j]
  if sum > 0:
    cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
tmp = input()
N = int(input().split()[0])
M = int(input().split()[1])
C = int(input().split()[2])
B = [int(b) for b in input().split()]
cnt = 0
for i in range(N):
  A = [int(a) for a in input().split()]
  sum = 0
  for j in range(M):
    sum += B[j]*A[j]
  sum += C
  if C > 0:
    cnt += 1
print(cnt)

Fixed submission:
tmp = input()
N = int(tmp.split(' ')[0])
M = int(tmp.split(' ')[1])
C = int(tmp.split(' ')[2])
B = [int(b) for b in input().split(' ')]
cnt = 0
for i in range(N):
  A = [int(a) for a in input().split(' ')]
  sum = C
  for j in range(M):
    sum += B[j]*A[j]
  if sum > 0:
    cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
tmp = input()
N = int(input().split()[0])
M = int(input().split()[1])
C = int(input().split()[2])
tmp = input()
B = [int(b) for b in tmp.split()]
cnt = 0
for i in range(N):
  tmp = input()
  A = [int(a) for a in tmp.split()]
  sum = 0
  for j in range(M):
    sum += B[j]*A[j]
  sum += C
  if C > 0:
    cnt += 1
print(cnt)


Fixed submission:
tmp = input()
N = int(tmp.split(' ')[0])
M = int(tmp.split(' ')[1])
C = int(tmp.split(' ')[2])
B = [int(b) for b in input().split(' ')]
cnt = 0
for i in range(N):
  A = [int(a) for a in input().split(' ')]
  sum = C
  for j in range(M):
    sum += B[j]*A[j]
  if sum > 0:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
A = []
B = []
for i in range(N):
	tmp = input()
	A.append(int(tmp.split()[0]))
	B.append(int(tmp.split()[1]))

cnt=0
total=0
while cnt < M:
	mini = N
	minv = 999999999999999
	for i in range(N):
		if minv > A[i]:
			minv = A[i]
			mini = i
	cnt += B[mini]
	total += A[mini]*B[mini]
	A[mini] = 9999999999999999
total -= minv*(cnt-M)
print(total)

Fixed submission:
tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
AB = []
for i in range(N):
	tmp = input()
	AB.append([int(tmp.split()[0]),int(tmp.split()[1])])

AB.sort()

cnt=0
total=0
i = 0
while cnt < M:
	cnt += AB[i][1]
	total += AB[i][0]*AB[i][1]
	i+=1
total -=  AB[i-1][0]*(cnt-M)
print(total)

Buggy python submission (verdict: Runtime Error):
tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
A = []
B = []
for i in range(N):
	tmp = input()
	A[i] = int(tmp.split()[0])
	B[i] = int(tmp.split()[1])

cnt=0
total=0
while cnt < M:
	mini = N
	minv = 999999999999999
	for i in range(N):
		if minv > A[i]:
			minv = A[i]
			mini = i
	cnt += B[mini]
	total += A[mini]*B[mini]
	A[mini] = 999999999999999
total -= minv*(cnt-M)
print(total)

Fixed submission:
tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
AB = []
for i in range(N):
	tmp = input()
	AB.append([int(tmp.split()[0]),int(tmp.split()[1])])

AB.sort()

cnt=0
total=0
i = 0
while cnt < M:
	cnt += AB[i][1]
	total += AB[i][0]*AB[i][1]
	i+=1
total -=  AB[i-1][0]*(cnt-M)
print(total)

Buggy python submission (verdict: Runtime Error):
tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
A = []
B = []
for i in range(N):
	tmp = input()
	A[i] = int(tmp.split()[0])
	B[i] = int(tmp.split()[1])

minv = 100000000000
cnt=0
total=0
while cnt < M:
	mini = N
	for i in range(N):
		if minv > A[i]:
			minv = A[i]
			mini = i
	cnt += B[mini]
	total = A[mini]*B[mini]
	A[mini] = 1000000000000
total -= minv*(cnt-M)
print(total)

Fixed submission:
tmp = input()
N = int(tmp.split()[0])
M = int(tmp.split()[1])
AB = []
for i in range(N):
	tmp = input()
	AB.append([int(tmp.split()[0]),int(tmp.split()[1])])

AB.sort()

cnt=0
total=0
i = 0
while cnt < M:
	cnt += AB[i][1]
	total += AB[i][0]*AB[i][1]
	i+=1
total -=  AB[i-1][0]*(cnt-M)
print(total)
Buggy python submission (verdict: Runtime Error):
tmp = input()
A = int(tmp.split()[0])
B = int(tmp.split()[1])
 
res = 0
if A%2 == 0:
	if B%2 == 0:
		res = B^((B-A)/2%2)
	else :
		res = (B-A+1)/2%2
else :
	if B%2 == 0:
		res = A^B^((B-A-1)/2%2)
	else :
		res = A^((B-A)/2%2)

print(res)

Fixed submission:
tmp = input()
A = int(tmp.split()[0])
B = int(tmp.split()[1])
 
res = 0
if A%2 == 0:
	if B%2 == 0:
		res = B^(int((B-A)/2)%2)
	else :
		res = int((B-A+1)/2)%2
else :
	if B%2 == 0:
		res = A^B^(int((B-A-1)/2)%2)
	else :
		res = A^(int((B-A)/2)%2)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
tmp = input()
A = int(tmp.split()[0])
B = int(tmp.split()[1])
 
res = 0
while A <= B:
  res = res^A
  A += 1
print(res)

Fixed submission:
tmp = input()
A = int(tmp.split()[0])
B = int(tmp.split()[1])
 
res = 0
if A%2 == 0:
	if B%2 == 0:
		res = B^(int((B-A)/2)%2)
	else :
		res = int((B-A+1)/2)%2
else :
	if B%2 == 0:
		res = A^B^(int((B-A-1)/2)%2)
	else :
		res = A^(int((B-A)/2)%2)
print(res)
Buggy python submission (verdict: Runtime Error):
import math
X = 2*R*math.pi

Fixed submission:
import math
R = int(input())
print(2*math.pi*R)

Buggy python submission (verdict: Runtime Error):
input_line = int(input(R))
gaishuu = 2*3.1415*input_line
input(gaishuu)

Fixed submission:
import math
R = int(input())
print(2*math.pi*R)

Buggy python submission (verdict: Runtime Error):
X = 2*3.1415926535*R
print(X)

Fixed submission:
import math
R = int(input())
print(2*math.pi*R)
Buggy python submission (verdict: Runtime Error):
import math

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

for i in range(n):
    if i == 0:
        b = a[1:]
    elif i == n-1:
        b = a[:n-1]
    else:
        tmp1 = a[:i]
        tmp2 = a[i+1:]
        b = []
        b.extend(tmp1)
        b.extend(tmp2)
    current = b[0]
    for j in range(n-1):
        current = math.gcd(current, b[j])
    if max < current:
        max = current
print(max)


Fixed submission:
a, b, t = map(int, input().split())
times = t // a
print(times*b)