Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
if __name__ == "__main__": 
	string = input()
	l = string.split(" ")
	a = int(l[0])
	b = int(l[1])
	n = int(l[2])
	ans = 0
	for i in range(n,0,-1):
		f = math.floor((a*i)/b)
		s = math.floor(i/b)
		temp = int(f) - (a*int(s))
		if(temp > ans):
			ans = temp
	print(ans)

Fixed submission:
import math
if __name__ == "__main__": 
	string = input()
	l = string.split(" ")
	a = int(l[0])
	b = int(l[1])
	n = int(l[2])
	ans = 0
	ni = min(n,b-1)
	f = math.floor((a*(ni))/b)
	s = math.floor((ni)/b)
	temp = int(f) - (a*int(s))
	ans = temp
	# if(n>b):
	# 	f = math.floor((a*(b-1))/b)
	# 	s = math.floor((b-1)/b)
	# 	temp = int(f) - (a*int(s))
	# 	ans = temp
	# else:
	# 	f = math.floor((a*(n))/b)
	# 	s = math.floor((n)/b)
	# 	temp = int(f) - (a*int(s))
	# 	ans = temp
	print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
if __name__ == "__main__": 
	string = input()
	l = string.split(" ")
	a = int(l[0])
	b = int(l[1])
	n = int(l[2])
	ans = 0
	for i in range(1,n+1):
		f = math.floor((a*i)/b)
		s = math.floor(i/b)
		temp = int(f) - (a*int(s))
		if(temp > ans):
			ans = temp
	print(ans)

Fixed submission:
import math
if __name__ == "__main__": 
	string = input()
	l = string.split(" ")
	a = int(l[0])
	b = int(l[1])
	n = int(l[2])
	ans = 0
	ni = min(n,b-1)
	f = math.floor((a*(ni))/b)
	s = math.floor((ni)/b)
	temp = int(f) - (a*int(s))
	ans = temp
	# if(n>b):
	# 	f = math.floor((a*(b-1))/b)
	# 	s = math.floor((b-1)/b)
	# 	temp = int(f) - (a*int(s))
	# 	ans = temp
	# else:
	# 	f = math.floor((a*(n))/b)
	# 	s = math.floor((n)/b)
	# 	temp = int(f) - (a*int(s))
	# 	ans = temp
	print(ans)
Buggy python submission (verdict: Runtime Error):
sum = 0
N = input() 
for i in range(int(N)):
	s = float(input())
	sum = sum+(1/s)
print(sum)

Fixed submission:
sum = 0.00
s = 0 
N = int(input()) 
numlist = list(input().split())
for i in range(N):
	s = int(numlist[i])
	sum = sum+(1/s)
print(1/sum)

Buggy python submission (verdict: Runtime Error):
sum = 0
N = input() 
for i in range(N):
	s = input()
	sum += 1/s
print(sum)

Fixed submission:
sum = 0.00
s = 0 
N = int(input()) 
numlist = list(input().split())
for i in range(N):
	s = int(numlist[i])
	sum = sum+(1/s)
print(1/sum)

Buggy python submission (verdict: Runtime Error):
int N
float sum = 0
N = input() 
for i in range(N)
	s = input()
	sum = (float)1/s
print(sum)

Fixed submission:
sum = 0.00
s = 0 
N = int(input()) 
numlist = list(input().split())
for i in range(N):
	s = int(numlist[i])
	sum = sum+(1/s)
print(1/sum)

Buggy python submission (verdict: Runtime Error):
int N
float sum = 0
N = input() 
for i in N
	s = input()
	sum = (float)1/s
print(sum)

Fixed submission:
sum = 0.00
s = 0 
N = int(input()) 
numlist = list(input().split())
for i in range(N):
	s = int(numlist[i])
	sum = sum+(1/s)
