Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def odd(a):
    return a/2

def even(b):
    return 3*b+1

num = int(input())
box = [num]
cnt = 0
answer = 0
while(True):
    if(num%2 == 0):
        num = odd(num)
    else:
        num = even(num)
    box.append(num)
    for i in range(len(box)-1):
        if(box[i] == num):
            answer = i
    if(answer != 0):
        print(str(i+2))
        break

Fixed submission:
x = input()
box= x.split(" ")

add = int(box[0]) * int(box[1])/ 2
print(int(add))
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
a = a.sort()
ans = 0
i = 0
while m > 0:
  if a[i][1] > 0:
    a[i][1] -= 1
    ans += a[i][0]
    m -= 1
  else:
    i += 1
print(ans)


Fixed submission:
n, m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
a.sort()
ans = 0
i = 0
while m > 0:
  if a[i][1] > 0:
    a[i][1] -= 1
    ans += a[i][0]
    m -= 1
  else:
    i += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

s = list(input())
t = list(input())

i = 0
if len(s) != len(t):
    print("No")
else:
    while True:
        s = np.roll(s,-1)
        i += 1
        if s == t:
            print("Yes")
            break
        elif i >= len(s):
            print("No")
            break


Fixed submission:
import numpy as np

s = list(input())
t = list(input())

i = 0
while True:
    s = list(np.roll(s,-1))
    i += 1
    if s == t:
        print("Yes")
        break
    elif i >= len(s):
        print("No")
        break
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())

if a - b <= d and b - c <= d or a - c <= d:
    print"Yes"
else:
    print"No"


Fixed submission:
a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")

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

if a - b <= d and b - c <= d or a - c <= d:
    print"Yes"
else:
    print"No"


Fixed submission:
a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if a - b <= d and b - c <= d or a - c <= d:
    print"Yes"
else:
    print"No"


Fixed submission:
a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if a - b <= d and b - c <= d:
    print"Yes"
else:
    print"No"


Fixed submission:
a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
if a - b <= d and b - c <= d:
    print"Yes"
else:
    print"No"


