Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]
List = [A+B, A-B, A*B]
List = sorted(List)
print(List[3])

Fixed submission:
A, B = [int(i) for i in input().split()]
List = [A+B, A-B, A*B]
List = sorted(List)
print(List[2])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = [int(i) for i in input().split()]
for i in range(n):
  y = x.copy()
  del y[i]
  y = sorted(y)
  print(y[int( n/2-1 )])

Fixed submission:
n = int(input())
x = [int(i) for i in input().split()]
y = sorted(x)
m1 = y[int(n/2-1)]
m2 = y[int(n/2)]
if m1==m2:
  for i in x:
    print(m1)
else:
  for i in x:
    if m2 > i:
      print(m2)
    elif i > m1:
      print(m1)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = [int(i) for i in input().split()]
n = [i for i in range(a, b+1) if i<=a+(k-1) or i>=b-(k-1)]
for i in n:
  print(i)

Fixed submission:
a, b, k = [int(i) for i in input().split()]
if k >= b-a+1:
  for i in range(a, b+1):
    print(i)
else:
  c = [i for i in range(a, a+k)]
  d = [i for i in range(b-(k-1), b+1)]
  e = sorted(list(set(c) | set(d)))
  for i in e:
    print(i)
Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())
Y = Y/2
z = Z + Y
print(z)

Fixed submission:

# coding: utf-8

# In[1]:


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


# In[2]:


y = y/2


# In[3]:


z = x + y


# In[8]:


print(int(z))
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print('Hello World')
else if N == 2:
    a = int(input())
    b = int(input())
    print(a + b)

Fixed submission:
N = int(input())
if N == 1:
    print('Hello World')
else :
    a = int(input())
    b = int(input())
    print(a + b)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print('Hello World')
else if N == 2:
    a = input(input())
    b = input(input())
    print(a + b)

Fixed submission:
N = int(input())
if N == 1:
    print('Hello World')
else :
    a = int(input())
    b = int(input())
    print(a + b)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print('Hello World')
else:
    a = input(input())
    b = input(input())
    print(a + b)

Fixed submission:
N = int(input())
if N == 1:
    print('Hello World')
else :
    a = int(input())
    b = int(input())
    print(a + b)
Buggy python submission (verdict: Time Limit Exceeded):
ken_shi_list = input().split()
ken_num = int(ken_shi_list[0])
shi_num = int(ken_shi_list[1])

shi_list = []
nen_list = [[] for i in range(ken_num) ]


for i in range(shi_num):
    shi_list.append(input().split())
    nen_list[int(shi_list[i][0])-1].append( int(shi_list[i][1]) )


for i in range(ken_num):
   nen_list[i-1].sort()


for i in range(shi_num):
    ken = int(shi_list[i][0])
    nen = int(shi_list[i][1])
    for j in range( len(nen_list[ken-1]) ):
        if nen == nen_list[ken-1][j] :
            print( str(ken).zfill(6) + str(j+1).zfill(6) )    
            break



Fixed submission:
ken_shi_list = input().split()
ken_num = int(ken_shi_list[0])
shi_num = int(ken_shi_list[1])
 
shi_list = []
nen_list = [[] for i in range(ken_num) ]
 
for i in range(shi_num):
    shi_list.append(input().split())
    nen_list[int(shi_list[i][0])-1].append( int(shi_list[i][1]) )
 
 
checker = {}
for i in range(ken_num):
   nen_list[i].sort()
   for j in range(len(nen_list[i])):
        checker[nen_list[i][j]] = j+1


for i in range(shi_num):
    ken = int(shi_list[i][0])
    nen = int(shi_list[i][1])
    print( str(ken).zfill(6) + str(checker[nen]).zfill(6) )
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,t = map(int,input().split())
ans_no = 0
ans_cost = t

for i in range(n):
    a,b = map(int,input().split())
    if b<ans_cost:
        ans_no = a

if ans_no == 0:
    print("TLE")
else print(ans_no)

Fixed submission:
age = int(input())
if age == 1:
  print("Hello World")
else:
  a=int(input())
  b=int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,t = map(int,input().split())
ans_cost = float('inf')
ans_time = t

for i in range(n):
    a,b = map(int,input().split())
    if b=ans_time:
        if a<ans_cost:
            ans_cost = a


if ans_cost == float('inf'):
    print("TLE")
else:
     print(ans_cost)

