Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
h = x

for i in range(2,10**5):
    if x%i == 0:
        h = i
        break


for i in range(1, 10**9):
    a = i
    b = h-i
    if a**5-b**5 == x:
        print(a, b)
        exit(0)
    b = i-h
    if a**5-b**5 == x:
        print(a, b)
        exit(0)

Fixed submission:
x = int(input())

for a in range(-118, 120):
    for b in range(-119, 119):
        if a**5-b**5 == x:
            print(a, b)
            exit()

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
h = x

for i in range(2,10**9):
    if x%i == 0:
        h = i
        break


for i in range(1, 10**9):
    a = i
    b = h-i
    if a**5-b**5 == x:
        print(a, b)
        exit(0)
    b = i-h
    if a**5-b**5 == x:
        print(a, b)
        exit(0)

Fixed submission:
x = int(input())

for a in range(-118, 120):
    for b in range(-119, 119):
        if a**5-b**5 == x:
            print(a, b)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
r = []
g = []
b = []

ans = 0

for i in range(n):
    if s[i] == "R":
        r.append(i)
    if s[i] == "G":
        g.append(i)
    if s[i] == "B":
        b.append(i)

for i in r:
    for j in g:
        for k in b:
            li = [i,j,k]
            li.sort()
            if li[1]-li[0]==li[2]-li[1]:
                continue
            else:
                ans += 1

print(ans)

Fixed submission:
n = int(input())
s = input()
r = []
g = []
b = []

ans = s.count("R")*s.count("G")*s.count("B")

for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if k<n and s[k] != s[i] and s[k] != s[j] and s[i] != s[j]:
            ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        a = s[i]
        b = s[j]
        if a == b:
            continue
        else:
            for k in range(j+1,n):
                c = s[k]
                if a != c and b != c and j-i != k-j:
                    ans += 1

print(ans)

Fixed submission:
n = int(input())
s = input()
r = []
g = []
b = []

ans = s.count("R")*s.count("G")*s.count("B")

for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if k<n and s[k] != s[i] and s[k] != s[j] and s[i] != s[j]:
            ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i]==s[j]:
            continue
        else:
            for k in range(j+1,n):
                if s[i] != s[k] and s[j] != s[k] and j-i != k-j:
                    ans += 1

print(ans)

Fixed submission:
n = int(input())
s = input()
r = []
g = []
b = []

ans = s.count("R")*s.count("G")*s.count("B")

for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if k<n and s[k] != s[i] and s[k] != s[j] and s[i] != s[j]:
            ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
li=[list(map(str,input().split())) for _ in range(q)]

que = []
frag = True

for i in range(q):
    que = li[i]
    if que[0] == "1":
        if frag:
            frag = False
        else:
            frag = True
    else:
        f = que[1]
        c = que[2]
        if frag:
            if f == "1":
                s = c + s
            else:
                s = s + c
        else:
            if f == "1":
                s = s + c
            else:
                s = c + s

if frag:
    print(s)
else:
    print(s[::-1])

Fixed submission:
s = input()
q = int(input())
li=[list(map(str,input().split())) for _ in range(q)]

moji = "0"
frag = True

for i in range(q):
    que = li[i]
    if que[0] == "1":
        if frag:
            frag = False
        else:
            frag = True
    else:
        f = que[1]
        c = que[2]
        if frag:
            if f == "1":
                moji = c+moji
            else:
                moji = moji+c
        else:
            if f == "1":
                moji = moji+c
            else:
                moji = c+moji


if frag:
    print(moji.replace("0",s))
else:
    moji = moji[::-1]
    print(moji.replace("0",s[::-1]))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
li=[list(map(str,input().split())) for _ in range(q)]

que = []

for i in range(q):
    que = li[i]
    if que[0] == "1":
        s = s[::-1]
    else:
        f = que[1]
        c = que[2]
        if f == "1":
            s = c + s
        else:
            s = s + c

print(s)

Fixed submission:
s = input()
q = int(input())
li=[list(map(str,input().split())) for _ in range(q)]

moji = "0"
frag = True

for i in range(q):
    que = li[i]
    if que[0] == "1":
        if frag:
            frag = False
        else:
            frag = True
    else:
        f = que[1]
        c = que[2]
        if frag:
            if f == "1":
                moji = c+moji
            else:
                moji = moji+c
        else:
            if f == "1":
                moji = moji+c
            else:
                moji = c+moji


