Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = []
for i in range(m):
    li.append(int(input()))


def fib(dan):
    if dan == 1:
        return 1
    elif dan == 2:
        return 1
    elif dan == 0:
        return 0
    else:
        a1 = 1
        a2 = 1
        a3 = 0
        for _ in range(dan-2):
            a3 = a1 + a2 1000000007
            a1 = a2 % 1000000007
            a2 = a3 % 1000000007

        return a3



if m != 0:
    ans = fib(li[0]) % 1000000007
    for i in range(m-1):
        ans = ans * fib(li[i+1] - li[i] - 1 ) % 1000000007

    ans = ans * fib(n - li[m-1]) % 1000000007
    print(ans)

else:
    print(fib(n))





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


def fib(dan):
    if dan == 1:
        return 1
    elif dan == 2:
        return 1
    elif dan == 0:
        return 0
    else:
        a1 = 1
        a2 = 1
        a3 = 0
        for _ in range(dan-2):
            a3 = (a1 + a2) % 1000000007
            a1 = a2 % 1000000007
            a2 = a3 % 1000000007

        return a3



if m != 0:
    ans = fib(li[0]) % 1000000007
    for i in range(m-1):
        ans = ans * fib(li[i+1] - li[i] - 1 ) % 1000000007

    ans = ans * fib(n - li[m-1]) % 1000000007
    print(ans)

else:
    print(fib(n+1))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = []
for i in range(m):
    li.append(int(input()))


def fib(dan):
    if dan == 1:
        return 1
    elif dan == 2:
        return 1
    else:
        a1 = 1
        a2 = 1
        a3 = 0
        for _ in range(dan-2):
            a3 = a1 + a2
            a1 = a2
            a2 = a3

        return a3

ans = fib(li[0])

for i in range(m-1):
    ans = ans * fib(li[i+1] - li[i] - 1 ) % 1000000007

ans = ans * fib(n - li[m-1]) % 1000000007
print(ans)


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


def fib(dan):
    if dan == 1:
        return 1
    elif dan == 2:
        return 1
    elif dan == 0:
        return 0
    else:
        a1 = 1
        a2 = 1
        a3 = 0
        for _ in range(dan-2):
            a3 = (a1 + a2) % 1000000007
            a1 = a2 % 1000000007
            a2 = a3 % 1000000007

        return a3



if m != 0:
    ans = fib(li[0]) % 1000000007
    for i in range(m-1):
        ans = ans * fib(li[i+1] - li[i] - 1 ) % 1000000007

    ans = ans * fib(n - li[m-1]) % 1000000007
    print(ans)

else:
    print(fib(n+1))
Buggy python submission (verdict: Runtime Error):
n = int(input())
long ans = 0
li = []
for i in range(n):
    a, b = map(int, input().split())
    li.append([a+b, a, b])

li = sorted(li)
for i in range(n):
    if i%2 == 0:
        ans += li[i][1]
    if i%2 == 1:
        ans -= li[i][2]

print(ans)