Fixed submission:
# -*- coding: utf-8 -*-
n,t = map(int,input().split())
ans_cost = 10000
ans_time = t

for i in range(n):
    a,b = map(int,input().split())
    if b<=ans_time:
        if a<ans_cost:
            ans_cost = a


if ans_cost == 10000:
    print("TLE")
else:
     print(ans_cost)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,t = map(int,input().split())
ans_no = 0
ans_cost = t

for i in range(n):
    a,b = map(int,input().split())
    if b<ans_cost:
        ans_no = a

if ans_no = 0:
    print("TLE")
else print(ans_no)

Fixed submission:
# -*- coding: utf-8 -*-
n,t = map(int,input().split())
ans_cost = 10000
ans_time = t

for i in range(n):
    a,b = map(int,input().split())
    if b<=ans_time:
        if a<ans_cost:
            ans_cost = a


if ans_cost == 10000:
    print("TLE")
else:
     print(ans_cost)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,m,x,y = map(int,input().split())
xi = list(map(int,input().split()))
yi = list(map(int,input().split()))

xi.append(x)
yi.append(y)

xi.sort()
xi.reverse()
yi.sort()

if xi[0]<yi[0]:
    print("No War")
else:
    print("War")


Fixed submission:
# -*- coding: utf-8 -*-
list1 = list(map(int, input().split()))
list1.sort()
print(10*list1[2]+list1[1]+list1[0])
Buggy python submission (verdict: Runtime Error):
s = input()
s[3] = '8'
print(s)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
print(s[:3]+"8"+s[4:])
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
x=[int(i) for i in input().split()]
cost=[]

for i in range(N-K+1):
	length=0
	for j in range(K-1):
		length+=abs(x[i+j+1]-x[i+j])
	cost.append(length+abs(x[i]))
	cost.append(length+abs(x[i+K-1]))
print(min(cost))

Fixed submission:
N,K=map(int,input().split())
x=[int(i) for i in input().split()]
cost=[]

for i in range(N-K+1):
	length=abs(x[i]-x[i+K-1])
	cost.append(length+abs(x[i]))
	cost.append(length+abs(x[i+K-1]))
print(min(cost))
Buggy python submission (verdict: Runtime Error):
A,B,C,X,Y = map(int,input().split())

if X>Y:
    print(min( A*X+B*Y , 2*C*X , 2*C*Y+A*(X-Y)))
else:
    print(min( A*X+B*Y , 2*C*Y , 2*C*X+A*(Y-X)))


Fixed submission:
ans=700
for i in list(input()):
    if i=='o':
        ans += 100
print(ans)
Buggy python submission (verdict: Runtime Error):
print(int(input())+int(input())/2)

Fixed submission:
x, y = map(int, input().split())
print(x+y//2)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l+1, 0, -1):
    if l % i == 0:
        d = True
        for item in c:
            if item % i != 0:
                d = False
        if d:
            print(i)
            break

Fixed submission:
a, b = map(int, input().split())
if (a*b)%2 == 0:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
f = [l]
if l < 999999999:
    for i in range(1, l):
        if l % i == 0:
            f.append(i)
for i in range(len(f), 0, -1):
    d = True
    for item in c:
        if item % f[i-1] != 0:
            d = False
    if d:
        print(f[i-1])
        break


Fixed submission:
a, b = map(int, input().split())
if (a*b)%2 == 0:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
f = set()
for i in range(1, l+1):
    if l % i == 0:
        f.add(i)
for i in range(len(f), 0, -1):
    d = True
    for item in c:
        if item % i != 0:
            d = False
    if d:
        print(i)
        break

Fixed submission:
a, b = map(int, input().split())
if (a*b)%2 == 0:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l, 0, -1):
    d = True
    for item in c:
        if item % i != 0:
            d = False
    if d:
        print(i)
        break

Fixed submission:
a, b = map(int, input().split())
if (a*b)%2 == 0:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
f = []
for i in range(1, l+1):
    if l % i == 0:
        f.append(i)
for i in range(len(f), 0, -1):
    d = True
    for item in c:
        if item % f[i-1] != 0:
            d = False
    if d:
        print(f[i-1])
        break

Fixed submission:
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l+1, 0, -1):
    if l % i == 0:
        d = True
        for item in c:
            if item % i != 0:
                d = False
        if d:
            print(i)
            break

Buggy python submission (verdict: Time Limit Exceeded):
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l, 0, -1):
    d = True
    for item in c:
        if item % i != 0:
            d = False
    if d:
        print(i)
        break