if frag:
    print(moji.replace("0",s))
else:
    moji = moji[::-1]
    print(moji.replace("0",s[::-1]))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

li = [0]*n

for i in range(n):
    s, c = map(int, input().split())
    if li[s-1] != 0 and li[s-1] != c:
        print(-1)
        exit(0)
    if s==1 and c==0:
        print(-1)
        exit(0)
    li[s-1]=c

if li[0]==0:
    li[0]=1

for i in range(n):
    print(li[i], end="")

Fixed submission:
n, m = map(int, input().split())

li = [0]*n

for i in range(m):
    s, c = map(int, input().split())
    if li[s-1] != 0 and li[s-1] != c:
        print(-1)
        exit(0)
    if s==1 and c==0:
        if n>1:
            print(-1)
            exit(0)
    li[s-1]=c

if n>1 and li[0]==0:
    li[0]=1

for i in range(n):
    print(li[i], end="")
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
n, k = map(int, input().split())
p = list(map(int, input().split()))

num_li = [0]*n
ans = 0
num = 0

for i in range(n):
    num_li[i] = ((p[i]*(p[i]+1))/2)/Decimal(p[i])

num = sum(num_li[:k])

for j in range(n-k):
    num = num-num_li[j]+num_li[j+k]
    ans = max(num,ans)

print('{:.10f}'.format(ans))

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))

num_li = [0]*n

for i in range(n):
    num_li[i] = (p[i]+1)/2

num = sum(num_li[:k])
ans = num

for j in range(n-k):
    num = num-num_li[j]+num_li[j+k]
    ans = max(num, ans)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

num_li = [0]*n
ans = 0
num = 0

for i in range(n):
    num_li[i] = ((p[i]*(p[i]+1))/2)/p[i]

ans = sum(num_li[:k])

for j in range(n-k+1):
    num += num_li[j]
    for m in range(1,k):
        num += num_li[j+m]
    ans = max(num, ans)
    num = 0

print(ans)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))

num_li = [0]*n

for i in range(n):
    num_li[i] = (p[i]+1)/2

num = sum(num_li[:k])
ans = num

for j in range(n-k):
    num = num-num_li[j]+num_li[j+k]
    ans = max(num, ans)

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

for i in range(1,min(a,b)):
    if a%i==0 and b%i==0:
        ans=i

