Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def(x)
 if x == 1
  return 0
return 1

Fixed submission:
x = int ( input() )
if x==1:
  print (0)
  
else :
  print (1)

Buggy python submission (verdict: Runtime Error):
x=input()
if x==1:
  print("0")
elif x==0:
  print("1")
else:
  break

Fixed submission:
x=int(input())
if x==1:
  print("0")
if x==0:
  print("1")

Buggy python submission (verdict: Runtime Error):
x=include("xを入力してください")
if x==1:
  print("0")
else:
  print("1")

Fixed submission:
x=int(input())
if x==1:
  print("0")
if x==0:
  print("1")

Buggy python submission (verdict: Runtime Error):
x=input(xを入力してください)
if x==1:
  print("0")
 elif x==0:
  print("1")

Fixed submission:
x=int(input())
if x==1:
  print("0")
if x==0:
  print("1")
Buggy python submission (verdict: Runtime Error):
a,b,c,d=input().split( )
line[n]
x=int(b)
y=int(d)
print(x*y)

Fixed submission:
a,b,c,d=map(int,input().split( ))
print(max(a*d,b*c,a*c,b*d))

Buggy python submission (verdict: Runtime Error):
n=input()
line[n]
x=int(line[1])
y=int(line[3])
print(x*y)

Fixed submission:
a,b,c,d=map(int,input().split( ))
print(max(a*d,b*c,a*c,b*d))
Buggy python submission (verdict: Runtime Error):
input(a)
if a == '0':
  print('1')
elif a == '1':
  print('0')

Fixed submission:
a = input()
if a == '0':
  print('1')
elif a == '1':
  print('0')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')

Fixed submission:
a,b,c = map(int, input().split())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')

Buggy python submission (verdict: Runtime Error):
a = input()
a = [int(a)]
b = a[1]*a[2]
if b >= a[0]:
  print('Yes')
elif b < a[0]:
  print('No')

Fixed submission:
a,b,c = map(int, input().split())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')

Buggy python submission (verdict: Runtime Error):
a = int([input()])
b = a[1]*a[2]
if b >= a[0]:
  print('Yes')
elif b < a[0]:
  print('No')

Fixed submission:
a,b,c = map(int, input().split())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')

Buggy python submission (verdict: Runtime Error):
a = int[input()]
b = a[1]*a[2]
if b >= a[0]:
  print('Yes')
elif b < a[0]:
  print('No')

Fixed submission:
a,b,c = map(int, input().split())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')

Buggy python submission (verdict: Runtime Error):
a = [input()]
b = a[1]*a[2]
if b >= a[0]:
  print('Yes')
elif b < a[0]:
  print('No')

Fixed submission:
a,b,c = map(int, input().split())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')
Buggy python submission (verdict: Runtime Error):
a=input()
if a=='1':
  print('0')
 else:
  print('1')

Fixed submission:
a=input()
if a=='1':
  print('0')
if a=='0':
  print('1')
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e = (int(x) for i in input().split())
if a == 0:
  print(1)
if b == 0:
  print(2)
if c == 0:
  print(3)
if d == 0:
  print(4)
if e == 0:
  print(5)
  

Fixed submission:
a,b,c,d,e = (int(i) for i in input().split())
if a == 0:
  print(1)
if b == 0:
  print(2)
if c == 0:
  print(3)
if d == 0:
  print(4)