Fixed submission:
a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
print((a[0] + a[1]) * a[2] // 2)


Fixed submission:
a,b,h = [int(input()) for i in range(3)]
print((a + b) * h // 2)

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


Fixed submission:
a,b,h = [int(input()) for i in range(3)]
print((a + b) * h // 2)

Buggy python submission (verdict: Runtime Error):
import math
a,b,h = map(int,input().split())
ans = math.floor((a + b) * h / 2)
print(ans)


Fixed submission:
a,b,h = [int(input()) for i in range(3)]
print((a + b) * h // 2)
Buggy python submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari


def ans(l, m, s):
    cnt = 0

    R_s, R_a = f(N, l)

    for i in range(R_s + 1):
        x = R_a + i * l # R を i 個使う
        G_s, G_a = f(x, m)
        for j in range(G_s + 1):
            y = G_a + j * m # G を j 個使う
            if y % s == 0:
                cnt += 1
    return cnt

li = [R, G, B]
li.sort(reverse=True)

cnt = ans(li[0], li[1], li[2])

print(cnt)





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

print(N-K+1)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari

R_s, R_a = f(N, R)

cnt = 0

for i in range(R_s + 1):
    x = R_a + i * R # R を i 個使う
    G_s, G_a = f(x, G)
    for j in range(G_s + 1):
        y = G_a + j * G # G を j 個使う
        B_s, B_a = f(y, B)
        if B_a == 0:
            cnt += 1

print(cnt)





Fixed submission:
R, G, B, N = map(int, input().split())

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari


def ans(l, m, s):
    cnt = 0

    R_s, R_a = f(N, l)

    for i in range(R_s + 1):
        x = R_a + i * l # R を i 個使う
        G_s, G_a = f(x, m)
        for j in range(G_s + 1):
            y = G_a + j * m # G を j 個使う
            if y % s == 0:
                cnt += 1
    return cnt

li = [R, G, B]
li.sort(reverse=True)

cnt = ans(li[0], li[1], li[2])

print(cnt)
Buggy python submission (verdict: Runtime Error):
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def gcd_l(l):
    return functools.reduce(lambda x, y: gcd(x, y), l)


l = [0] * N  #L_i, i = 0, 1, 2, ..., N-1
for i in range(N):
    if i == 0:
        continue
    else:
        l[i] = gcd_l(l[i-1] + A[i-1])

r = [0] * N #R_i, i = 0, 1, 2, ..., N-1
for j in range(N):
    if j == 0:
        continue
    else:
        r[N-j] = gcd_l(r[N-j] + A[N-j-1])

m = [0] * N
for i in range(N):
    m[i] = gcd(l[i], r[i])

print(max(m))


Fixed submission:
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

l = [0] * N  #L_i, i = 0, 1, 2, ..., N-1
for i in range(N):
    if i == 0:
        continue
    else:
        l[i] = gcd(l[i-1], A[i-1])

r = [0] * N #R_i, i = 0, 1, 2, ..., N-1
for j in range(N):
    if j == 0:
        continue
    else:
        r[N-j-1] = gcd(r[N-j], A[N-j])

m = [0] * N
for i in range(N):
    m[i] = gcd(l[i], r[i])

print(max(m))

Buggy python submission (verdict: Runtime Error):
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
n = 0

gcds = []
if N == 2:
    n = max(A)
else:
    for i in range(N-1):
        if i == 0:
            continue
        l = A[0:i]
        r = A[i+1:N]

        l_gcd = functools.reduce(lambda x, y: gcd(x, y), l)
        r_gcd = functools.reduce(lambda x, y: gcd(x, y), r)
        gcds.append(gcd(l_gcd, r_gcd))

print(max(gcds))


Fixed submission:
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

l = [0] * N  #L_i, i = 0, 1, 2, ..., N-1
for i in range(N):
    if i == 0:
        continue
    else:
        l[i] = gcd(l[i-1], A[i-1])

r = [0] * N #R_i, i = 0, 1, 2, ..., N-1
for j in range(N):
    if j == 0:
        continue
    else:
        r[N-j-1] = gcd(r[N-j], A[N-j])

m = [0] * N
for i in range(N):
    m[i] = gcd(l[i], r[i])

print(max(m))

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
n = 0

if N == 2:
    n = max(A)
else:
    for i in range(N):
        l = copy.copy(A)
        l.pop(i)
        res = functools.reduce(lambda x, y: gcd(x, y), l)
        if res > n:
            n = res
print(n)


Fixed submission:
import functools
import copy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

l = [0] * N  #L_i, i = 0, 1, 2, ..., N-1
for i in range(N):
    if i == 0:
        continue
    else:
        l[i] = gcd(l[i-1], A[i-1])

r = [0] * N #R_i, i = 0, 1, 2, ..., N-1
for j in range(N):
    if j == 0:
        continue
    else:
        r[N-j-1] = gcd(r[N-j], A[N-j])

m = [0] * N
for i in range(N):
    m[i] = gcd(l[i], r[i])

print(max(m))
Buggy python submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split(" ")]
if B <= 5:
  print(str(0))
elif B <= 13:
  print(str(int(B/2)))
else:
  print(str(b))


Fixed submission:
A, B = [int(i) for i in input().split(" ")]
if A <= 5:
  print(str(0))
elif A <= 12:
  print(str(round(B/2)))
else:
  print(str(B))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().strip().split(' '))
c = 0
for i in range(n):
  if(!(i&1)):
    c+=1
if(c>=k):
  print("YES")
else:
  print("NO")

Fixed submission:


n,k = map(int,input().strip().split(' '))
c = 0
for i in range(n):
  if i%2 == 0:
    c+=1
if(c>=k):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
A, B= map(int, input().split())
sum = 0
i=0
while i < 2:
    if A => B:
        sum += A
        A -= 1
    else:
        sum+= B
        B -= 1
    i +=1

print(sum)

Fixed submission:
A, B= map(int, input().split())
sum = 0
i=0
while i < 2:
    if A >= B:
        sum += A
        A -= 1
    else:
        sum+= B
        B -= 1
    i +=1

print(sum)
Buggy python submission (verdict: Runtime Error):
S = input()
sum01 = 0
sum10 = 0

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i:i+1] == 1:
      sum01 += 1
  if (i % 2) == 1:
    if S[i:i+1] == 0:
      sum01 += 1

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i+:i+1] == 0:
      sum10 += 1
  if (i % 2) == 1:
    if S[i:i+1] == 1:
      sum10 += 1
        
if sum01 > sum10:
  print(sum10)
else:
  print(sum01)


