Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
cnt=0
siten=s[0]
onezero=[]
for i in range(n-1):
    if s[i:i+2]=='01':
        cnt+=1
        onezero+=[cnt]
        cnt=0
        
    else:
        cnt+=1
        if n-2==i:
            cnt+=1
            onezero[-1]+=cnt

ans=[1]
for i in range(max(1,len(onezero)-k+1)):
    #print(onezero[i:i+k])
    if siten=='0':
        ans+=[sum(onezero[i:i+k+1])-1]
    else:
        ans+=[sum(onezero[i:i+k])]

print(max(ans))

Fixed submission:
n,k=map(int,input().split())
s=input()
cnt=1
siten=s[0]
onezero=[0]
for i in range(n-1):
    if s[i]!=s[i+1]:
        onezero+=[cnt]
    cnt+=1

onezero+=[cnt]

x=len(onezero)

if siten=='1':
    onezero+=[onezero[-1]]*2
    t=int(x/2-1)
    if k>=t:
        print(n)
    else:
        ans=[0]
        for i in range(t-k+2):
            ans+=[onezero[2*(i+k)+1]-onezero[2*i]]
        print(max(ans))

else:
    onezero+=[onezero[-1]]
    t=int(x/2)
    if k>=t:
        print(n)
    else:
        ans=[onezero[2*k]]
        for i in range(t-k):
            ans+=[onezero[2*(i+k+1)]-onezero[2*i+1]]
        print(max(ans))
Buggy python submission (verdict: Runtime Error):
import math
a=[input() for i in range(5)]
si=min([a[i][-1] for i in range(5)if a[i][-1]!='0'])
ans=[math.ceil(int(i)/10)*10 for i in a]
print(sum(ans)+int(si)-10)


Fixed submission:
import math
a=[input() for i in range(5)]
nzero=['99999']
for i in a:
    if i[-1]!='0':
        nzero+=[i[-1]]
ans=sum([math.ceil(int(i)/10)*10 for i in a])
h=min(nzero)

if h=='99999':
    print(ans)
else:
    print(ans-10+int(h))
Buggy python submission (verdict: Time Limit Exceeded):
def ca():
    x,y,z,k=map(int,input().split())
    a=[int(i)for i in input().split()]
    b=[int(i)for i in input().split()]
    c=[int(i)for i in input().split()]
    c.sort(reverse=True)
    AB=[i+j for i in a for j in b]
    AB.sort(reverse=True)
    ans=[i+j for i in AB[:k]for j in c]
    ans.sort(reverse=True)
    for i in ans[:k]:
        print(i)
    exit()
print(ca())

Fixed submission:
def ca():
    x,y,z,k=map(int,input().split())
    a=[int(i)for i in input().split()]
    b=[int(i)for i in input().split()]
    c=[int(i)for i in input().split()]
    c.sort(reverse=True)
    AB=[i+j for i in a for j in b]
    AB.sort(reverse=True)
    ans=[i+j for i in AB[:k]for j in c]
    ans.sort(reverse=True)
    for i in ans[:k]:
        print(i)
    exit()
print(ca())

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k=map(int,input().split())
a=[int(i)for i in input().split()]
b=[int(i)for i in input().split()]
c=[int(i)for i in input().split()]
c.sort(reverse=True)
AB=[i+j for i in a for j in b]
AB.sort(reverse=True)
ans=[i+j for i in AB[:k]for j in c]
ans.sort(reverse=True)
for i in ans[:k]:
    print(i)

Fixed submission:
def ca():
    x,y,z,k=map(int,input().split())
    a=[int(i)for i in input().split()]
    b=[int(i)for i in input().split()]
    c=[int(i)for i in input().split()]
    c.sort(reverse=True)
    AB=[i+j for i in a for j in b]
    AB.sort(reverse=True)
    ans=[i+j for i in AB[:k]for j in c]
    ans.sort(reverse=True)
    for i in ans[:k]:
        print(i)
    exit()