print(a*b//ans)

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

n = max(a,b)
m = min(a,b)
ans=0

for i in range(1,m+1):
    ans = n*i
    if (ans)%m==0:
        print(ans)
        exit(0)
Buggy python submission (verdict: Runtime Error):
import math

x, y = map(int, input().split())

a = x+y
b = abs(x-y)
c = (x+y)/3
e=1

if a%3 != 0:
    ans = 0
elif b==c:
    ans = 1
else:
    d=c / 2 + b / 2
    n=int(c-(c/2+b/2))

    for i in range(n):
        e*=d-i

    ans = int(e/math.factorial(n))%(10**9+7)

print(ans)

Fixed submission:
x, y = map(int, input().split())

if (x+y)%3 != 0:
    print(0)
    exit(0)

n = (2*y-x)//3
m = (2*x-y)//3

if n<0 or m<0:
    print(0)
    exit(0)

mi = min(n,m)
num = n+m
mod = 10**9+7
a = 1
b = 1

for i in range(mi):
    a = a*(num-i)%mod
    b = b*(mi-i)%mod

print((a*pow(b,mod-2,mod))%mod)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
num_i = 0

for i in range(1,int(math.sqrt(n))):
    if n%i == 0:
        num_i = i

num_j = n//num_i
ans = (num_i-1)+(num_j-1)

print(ans)

Fixed submission:
import math

n = int(input())
num_i = 0

for i in range(1,int(math.sqrt(n))+1):
    if n%i == 0:
        num_i = i

num_j = n//num_i
ans = (num_i-1)+(num_j-1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

ans = round(n*(n-1)*(n-2)/6)
b=0

l.sort()

for i in range(n):
    for j in range(i+1,n):
        b = l[i] + l[j]
        for k in range(j+1,n):
            if b<=l[k]:
                ans-=n-k
                break

if ans<0:
    ans=0

print(ans)

Fixed submission:
import bisect
n = int(input())
li = list(map(int, input().split()))

li.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        ans += bisect.bisect_left(li, li[i]+li[j]) - j - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

ans = round(n*(n-1)*(n-2)/6)
b=0

l.sort()

for i in range(n):
    for j in range(i+1,n):
        b = l[i] + l[j]
        for k in range(j+1,n):
            if b>l[k]:
                continue
            else:
                ans-=n-k
                break

if ans<0:
    ans=0

print(ans)

Fixed submission:
import bisect
n = int(input())
li = list(map(int, input().split()))

li.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        ans += bisect.bisect_left(li, li[i]+li[j]) - j - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

ans = round(n*(n-1)*(n-2)/6)
b=0

l.sort()

for i in range(n):
    for j in range(i+1,n):
        b = l[i] + l[j]
        for k in range(n):
            if b<=l[n-k-1]:
                ans-=1
            else:
                break

if ans<0:
    ans=0

print(ans)

Fixed submission:
import bisect
n = int(input())
li = list(map(int, input().split()))

li.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        ans += bisect.bisect_left(li, li[i]+li[j]) - j - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

ans = round(n*(n-1)*(n-2)/6)

l.sort()

for i in range(n):
    for j in range(n):
        if i<=j:
            break
        for k in range(n):
            if l[i]+l[j]<=l[n-k-1]:
                ans-=1
            else:
                break

if ans<0:
    ans=0

print(ans)

Fixed submission:
import bisect
n = int(input())
li = list(map(int, input().split()))

li.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        ans += bisect.bisect_left(li, li[i]+li[j]) - j - 1

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

for i in range(n):
    ans[a[i]-1]=i+1

print(" ".join(map(str,ans)))

Fixed submission:
n, k = map(int, input().split())

h = list(map(int, input().split()))

ans=0

for i in range(n):
    if h[i]>=k:
        ans+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int, input().split()))

for i in range(n):
    print(h.index(i+1)+1, end=" ")

Fixed submission:
n = int(input())
h = list(map(int, input().split()))

n_list = list(range(1,n+1))

h_dict = dict(zip(h,n_list))


for i in range(1,n+1):
    print(h_dict[i], end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
cnt = k-q
a = [int(input()) for i in range(q)]

for j in range(1,n+1):
    if cnt+a.count(j)>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n, k, q = map(int, input().split())
b=[k-q]*n

for i in range(q):
    ctn = int(input())
    b[ctn-1]+=1

for j in range(n):
    if b[j]>0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())

a = list(map(int, [input() for i in range(q)]))
b = [k]*n

cnt = k-q

for j in range(1,n+1):
    if cnt+a.count(j)>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n, k, q = map(int, input().split())
b=[k-q]*n

for i in range(q):
    ctn = int(input())
    b[ctn-1]+=1

for j in range(n):
    if b[j]>0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, [input() for i in range(n)]))

maxa=max(a)

for i in range(n):
    if a[i]==maxa:
        list = a[:]
        list.pop(i)
        list.sort(reverse=True)
        print(list[0])
    else:
        print(maxa)

Fixed submission:
n = int(input())
a = list(map(int, [input() for i in range(n)]))

list=a[:]
list.sort(reverse=True)
max1 = list[0]
max2 = list[1]

for i in range(n):
    if a[i]==max1:
        print(max2)
    else:
        print(max1)

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

maxa=max(a)

for i in range(n):
    if a[i]==maxa:
        list = a[:]
        list.pop(i)
        print(max(list))
    else:
        print(maxa)

Fixed submission:
n = int(input())
a = list(map(int, [input() for i in range(n)]))

list=a[:]
list.sort(reverse=True)
max1 = list[0]
max2 = list[1]

for i in range(n):
    if a[i]==max1:
        print(max2)
    else:
        print(max1)

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

for i in range(n):
    list=a[:]
    list.pop(i)
    print(max(list))

Fixed submission:
n = int(input())
a = list(map(int, [input() for i in range(n)]))

list=a[:]
list.sort(reverse=True)
max1 = list[0]
max2 = list[1]