Fixed submission:
S = input()
sumi = 0
sumii = 0

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i:i+1] == "1":
      sumi += 1
  if (i % 2) == 1:
    if S[i:i+1] == "0":
      sumi += 1

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i:i+1] == "0":
      sumii += 1
  if (i % 2) == 1:
    if S[i:i+1] == "1":
      sumii += 1
        
if sumi > sumii:
  print(sumii)
else:
  print(sumi)

Buggy python submission (verdict: Runtime Error):
S = input()
sum01 = 0
sum10 = 0

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i:i+1] == '1':
      sum01 += 1
  if (i % 2) == 1:
    if S[i:i+1] == '0':
      sum01 += 1

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i+:i+1] == '0':
      sum10 += 1
  if (i % 2) == 1:
    if S[i:i+1] == '1':
      sum10 += 1
        
if sum01 > sum10:
  print(sum10)
else:
  print(sum01)


Fixed submission:
S = input()
sumi = 0
sumii = 0

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i:i+1] == "1":
      sumi += 1
  if (i % 2) == 1:
    if S[i:i+1] == "0":
      sumi += 1

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i:i+1] == "0":
      sumii += 1
  if (i % 2) == 1:
    if S[i:i+1] == "1":
      sumii += 1
        
if sumi > sumii:
  print(sumii)
else:
  print(sumi)
Buggy python submission (verdict: Runtime Error):
import heapq as hq

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()]

pri = []
data = []
hq.heapify(pri)

A.sort()
B.sort()
C.sort()
A.reverse()
B.reverse()
C.reverse()

hq.heappush(pri, [-A[0]-B[0]-C[0],0,0,0])
data.append([0,0,0])

for i in range(K):
    s = pri[0][1]
    t = pri[0][2]
    u = pri[0][3]
    if s+1 <= X-1:
        if [s + 1, t, u] not in data:
            data.append([s+1, t, u])
            hq.heappush(pri, [-A[s+1]-B[t]-C[u],s+1,t,u])
    if t+1 <= Y-1:
        if [s, t+1, u] not in data:
            data.append([s, t+1, u])
            hq.heappush(pri, [-A[s]-B[t+1]-C[u],s,t+1,u])
    if u+1 <= Z-1:
        if [s, t, u+1] not in data:
            data.append([s, t, u+1])
            hq.heappush(pri, [-A[s]-B[t]-C[u+1],s,t,u+1])
    print(hq.heappop(pri)[0] * -1)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if (e - a) <= k:
    print("Yay!")
else:
    print(":(")

Buggy python submission (verdict: Runtime Error):
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()
B.sort()
C.sort()
A.reverse()
B.reverse()
C.reverse()

data = []

for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if i * j * k <= K:
                data.append(A[i] + B[j] + C[k])
                
data.sort()
data.reverse()
for i in range(K):
    print(data[i])


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if (e - a) <= k:
    print("Yay!")
else:
    print(":(")

Buggy python submission (verdict: Runtime Error):
a = [int(i) for i in input().split()]

if a[4] - a[0] <= a[5]:
    print("Yay!")
else:
    print(":(")

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if (e - a) <= k:
    print("Yay!")
else:
    print(":(")

Buggy python submission (verdict: Runtime Error):
N = 6 #the number of the input data
a = [[int(i) for i in input().split()] for j in range(N)]

if a[N-2] - a[0] <= k:
    print("Yay!")
else:
    print(":(")

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if (e - a) <= k:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list = [A,B,C,D,E]
num =[]
num_t = []
for i in range(len(list)):
    s = 0
    t = 0
    if list[i] >= 100:
        s = list[i] - 100
        t = 100
    else:
        s = list[i]
    while s >= 10:
        s -= 10
        t += 10
    num.append(s)
    if s != 0:
        t += 10
    num_t.append(t)
    
last_index = len(num)
for i in range(len(num)):
    if num[i] != 0:
        if num[i] <= last_index:
            last_index = i

sum = 0
for i in range(len(num_t)):
    sum += num_t[i]
    
sum = sum - num_t[last_index] + list[last_index]
print(sum)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list = [A,B,C,D,E]
num =[]
num_t = []
for i in range(len(list)):
    s = 0
    t = 0
    if list[i] >= 100:
        s = list[i] - 100
        t = 100
    else:
        s = list[i]
    while s >= 10:
        s -= 10
        t += 10
    num.append(s)
    if s != 0:
        t += 10
    num_t.append(t)
    
last_index = -1
for i in range(len(num)):
    if num[i] != 0:
        if last_index == -1:
            last_index = i
        if num[i] <= num[last_index]:
            last_index = i