Fixed submission:
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l+1, 0, -1):
    if l % i == 0:
        d = True
        for item in c:
            if item % i != 0:
                d = False
        if d:
            print(i)
            break

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
c = list(map(int, input().split()))
dis = set()
for i in range(1, n):
    dis.add(abs(c[i] - c[i-1]))
l = min(dis)
for i in range(l, 0, -1):
    d = True
    for item in dis:
        if item % i != 0:
            d = False
    if d:
        print(i)
        break


Fixed submission:
n, x = map(int, input().split())
c = list(map(int, input().split()))
c = set([abs(x-c[i]) for i in range(n)])
l = min(c)
for i in range(l+1, 0, -1):
    if l % i == 0:
        d = True
        for item in c:
            if item % i != 0:
                d = False
        if d:
            print(i)
            break
Buggy python submission (verdict: Runtime Error):
n = int(input())
d,x = map(int, input().split())
times = [int(input()) for i in range(n)]

count = 0
for k in range(n):
    count += int(d/times[k]) + 1

print(count + x)
    

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
a = sorted([x - i - 1 for i, x in enumerate(A)])
c = a[N // 2]
print(sum([abs(i - c) for i in a]))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())

t = 0
pt = 0
for i in range(1000):
    t += i
    if a < pt and b < t:
        if (pt-a) == (t-b):
            print(pt-a)
            break
    pt = t

         


Fixed submission:
s = int(input())
if s>999:
     print("ABD")
else:
  print("ABC")

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

t = 0
pt =0

for I in range(1000):
     t+=1
     if (pt < a and  b < t ):
              if( pt-a==t-b ):
                    print(pt-a)
                    break
     pt+=1


Fixed submission:
s = int(input())
if s>999:
     print("ABD")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
count=0
counts=[]
for i in range(n):
    east,west = s[:i],s[i+1:]
    for n in east:
        if n=="W":
            count+=1
    for e in west:
        if e == "E":
            count +=1
    counts.append(count)
    
print(min(counts))

Fixed submission:
a,b = map(int, input().split() )
result=[]
s = a+b
result.append(s)
s = a*b
result.append(s)
s = a-b
result.append(s)
print(max(result))
Buggy python submission (verdict: Runtime Error):
n = int(input())
res = 1
for i in range(1,n+1):
    for k in range(2,1+n):
        num = i**k
        if num > n:
            break
        if num <= n :
            res = max(res,num)
    
print(res)

Fixed submission:
a,b,c,d = map(int,input().split())
if abs(a-b)<=d and abs(b-c)<=d:
     print("Yes")
elif abs(a-c)<=d:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
res = 1
for i in range(1,n+1):
    for k in range(1,1+n):
        num = i**k
        if num <= n :
            res = max(res,num)
    
print(res)

Fixed submission:
a,b,c,d = map(int,input().split())
if abs(a-b)<=d and abs(b-c)<=d:
     print("Yes")
elif abs(a-c)<=d:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int(), input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+kk*m
print(al)

Fixed submission:
a,b=map(int,input().split())
if b>=a:
  print(a)
else:
  print(a-1)

Buggy python submission (verdict: Runtime Error):
a,b = map(int() , input().split())
count=0
for i in range(1,a+1):
    for n in range(1b+1):
        if i==n:
            count+=1

Fixed submission:
a,b=map(int,input().split())
if b>=a:
  print(a)
else:
  print(a-1)

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
count=0
for i in range(1,a+1):
    for n in range(1b+1):
        if i==n:
            count+=1

print(count)

Fixed submission:
a,b=map(int,input().split())
if b>=a:
  print(a)
else:
  print(a-1)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int(), input().split())
k = int(input())
kk=2**k
m = max([a,b,c])
al = a+b+c-m+kk*m
print(al)