Fixed submission:
n, a, b = map(int, input().split())
print(str(min(a, b)) + " " + str(max(0, a+b-n)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
li = []
for i in range(n):
    a, b = map(int, input().split())
    li.append([a+b, a, b])

li = sorted(li)
li = reversed(li)
for i in range(n):
    if i%2 == 0:
        ans += li[i][1]
    else:
        ans -= li[i][2]

print(ans)




Fixed submission:
n = int(input())
ans = 0
li = []
for i in range(n):
    a, b = map(int, input().split())
    li.append([a+b, a, b])

li = sorted(li)
li.reverse()
for i in range(n):
    if i%2 == 0:
        ans += li[i][1]
    else:
        ans -= li[i][2]

print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np
import math

n, p = map(int, input().split())
if n != 1:
    table = [0] * (math.sqrt(p) + 1)

    pl = []
    ans = 1

    for i in range(2, math.sqrt(p)+1):
        if table[i] == 0:
            pl.append(i)
            for j in range(i + i, math.sqrt(p)+1, i):
                table[j] = 1

    a = 0

    for i in range(len(pl)):
        q = p
        while q % pl[i] == 0:
            a += 1
            q = q / pl[i]
        ans = ans * (pl[i] ** (int(a//n)))
        a = 0
else:
    ans = p
print(ans)

Fixed submission:
import itertools
import numpy as np
import math

n, p = map(int, input().split())
if n != 1:
    table = [0] * (int(math.sqrt(p)) + 1)

    pl = []
    ans = 1

    for i in range(2, int(math.sqrt(p)) + 1):
        if table[i] == 0:
            pl.append(i)
            for j in range(i + i, int(math.sqrt(p)) + 1, i):
                table[j] = 1

    a = 0

    for i in range(len(pl)):
        q = p
        while q % pl[i] == 0:
            a += 1
            q = q / pl[i]
        ans = ans * (pl[i] ** (int(a//n)))
        a = 0
else:
    ans = p

print(ans)

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

n, p = map(int, input().split())
if n != 1:
    table = [0] * (math.sqrt(p) + 1)

    pl = []
    ans = 1

    for i in range(2, math.sqrt(p)+1):
        if table[i] == 0:
            pl.append(i)
            for j in range(i + i, p + 3, i):
                table[j] = 1

    a = 0

    for i in range(len(pl)):
        q = p
        while q % pl[i] == 0:
            a += 1
            q = q / pl[i]
        ans = ans * (pl[i] ** (int(a//n)))
        a = 0
else:
    ans = p
print(ans)

Fixed submission:
import itertools
import numpy as np
import math

n, p = map(int, input().split())
if n != 1:
    table = [0] * (int(math.sqrt(p)) + 1)

    pl = []
    ans = 1

    for i in range(2, int(math.sqrt(p)) + 1):
        if table[i] == 0:
            pl.append(i)
            for j in range(i + i, int(math.sqrt(p)) + 1, i):
                table[j] = 1

    a = 0

    for i in range(len(pl)):
        q = p
        while q % pl[i] == 0:
            a += 1
            q = q / pl[i]
        ans = ans * (pl[i] ** (int(a//n)))
        a = 0
else:
    ans = p

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))
ans = sum(a) - a[n-1] / 2
print(ans)


Fixed submission:
n = int(input())
a = sorted(list(map(int, [input() for i in range(n)])))
ans = sum(a) - (a[n-1] / 2)
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ans = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t > T:
        continue
    if ans > c:
        ans = c

if ans = 1001:
    print('TLE')
else:
    print(ans)


Fixed submission:
N, T = map(int, input().split())
ans = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t > T:
        continue
    if ans > c:
        ans = c

if ans == 1001:
    print('TLE')
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ans = 1001
for i in range(n):
    c, t = map(int, input().split())
    if t > T:
        continue
    if ans > c:
        ans = c

if ans = 1001:
    print('TLE')
else:
    print(ans)


Fixed submission:
N, T = map(int, input().split())
ans = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t > T:
        continue
    if ans > c:
        ans = c

if ans == 1001:
    print('TLE')
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ans = 1000
for i in range(n):
    c, t = map(int, input().split())
    if t > T:
        continue
    if ans > c:
        ans = c

print(ans)
  

Fixed submission:
N, T = map(int, input().split())
ans = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t > T:
        continue
    if ans > c:
        ans = c

if ans == 1001:
    print('TLE')
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n, 1000):
  if i % 111 = 0:
    print(i)
    exit()


Fixed submission:
n = int(input())
for i in range(n, 1000):
  if i % 111 == 0:
    print(i)
    exit()

Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n, 1000):
  if i % 111 = 0:
    print(i)
    break

Fixed submission:
n = int(input())
for i in range(n, 1000):
  if i % 111 == 0:
    print(i)
    exit()
Buggy python submission (verdict: Runtime Error):
import math
from scipy.misc import comb
 
N, M = map(int, input().split())
li1 = []
li2 = []
a = 1

for j in range(2, int(math.sqrt(M))):
    dest = int(math.sqrt(j))
    for i in range(2,dest):
        if j % i == 0:
            continue
    li1.append(j)

for k in range(len(li1)):
    if M % li1[k] != 0:
        continue
    c = 0
    x = M
    while x % li1[k] == 0:
        x = x / li1[k]
        c += 1
    li2.append(c)

for l in range(len(li2)):
    a *= comb(li2[l] + N - 1, N - 1)

print(int(a))

Fixed submission:
l = sorted(list(map(int, input().split())))
print(l[2] * 10 + l[1] + l[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(N):
    B.append(A[i] - i - 1)

B = sorted(B)
M = B[int((N + 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(N):
    B.append(A[i] - i - 1)

B = sorted(B)
M = B[int((N - 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(N):
    B.append(A[i] - i)

B = sorted(B)
M = B[int((N + 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(N):
    B.append(A[i] - i - 1)

B = sorted(B)
M = B[int((N - 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range (N):
    B[i] = A[i]- i

B = sorted(B)
M = B[int((N + 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(N):
    B.append(A[i] - i - 1)

B = sorted(B)
M = B[int((N - 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int, input().split())))
M = int((N + 1)/2)
ans = 0

for i in range(N):
    t = A[i] - A[M]
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(N):
    B.append(A[i] - i - 1)

B = sorted(B)
M = B[int((N - 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
bool1 = False

a0 = int(input())

for i in range(N-1):
    a1 = int(input())
    if i == 0 and a0 != 0:
        bool1 = True
        break
    if a1 - a0 > 1:
        bool1 = True
        break
    elif a1 - a0 == 1:
        a0 = a1
        continue
    else:
        ans += a0
        a0 = a1
       
if bool1 == True:
    print(-1)
else:
    print(ans + a1)

Fixed submission:
N = int(input())
ans = 0
bool1 = False

a0 = int(input())
if N == 1:
    if a0 != 0:
        print(-1)
    else:
        print(0)

else:
    for i in range(N-1):
        a1 = int(input())
        if i == 0 and a0 != 0:
            bool1 = True
            break
        if a1 - a0 > 1:
            bool1 = True
            break
        elif a1 - a0 == 1:
            a0 = a1
            continue
        else:
            ans += a0
            a0 = a1

    if bool1 == True:
        print(-1)
    else:
        print(ans + a1)
Buggy python submission (verdict: Runtime Error):
a = input()
print(a ** 3)

Fixed submission:
a = int(input())
print(a ** 3)

Buggy python submission (verdict: Runtime Error):
print(input() ** 3)

Fixed submission:
a = int(input())
print(a ** 3)

Buggy python submission (verdict: Runtime Error):
n = input()
print(10 ** n)

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

for i in range(n-2):
  if b[i] > b[i+1]:
    a = a + b[i+1]
  if b[i+1] > b[i]:
    a = a + b[i]
  if b[i+1]==b[i]:
    a = a + b[i]
  a = a + b[n-1] + b[0]
print(a)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a_sum = 0

a_sum += b[0]

for i in range(n-2):
    if b[i] >= b[i+1]:
        a_sum += b[i+1]
    if b[i+1] > b[i]:
        a_sum += b[i]

a_sum += b[n-2]
print(a_sum)

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

for i in range(n-2):
  if b[i] >= b[i+1]:
    a = a + b[i+1]
  if b[i+1] > b[i]:
    a = a + b[i]
  a = a + b[n-1] + b[0]
print(a)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a_sum = 0

a_sum += b[0]

for i in range(n-2):
    if b[i] >= b[i+1]:
        a_sum += b[i+1]
    if b[i+1] > b[i]:
        a_sum += b[i]

a_sum += b[n-2]
print(a_sum)

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

for i in range(n-2):
  if b[i] > b[i+1]:
    a = a + b[i+1]
  if b[i+1] > b[i]:
    a = a + b[i]
  a = a + b[n-1] + b[0]
print(a)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a_sum = 0

a_sum += b[0]

for i in range(n-2):
    if b[i] >= b[i+1]:
        a_sum += b[i+1]
    if b[i+1] > b[i]:
        a_sum += b[i]

a_sum += b[n-2]
print(a_sum)

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

for i in range(n-2):
  if b[i] > b[i+1]:
    a = a + b[i+1]
  if b[i+1] > b[i]:
    a = a + b[i]
  a = a + b[n-1]
print(a)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a_sum = 0

a_sum += b[0]

for i in range(n-2):
    if b[i] >= b[i+1]:
        a_sum += b[i+1]
    if b[i+1] > b[i]:
        a_sum += b[i]

a_sum += b[n-2]
print(a_sum)

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

for i in range(n-2):
  if b[i] > b[i+1]:
    a = a + b[i+1]
  if b[i+1] > b[i]:
    a = a + b[i]
    a = a + b[n-1]
print(a)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a_sum = 0

a_sum += b[0]

for i in range(n-2):
    if b[i] >= b[i+1]:
        a_sum += b[i+1]
    if b[i+1] > b[i]:
        a_sum += b[i]

a_sum += b[n-2]
print(a_sum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s_list = [input() for i in range(n)]
m = int(input())
t_list = [input() for j in range(m)]


def list_diff(list1, list2):
    result = list1.copy()
    for val in list2:
        if val in result:
            result.remove(val)
    return result


def count_max(diff_list):
    cnt_list = [diff_list.count(ele) for ele in set(diff_list)]
    return max(cnt_list)


lst = list_diff(s_list, t_list)
print(count_max(lst))

Fixed submission:
n = int(input())
s_list = [input() for i in range(n)]
m = int(input())
t_list = [input() for j in range(m)]


def list_diff(list1, list2):
    result = list1.copy()
    for val in list2:
        if val in result:
            result.remove(val)
    return result


def count_max(diff_list):
    cnt_list = [diff_list.count(ele) for ele in set(diff_list)]
    if len(cnt_list) != 0:
        return max(cnt_list)
    else:
        return 0


lst = list_diff(s_list, t_list)
print(count_max(lst))
Buggy python submission (verdict: Runtime Error):
n = int(input())
list_d = [int(input()) for i int range(n)]

print(len(set(lst)))

Fixed submission:
n = int(input())
list_d = [int(input()) for i in range(n)]

print(len(set(list_d)))

Buggy python submission (verdict: Runtime Error):
n = int(input())
list_d = [int(input()) for i int range(n)]

print(len(set(lst)))

Fixed submission:
n = int(input())
list_d = [int(input()) for i in range(n)]

print(len(set(list_d)))

Buggy python submission (verdict: Runtime Error):
N = int(input())
list_d = [int(input()) for i int range(n)]

print(len(set(lst)))

Fixed submission:
n = int(input())
list_d = [int(input()) for i in range(n)]

print(len(set(list_d)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
list_a = list(map(int, input().split()))

cnt = 0
while all(map(lambda x: x%2 == 0, list_a)):
    list_a = list(map(lambda x: x%2, list_a))
    cnt +=1

print(cnt)

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

cnt = 0
while all(map(lambda x: x%2 == 0, list_a)):
    list_a = list(map(lambda x: x/2, list_a))
    cnt +=1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = 0
for x in range(len(a)):
    c = 0
    for y in range (x):
       if a[y] < a[x]:
           c +=1
    if c == 0:
        b+=1
print(b)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = 0
mini = 2*(10**5)+10
for x in range(len(a)):
    if a[x] < mini :
        mini=a[x]
        b+=1
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())

ans=0

for i in range(N+1):
  if i*R > N:
    break
  else:
    for j in range(N+1):
      if i*R+j*G > N:
        break
      else:
        if N-(i*R+j*G) == 0 or (N-(i*R+j*G)) % B == 0:
          ans+=1
          
print(ans)


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

ans=0

for i in range(N+1):
  if i*R > N:
    break
  else:
    for j in range(N+1):
      if i*R+j*G > N:
        break
      else:
        if N-(i*R+j*G) == 0 or (N-(i*R+j*G)) % B == 0:
          ans+=1
          
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=0
B=0
AB=0
ans=0

for i in range(N):
  s=input()
  for j in range(len(s)-1):
    if s[j]=="A" and s[j+1]=="B":
      ans+=1
      
  if s[0]=="B" and s[-1]=="A":
    AB+=1
  elif s[0]=="B":
    B+=1
  elif s[-1]=="A":
    A+=1
  else:
    continue
  
ans+=min(A,B)
tmp=abs(A-B)

if AB <= tmp:
  ans+=AB
else:
  ans+=AB//tmp*tmp
  ans+=AB%temp
  
print(ans)

Fixed submission:
N=int(input())
A=0
B=0
AB=0
ans=0

for i in range(N):
  s=input()
  for j in range(len(s)-1):
    if s[j]=="A" and s[j+1]=="B":
      ans+=1
      
  if s[0]=="B" and s[-1]=="A":
    AB+=1
  elif s[0]=="B":
    B+=1
  elif s[-1]=="A":
    A+=1
  else:
    continue

if AB==0:
  ans+=min(A,B)
else:
  if A==0 and B==0:
    ans+=(AB-1)
  else:
    ans+=(AB+min(A,B))
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
ans=len(S)
def solve(s):
    res=""
    cnt=0
    while cnt < len(s):
        if cnt == len(s)-1:
            res+=s[cnt]
            cnt+=1
        elif s[cnt] ==s[cnt+1]:
            res +=s[cnt]
            cnt+=1
        else:
            cnt+=2

    if len(s) == len(res):
        return ans-len(s)
    else:
        return solve(res)

print(solve(S))

Fixed submission:
S=input()

cnt=0
for i in range(len(S)):
    if S[i]=="0":
        cnt+=1
    else:
        cnt-=1
print(len(S)-abs(cnt))
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
H=[int(x) for x in input().split()]
INF=10**10

dp=[INF for x in range(N)]
dp[0]=0

for i in range(N):
    for j in range(1,K+1):
        if i+j < N:
            dp[i+j]=min(dp[i+j],dp[i]+abs(H[i]-H[i+j]))
        else:
            break

print(dp[N-1])

Fixed submission:
N,K=map(int,input().split())
H=[int(x) for x in input().split()]
INF=10**10

dp=[INF for x in range(N)]
dp[0]=0

for i in range(N):
    for j in range(1,K+1):
        if i+j < N:
            dp[i+j]=min(dp[i+j],dp[i]+abs(H[i]-H[i+j]))
        else:
            break

print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
WV=[[int(x) for x in input().split()] for y in range(N)]

dp=[[0 for x in range(W+1)] for y in range(N+1)]
for i in range(N-1,-1,-1):
    for j in range(W+1):
        if j < WV[i][0]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j],dp[i+1][j-WV[i][0]]+WV[i][1])

print(dp[0][W])

Fixed submission:
N,W=map(int,input().split())
WV=[[int(x) for x in input().split()] for y in range(N)]

dp=[[0 for x in range(W+1)] for y in range(N+1)]
for i in range(N-1,-1,-1):
    for j in range(W+1):
        if j < WV[i][0]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j],dp[i+1][j-WV[i][0]]+WV[i][1])

print(dp[0][W])
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input())

if A+B < C-1:
  print(A+B+B+1)
else:
  print(C+B)

Fixed submission:
A,B,C=map(int,input().split())

if A+B < C-1:
  print(A+B+B+1)
else:
  print(C+B)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

N,M=map(int,input().split())

A=defaultdict(list)
Q=[]

for i in range(M):
  P,Y=map(int,input().split())
  Q.append([P,Y])
  A[P].append(Y)
  
for a,b in A.items():
  A[a].sort()

for l in Q:
  s=str(l[0]).zfill(6)
  num=A[l[0]].index(l[1])
  s+=str(num+1).zfill(6)
  print(s)


Fixed submission:
X,Y=map(int,input().split())

print(X+Y//2)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

N,M=map(int,input().split())

A=defaultdict(list)
Q=[]

for i in range(M):
  P,Y=map(int,input().split())
  Q.append([P,Y])
  A[P].append(Y)
  
for a,b in A.items():
  A[a].sort()

for l in Q:
  s=str(l[0]).zfill(6)
  num=A[l[0]].index(l[1])
  s+=str(num+1).zfill(6)
  print(s)


Fixed submission:
from collections import defaultdict

N,M=map(int,input().split())

Q=[]

for i in range(M):
  P,Y=map(int,input().split())
  Q.append([P,Y,i])
  
Q = sorted(Q,key=lambda x:x[1])
Q = sorted(Q,key=lambda x:x[0])

nowP=Q[0][0]
nownum=0

for l in Q:
  s=str(l[0]).zfill(6)
  if l[0]==nowP:
    nownum+=1
  else:
    nowP=l[0]
    nownum=1
  s+=str(nownum).zfill(6)
  l.append(s)
  
Q = sorted(Q,key=lambda x:x[2])

for l in Q:
  print(l[3])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

N,M=map(int,input().split())

A=defaultdict(list)
Q=[]

for i in range(M):
  P,Y=map(int,input().split())
  Q.append([P,Y])
  A[P].append(Y)
  
for a,b in A.items():
  A[a].sort()

for l in Q:
  s=str(l[0]).zfill(6)
  num=A[l[0]].index(l[1])
  s+=str(num+1).zfill(6)
  print(s)

Fixed submission:
from collections import defaultdict

N,M=map(int,input().split())

Q=[]

for i in range(M):
  P,Y=map(int,input().split())
  Q.append([P,Y,i])
  
Q = sorted(Q,key=lambda x:x[1])
Q = sorted(Q,key=lambda x:x[0])

nowP=Q[0][0]
nownum=0

for l in Q:
  s=str(l[0]).zfill(6)
  if l[0]==nowP:
    nownum+=1
  else:
    nowP=l[0]
    nownum=1
  s+=str(nownum).zfill(6)
  l.append(s)
  
Q = sorted(Q,key=lambda x:x[2])

for l in Q:
  print(l[3])
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

if M%N==0:
  print(M//N)
else:
  ans= (M//N)
  while ans > 1:
    if M%ans==0:
      break
    else:
      ans-=1
  print(ans)

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

if M%N==0:
  print(M//N)
else:
  ans= (M//N)
  cnt=[]
  for i in range(1,M):
    if i*i > M:
      break
    if M%i==0:
      cnt.append(i)
      cnt.append(M//i)
      
  cnt.sort(reverse=True)
  for j in range(len(cnt)):
    if cnt[j] < ans:
      ans=cnt[j]
      break
  
  print(ans)
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
print(A*B-(A+B-1))

Fixed submission:
A,B=map(int,input().split())
print(A*B-(A+B-1))