if e == 0:
  print(5)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    b = list(reversed(b))
    bad = next((x for x, y in zip(a, b) if x == y), None)
    if bad is None:
        print(' '.join(map(str, b)))
    else:
        l_1 = sum(1 for x, y in zip(a, b) if x < y and y != bad)
        l_2 = sum(1 for x, y in zip(a, b) if x < y and y == bad)
        l_3 = sum(1 for x, y in zip(a, b) if x == y)
        l_4 = sum(1 for x, y in zip(a, b) if x > y and x == bad)
        l_5 = sum(1 for x, y in zip(a, b) if x > y and x != bad)
        if l_3 > l_1 + l_5:
            print('No')
        else:
            good_part = b[:l_1] + b[l_1 + l_2 + l_3 + l_4:]
            bad_part = b[l_1 + l_2:l_1 + l_2 + l_3]
            b[l_1 + l_2:l_1 + l_2 + l_3] = good_part[:l_3]
            good_part[:l_3] = bad_part
            b[:l_1] = good_part[:l_1]
            b[l_1 + l_2 + l_3 + l_4:] = good_part[l_1:]
            assert all(x != y for x, y in zip(a, b))
            print('Yes')
            print(' '.join(map(str, b)))


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    b = list(reversed(b))
    bad = next((x for x, y in zip(a, b) if x == y), None)
    if bad is None:
        print('Yes')
        print(' '.join(map(str, b)))
    else:
        l_1 = sum(1 for x, y in zip(a, b) if x < bad < y)
        l_2 = sum(1 for x, y in zip(a, b) if x < y and bad in (x, y))
        l_3 = sum(1 for x, y in zip(a, b) if x == y)
        l_4 = sum(1 for x, y in zip(a, b) if x > y and bad in (x, y))
        l_5 = sum(1 for x, y in zip(a, b) if x > bad > y and x != bad)
        if l_3 > l_1 + l_5:
            print('No')
        else:
            good_part = b[:l_1] + b[l_1 + l_2 + l_3 + l_4:]
            bad_part = b[l_1 + l_2:l_1 + l_2 + l_3]
            b[l_1 + l_2:l_1 + l_2 + l_3] = good_part[:l_3]
            good_part[:l_3] = bad_part
            b[:l_1] = good_part[:l_1]
            b[l_1 + l_2 + l_3 + l_4:] = good_part[l_1:]
            assert all(x != y for x, y in zip(a, b))
            print('Yes')
            print(' '.join(map(str, b)))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
h1=input('>>')
m1=input('>>')
h2=input('>>')
m2=input('>>')
k=input('>>')
print('60*(h2-h1)+(m2-m1)-k')









Fixed submission:
h1,m1,h2,m2,k=map(int,input().split())
s=60*(h2-h1)+(m2-m1)-k
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
nums = input().split()

seki = 1
for item in nums:
  seki *= int(item)
  
if seki > 10**18:
  print(-1)
else:
  print(seki)

Fixed submission:
num = int(input())
nums = input().split()

zero_flag = False
for item in nums:
  if item == '0':
    zero_flag = True
    break
    
if zero_flag:
  seki = 0
else:
  seki = 1
  for item in nums:
    seki *= int(item)
    if seki > 10**18:
      seki = -1
      break

print(seki)
Buggy python submission (verdict: Runtime Error):
d,t,s = map(int,input().split())
if d/s <=t　:
  print('Yes')
else:
  print('No')

Fixed submission:
d,t,s = map(int,input().split())
if d/s <=t:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
aa=0
for i in range(n):
    for j in range(n):
        if i<j:
            aa+=a[i]*a[j]
            aa%=1000000007
print(aa)

