Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(1,n+1):
    ol[i].sort()
for i in range(m):
    print("%06d%06d" % (pl[i], ol[pl[i]].index(yl[i])+1))

Fixed submission:
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(1,n+1):
    ol[i].sort()
for i in range(m):
    print("%06d%06d" % (pl[i], bisect.bisect_right(ol[pl[i]], yl[i])))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    bisect.insort_left(ol[pl[i]], yl[i])
for i in range(m):
    x = bisect.bisect_right(ol[pl[i]], yl[i])
    print("%06d%06d" % (pl[i], x))


Fixed submission:
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(1,n+1):
    ol[i].sort()
for i in range(m):
    print("%06d%06d" % (pl[i], bisect.bisect_right(ol[pl[i]], yl[i])))

Buggy python submission (verdict: Runtime Error):
import bisect
n,m=map(int, input().split())
pl=[0]*m
yl=[0]*m
ol=[[] for i in range(n+1)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(n):
    ol[pl[i]] = sorted(ol[pl[i]])
for i in range(m):
    x = bisect.bisect_right(ol[pl[i]], yl[i])
    print("%06d%06d" % (pl[i], x))


Fixed submission:
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(1,n+1):
    ol[i].sort()
for i in range(m):
    print("%06d%06d" % (pl[i], bisect.bisect_right(ol[pl[i]], yl[i])))

Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
pl=[0]*m
yl=[0]*m
cl=[0]*(m+1)
ol=[[] for i in range(n+1)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append((pl[i], yl[i], i))
for i in range(n):
    cnt = 1
    for o in sorted(ol[pl[i]]):
        cl[o[2]] = cnt
        cnt+=1
for i in range(m):
    print("%06d%06d" % (pl[i], cl[i]))


Fixed submission:
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(1,n+1):
    ol[i].sort()
for i in range(m):
    print("%06d%06d" % (pl[i], bisect.bisect_right(ol[pl[i]], yl[i])))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
pl=[0]*m
yl=[0]*m
cl=[0]*m
ppl=[[] for j in range(n+1)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    cnt=1
    for j in ppl[pl[i]]:
        if yl[i] < yl[j]:
            cl[j] += 1
        else:
            cnt+=1
    ppl[pl[i]].append(i)
    cl[i] = cnt
for i in range(m):
    print("%06d%06d" % (pl[i], cl[i]))

Fixed submission:
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(1,n+1):
    ol[i].sort()
for i in range(m):
    print("%06d%06d" % (pl[i], bisect.bisect_right(ol[pl[i]], yl[i])))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
pl=[0]*m
yl=[0]*m
sl={}
cl=[0]*m
for i in range(m):
    p,y = map(int, input().split())
    pl[i]=p
    yl[i]=y
    if not p in sl:
        sl[p] = []
    sl[p].append((y, i))

for k, s in sl.items():
    sl[k] = sorted(s)

for i in range(m):
    p=pl[i]
    for j, tl in enumerate(sl[p]):
        if tl[1]==i:
            cl[i] = j+1

for i in range(m):
    print("%06d%06d" % (pl[i], cl[i]))


Fixed submission:
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(1,n+1):
    ol[i].sort()
for i in range(m):
    print("%06d%06d" % (pl[i], bisect.bisect_right(ol[pl[i]], yl[i])))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
pl=[0]*m
yl=[0]*m
sl={}
cl=[0]*m
for i in range(m):
    p,y = map(int, input().split())
    pl[i]=p
    yl[i]=y
    if not p in sl:
        sl[p] = [(y, i)]
        continue
    no=True
    for j, tl in enumerate(sl[p]):
        if tl[0] > y:
            sl[p].insert(j, (y, i))
            no=False
            break
    if no:
        sl[p].append((y, i))

for i in range(m):
    p=pl[i]
    for j, tl in enumerate(sl[p]):
        if tl[1]==i:
            cl[i] = j+1

for i in range(m):
    print("%06d%06d" % (pl[i], cl[i]))


Fixed submission:
import bisect
n,m=map(int, input().split())
pl=[0]*100000
yl=[0]*100000
ol=[[] for i in range(100001)]
for i in range(m):
    pl[i],yl[i] = map(int, input().split())
    ol[pl[i]].append(yl[i])
for i in range(1,n+1):
    ol[i].sort()
for i in range(m):
    print("%06d%06d" % (pl[i], bisect.bisect_right(ol[pl[i]], yl[i])))