print(ca())

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k=map(int,input().split())
a=[int(i)for i in input().split()]
b=[int(i)for i in input().split()]
c=[int(i)for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans=[]
for A in a:
    for B in b:
        ans+=[A+B]
ans.sort(reverse=True)
ANS=[]
for K in ans[:k]:
    for C in c:
        ANS+=[C+K]
ANS.sort(reverse=True)
for i in range(k):
    print(ANS[i])

Fixed submission:
def ca():
    x,y,z,k=map(int,input().split())
    a=[int(i)for i in input().split()]
    b=[int(i)for i in input().split()]
    c=[int(i)for i in input().split()]
    c.sort(reverse=True)
    AB=[i+j for i in a for j in b]
    AB.sort(reverse=True)
    ans=[i+j for i in AB[:k]for j in c]
    ans.sort(reverse=True)
    for i in ans[:k]:
        print(i)
    exit()
print(ca())

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k=map(int,input().split())
a=[int(i)for i in input().split()]
b=[int(i)for i in input().split()]
c=[int(i)for i in input().split()]
ans=[]
for A in a:
    for B in b:
        for C in c:
            ans+=[A+B+C]
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])

Fixed submission:
def ca():
    x,y,z,k=map(int,input().split())
    a=[int(i)for i in input().split()]
    b=[int(i)for i in input().split()]
    c=[int(i)for i in input().split()]
    c.sort(reverse=True)
    AB=[i+j for i in a for j in b]
    AB.sort(reverse=True)
    ans=[i+j for i in AB[:k]for j in c]
    ans.sort(reverse=True)
    for i in ans[:k]:
        print(i)
    exit()
print(ca())
Buggy python submission (verdict: Time Limit Exceeded):
def go():
    n,q=map(int,input().split())
    mas=[1 for i in range(n)]
    s=list(input())
    td=[list(map(str,input().split()))for i in range(q)]
    for t,d in td:
        indexall=[i for i, x in enumerate(s) if x==t]
        for i in indexall:
            if mas[i]>0:
                memo=mas[i]
                mas[i]=0
                if d=='L':
                    if i-1>=0:
                        mas[i-1]+=memo
                else:
                    if i+1<=n-1:
                        mas[i+1]+=memo

    return sum(mas)

print(go())

Fixed submission:
def nibu():
    n,q=map(int,input().split())
    s=[0]+list(input())+[0]
    td=[input().split()for i in range(q)][::-1]

    L=0
    R=n+1

    for t,d in td:
        if t==s[L+1] and d=='L':
            L+=1
        elif t==s[L] and d=='R':
            L-=1
        
        if t==s[R-1] and d=='R':
            R-=1
        elif t==s[R] and d=='L':
            R+=1

    return max(0,R-L-1)

print(nibu())
Buggy python submission (verdict: Runtime Error):
s=input()
at='ACGT'
cnt=0
ans=[]
for i in s:
    if i in at:
        cnt+=1
    else:
        ans+=[cnt]
        cnt=0
print(max(ans))

Fixed submission:
s=input()
at='ACGT'
cnt=0
ans=[0]
for i in s:
    if i in at:
        cnt+=1
        ans+=[cnt]
    else:

        cnt=0