sum = 0
for i in range(len(num_t)):
    sum += num_t[i]
    
sum = sum - num_t[last_index] + list[last_index]
print(sum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list_t = [A,B,C,D,E]
lowest = list_t[0]

for i in range(len(list_t)):
    if lowest >= list_t[i]:
        lowest = list_t[i]
    
a = N // lowest
print(a + 5

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list_t = [A,B,C,D,E]
lowest = list_t[0]

for i in range(len(list_t)):
    if lowest >= list_t[i]:
        lowest = list_t[i]
    
    
if (N % lowest) != 0:
    print(N // lowest + 5)
else:
    print(N // lowest + 4)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list_trans = [A,B,C,D,E]
list = [N,0,0,0,0,0]#initial condition
time = 0

while list[5] < N:
    list_new = [0,0,0,0,0,0]
    for i in range(len(list)-1):
        if (list[i] - list_trans[i]) >= 0:
            list_new[i] -= list_trans[i]
            list_new[i+1] += list_trans[i]
        else:
            list_new[i] -= list[i]
            list_new[i+1] += list[i]
    for i in range(len(list)):
        list[i] = list[i] + list_new[i]
    time += 1
print(time)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list_t = [A,B,C,D,E]
lowest = list_t[0]

for i in range(len(list_t)):
    if lowest >= list_t[i]:
        lowest = list_t[i]
    
    
if (N % lowest) != 0:
    print(N // lowest + 5)
else:
    print(N // lowest + 4)
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)


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

if a == 2 or b == 2:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
import math

city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = math.gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = math.gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)


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


city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 昇順に並び替え
distance_list.sort()

# 出力
print(reduce(math.gcd, distance_list))


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


city_num, start_pos = list(map(int, input().split()))
city_list = list(map(int, input().split()))

# スタート位置を入れて
city_list.append(start_pos)
# 昇順に並び替え
city_list.sort()

# city毎の距離のリストを生成する
distance_list = [city_list[i+1] - city_list[i] for i in range(city_num)]

# 距離が一つならそれを出力
if len(distance_list) == 1:
    print(distance_list[0])
    exit()

# 昇順に並び替え
distance_list.sort()

# 最大公約数を求める
max_gcd = gcd(distance_list[0], distance_list[1])
for i in range(2, len(distance_list)):
    max_gcd = gcd(max_gcd, distance_list[i])

# 出力
print(max_gcd)
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
piys = [[] for _ in range(M)] 
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y,i))
    
ans = [None]*M
for p,iys in enumerate(piys):
    iys.sort()
    for k,(y,i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1,k+1)

for i in ans:
    print(i)

Fixed submission:
N,M = map(int, input().split())
piys = [[] for _ in range(N)] 
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y,i))
    
ans = [None]*M
for p,iys in enumerate(piys):
    iys.sort()
    for k,(y,i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1,k+1)
 
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N,M = map(int, input().split())
piys = [[] for _ in range(M)] 
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y,i))
    
ans = [None]*M
for p,iys in enumerate(piys):
    iys.sort()
    for k,(y,i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1,k+1)

for i in ans:
    print(i)

Fixed submission:
N,M = map(int, input().split())
piys = [[] for _ in range(N)] 
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y,i))
    
ans = [None]*M
for p,iys in enumerate(piys):
    iys.sort()
    for k,(y,i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1,k+1)
 
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N,M = map(int, input().split())
piys = [[] for _ in range(M)] 
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y,i))
    
ans = [None]*M
for p,iys in enumerate(piys):
    iys.sort(key=lambda x:x[0])
    for k,(y,i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1,k+1)

for i in ans:
    print(i)

Fixed submission:
N,M = map(int, input().split())
piys = [[] for _ in range(N)] 
for i in range(M):
    p, y = map(int, input().split())
    piys[p-1].append((y,i))
    
ans = [None]*M
for p,iys in enumerate(piys):
    iys.sort()
    for k,(y,i) in enumerate(iys):
        ans[i] = "%06d%06d" % (p+1,k+1)
 
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())

def height(n):
    if n==1:
        return 1
    else:
        return n+height(n-1)
    
d = height(b-a)
print(d-b)

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

def height(n):
    sum = 0
    for i in range(n+1):
        sum += i
    return sum
    
#    if n==1:
#        return 1
#    else:
#        return n+height(n-1)
    
d = height(b-a)
print(d-b)