Fixed submission:
input()
a = list(map(int, input().split()))
c = 1000000007
print(((sum(a)**2-sum(map(lambda x: x**2, a)))//2)%c)
Buggy python submission (verdict: Runtime Error):
n,x,t = map(int,input().split())
print(t*((n-1)//x+1)

Fixed submission:
n,x,t = map(int,input().split())
print(t*((n-1)//x+1))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
c=list(input())
m=float('inf')
for i in range(n+1):
  x=max(c[:i].count('W'),c[i:].count('R'))
  if m>x:
    m=x
print(m)

Fixed submission:
n = int(input())
c = input()
w = 0
r = c.count('R')
ans = r

for k in range(n):
  if c[k] == 'W':
    w += 1
  elif c[k] == 'R':
    r -= 1
  cnt = max(w, r)
  if ans > cnt:
    ans = cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
c=list(input())
l=[]
for i in range(n+1):
  l.append(max(c[:i].count('W'),c[i:].count('R')))
print(min(l))

Fixed submission:
n = int(input())
c = input()
w = 0
r = c.count('R')
ans = r

for k in range(n):
  if c[k] == 'W':
    w += 1
  elif c[k] == 'R':
    r -= 1
  cnt = max(w, r)
  if ans > cnt:
    ans = cnt
print(ans)
Buggy python submission (verdict: Runtime Error):
n=input()
print(999-((n-1)%1000))

Fixed submission:
n=int(input())
print(999-((n-1)%1000))
Buggy python submission (verdict: Runtime Error):
a=input()
print(a+a**2+a**3)

Fixed submission:
a=int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
aa=0
for s,t in zip(S,T):
  if s!=t:
    a+=1
print(a)

Fixed submission:
S=input()
T=input()
aa=0
for s,t in zip(S,T):
  if s!=t:
    aa+=1
print(aa)
Buggy python submission (verdict: Runtime Error):
n=int(input())
i=0
while True:
    i+=1
    if (26**i-1)/25*26>=n:
        n-=(26**i-1)/25*26
        break
def sisu(n, b):
　if (int(n/b)):
　　return sisu(int(n/b), b) + chr(n%b+65)
　return chr(n%b+65)
aa=sisu(n,26)
aa="a"*(i-len(aa))+aa
print(aa)

Fixed submission:
n=int(input())
a=''
while n != 0:
  n-=1
  a=chr(int(97+n%26))+a
  n//=26
print(a)
Buggy python submission (verdict: Runtime Error):
a=input().sprit()
x=0
for n in a:
  x+=1
  if n=="0":
    aa=x
print(aa)

Fixed submission:
a=input().split()
x=0
for n in a:
  x+=1
  if n=="0":
    aa=x
print(aa)

Buggy python submission (verdict: Runtime Error):
a=input().split()
x=0
for n in a:
  x+=1
  if n=0:
    aa=x
print(aa)

Fixed submission:
a=input().split()
x=0
for n in a:
  x+=1
  if n=="0":
    aa=x
print(aa)
Buggy python submission (verdict: Runtime Error):
x,y=input().split()
if y%2==1 or x*2>y or x*4<y:
  a="No"
else:
  a="Yes"
print(a)

Fixed submission:
x,y=input().split()
x=int(x)
y=int(y)
if y%2==1 or x*2>y or x*4<y:
  a="No"
else:
  a="Yes"
print(a)
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
pp=input().split()
a=int(a)
b=int(b)
p=[]
for pa in pp:
    p.append(int(pa))
x=0
y=-1
while:
    if a+x not in p:
        aa=a+x
        break
    elif a+y not in p:
        aa=a+y
        break
    x+=1
    y+=-1
print(aa)

Fixed submission:
a,b=input().split()
pp=input().split()
a=int(a)
b=int(b)
p=[]
for pa in pp:
    p.append(int(pa))
x=0
y=-1
while True:
    if a+x not in p:
        aa=a+x
        break
    elif a+y not in p:
        aa=a+y
        break
    x+=1
    y+=-1
print(aa)
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
print(a*b)

Fixed submission:
a,b=input().split()
print(int(a)*int(b))
Buggy python submission (verdict: Runtime Error):
def strr():
 a=raw_input()
 return a
def sstrr():
 a=raw_input().split()
 return a
def intt():
 a=int(raw_input())
 return a
def iintt():
 a=[int(s) for s in raw_input().split()]
 return a
def nestt(t):
 a=[raw_input().split() for s in range(t)] 
 return a

nr=iintt()
n=nr[0]
r=nr[1]
a
if n>=10:
 a=r
else:
 a=r+100*(10-n)
print a

Fixed submission:
def strr():
 a=raw_input()
 return a
def sstrr():
 a=raw_input().split()
 return a
def intt():
 a=int(raw_input())
 return a
def iintt():
 a=[int(s) for s in raw_input().split()]
 return a
def nestt(t):
 a=[raw_input().split() for s in range(t)] 
 return a

nr=iintt()
n=nr[0]
r=nr[1]
if n>=10:
 a=r
else:
 a=r+100*(10-n)
print a
Buggy python submission (verdict: Runtime Error):
s=raw_input()
s=s.split()
if x<=k*500:
 a="Yes"
else:
 a="No"
print(a)

Fixed submission:
s=raw_input()
s=s.split()
s[0]=int(s[0])
s[1]=int(s[1])
if s[1]<=s[0]*500:
 a="Yes"
else:
 a="No"
print(a)

Buggy python submission (verdict: Runtime Error):
s=raw_input()
s=s.split()
if x<=k*500
 a="Yes"
else;
 a="No"
print(a)

Fixed submission:
s=raw_input()
s=s.split()
s[0]=int(s[0])
s[1]=int(s[1])
if s[1]<=s[0]*500:
 a="Yes"
else:
 a="No"
print(a)

Buggy python submission (verdict: Runtime Error):
s=raw_input()
s=s.split()
if x<=k*500;
 a="Yes"
else;
 a="No"
print(a)

Fixed submission:
s=raw_input()
s=s.split()
s[0]=int(s[0])
s[1]=int(s[1])
if s[1]<=s[0]*500:
 a="Yes"
else:
 a="No"
print(a)
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=6-a-b
print(c)

Fixed submission:
a=input()
b=input()
c=6-a-b
print(c)

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=6-a-b
print(c)

Fixed submission:
a=input()
b=input()
c=6-a-b
print(c)
Buggy python submission (verdict: Runtime Error):
input()
st=input().split()
a=""
for s,t in zip(st[0],st[1]):
 a+=(s+t)
print(a)

Fixed submission:
input()
st=raw_input().split()
a=""
for s,t in zip(st[0],st[1]):
 a+=(s+t)
print(a)
Buggy python submission (verdict: Runtime Error):
a=input()
if a=="SUN":
 b=7
if a=="MON":
 b=6
if a=="TUE":
 b=5
if a=="WED":
 b=4
if a=="THU":
 b=3
if a=="FRI":
 b=2
if a=="SET":
 b=1
print(b)

Fixed submission:
a=input()
if a=='SUN':
 b=7
if a=="MON":
 b=6
if a=="TUE":
 b=5
if a=="WED":
 b=4
if a=="THU":
 b=3
if a=="FRI":
 b=2
if a=="SAT":
 b=1
print(b)
Buggy python submission (verdict: Runtime Error):
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
a,b,c=[a,b,c].sort()
print(a*b)

Fixed submission:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
abc=sorted([a,b,c])
if abc[2]%2==0:
    print(0)
else:
    print(abc[0]*abc[1])
Buggy python submission (verdict: Runtime Error):
def compare(a,b):
  res = 0
  for x,y in zip(a,b):
    if x == y:
      res += 1
  return res

s,t = map(int, input().split())
len_t = len(t)
ans = 0
for i in range(len(s)-len(t)+1):
  ans = max(ans,compare(s[i:i+len_t],t))
print(ans)


Fixed submission:
a,b,c = map(int, input().split())
print("Yes") if b * c >= a else print("No")
Buggy python submission (verdict: Runtime Error):
h,w,m = map(int, input().split())
hw = [list(map(int, input().split())) for i in range(m)]
bomb = set()
h_list = [0] * (h+1)
w_list = [0] * (w+1)
for H,W in hw:
  h_list[H] += 1
  w_list[W] += 1
  bomb.add((H,W))
max_h = max(h_list)
max_w = max(w_list)
maxh_list = []
maxw_list = []
for k,v in enumerate(h_list):
  if v == max_h:
    maxh_list.append(k)
for k,v in enumerate(w_list):
  if v == max_w:
    maxw_list.append(k)
if len(maxh_list) * len(maxv_list) > m:
  ans = max_h * max_w
else:
  ans = max_h * max_w - 1
  for i in maxh_list:
    for j in maxw_list:
      if (i,j) not in bomb:
        ans = max_h * max_w
        break
print(ans)
      

Fixed submission:
h,w,m = map(int, input().split())
hw = [list(map(int, input().split())) for i in range(m)]
bomb = set()
h_list = [0] * (h+1)
w_list = [0] * (w+1)
for H,W in hw:
  h_list[H] += 1
  w_list[W] += 1
  bomb.add((H,W))
max_h = max(h_list)
max_w = max(w_list)
maxh_list = []
maxw_list = []
for k,v in enumerate(h_list):
  if v == max_h:
    maxh_list.append(k)
for k,v in enumerate(w_list):
  if v == max_w:
    maxw_list.append(k)
if len(maxh_list) * len(maxw_list) > m:
  ans = max_h + max_w
else:
  ans = max_h + max_w - 1
  for i in maxh_list:
    for j in maxw_list:
      if (i,j) not in bomb:
        ans = max_h + max_w
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
from heapq import heappop, heappush

t = int(input())
for i in range(t):
  n = int(input())
  klr = [list(map(int, input().split())) for i in range(n)]
  plus = []
  p_que = []
  minus = []
  m_que = []
  ans = 0
  for key, (k,l,r) in enumerate(klr):
    diff = l-r
    if diff >= 0:
      plus.append([k, diff, key])
      heappush(p_que,(diff, k, key))
      ans += r
    else:
      minus.append([k, -diff, key])
      heappush(m_que,(-diff, k, key))
      ans += l
  plus.sort(reverse=True)
  used = [0] * n
  now = len(plus)
  for k,diff,key in plus:
    while now > k:
      data = heappop(p_que)
      idx = data[2]
      if used[idx]:
        continue
      used[idx] = 1
      now -= 1
    if used[key]:
      continue
    used[key] = 1
    ans += diff
    now -= 1
  now = len(plus) + 1      
  minus.sort()
  for k,diff,key in minus:
    while now <= k:
      data = heappop(m_que)
      idx = data[2]
      if used[idx]:
        continue
      used[idx] = 1
      now += 1
    if used[key]:
      continue
    used[key] = 1
    ans += diff
    now += 1
  print(ans)  


Fixed submission:
l,r,d = map(int, input().split())
ans = r//d - (l-1)//d
print(ans)
Buggy python submission (verdict: Runtime Error):
n = 10**6
mod = 10 ** 9 + 7
fact = [1]*(n+1)
rfact = [1]*(n+1)
r = 1
for i in range(1, n+1):
  fact[i] = r = r * i % mod
rfact[n] = r = pow(fact[n], mod-2, mod)
for i in range(n, 0, -1):
  rfact[i-1] = r = r * i % mod

# nPk (mod MOD) を求める
def perm(n, k):
  return fact[n] * rfact[n-k] % mod

# nCk (mod MOD) を求める
def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % mod

k = int(input())
s = input()

len_s = len(s)
ans = 0
for i in range(len_s,k+len_s+1):
    ans += (comb(i-1,len_s-1) * pow(25,i-len_s,mod) * pow(26,k+len_s-i,mod)) % mod
    ans %= mod
print(ans)

Fixed submission:
n = 2 * (10**6) + 10
mod = 10 ** 9 + 7
fact = [1]*(n+1)
rfact = [1]*(n+1)
r = 1
for i in range(1, n+1):
  fact[i] = r = r * i % mod
rfact[n] = r = pow(fact[n], mod-2, mod)
for i in range(n, 0, -1):
  rfact[i-1] = r = r * i % mod

# nPk (mod MOD) を求める
def perm(n, k):
  return fact[n] * rfact[n-k] % mod

# nCk (mod MOD) を求める
def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % mod

k = int(input())
s = input()

len_s = len(s)
ans = 0
for i in range(len_s,k+len_s+1):
    ans += (comb(i-1,len_s-1) * pow(25,i-len_s,mod) * pow(26,k+len_s-i,mod)) % mod
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
mod = 2019
rem = [0] * mod
rem[0] = 1
now = 0
for k,v in enumerate(S[::-1]):
  now += int(v) * (10 ** k)
  rem[now % mod] += 1
ans = 0
for i in rem:
  ans += i * (i-1) // 2
print(ans)

Fixed submission:
S = input()
mod = 2019
rem = [0] * mod
rem[0] = 1
now = 0
for k,v in enumerate(S[::-1]):
  now += int(v) * pow(10,k,mod)
  rem[now % mod] += 1
ans = 0
for i in rem:
  ans += i * (i-1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
mod = 2019
rem = [0] * mod
rem[0] = 1
now = 0
for k,v in enumerate(S[::-1]):
  now += int(v) * (10 ** k)
  rem[now % mod] += 1
ans = 0
for i in rem:
  ans += i * (i-1) // 2
print(ans)

Fixed submission:
S = input()
mod = 2019
rem = [0] * mod
rem[0] = 1
now = 0
for k,v in enumerate(S[::-1]):
  now += int(v) * pow(10,k,mod)
  rem[now % mod] += 1
ans = 0
for i in rem:
  ans += i * (i-1) // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted([(v,k) for k,v in enumerate(list(map(int, input().split())))], reverse=True)
dp = [[-(10 ** 18)] * (n+1) for i in range(n+1)]
dp[0][0] = 0
for i,(v,k) in enumerate(a):
  for j in range(i+1):
    left = j
    right = n-1-(i-j)
    dp[i+1][j] = max(dp[i+1][j], dp[i][j] + v * abs(k-right))
    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + v * abs(k-left))
print(max(dp[i+1]))

Fixed submission:
n = int(input())
a = sorted([(v,k) for k,v in enumerate(list(map(int, input().split())))], reverse=True)
dp = [[-(10 ** 18)] * (n+1) for i in range(n+1)]
dp[0][0] = 0
for i,(v,k) in enumerate(a):
  for j in range(i+1):
    left = j
    right = n-1-(i-j)
    dp[i+1][j] = max(dp[i+1][j], dp[i][j] + v * abs(k-right))
    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + v * abs(k-left))
print(max(dp[i+1]))
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

def GCD(a,b,c):
    return fractions.gcd(fractions.gcd(a,b),c)

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += GCD(i,j,k)
print(ans)

Fixed submission:
import math

def GCD(a,b,c):
    return math.gcd(math.gcd(a,b),c)

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += GCD(i,j,k)
print(ans)

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

def GCD(a,b,c):
    return fractions.gcd(fractions.gcd(a,b),c)

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += GCD(i,j,k)
print(ans)

Fixed submission:
import math

def GCD(a,b,c):
    return math.gcd(math.gcd(a,b),c)

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += GCD(i,j,k)
print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions

def GCD(a,b,c):
    return fractions.gcd(math.gcd(a,b),c)

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += GCD(i,j,k)
print(ans)


Fixed submission:
import math

def GCD(a,b,c):
    return math.gcd(math.gcd(a,b),c)

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += GCD(i,j,k)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
R,G,B = [0],[0],[0]
r,g,b = 0,0,0
ans = 0
for i in s[::-1]:
    if i == "R":
        r += 1
    elif i == "G":
        g += 1
    else:
        b += 1
    R.append(r)
    G.append(g)
    B.append(b)
R.reverse()
G.reverse()
B.reverse()
for ki,i in enumerate(s):
    for kj,j in enumerate(s[ki+1:],ki+1):
        INDEX = 2 * kj - ki
        if i == j:
            continue
        if i != "R" and j != "R":
            mini_ans = R[kj+1]
            if INDEX < n and s[INDEX] == "R":
                mini_ans -= 1
            ans += mini_ans
        elif i != "G" and j != "G":
            mini_ans = G[kj+1]
            if INDEX < n and s[INDEX] == "G":
                mini_ans -= 1
            ans += mini_ans
        elif i != "B" and j != "B":
            mini_ans = B[kj+1]
            if INDEX < n and s[INDEX] == "B":
                mini_ans -= 1
            ans += mini_ans
print(ans)

Fixed submission:
n = int(input())
s = input()
R,G,B = [0],[0],[0]
r,g,b = 0,0,0
ans = 0
for i in s[::-1]:
    if i == "R":
        r += 1
    elif i == "G":
        g += 1
    else:
        b += 1
    R.append(r)
    G.append(g)
    B.append(b)
R.reverse()
G.reverse()
B.reverse()
for ki,i in enumerate(s):
    for kj,j in enumerate(s[ki+1:],ki+1):
        INDEX = 2 * kj - ki
        if i == j:
            continue
        if i != "R" and j != "R":
            mini_ans = R[kj+1]
            if INDEX < n and s[INDEX] == "R":
                mini_ans -= 1
            ans += mini_ans
        elif i != "G" and j != "G":
            mini_ans = G[kj+1]
            if INDEX < n and s[INDEX] == "G":
                mini_ans -= 1
            ans += mini_ans
        elif i != "B" and j != "B":
            mini_ans = B[kj+1]
            if INDEX < n and s[INDEX] == "B":
                mini_ans -= 1
            ans += mini_ans
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a = input()
q = int(input())
query = [list(input().split()) for i in range(q)]
now = 0
for i in query:
  if i[0] == "1":
    now ^= 1
  elif i[0] == "2":
    f,c = int(i[1]),i[2]
    if (f+now) % 2:
      a = c + a
    else:
      a = a + c
if now:
  a = a[::-1]
print(a)

Fixed submission:
from collections import deque

s = list(input())
q = int(input())
query = [list(input().split()) for i in range(q)]
now = 0
a = deque(s)
for i in query:
  if i[0] == "1":
    now ^= 1
  elif i[0] == "2":
    f,c = int(i[1]),i[2]
    if (f+now) % 2:
      a.appendleft(c)
    else:
      a.append(c)
if now:
  a.reverse()
ans = "".join(a)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
keta = ["-1"] * n
if n == 1:
  ans = -1
  for s,c in sc:
    if ans == -1 or ans == c:
      ans = c
    else:
      print(-1)
      exit()
  if ans == -1:
    print(0)
  else:
    print(ans)
else:
  for s,c in sc:
    s-=1
    if keta[s] == "-1" or keta[s] == str(c):
      keta[s] = str(c)
    else:
      print(-1)
      exit()
  ans = ""
  for k,i in enumerate(keta):
    if i == "-1":
      if k == 0:
        ans += "1"
      else:
        ans += "0"
    else:
      ans += i   
  if ans[0] == "0":
    print(-1)
    exit()
  else:
    print(ans)


Fixed submission:
n = int(input())
if n % 2:
  print(n//2+1)
else:
  print(n//2)