for i in range(n):
    if a[i]==max1:
        print(max2)
    else:
        print(max1)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())

a = list(range(l, r+1))

if len(a)>2019:
    a = a[:2019]

num = 0
ans = 2019

for i in range(len(a)):
    for j in range(len(a)):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

Fixed submission:
l, r = map(int, input().split())

if r-l>2019:
    print(0)
    exit(0)
else:
    a = list(range(l, r+1))

num = 0
ans = 2019

for i in range(len(a)):
    for j in range(len(a)):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())

a = list(range(l, r+1))

if len(a)>2019:
    a = a[:2019]

print(a)

num = 0
ans = 2019

for i in range(len(a)):
    for j in range(len(a)):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

Fixed submission:
l, r = map(int, input().split())

if r-l>2019:
    print(0)
    exit(0)
else:
    a = list(range(l, r+1))

num = 0
ans = 2019

for i in range(len(a)):
    for j in range(len(a)):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())

a = list(range(l, r+1))
a_len = len(a)
if a_len>2019:
    a = a[:2019]

num = 0
ans = 2019

for i in range(a_len):
    for j in range(a_len):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)

Fixed submission:
l, r = map(int, input().split())

if r-l>2019:
    print(0)
    exit(0)
else:
    a = list(range(l, r+1))

num = 0
ans = 2019

for i in range(len(a)):
    for j in range(len(a)):
        if a[i]<a[j]:
            num = (a[i]*a[j])%2019
            ans = min(ans, num)
            if ans == 0:
                print(0)
                exit(0)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
dan = [0]*(n+1)
dan[0] = 1

for i in range(1,n+1):
    if i not in a:
        dan[i] += dan[i-1]
        if i >= 2:
            dan[i] += dan[i-2]

print(dan[n]%(10**9+7))

Fixed submission:
n, m = map(int, input().split())
li = [True]*(n+1)

for i in range(m):
    a = int(input())
    li[a] = False

dan = [0]*(n+1)
dan[0] = 1

for j in range(1,n+1):
    if li[j]:
        dan[j] += dan[j-1]
        if j >= 2:
            dan[j] += dan[j-2]