print(1/sum)
Buggy python submission (verdict: Runtime Error):
import math as m
a,b=map(float,input().split())
print(m.floor((a*(b*m))//m))


Fixed submission:
from math import floor as f
a,b=input().split()
b=int(str(b).replace(".",""))
print(int(a)*b//100)
Buggy python submission (verdict: Time Limit Exceeded):

s=input().rstrip()
q=int(input().rstrip())
ans=s
rev=0
for _ in range(q):
    que,*C=input().split()
    que=int(que)
    if que==2:
        f,c=C
        f=int(f)
        if f==1:
            if rev%2==0:
                s=c+s
            else:
                s+=c
        else:
            if rev%2==0:
                s+=c
            else:
                s=c+s
    else:
        rev+=1
print(s if rev%2==0 else s[::-1])

Fixed submission:
#import pysnooper
#import numpy
#import os,re,sys,operator
from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial,hypot
#import sys
#from fractions import gcd
setrecursionlimit(10**6+1)
input=stdin.readline

s=input().rstrip()
q=int(input().rstrip())
qu=deque(s)
rev=0
for _ in range(q):
    que,*C=input().split()
    que=int(que)
    if que==2:
        f,c=C
        f=int(f)
        if f==1:
            if rev%2==0:
                qu.appendleft(c)
            else:
                qu.append(c)
        else:
            if rev%2==0:
                qu.append(c)
            else:
                qu.appendleft(c)
    else:
        rev+=1
print("".join(qu) if rev%2==0 else "".join(qu)[::-1])
Buggy python submission (verdict: Runtime Error):
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial,hypot
#import sys
#from fractions import gcd
setrecursionlimit(10**6+1)
input=stdin.readline

n,m=map(int,input().split())
ans=["" for _ in range(n)]
for _ in range(m):
    s,c=map(int,input().split())
    if ans[s-1]==c:
        continue
    elif ans[s-1]=="":
        ans[s-1]=c
    else:
        print(-1)
        exit()
if ans[0]==0:
    print(-1)
    exit()
for i in range(n):
    if ans[i]=="":
        ans[i]=1
print("".join(ans)

Fixed submission:
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial,hypot
#import sys
#from fractions import gcd
setrecursionlimit(10**6+1)
input=stdin.readline

n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
for i in range(1000):
    now=str(i)
    if len(now)!=n:
        continue
    ch=True
    for j in range(m):
        #print(now[a[j][0]-1],a[j][1])
        if int(now[a[j][0]-1])!=a[j][1]:
            ch=False
            break
    if ch:
        print(i)
        exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
print("Yes" if n=m else "No")


Fixed submission:
n,m=map(int,input().split())
print("Yes" if n==m else "No")
Buggy python submission (verdict: Runtime Error):
import os,re,sys,operator,math
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq
import numpy as np

setrecursionlimit(10**6)
s=stdin.readline().rstrip()
lens=len(s)
loop1=1
loop2=lens-2
t2=list(s[-1])
t1=list(s[0])
now=0
z=""
while loop1<lens:
    z=str(s[loop1])
    ch=False
    while loop1<lens:
        if z!=t1[now]:
            t1.append(z)
            ch=True
            now+=1
            break
        else:
            loop1+=1
            if loop1<lens:
                z+=s[loop1]
    if not ch:
        t1[-1]+=z
    loop1+=1
z=""
now=0
while loop2>-1:
    z=str(s[loop2])
    ch=False
    while loop2>-1:
        if z!=t2[now]:
            t2.append(z)
            ch=True
            now+=1
            break
        else:
            loop2-=1
            if loop2>-1:
                z+=s[loop2]
    if not ch:
        t2[-1]+=z
    loop2-=1
print(max(len(t1),len(t2)))

Fixed submission:
import os,re,sys,operator,math
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq


setrecursionlimit(10**6)
s=stdin.readline().rstrip()
lens=len(s)
loop1=1
loop2=lens-2
t2=list(s[-1])
t1=list(s[0])
now=0
z=""
while loop1<lens:
    z=str(s[loop1])
    ch=False
    while loop1<lens:
        if z!=t1[now]:
            t1.append(z)
            ch=True
            now+=1
            break
        else:
            loop1+=1
            if loop1<lens:
                z+=s[loop1]
    if not ch:
        t1[-1]+=z
    loop1+=1
z=""
now=0
while loop2>-1:
    z=str(s[loop2])
    ch=False
    while loop2>-1:
        if z!=t2[now]:
            t2.append(z)
            ch=True
            now+=1
            break
        else:
            loop2-=1
            if loop2>-1:
                z+=s[loop2]
    if not ch:
        t2[-1]+=z
    loop2-=1
print(max(len(t1),len(t2)))
Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())

if ((a + b) % 2) == 0:
    print((a + b) / 2)
else:
    print("IMPOSSIBLE")

Fixed submission:
a,b = map(int, input().split())

if(a < b):
  swap = b
  b = a
  a = swap

k = (a + b) // 2

if ((((a + b) % 2) == 0) and (a >= k) and (k >= b)) :
    print(k)
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())

if ((a + b) % 2) == 0:
    print((a + b) / 2)
else:
    print("IMPOSSIBLE")

Fixed submission:
a,b = map(int, input().split())

if(a < b):
  swap = b
  b = a
  a = swap

k = (a + b) // 2

if ((((a + b) % 2) == 0) and (a >= k) and (k >= b)) :
    print(k)
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = input().split()

if ((a + b) % 2) == 0:
    print((a + b) / 2)
else:
    print("IMPOSSIBLE")

Fixed submission:
a,b = map(int, input().split())

if(a < b):
  swap = b
  b = a
  a = swap

k = (a + b) // 2

if ((((a + b) % 2) == 0) and (a >= k) and (k >= b)) :
    print(k)
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a, b = input().split()

if (a + b) % 2 == 0:
    print((a + b) % 2)
else:
    print("IMPOSSIBLE")

Fixed submission:
a,b = map(int, input().split())

if(a < b):
  swap = b
  b = a
  a = swap

k = (a + b) // 2

if ((((a + b) % 2) == 0) and (a >= k) and (k >= b)) :
    print(k)
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)

Fixed submission:
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)