Fixed submission:
a,b,c = map(int, input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+m*kk
print(al)

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int(), input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+kk*m
print(al)


Fixed submission:
a,b,c = map(int, input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+m*kk
print(al)

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

m = max(a,b,c)
al = a+b+c-m+m*2**k
print(al)

Fixed submission:
a,b,c = map(int, input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+m*kk
print(al)

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

m = max(a,b,c)
al = a+b+c-m+m**K
print(al)

Fixed submission:
a,b,c = map(int, input().split())
k = int(input())
kk=2**k
m = max(a,b,c)
al = a+b+c-m+m*kk
print(al)
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int, input().split()))

for i in range(n):
    li.sort()
    a =  li[i]
    b = li[int((n+1)/2)]
    print(b)
    li.append(a)

Fixed submission:
x,y,z=map(int,input().split())
if x <= z <= x+y :
  print("YES")
else:
  print("NO")

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

for i in range(1,1+n):
    li.sort()
    a =  li[i]
    li.pop(i)
    b = li[int((n+1)/2)]
    print(b)
    li.append(a)

Fixed submission:
x,y,z=map(int,input().split())
if x <= z <= x+y :
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,x = map(int(), input().split())
if a+b > x:
    print("YES")
else:
    print("NO")

Fixed submission:
x,y,z=map(int,input().split())
if x <= z <= x+y :
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n,m,x = map(int , input().split())

tax = [input() for i in range(m)]
alltax = len(tax)
atax = len(tax[:x])
btax = alltax-atax
if atax > btax:
    print(btax)
else:
    print(atax)

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

result = len(set(range(0,X))&A)
result = min(result, len(set(range(X,N))&A))

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

li = [i for i in range(a,b+1)]
print(li[0])
print(li[k-1])
print(li[b+1-k-a])
print(li[b-a])

Fixed submission:
A,B,K = map(int,input().split())
if (B - A + 2)//2 <= K:
    L = list(range(A,B+1))
else:
    L = list(range(A,A+K)) + list(range(B-K+1,B+1))
for i in L:
    print(i)

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

li = [i for i in range(a,b+1)]
print(li[0])
print(li[k-1])
print(li[-k])
print(li[-1])


Fixed submission:
A,B,K = map(int,input().split())
if (B - A + 2)//2 <= K:
    L = list(range(A,B+1))
else:
    L = list(range(A,A+K)) + list(range(B-K+1,B+1))
for i in L:
    print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d,x = map(int(), input().split())
times = [int(input()) for i in range(n)]

count = 0
for k in range(n):
    count += int(d/times[k]) + 1

print(count + x)

Fixed submission:
N=int(input())
D,X=map(int,input().split())
ans=0
for _ in[0]*N:
    A=int(input())
    ans+=(D+A-1)//A
print(ans+X)
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-


def ID():
    N, M = [int(n) for n in input().split()]
    lst = [[n for n in input().split()] for _ in range(M)]
    sorted_lst = sorted(lst, key=lambda x: int(x[1]))
    memo = {}
    result = {}
    for p, x in sorted_lst:
        if p not in memo:
            memo[p] = 1
        else:
            memo[p] += 1
        higher = p.zfill(6)
        lower = "{0:06d}".format(memo[p])
        result[p + x] = higher + lower

    for p, x in lst:
        print(result[p+x])


if __name__ == '__main__':
    ID()

Fixed submission:
# -*- coding:utf-8 -*-


def Discount_Fare():
    X, Y = [int(n) for n in input().split()]
    print(X + (Y // 2))


if __name__ == '__main__':
    Discount_Fare()

Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = (int(i) for i in input().split())
H = [int(i) for i in input().split()]

H_T = [0 for i in range(len(H))]
for i in range(len(H)):
    H_T[i] = float(T) - float(H[i])*0.006

min = 1000
index = 0
for i in range(len(H_T)):
    if(abs(H_T[i] - A) < min):
        index = i
        min = abs(H_T[i] - A)
print(index+1)


Fixed submission:
x, y = (int(i) for i in input().split())

print(int(x+y/2))
Buggy python submission (verdict: Runtime Error):
n = str(input())

result = n.replace('1', '2').replace('9','1').replace('2','9')

return result


Fixed submission:
n = str(input())

result = n.replace('1', '2').replace('9','1').replace('2','9')

print(result)
Buggy python submission (verdict: Runtime Error):
X,Y = map(int, intput().split())
print("{}".format(X+(Y/2)))

Fixed submission:
x,y = map(int,input().split())
print('{}'.format(int(x+(y/2))))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
print('Even' if (a*b)&1==0 else 'Odd')

Fixed submission:
a,b=map(int,input().split())
print('Even' if a*b%2==0 else 'Odd')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
print('Even'if((a*b)&1==0)else'Odd')

Fixed submission:
a,b=map(int,input().split())
print('Even' if a*b%2==0 else 'Odd')
Buggy python submission (verdict: Runtime Error):
#coding:utf-8
s = input()
a = 0
for c in s:
  a = a + 1 if c == "+" else a = a - 1
print(a)

Fixed submission:
#coding:utf-8
s = input()
a = 0
for c in s:
  a = a + 1 if c == "+" else a - 1
print(a)

Buggy python submission (verdict: Runtime Error):
#coding:utf-8
s = input()
a = 0
for c in s:
  a = a + 1 if c = "+" else a = a - 1
print(a)

Fixed submission:
#coding:utf-8
s = input()
a = 0
for c in s:
  a = a + 1 if c == "+" else a - 1
print(a)
Buggy python submission (verdict: Runtime Error):
    def htemp(t, x):
        return float(t - 0.006 * x)
     
    input()
    lt, la = [int(x) for x in input().split()]
    h_ary = [int(x) for x in input().split()]
     
    maxdiff = float('inf')
    goodpoint = 0
    for i, h in enumerate(h_ary):
        diff = abs(la - htemp(lt, h))
        if diff < maxdiff:
            maxdiff = diff
            goodpoint = i
    print(goodpoint+1)

Fixed submission:
def htemp(t, x):
    return float(t - 0.006 * x)
    
input()
lt, la = [int(x) for x in input().split()]
h_ary = [int(x) for x in input().split()]
    
maxdiff = float('inf')
goodpoint = 0
for i, h in enumerate(h_ary):
    diff = abs(la - htemp(lt, h))
    if diff < maxdiff:
        maxdiff = diff
        goodpoint = i
print(goodpoint+1)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = a * b 
amari = c % 2
if(amari == 1 ){
    print("Odd")
}
else(amari == 0){
    print("Even")
}

Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
c = a * b 
amari = c % 2
if amari == 1 :
    print("Odd")

elif amari == 0 :
    print("Even")
Buggy python submission (verdict: Runtime Error):
S=input()
K=int(input())

ans = '1'
pos = 0

while(ans=='1' and pos<=K):
  if S[pos] != '1':
    ans = S[pos]
  pos+=1
  
print(ans)

Fixed submission:
S=input()
K=int(input())

ans = '1'
pos = 0

while(ans=='1' and pos<K):
  if S[pos] != '1':
    ans = S[pos]
  pos+=1
  
print(ans)
Buggy python submission (verdict: Runtime Error):
from operator import itemgetter

def main():
    n, m = map(int, input().split())
    data = []
    for i in range(m):
        p, y = map(int, input().split())
        data.append([p, y, i])
    data_sorted = sorted(data, key=itemgetter(0, 1))

    p, y, i = 0, 0, 0
    p_prev = 0 
    x = 1 # initialize
    codes = []
    for p, y, i in data:
        # initialize if new prefecture, increment if not
        if p != p_prev:
            x = 1
        else:
            x += 1
        code = '{:06d}{:06d}'.format(p, x)
        codes.append([i, codes])
        p_prev = p

    for i, code in sorted(codes, key=itemgetter(0)):
        print code
        
main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Describe
"""
from operator import itemgetter

def main():
    n, m = map(int, input().split())
    data = []
    for i in range(m):
        p, y = map(int, input().split())
        data.append([p, y, i])
    # print(data)
    data_sorted = sorted(data, key=itemgetter(0, 1))
    # print(data_sorted)

    p, y, i = 0, 0, 0
    p_prev = 0 
    x = 1 # initialize
    codes = []
    for p, y, i in data_sorted:
        # initialize if new prefecture, increment if not
        if p != p_prev:
            x = 1
        else:
            x += 1
        code = '{:06d}{:06d}'.format(p, x)
        codes.append([i, code])
        p_prev = p
    # print(codes)

    codes_sorted = sorted(codes, key=itemgetter(0))
    # print(codes_sorted)

    for i, code in codes_sorted:
        print(code)
        
main()
Buggy python submission (verdict: Runtime Error):
N=int(input())
T,A=list(map(lambda x:float(A),input().split()))
H_list = list(map(lambda x:float(A),input().split()))
diff = [abs(T-x*0.006-A) for x in H_list]
i=diff.index(min(diff))
print(i+1)

Fixed submission:
N=int(input())
T,A=list(map(lambda x:float(x),input().split()))
H_list = list(map(lambda x:float(x),input().split()))
diff = [abs(T-x*0.006-A) for x in H_list]
i=diff.index(min(diff))
print(i+1)