print(dan[n]%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

l = [[0] * w for i in range(h)]
r = [[0] * w for i in range(h)]
u = [[0] * w for i in range(h)]
d = [[0] * w for i in range(h)]

st = ""
std = ""

for i in range(h):
    st = s[i]
    std = s[h-i-1]
    for j in range(w):
        if st[j] == ".":
            if j>0:
                l[i][j] = l[i][j-1]+1
            elif j==0:
                l[i][j] = 1
        else:
            l[i][j] = 0
        if st[w-j-1] == ".":
            if j>0:
                r[i][w-j-1] = r[i][w-j] + 1
            elif j==0:
                r[i][w-j-1] = 1
        else:
            r[i][w-j-1] = 0
        if st[j] == ".":
            if i>0:
                u[i][j] = u[i-1][j] + 1
            elif i == 0:
                u[i][j] = 1
        else:
            u[i][j] = 0
        if std[j] == ".":
            if i>0:
                d[h-i-1][j] = d[h-i][j] + 1
            elif i == 0:
                d[h-i-1][j] = 1
        else:
            d[h-i-1][j] = 0

ans = 0

for i in range(h):
    for j in range(w):
        ans = max(ans, l[i][j]+r[i][j]+u[i][j]+d[i][j]-3)

print(ans)

Fixed submission:
import numpy as np
h, w = map(int,input().split())

map=[list(input()) for _ in range(h)]
map = [[1 if s == '.' else 0 for s in map[i]] for i in range(h)]

map = np.array(map,dtype=int)
l=map.copy()
r=map.copy()
u=map.copy()
d=map.copy()

for i in range(1,h):
    u[i] += u[i-1]
    u[i] *= map[i]
for i in range(h-1, 0, -1):
    d[i-1] += d[i]
    d[i-1] *= map[i-1]
for i in range(1,w):
    l[:, i] += l[:, i-1]
    l[:, i] *= map[:, i]
for i in range(w-1, 0, -1):
    r[:, i-1] += r[:, i]
    r[:, i-1] *= map[:, i-1]

print((u+d+l+r).max()-3)
Buggy python submission (verdict: Runtime Error):
l = []
num = []

for i in range(5):
    menu = int(input())
    if menu%10 != 0:
        num.append(menu%10)
        menu = (menu//10+1)*10
    l.append(menu)

ans = sum(l)-(10-min(num))

print(ans)

Fixed submission:
l = []
num = []

for i in range(5):
    menu = int(input())
    if menu%10 != 0:
        num.append(menu%10)
        menu = (menu//10+1)*10
    l.append(menu)

ans = sum(l)

if num:
    ans -= 10-min(num)

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

for i in range(q):
    l, r = map(int, input().split())
    li.append(s[l-1:r].count("AC"))

for i in li:
    print(i)

Fixed submission:
import bisect
n, q = map(int, input().split())
s = input()
li = []

for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        li.append(i)

ans = []
num = 0

for i in range(q):
    l, r = map(int, input().split())
    num = bisect.bisect_right(li, r-2)-bisect.bisect_left(li, l-1)
    ans.append(num)

for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
py = []
mli = [0]*m
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = str(p).zfill(6)
    yi = str(mli[p-1]).zfill(6)
    li[i] = pi+yi

for i in li:
    print(i)

Fixed submission:
n, m = map(int, input().split())
py = []
mli = [0]*n
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = str(p).zfill(6)
    yi = str(mli[p-1]).zfill(6)
    li[i] = pi+yi

for i in li:
    print(i)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
py = []
mli = [0]*m
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = '{0:06d}'.format(p)
    yi = '{0:06d}'.format(mli[p-1])
    li[i] = str(pi)+str(yi)

for i in li:
    print(i)

Fixed submission:
n, m = map(int, input().split())
py = []
mli = [0]*n
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = str(p).zfill(6)
    yi = str(mli[p-1]).zfill(6)
    li[i] = pi+yi

for i in li:
    print(i)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
py = []
mli = [0]*m
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p] += 1
    pi = '{0:06d}'.format(p)
    yi = '{0:06d}'.format(mli[p])
    li[i] = str(pi)+str(yi)

for i in li:
    print(i)

Fixed submission:
n, m = map(int, input().split())
py = []
mli = [0]*n
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = str(p).zfill(6)
    yi = str(mli[p-1]).zfill(6)
    li[i] = pi+yi

for i in li:
    print(i)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
py = []
mli = [0]*m
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p] += 1
    pi = '{0:05d}'.format(p)
    yi = '{0:05d}'.format(mli[p])
    li[i] = str(pi)+str(yi)

for i in li:
    print(i)

Fixed submission:
n, m = map(int, input().split())
py = []
mli = [0]*n
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = str(p).zfill(6)
    yi = str(mli[p-1]).zfill(6)
    li[i] = pi+yi

for i in li:
    print(i)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())

if a>b:
    print(Alice)
elif a<b:
    print(Bob)
else:
    print(Drow)

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

if a==1:
    a+=13

if b==1:
    b+=13

if a>b:
    print('Alice')
elif a<b:
    print('Bob')
else:
    print('Draw')
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

ans = 0

for i in range(k + 1):
    for j in range(k + 1):
        for l in range(k + 1):
            if i+j+l == s:
                ans+=1

print(ans)

Fixed submission:
k, s = map(int, input().split())

ans = 0

for i in range(k + 1):
    for j in range(k + 1):
        if i+j<=s and i+j+k>=s:
            ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
sx, sy, tx, ty= map(int, input().split())

w = tx-sx
h = ty-sy


ans = ""
ans+="R"*w
ans+="U"*h
ans+="L"*w
ans+="D"*h

ans+="D"
ans+="R"*(x+1)
ans+="U"*(y+1)
ans+="L"

ans+="U"
ans+="L"*(x+1)
ans+="D"*(y+1)
ans+="R"

print(ans)

Fixed submission:
sx, sy, tx, ty= map(int, input().split())

w = tx-sx
h = ty-sy


ans = ""
ans+="R"*w
ans+="U"*h
ans+="L"*w
ans+="D"*h

ans+="D"
ans+="R"*(w+1)
ans+="U"*(h+1)
ans+="L"

ans+="U"
ans+="L"*(w+1)
ans+="D"*(h+1)
ans+="R"

print(ans)