Buggy python submission (verdict: Runtime Error):
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)


Fixed submission:
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
Buggy python submission (verdict: Runtime Error):
n = input()
s, t = input().split()
print("".join(f"{a}{b}" for a, b in zip(s, t)))

Fixed submission:
n = input()
s, t = input().split()
print("".join("{}{}".format(a, b) for a, b in zip(s, t)))
Buggy python submission (verdict: Runtime Error):
print("bust" if sum(map(int, input().strip().split()) >= 22 else "win")

Fixed submission:
print("bust" if sum(map(int, input().strip().split())) >= 22 else "win")
Buggy python submission (verdict: Runtime Error):
X, A = map(int, input().split())
print(0 if X < a else 10)


Fixed submission:
X, A = map(int, input().split())
print(0 if X < A else 10)
Buggy python submission (verdict: Runtime Error):
import sys

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

eo = sum(XY[0]) % 2
for xy in XY:
    if (sum(xy) % 2 != eo):
        print(-1)
        os.exit()

m = 40 - eo
print(m)
D = [2 ** i for i in range(38, -1, -1)]
if eo == 0:
    D.append(1)

print(" ".join(map(str, D)))
for x, y in XY:
    w = ""
    for i in range(m):
        if 0 <= x - y and 0 <= x + y:
            w += "R"
            x -= D[i]
        elif 0 > x - y and 0 <= x + y:
            w += "U"
            y -= D[i]
        elif 0 <= x - y and 0 > x + y:
            w += "D"
            y += D[i]
        else:
            w += "L"
            x += D[i]
    print(w)


Fixed submission:
import sys

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

eo = sum(XY[0]) % 2
for xy in XY:
    if (sum(xy) % 2 != eo):
        print(-1)
        sys.exit()

m = 40 - eo
print(m)
D = [2 ** i for i in range(38, -1, -1)]
if eo == 0:
    D.append(1)

print(" ".join(map(str, D)))
for x, y in XY:
    w = ""
    for i in range(m):
        if 0 <= x - y and 0 <= x + y:
            w += "R"
            x -= D[i]
        elif 0 > x - y and 0 <= x + y:
            w += "U"
            y -= D[i]
        elif 0 <= x - y and 0 > x + y:
            w += "D"
            y += D[i]
        else:
            w += "L"
            x += D[i]
    print(w)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

S, C = [], []
for _ in range(N):
    a, b = map(int, input().split())
    S.append((a, b))

for _ in range(M):
    c, d = map(int, input().split())
    C.append((c, d))

for a, b in S:
    ans = None
    min_dist = int(2e8)
    for i, (c, d) in enumerate(C):
        dist = abs(c - a) + abs(d - b)
        if dist < min_dist:
            min_dist = dist
            ans = i
    print(ans + 1)

Fixed submission:
N, M = map(int, input().split())

S, C = [], []
for _ in range(N):
    a, b = map(int, input().split())
    S.append((a, b))

for _ in range(M):
    c, d = map(int, input().split())
    C.append((c, d))

for a, b in S:
    ans = None
    min_dist = 1 << 32
    for i, (c, d) in enumerate(C):
        dist = abs(c - a) + abs(d - b)
        if dist < min_dist:
            min_dist = dist
            ans = i
    print(ans + 1)
Buggy python submission (verdict: Runtime Error):
"""
左右一列にN個のマスが並んでいます。
左からi番目のマスの高さはH(i)
あなたは好きなマスに降り立ち、右隣のマスの高さが今居るマスの高さ以下である限り右隣のマスへ移動し続けます。
最大で何回移動できるでしょうか。
"""
 
import numpy as np
 
n = int(input())
h = list(map(int, input().split()))
tmp = []
ans = 0
 
for i in range(n-1):
  if h[i] < h[i+1]:
    tmp.append(1)
  else:
    tmp.append(0)
    
box = []   
for i in tmp:
  if i == 0:
    ans += 1
  else:
    ans = 0
  box.append(ans)
    
# print(ans)
# print(box)
print(max(box))

Fixed submission:
"""
左右一列にN個のマスが並んでいます。
左からi番目のマスの高さはH(i)
あなたは好きなマスに降り立ち、右隣のマスの高さが今居るマスの高さ以下である限り右隣のマスへ移動し続けます。
最大で何回移動できるでしょうか。
"""
 
import numpy as np
 
n = int(input())
h = list(map(int, input().split()))
tmp = []
ans = 0

if n != 1:
  for i in range(n-1):
    if h[i] < h[i+1]:
      tmp.append(1)
    else:
      tmp.append(0)
    
box = []   
for i in tmp:
  if i == 0:
    ans += 1
  else:
    ans = 0
  box.append(ans)
    
# print(ans)
# print(box)

if n != 1:
  rslt = max(box)
else:
  rslt = 0
  
print(rslt)

Buggy python submission (verdict: Runtime Error):
"""
左右一列にN個のマスが並んでいます。
左からi番目のマスの高さはH(i)
あなたは好きなマスに降り立ち、右隣のマスの高さが今居るマスの高さ以下である限り右隣のマスへ移動し続けます。
最大で何回移動できるでしょうか。
"""
 
import numpy as np
 
n = int(input())
h = list(map(int, input().split()))
tmp = []
ans = 0
 
for i in range(n-1):
  if h[i] < h[i+1]:
    tmp.append(1)
  else:
    tmp.append(0)
    
box = []   
for i in tmp:
  if i == 0:
    ans += 1
  else:
    ans = 0
  box.append(ans)
    
# print(ans)
# print(box)
print(max(box))

Fixed submission:
"""
左右一列にN個のマスが並んでいます。
左からi番目のマスの高さはH(i)
あなたは好きなマスに降り立ち、右隣のマスの高さが今居るマスの高さ以下である限り右隣のマスへ移動し続けます。
最大で何回移動できるでしょうか。
"""
 
import numpy as np
 
n = int(input())
h = list(map(int, input().split()))
tmp = []
ans = 0

if n != 1:
  for i in range(n-1):
    if h[i] < h[i+1]:
      tmp.append(1)
    else:
      tmp.append(0)
    
box = []   
for i in tmp:
  if i == 0:
    ans += 1
  else:
    ans = 0
  box.append(ans)
    
# print(ans)
# print(box)

if n != 1:
  rslt = max(box)
else:
  rslt = 0
  
print(rslt)

Buggy python submission (verdict: Runtime Error):
"""
左右一列にN個のマスが並んでいます。
左からi番目のマスの高さはH(i)
あなたは好きなマスに降り立ち、右隣のマスの高さが今居るマスの高さ以下である限り右隣のマスへ移動し続けます。
最大で何回移動できるでしょうか。
"""

import numpy as np

n = int(input())
h = list(map(int, input().split()))
tmp = []
ans = 0

for i in range(n-1):
  if h[i] < h[i+1]:
    tmp.append(1)
  else:
    tmp.append(0)
    
# print(tmp)
tmp_box = []
for i in tmp:
  tmp_box.append(ans)
  if i == 0:
    ans += 1
  else:
    ans == 0
    
    
print(max(tmp_box))

Fixed submission:
"""
左右一列にN個のマスが並んでいます。
左からi番目のマスの高さはH(i)
あなたは好きなマスに降り立ち、右隣のマスの高さが今居るマスの高さ以下である限り右隣のマスへ移動し続けます。
最大で何回移動できるでしょうか。
"""
 
import numpy as np
 
n = int(input())
h = list(map(int, input().split()))
tmp = []
ans = 0

if n != 1:
  for i in range(n-1):
    if h[i] < h[i+1]:
      tmp.append(1)
    else:
      tmp.append(0)
    
box = []   
for i in tmp:
  if i == 0:
    ans += 1
  else:
    ans = 0
  box.append(ans)
    
# print(ans)
# print(box)

if n != 1:
  rslt = max(box)
else:
  rslt = 0
  
print(rslt)
Buggy python submission (verdict: Runtime Error):
import collections

n = int(input())
s = np.array([[str(i) for i in input().split()] for i in range(n)])
s = np.ravel(s)
ans = 0
sorted_list = [''.join(sorted(e)) for e in s]
# dict
c = collections.Counter(sorted_list)
for i in c.values():
  for j in range(0, i):
    ans += j

print(ans)

Fixed submission:
import numpy as np
import collections

n = int(input())
s = np.array([[str(i) for i in input().split()] for i in range(n)])
s = np.ravel(s)
ans = 0
sorted_list = [''.join(sorted(e)) for e in s]
# dict
c = collections.Counter(sorted_list)
for i in c.values():
  for j in range(0, i):
    ans += j

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
job_r = [[] for _ in range(m)]

for i in range(n):
    d, r = list(map(int, input().split()))
    if d-1 < m:
        job_r[d-1].append(r)

total_reward = 0
aaa_list = []
for i in range(m):
    aaa_list.extend(job_r[i])
    if len(aaa_list) >0:
        reward = max(aaa_list)
        total_reward += reward
        aaa_list.remove(reward)
print(total_reward)

Fixed submission:
from heapq import heappop, heappush
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
X = sorted([list(map(int, input().split())) for _ in range(N)], key = lambda x: x[0])

hq = []
ans, j = 0, 0

for i in range(1, M + 1):  # M - i 日後にするバイトを考える
    while (j < N) and (X[j][0] <= i):
        heappush(hq, -X[j][1])  # 候補の追加
        j += 1
    if len(hq):
        ans += -heappop(hq)  # 候補があるとき、候補から最大値を取り出す

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

b_rest = [max(b[0]-a[0],0)]
a_rest = [max(a[0]-b[0],0)]

for i in range(1, n-1):
  b_rest.append( min(b[i], max( ((b[i]+b_rest[i-1])-a[i]), 0 ) ) )
  a_rest.append( max( a[i]-(b[i]+b_rest[i-1]), 0 ) ) 

a_rest.append(max(0, (a[n-1]-b_rest[-1]) ) )
ans = sum(a) - sum(a_rest)
                                
print(ans)

Fixed submission:
"""
- https://atcoder.jp/contests/abc136/tasks/abc135_a
- |A−K|=|B−K| (others:IMPOSSIBLE)
- reg: 0≤A, B≤10^9
"""

a, b = map(int, input().split())
# 三項演算子
k = int ((a+b)/2) if (a+b) % 2 == 0 else 'IMPOSSIBLE'

print(k)
Buggy python submission (verdict: Runtime Error):
p, q, r = map(int, input().split())
sorted_list = sorted(list[p, q, r])
ans = sorted_list[0] + sorted_list[1]
print(ans)


Fixed submission:
p, q, r = map(int, input().split())
sorted_list = sorted([p, q, r])
ans = sorted_list[0] + sorted_list[1]
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
v = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
p = v-c
for i in p:
    if i>0:
        ans+=i

print(ans)


Fixed submission:
import numpy as np

n = int(input())
v = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
p = v-c
ans = sum([i for i in p if i>0])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(input().split())

X=0
for i in range(N):
    X+=A.count(A[i])

if X==N:
    print("YES")
else:
    print("NO")

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
 
if len(set(A))==len(A):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
print('ATCG'['TAGC'.index()])

Fixed submission:
print('ATCG'['TAGC'.index(input())])
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
s=input()
k=int(input())
list=list(s)
ans=1
for i in range(min(k,list.len())):
    if not list[i] == 1:
        ans=list[i]
        break
print(ans)


Fixed submission:
# coding:utf-8
s=input()
k=int(input())
lists=list(s)
ans=1
for i in range(min(k,len(lists))):
    if not lists[i] == "1":
        ans=lists[i]
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
print('YES'if __import__('collections').Counter(map(int,open(0).read().split())).most_common[0][1]<3 else'NO')

Fixed submission:
print('YES'if __import__('collections').Counter(map(int,open(0).read().split())).most_common()[0][1]<3 else'NO')
Buggy python submission (verdict: Time Limit Exceeded):
n=input()
a=map(int,raw_input().split())
r=0
for i in range(1<<n):
 b=[a[j]*((i>>j&1)*2-1)%24 for j in range(n)]+[0]
 s=24
 for j in range(n):
  for k in range(j+1,n+1):s=min(s,(b[j]-b[k])%24,(b[k]-b[j])%24)
 r=max(r,s)
print r

Fixed submission:
n=input()
a=sorted(map(int,raw_input().split()))
r=0
b=[0]+[a[j]*(-1)**j%24 for j in range(n)]
s=24
for j in range(n):
 for k in range(j+1,n+1):s=min(s,(b[j]-b[k])%24,(b[k]-b[j])%24)
r=max(r,s)
print r

Buggy python submission (verdict: Runtime Error):
n=input()
a=map(int,raw_input().split())
r=0
for i in range(1<<n):
 b=[a[j]*((i>>j&1)*2-1)%24 for j in range(n)]+[0]
 s=24
 for j in range(n):
  for k in range(j+1,n+1):s=min(s,(b[j]-b[k])%24,(b[k]-b[j])%24)
 r=max(r,s)
print r

Fixed submission:
n=input()
a=sorted(map(int,raw_input().split()))
r=0
b=[0]+[a[j]*(-1)**j%24 for j in range(n)]
s=24
for j in range(n):
 for k in range(j+1,n+1):s=min(s,(b[j]-b[k])%24,(b[k]-b[j])%24)
r=max(r,s)
print r