ans.sort()
print(ans[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()

ans=[0]*n
for i in range(n-1):
    if s[i:i+2]=='AC':
        ans[i:i+2]=[1,2]

for i in range(q):
    l,r=map(int,input().split())
    cnt=0
    for j in range(l-1,r-1):
        if ans[j:j+2]==[1,2]:
            cnt+=1
    print(cnt)

Fixed submission:
n,q=map(int,input().split())
s=input()
ans=[0]*n+[0]
for i in range(n):
    if s[i:i+2]=='AC':
        ans[i+1]=ans[i]+1
    else:
        ans[i+1]=ans[i]
for i in range(q):
    l,r=map(int,input().split())
    print(ans[r-1]-ans[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    print(s[l-1:r].count('AC'))

Fixed submission:
n,q=map(int,input().split())
s=input()
ans=[0]*n+[0]
for i in range(n):
    if s[i:i+2]=='AC':
        ans[i+1]=ans[i]+1
    else:
        ans[i+1]=ans[i]
for i in range(q):
    l,r=map(int,input().split())
    print(ans[r-1]-ans[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]

ab.sort()

AB=[[ab[i][0]]*ab[i][1] for i in range(n)]
A=[]
for i in AB:
    A+=i
ans=0

for i in range(m):
    ans+=A[i]
print(ans)

Fixed submission:
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]

ab.sort()

ans=0
B=0
cnt=0
for a,b in ab:
    B+=b
    if B<m:
        ans+=a*b
        cnt+=b
    else:
        ans+=a*(m-cnt)
        print(ans)
        exit()

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

ab.sort()

AB=[[ab[i][0]]*ab[i][1] for i in range(n)]
ans=0
cnt=0
for i in AB:
    for z in i:
        ans+=z
        cnt+=1
        if cnt>=m:
            print(ans)
            exit()

Fixed submission:
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]

ab.sort()

ans=0
B=0
cnt=0
for a,b in ab:
    B+=b
    if B<m:
        ans+=a*b
        cnt+=b
    else:
        ans+=a*(m-cnt)
        print(ans)
        exit()
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def mon():
    input()
    a=[int(i) for i in input().split()]
    return gcd_list(a)
print(mon())

Fixed submission:
from functools import reduce
import fractions
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def mon():
    input()
    a=[int(i) for i in input().split()]
    return gcd_list(a)
print(mon())

Buggy python submission (verdict: Runtime Error):
import math
def mon():
    n=int(input())
    a=[int(i) for i in input().split()]
    a.sort()
    za=a[0]

    b=[i for i in a[1:] if i%za!=0]
    if b==[]:
        print(za)
        exit()

    c=[za]
    for i in b:
        c+=[i%za]

    while not len(c)==1:
        c[0]=c[0]%c[1]
        c.sort(reverse=True)
        c[0]=c[0]-c[1]
        if c[0]<=0:
            c.pop(0)

    return(c[0])


print(mon())

Fixed submission:
from functools import reduce
import fractions
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def mon():
    input()
    a=[int(i) for i in input().split()]
    return gcd_list(a)
print(mon())

Buggy python submission (verdict: Time Limit Exceeded):
import math
def mon():
    n=int(input())
    a=[int(i) for i in input().split()]
    a.sort()
    za=a[0]

    b=[i for i in a[1:] if i%za!=0]
    if b==[]:
        print(za)
        exit()
    c=[za]

    for i in b:
        c+=[i%za]

    while not len(c)==1:
        c.sort(reverse=True)
        c[0]=c[0]-c[1]
        if c[0]<=0:
            c.pop(0)

    return(c[0])


print(mon())

Fixed submission:
from functools import reduce
import fractions
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def mon():
    input()
    a=[int(i) for i in input().split()]
    return gcd_list(a)
print(mon())
Buggy python submission (verdict: Time Limit Exceeded):
def dif(n,ab):
    a=[int(i[0]) for i in ab]
    b=[int(i[1]) for i in ab]
    tp=0
    ap=0
    for i in range(n):
        tm=max(a)
        am=max(b)
        if tm>am:
            

            b[a.index(tm)]=0
            a[a.index(tm)]=0
            tp+=tm
        else:
            tp+=a[b.index(am)]
            a[b.index(am)]=0
            b[b.index(am)]=0
        am=max(b)
        a[b.index(am)]=0
        b[b.index(am)]=0
        ap+=am

    return tp-ap

n=int(input())
print(dif(n,[input().split() for i in range(n)]))

Fixed submission:
def dif(n,ab):
    c=[[sum(i),i] for i in ab]
    c.sort(reverse=True)

    ap=0
    bp=0
    for i in range(n):
        if i%2==0:
            ap+=c[i][1][0]
        else:
            bp+=c[i][1][1]


    return ap-bp

n=int(input())
print(dif(n,[list(map(int,input().split())) for i in range(n)]))
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
    while b:
            a,b=b,a%b
    return a


def lcm(x,y):
    return (x * y) // gcd(x, y)

def atwo(n,m,s,t):
    l=lcm(n,m)
    a=l/n
    b=l/m
    for i in range(n):
        for j in range(m):
            if a*i==b*j:
                if s[i]==t[j]:
                    pass
                else:
                    l=-1

    return l

n,m=map(int,input().split())
print(atwo(n,m,input(),input()))

Fixed submission:
def gcd(a, b):
    while b:
            a,b = b,a%b
    return a

def lcm(x,y):
    return (x * y) // gcd(x, y)

def atwo(n,m,s,t):
    l=lcm(n,m)
    gc=gcd(n,m)
    if s[0::n//gc]==t[0::m//gc]:
        print(l)
        exit()
    else:
        print(-1)
        exit()

n,m=map(int,input().split())
print(atwo(n,m,input(),input()))

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

def lcm(x,y):
    return (x * y) // math.gcd(x, y)
def atwo(n,m,s,t):
    l=lcm(n,m)
    a=l/n
    b=l/m
    for i in range(n):
        for j in range(m):
            if a*i==b*j:
                if s[i]==t[j]:
                    pass
                else:
                    l=-1

    return l

n,m=map(int,input().split())
print(atwo(n,m,input(),input()))

Fixed submission:
def gcd(a, b):
    while b:
            a,b = b,a%b
    return a

def lcm(x,y):
    return (x * y) // gcd(x, y)

def atwo(n,m,s,t):
    l=lcm(n,m)
    gc=gcd(n,m)
    if s[0::n//gc]==t[0::m//gc]:
        print(l)
        exit()
    else:
        print(-1)
        exit()

n,m=map(int,input().split())
print(atwo(n,m,input(),input()))
Buggy python submission (verdict: Time Limit Exceeded):
def mincos(n,ab):
    aball=[]
    aball+=[(ab[i][0],i+1,'a') for i in range(n)]
    aball+=[(ab[i][1],i+1,'b') for i in range(n)]
    aball.sort()
    
    ans1=sum([i[0] for i in aball[:n]])
    
    hen=aball[n][0]
    hen2=aball[n+1][0]
    d=[]
    t=None
    hantei=True
    for i,c,mab in aball[:n]:
        if t!=None and t!=mab:
            hantei=False
        if  c in d:
            print(ans1)
            exit()
        d+=[c]
        t=mab

    if hantei:
        print(ans1)
        exit()

    ans2=[]
    for i,c,aorb in aball[:n]:
        if aball[n][1]!=c:
            ans2+=[ans1-i+hen]
        else:
            ans2+=[ans1-i+hen2]
    print(min(ans2))
    exit()

n=int(input())
print(mincos(n,[list(map(int,input().split())) for i in range(n)]))

Fixed submission:
def mincos(n,ab):
    aball=[]
    aball+=[(ab[i][0],i+1,'a') for i in range(n)]
    aball+=[(ab[i][1],i+1,'b') for i in range(n)]
    aball.sort()
    
    ans1=sum([i[0] for i in aball[:n]])

    hen=aball[n][0]
    hen2=aball[n+1][0]
    d=set()
    t=None
    hantei=True
    for i,c,mab in aball[:n]:
        if t!=None and t!=mab:
            hantei=False
        if  c in d:
            print(ans1)
            exit()
        d.add(c)
        t=mab

    if hantei:
        print(ans1)
        exit()

    ans2=[]
    for i,c,aorb in aball[:n]:
        if aball[n][1]!=c:
            ans2+=[ans1-i+hen]
        else:
            ans2+=[ans1-i+hen2]
    print(min(ans2))
    exit()

n=int(input())
print(mincos(n,[list(map(int,input().split())) for i in range(n)]))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
cnt=[]
for i in range(1,n):
    w=s[:i-1]
    e=s[i:]
    wc=w.count('W')
    ec=e.count('E')
    cnt.append(wc+ec)

print(min(cnt))

Fixed submission:
def we(s):
    cnt=s.count('E')
    ans=s.count('E')
    for i in s:
        if i =='W':
            cnt+=1
        else:
            cnt-=1
            ans=min(ans,cnt)
    return (min(cnt,ans))
input()
print(we(input()))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
cnt=[]
for i in range(1,n):
    w=s[:i-1]
    e=s[i:]
    wc=w.count('W')
    ec=e.count('E')
    cnt.append(wc+ec)

print(min(cnt))

Fixed submission:
def we(s):
    cnt=s.count('E')
    ans=s.count('E')
    for i in s:
        if i =='W':
            cnt+=1
        else:
            cnt-=1
            ans=min(ans,cnt)
    return (min(cnt,ans))
input()
print(we(input()))
Buggy python submission (verdict: Runtime Error):
hw=[int(i) for i in input().split()]
s=['.'+input()+'.' for i in range(hw[0])]
s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
for i in range(1,hw[1]+1):
    for n in range(1,hw[0]+1):
        if s[i][n]=='#':
            if s[i+1][n]=='.' and s[i][n+1]=='.' and s[i-1][n]=='.' and s[i][n-1]=='.':
                print('No')
                exit()
print('Yes')


Fixed submission:
hw=[int(i) for i in input().split()]
s=['.'+input()+'.' for i in range(hw[0])]
s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
for i in range(1,hw[0]+1):
    for n in range(1,hw[1]+1):
        if s[i][n]=='#':
            if s[i+1][n]==s[i][n+1]==s[i-1][n]==s[i][n-1]=='.':
                print('No')
                exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
def g2():
    hw=[int(i) for i in input().split()]
    s=['.'+input()+'.' for i in range(hw[0])]
    s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
    for i in range(1,hw[1]+1):
        for n in range(1,hw[0]+1):
            if s[i][n]=='#':
                if s[i+1][n]=='.' and s[i][n+1]=='.' and s[i-1][n]=='.' and s[i][n-1]=='.':
                    print('No')
                    exit()
    print('Yes')
    exit()
print(g2())

Fixed submission:
hw=[int(i) for i in input().split()]
s=['.'+input()+'.' for i in range(hw[0])]
s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
for i in range(1,hw[0]+1):
    for n in range(1,hw[1]+1):
        if s[i][n]=='#':
            if s[i+1][n]==s[i][n+1]==s[i-1][n]==s[i][n-1]=='.':
                print('No')
                exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
def g2():
    hw=[int(i) for i in input().split()]
    s=['.'+input()+'.' for i in range(hw[0])]
    s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
    for i in range(1,hw[1]+1):
        for n in range(1,hw[0]+1):
            if s[i][n]=='#':
                if s[i+1][n]=='.' and s[i][n+1]=='.' and s[i-1][n]=='.' and s[i][n-1]=='.':
                    print('No')
                    exit()
    print('Yes')
    exit()
print(g2())

Fixed submission:
hw=[int(i) for i in input().split()]
s=['.'+input()+'.' for i in range(hw[0])]
s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
for i in range(1,hw[0]+1):
    for n in range(1,hw[1]+1):
        if s[i][n]=='#':
            if s[i+1][n]==s[i][n+1]==s[i-1][n]==s[i][n-1]=='.':
                print('No')
                exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a.sort()
b.sort()
c.sort()
s=bisect.bisect_left(a,b[-1])
l=bisect.bisect_right(c,b[0])
cnt=0
ab=[]
for B in b:
    for A in a[:s+1]:
        if B>A:
            ab+=[B]
ans=0
for AB in ab:
    for C in c[l:]:
        if AB<C:
            ans+=1
print(ans)

Fixed submission:
import bisect
n=int(input())
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
ans=0
for B in b:
    m=bisect.bisect_left(a,B)
    l=bisect.bisect_right(c,B)
    ans+=m*(n-l)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]

ab=[]
for B in b:
    for A in a:
        if B>A:
            ab+=[B]
ans=0
for AB in ab:
    for C in c:
        if AB<C:
            ans+=1
print(ans)

Fixed submission:
import bisect
n=int(input())
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
ans=0
for B in b:
    m=bisect.bisect_left(a,B)
    l=bisect.bisect_right(c,B)
    ans+=m*(n-l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input())for i in range(n)]
print(len(set([i for i in a if a.count(i)%2!=0])))

Fixed submission:
n=int(input())
a=[int(input())for i in range(n)]
a.sort()
memo=a[0]
ans=0
cnt=0
for i in range(n):
    if a[i]==memo:
        cnt+=1
        if i==n-1:
            if cnt%2!=0:
                ans+=1
    else:
        if cnt%2!=0:
            ans+=1
        if i==n-1:
            ans+=1
        cnt=1

    memo=a[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

ans=0


def dfs(v,n,visi):
    allv=True

    for i in visi:
        if not i:
            allv=False

    if allv:
        return 1

    ret=0

    for i in range(n):
        if G[v][i]==False:
            continue
        if visi[i]:
            continue
        visi[i]=True
        ret+=dfs(i,n,visi)
        visi[i]=False

    return ret

n,m=map(int,input().split())
ab=[list(map(int,input().split()))for i in range(m)]
G=[[False for i in range(n)]for i in range(m)]

for a,b in ab:
    G[a-1][b-1]=G[b-1][a-1]=True

visi=[False for i in range(n)]

visi[0]=True

print(dfs(0,n,visi))

Fixed submission:
import sys
sys.setrecursionlimit(100000)

ans=0


def dfs(v,n,visi):
    allv=True

    for i in visi:
        if not i:
            allv=False

    if allv:
        return 1

    ret=0

    for i in range(n):
        if G[v][i]==False:
            continue
        if visi[i]:
            continue
        visi[i]=True
        ret+=dfs(i,n,visi)
        visi[i]=False

    return ret

n,m=map(int,input().split())
ab=[list(map(int,input().split()))for i in range(m)]
G=[[False for i in range(8)]for i in range(8)]

for a,b in ab:
    G[a-1][b-1]=G[b-1][a-1]=True

visi=[False for i in range(n)]

visi[0]=True

print(dfs(0,n,visi))
Buggy python submission (verdict: Time Limit Exceeded):
L,R = (int(i) for i in input().split())

minimum = 2019
checked = set()

start = L
end   = R+1

for i in range(start, end):
    a = i % 2019
    if a not in checked:
        checked.add(a)
        endd = min(end, i+1+2019)
        for j in range(i+1, endd):
            v = (i * j) % 2019
            minimum = min([v, minimum])

print(minimum)

Fixed submission:
L,R = (int(i) for i in input().split())

minimum = 2019
checked = set()

start = L
end   = R+1

end2 = min(end, start+1+2019)
for i in range(start, end2):
    a = i % 2019
    if a not in checked:
        checked.add(a)
        endd = min(end, i+1+2019)
        for j in range(i+1, endd):
            v = (i * j) % 2019
            minimum = min([v, minimum])

print(minimum)

Buggy python submission (verdict: Time Limit Exceeded):
L,R = (int(i) for i in input().split())

minimum = 2019
checked = set()
for i in range(L, R+1):
    a = i%2019
    if a not in checked:
        checked.add(a)
        for j in range(i+1, R+1):
            v = (i * j) % 2019
            minimum = min([v, minimum])

print(minimum)

Fixed submission:
L,R = (int(i) for i in input().split())

minimum = 2019
checked = set()

start = L
end   = R+1

end2 = min(end, start+1+2019)
for i in range(start, end2):
    a = i % 2019
    if a not in checked:
        checked.add(a)
        endd = min(end, i+1+2019)
        for j in range(i+1, endd):
            v = (i * j) % 2019
            minimum = min([v, minimum])

print(minimum)
Buggy python submission (verdict: Runtime Error):
AB = int(input().split())

A = AB[0]
B = AB[1]

if A%2 == 0 and B%2 == 0:
  print((A+B)/2)
  
elif A%2 == 1 and B%2 ==1:
  print((A+B)/1)
  
else:
  print("IMPOSSIBLE")

Fixed submission:
AB = list(map(int, input().split()))
 
A = int(AB[0])
B = int(AB[1])
 
if A%2 == 0 and B%2 == 0:
    print(int((A+B)/2))
elif A%2 == 1 and B%2 == 1:
    print(int((A+B)/2))
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = a + b
if c % 2 == 1:
    print('IMPOSSIBLE')
else:
    print(int(c / 2))

Fixed submission:
a, b = map(int, input().split())
c = a + b
if c % 2:
    print('IMPOSSIBLE')
else:
    print(int(c / 2))

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = a + b
if c % 2:
    print('IMPOSSIBLE')
else:
    print(int(c / 2))

Fixed submission:
a, b = map(int, input().split())
c = a + b
if c % 2:
    print('IMPOSSIBLE')
else:
    print(int(c / 2))
Buggy python submission (verdict: Runtime Error):
#coding: UTF-8

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Ans = 0

for num in range(N):
    Ans += min(A[num], B[num])
    if A[num] => B[num]:
        pass
    else: # A[num] < B[num]
        B[num] -= A[num]
        Ans += min(A[num+1], B[num])
        if A[num+1] => B[num]:
            A[num+1] -= B[num]
        else:
            A[num+1] = 0
print(Ans)

Fixed submission:
#coding: UTF-8

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Ans = 0

for num in range(N):
    Ans += min(A[num], B[num])
    if A[num] >= B[num]:
        pass
    else: # A[num] < B[num]
        B[num] -= A[num]
        Ans += min(A[num+1], B[num])
        if A[num+1] >= B[num]:
            A[num+1] -= B[num]
        else:
            A[num+1] = 0
print(Ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(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)%2 == 0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")