Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
hw = input().split(" ");
h = int(hw[0]);
w = int(hw[1]);
pic = [['.']*(h+2) for i in range(w+2)];
can = 0;
for i in range(1,h+1) :
	s = list(input().rstrip('\n'));
	for j in range(1,w+1) :
		pic[i][j] = s[j-1];
for i in range(1,h+1) :
	for j in range(1,w+1) :
		if pic[i][j] == '#' and pic[i][j-1] == '.' and pic[i-1][j] == '.' and pic[i][j+1] == '.' and pic[i+1][j] == '.' :
			can = can + 1;
if can == 0 :
	print('Yes');
else :
	print('No');

Fixed submission:
hw = input().split(" ");
h = int(hw[0]);
w = int(hw[1]);
pic = [['.']*(w+2) for i in range(h+2)];
can = 0;
for i in range(1,h+1) :
	s = list(input().rstrip('\n'));
	for j in range(1,w+1) :
		pic[i][j] = s[j-1];
for i in range(1,h+1) :
	for j in range(1,w+1) :
		if pic[i][j] == '#' and pic[i][j-1] == '.' and pic[i-1][j] == '.' and pic[i][j+1] == '.' and pic[i+1][j] == '.' :
			can = can + 1;
if can == 0 :
	print('Yes');
else :
	print('No');

Buggy python submission (verdict: Runtime Error):
hw = input().split(" ");
h = int(hw[0]);
w = int(hw[1]);
pic = [[.]*h+2 for i in range(w+2)];
can = 0;
for i in range(1,h+1) :
	s = list(input().rstrip('\n'));
	for j in range(1,w+1) :
		pic[i][j] = s[j-1];
for i in range(1,h+1) :
	for j in range(1,w+1) :
		else :
			if pic[i][j] == '#' and pic[i][j-1] == '.' and pic[i-1][j] == '.' and pic[i][j+1] == '.' and pic[i+1][j] == '.' :
				can = can + 1;
if can == 0 :
	print('Yes');
else :
	print('No');

Fixed submission:
hw = input().split(" ");
h = int(hw[0]);
w = int(hw[1]);
pic = [['.']*(w+2) for i in range(h+2)];
can = 0;
for i in range(1,h+1) :
	s = list(input().rstrip('\n'));
	for j in range(1,w+1) :
		pic[i][j] = s[j-1];
for i in range(1,h+1) :
	for j in range(1,w+1) :
		if pic[i][j] == '#' and pic[i][j-1] == '.' and pic[i-1][j] == '.' and pic[i][j+1] == '.' and pic[i+1][j] == '.' :
			can = can + 1;
if can == 0 :
	print('Yes');
else :
	print('No');
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input());
a = input().split(" ");
b = input().split(" ");
c = input().split(" ");
num_b = [0]*n;
for i in range(n) :
	for j in range(n) :
		if int(b[i]) < int(c[j]) :
			num_b[i] += 1;
ans = 0;
for i in range(n) :
	for j in range(n) :
		if int(a[i]) < int(b[j]) :
			ans += num_b[j]
print(ans);

Fixed submission:
import bisect

n = int(input());
a = input().split(" ");
b = input().split(" ");
c = input().split(" ");
num_b = [0]*n;
for i in range(n) :
	a[i] = int(a[i]);
	b[i] = int(b[i]);
	c[i] = int(c[i]);
a.sort();
b.sort();
c.sort();
num_b = [0]*(n+1);
for i in range(n) :
	num_b[n-1-i] = n - bisect.bisect_right(c,b[n-1-i]) + num_b[n-i];
ans = 0;
for i in range(n) :
	ans += num_b[bisect.bisect_right(b,a[i])];
print(ans);
Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split( ))
if l[0] == l[1]:
	print(l[2])
elif l[0] == l[2] :
	print(l[1])
else:
	print(l[0])

Fixed submission:
s = input().split(" ");
a = int(s[0]);
b = int(s[1]);
c = int(s[2]);
if a == b :
	print(c);
elif a == c :
	print(b);
else :
	print(a);
Buggy python submission (verdict: Time Limit Exceeded):
import math

nm = input().split(" ");
n = int(nm[0]);
m = int(nm[1]);
if n - m == 1 or m - n == 1:
  ansn = math.factorial(n);
  ansm = math.factorial(m);
  print(ansn*ansm);
elif n == m :
  ansn = math.factorial(n);
  ansm = math.factorial(m);
  print(ansn*ansm*2);
else :
  print(0);

Fixed submission:
nm = input().split(" ");
n = int(nm[0]);
m = int(nm[1]);
mod = 10**9+7
if n - m == 1 or m - n == 1:
	ansn = 1;
	for i in range(n) :
		ansn = (ansn % mod)*((n-i) % mod);
		ansm = 1;
	for j in range(m) :
	 	ansm = (ansm % mod)*((m-j) % mod);
	print((ansn*ansm) % mod);
elif n == m :
	ansn = 1;
	for i in range(n) :
		ansn = (ansn % mod)*((n-i) % mod);
		ansm = 1;
	for j in range(m) :
  		ansm = (ansm % mod)*((m-j) % mod);
	print((ansn*ansm*2) % mod);
else :
	print(0);
Buggy python submission (verdict: Runtime Error):
s = input().split(" ");
n = s[0];
a = s[1];
b = s[2];
if a > b :
  print(0);
else
  if n = 1 or n = 2:
    print(1);
  else
    ans = (b - a)*(n - 2)+1;
    print(ans);

Fixed submission:
s = input().split(" ");
n = int(s[0]);
a = int(s[1]);
b = int(s[2]);
if a > b :
  print(0);
else :
  if n == 1 :
    if a==b :
      print(1);
    else :
      print(0);
  else :
    ans = (b - a)*(n - 2)+1;
    print(ans);
Buggy python submission (verdict: Runtime Error):
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    dog_no = input_number()
    base = 26
    alphabet = "abcdefghijklmnopqlstuvwxyz"
    n = 1
    n_ls = [n]
    t_ls = [0]
    while n <= 10 ** 15 + 1:
        n *= base
        n_ls.append(n + n_ls[-1])
        t_ls.append(n)
    n_ls.sort(reverse=True)
    t_ls.sort(reverse=True)

    ans = ""
    for i in range(len(n_ls)):
        d = dog_no // (n_ls[i])
        if d >= 1:
            if i == len(n_ls) - 1:
                ans += alphabet[dog_no - 1]
            else:
                a = dog_no // t_ls[i]
                dog_no %= t_ls[i]
                ans += alphabet[a - 1]
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
def f(n):
    if n == 0: return ""
    n -= 1
    return (f(n // 26) + chr(ord("a") + n % 26))

def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    n = input_number()
    ans = f(n)
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    X = int(input())
    t = []
    i = 0
    while True:
        x = i ** 5
        t.append(x)
        if x > 10 ** 9:
            break
        i += 1
    d = {}
    for i in range(len(t)):
        for j in range(len(t)):
            d[t[i] - t[j]] = [i, j]
            d[t[i] + t[j]] = [i, -j]
            d[-t[i] - t[j]] = [-i, j]
            d[-t[i] + t[j]] = [-i, -j]
    print(d[X][0], d[X][1])


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    X = int(input())
    t = []
    i = 0
    while True:
        x = i ** 5
        t.append(x)
        if x > 10 ** 12:
            break
        i += 1
    d = {}
    for i in range(len(t)):
        for j in range(len(t)):
            d[t[i] - t[j]] = [i, j]
            d[t[i] + t[j]] = [i, -j]
            d[-t[i] - t[j]] = [-i, j]
            d[-t[i] + t[j]] = [-i, -j]
    print(d[X][0], d[X][1])


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    X = input_number()
    t = []
    i = 0
    while True:
        x = i ** 5
        t.append(x)
        if x > 10 ** 9:
            break
        i += 1
    d = {}
    for i in range(len(t)):
        for j in range(len(t)):
            d[t[i] - t[j]] = [i, j]
            d[t[i] + t[j]] = [i,-j]
            d[-t[i] - t[j]] = [-i, j]
            d[-t[i] + t[j]] = [-i, -j]
    print(d[X][0],d[X][1])

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    X = int(input())
    t = []
    i = 0
    while True:
        x = i ** 5
        t.append(x)
        if x > 10 ** 12:
            break
        i += 1
    d = {}
    for i in range(len(t)):
        for j in range(len(t)):
            d[t[i] - t[j]] = [i, j]
            d[t[i] + t[j]] = [i, -j]
            d[-t[i] - t[j]] = [-i, j]
            d[-t[i] + t[j]] = [-i, -j]
    print(d[X][0], d[X][1])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
import math

N = int(input())
A = list(map(int, input().split()))
d = defaultdict(lambda: 0)
for i in range(len(A)):
    d[A[i]] += 1

r = 2
total = 0
calc_dict = {}
for k, v in zip(d.keys(), d.values()):
    if v > 1:
        ans1 = math.factorial(v) // (math.factorial(v - r) * math.factorial(r))
    else:
        ans1 = 0
    if v > 2:
        ans2 = math.factorial(v - 1) // (math.factorial(v - 1 - r) * math.factorial(r))
    else:
        ans2 = 0
    total += ans1
    calc_dict[k] = ans1 - ans2
for i in range(N):
    print(total - calc_dict[A[i]])


Fixed submission:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
d = defaultdict(lambda: 0)
for i in range(len(A)):
    d[A[i]] += 1
total = 0
for k,v in d.items():
    total += v*(v-1)//2
for a in A:
    print(total - (d[a]-1))

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

N = int(input())
A = list(map(int, input().split()))
d = defaultdict(lambda: 0)
for i in range(len(A)):
    d[A[i]] += 1

ans1 = 0
ans2 = 0
r = 2
calc_dict1 = {}
calc_dict2 = {}
for k, v in zip(d.keys(), d.values()):
    if v > 1:
        ans1 = math.factorial(v) // (math.factorial(v - r) * math.factorial(r))
    else:
        ans1 = 0
    if v > 2:
        ans2 = math.factorial(v - 1) // (math.factorial(v - 1 - r) * math.factorial(r))
    else:
        ans2 = 0
    calc_dict1[k] = ans1
    calc_dict2[k] = ans1 - ans2
total = sum(calc_dict1.values())
for i in range(N):
    print(total - calc_dict2[A[i]])

Fixed submission:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
d = defaultdict(lambda: 0)
for i in range(len(A)):
    d[A[i]] += 1
total = 0
for k,v in d.items():
    total += v*(v-1)//2
for a in A:
    print(total - (d[a]-1))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
d = defaultdict(lambda: 0)
for i in range(len(A)):
    d[A[i]] += 1

ans1 = 0
ans2 = 0
r = 2
calc_dict1 = {}
calc_dict2 = {}
for k, v in zip(d.keys(), d.values()):
    if v > 1:
        ans1 = math.factorial(v) // (math.factorial(v - r) * math.factorial(r))
    else:
        ans1 = 0
    if v > 2:
        ans2 = math.factorial(v - 1) // (math.factorial(v - 1 - r) * math.factorial(r))
    else:
        ans2 = 0
    calc_dict1[k] = ans1
    calc_dict2[k] = ans1 - ans2
total = sum(calc_dict1.values())
for i in range(N):
    print(total - calc_dict2[A[i]])

Fixed submission:
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
d = defaultdict(lambda: 0)
for i in range(len(A)):
    d[A[i]] += 1
total = 0
for k,v in d.items():
    total += v*(v-1)//2
for a in A:
    print(total - (d[a]-1))
Buggy python submission (verdict: Runtime Error):
ls = 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
K = int(input())
print(ls[K]+1)

Fixed submission:
ls = 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
K = int(input())
print(ls[K-1])
Buggy python submission (verdict: Runtime Error):
S = input()
is_hitachi = True
if len(S) >= 2:
    for i in range(0, len(S), 2):
        if not (S[i] == 'h' and S[i + 1] == 'i'):
            is_hitachi = False
    print('YNeos'[not is_hitachi::2])
else:
    print('No')
    

Fixed submission:
S = input()
is_hitachi = True
if len(S) %2 == 0:
    for i in range(0, len(S), 2):
        if not (S[i] == 'h' and S[i + 1] == 'i'):
            is_hitachi = False
    print('YNeos'[not is_hitachi::2])
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
is_hitachi = True
for i in range(0, len(S), 2):
    if not (S[i] == 'h' and S[i + 1] == 'i'):
        is_hitachi = False
print('YNeos'[not is_hitachi::2])


Fixed submission:
S = input()
is_hitachi = True
if len(S) %2 == 0:
    for i in range(0, len(S), 2):
        if not (S[i] == 'h' and S[i + 1] == 'i'):
            is_hitachi = False
    print('YNeos'[not is_hitachi::2])
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = []
for i in range(N):
    l.append(input())
s = set(l)
cd = {}
m = 0
for i in range(len(s)):
    st = s.pop()
    ct = l.count(st)
    cd[st] = ct
    if ct > m:
        m = ct

ans = []

for i in cd:
    if cd[i] == m:
        ans.append(i)

ans.sort()
for i in ans:
    print(i)

Fixed submission:
N = int(input())

dic = {}
m = 1
for i in range(N):
    st = input()
    if st not in dic:
        dic[st] = 1
    else:
        dic[st] += 1
        if dic[st] > m:
            m = dic[st]

ans = []
for s in dic:
    if dic[s] == m:
        ans.append(s)
ans.sort()
for i in range(len(ans)):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

s = []
for i in range(K):
    s.append(p[i])

m = sum(s)
for i in range(K,N):
    s.pop(0)
    s.append(p[i])
    if sum(s) > m:
        m = sum(s)

m += K

print(m / 2)


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

s = []
for i in range(K):
    s.append(p[i])

m = sum(s)
t = m
for i in range(K, N):
    t += p[i] - p[i - K]
    if m < t:
        m = t

m += K

print(m / 2)
Buggy python submission (verdict: Runtime Error):
_ = int(input())
s = list(input())

ans = 0
for i in range(len(s)-2):
    ans += "ABC" == f"{s[i]}{s[i+1]}{s[i+2]}"

print(ans)

Fixed submission:
_ = int(input())
s = str(input())

ans = 0
for i in range(len(s)-2):
    ans += "ABC" == '{}'.format(s[i:i+3])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

total = 0
mod = 10 ** 9 + 7
ls = []
max_length = len(bin(max(A))) - 2
for i in range(max_length+1):
    d = {0: 0, 1: 0}
    ls.append(d)
for i in range(N):
    idx = 0
    for j in range(max_length + 1):
        try:
            b = int(bin(A[i])[-j - 1])
        except Exception:
            b = 0
        ls[j][b] += 1
        idx += 1

ans = 0
for i in range(len(ls)):
    zero = ls[i][0]
    one = ls[i][1]
    ans += zero*one * 2**i
    ans %= mod
print(ans)


Fixed submission:
import numpy as np

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

A = np.array(A)
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    b = np.count_nonzero(A >> i & 1)
    ans += 2 ** i * b * (N - b)
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
A = list(map(int,input().split()))

total = 0
combo = list(itertools.combinations(A,2))
mod = 10**9+7
for x,y in combo:
    total += x^y
    total %= mod
print(total)

Fixed submission:
import numpy as np

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

A = np.array(A)
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    b = np.count_nonzero(A >> i & 1)
    ans += 2 ** i * b * (N - b)
    ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
tmp = []
for i in range(1, int(math.sqrt(N))):
    v = N % i
    if v == 0:
        mult = N / i
        tmp.append(int(i + mult - 2))
print(min(tmp))

Fixed submission:
N = int(input())
max = int(N**0.5)
a = max-1
for i in range(max,0,-1):
    v = N % i
    if v == 0:
        mult = N / i
        a = mult + i
        break
print(int(a-2))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(input().split())
cnt = 0
for i in range(1,N+1):
    print(A.index(str(i))+1, end=' ')

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ls = [0]*N
for i,x in enumerate(A):
    ls[x-1] = str(i+1)
print(' '.join(ls))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
cnt = 0
for i in range(1,N+1):
    print(A.index(i)+1, end=' ')

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ls = [0]*N
for i,x in enumerate(A):
    ls[x-1] = str(i+1)
print(' '.join(ls))
Buggy python submission (verdict: Runtime Error):
import sys

N = int(input())
ABList = []
for i in range(N):
    ABList.append(sys.stdin.readline().split())
sABList = sorted(ABList, key=[1])
temp = 0
isYes = True
for i in reversed(range(0, len(sABList))):
    temp += int(sABList[i][0])
    if temp > int(sABList[i][1]):
        isYes = False
print(sABList)
print(["No", "Yes"][isYes])


Fixed submission:
N = int(input())
works = []
for i in range(N):
    works.append(list(map(int, input().split())))
works = sorted(works, key=lambda x: (x[1], x[0]))
time = 0
isFail = False
for i in range(N):
    time += works[i][0]
    if time > works[i][1]:
        isFail = True
        break
print("YNeos"[isFail::2])
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S  = input()
for i in range(Q):
    l,r = map(int,input().split())
    s = S[l-1:r]
    print(s.count('AC'))


Fixed submission:
N, Q = map(int, input().split())
S = input()
count_AC = [0]
tmp = 0
for i in range(1, len(S)):
    if S[i - 1] + S[i] == 'AC':
        tmp += 1
    count_AC.append(tmp)
for i in range(Q):
    l, r = map(int, input().split())
    print(count_AC[r-1] - count_AC[l-1])
Buggy python submission (verdict: Runtime Error):
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    A, B, K = input_number_list()
    t = 0
    i = max(A,B)
    while t < K:
        i -= 1
        t += 1 if A % i == 0 and B % i == 0 else 0
    print(i)


main()

Fixed submission:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    A, B, K = input_number_list()
    t = 0
    i = max(A,B)+1
    while t < K:
        i -= 1
        t += 1 if A % i == 0 and B % i == 0 else 0
    print(i)


main()
Buggy python submission (verdict: Runtime Error):
S = input()
ls = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
is_ng = True
for i in range(len(S)-len(ls)+1):
    if S[i] == 'k':
        idx = 0
        tmp = 0
        for j in range(i, len(S)):
            if S[j] == ls[idx]:
                if tmp == 1:
                    tmp = 2
                idx += 1
            else:
                if tmp == 0:
                    tmp = 1
                elif tmp==2:
                    break
                continue
            if idx == len(ls):
                is_ng = False
print('YNEOS'[is_ng::2])

Fixed submission:
S = input()
ls = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
is_ng = True
idx = 0
tmp = 0
for i in range(len(ls)):
    l = S[:i]
    r = S[-len(ls)+i:]
    if l+r == 'keyence':
        is_ng=False

print('YNEOS'[is_ng::2])
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float('inf')]*(N+10000)
dp[0] = 0
for i in range(N):
    for j in range(K+1):
        try:
            dp[i+j] = min(dp[i]+abs(h[i]-h[i+j]),dp[i+j])
        except Exception:
            continue
print(dp[N-1])

Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float('inf')]*(N+K)
dp[0] = 0
for i in range(N):
    for j in range(K+1):
        try:
            dp[i+j] = min(dp[i]+abs(h[i]-h[i+j]),dp[i+j])
        except Exception:
            break
print(dp[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float('inf')]*N
dp[0] = 0
for i in range(1,N):
    for j in range(K):
        if i+j > N-1:
            break
        dp[i+j] = min(dp[i-1]+abs(h[i-1]-h[i+j]),dp[i+j])
print(dp[-1])

Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float('inf')]*(N+K)
dp[0] = 0
for i in range(N):
    for j in range(K+1):
        try:
            dp[i+j] = min(dp[i]+abs(h[i]-h[i+j]),dp[i+j])
        except Exception:
            break
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from builtins import int, map, list, print
    from collections import defaultdict
    from bisect import bisect_left
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N,M = input_number_list()
    P = []
    Y = []
    city = defaultdict(list)
    for i in range(M):
        p,y = input_number_list()
        P.append(p)
        Y.append(y)
        city[p].insert(bisect_left(city[p],y),y)
    for i in range(M):
        print('{:06}{:06}'.format(P[i],city[P[i]].index(Y[i])+1))
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    from builtins import int, map, list, print
    from collections import defaultdict, deque
    from bisect import bisect_left
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number_list = (lambda: list(map(int, input_list())))

    N, M = input_number_list()
    pref = [[0] for i in range(N + 1)]
    q = deque()
    for i in range(M):
        p, y = map(int, input_number_list())
        pref[p].append(y)
        q.append((p, y))
    for p in pref:
        p.sort()
    for p, y in q:
        print('{:06}{:06}'.format(p, bisect_left(pref[p], y)))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    from builtins import int, map, list, print
    from collections import defaultdict
    from bisect import bisect_left
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N,M = input_number_list()
    P = []
    Y = []
    city = defaultdict(list)
    for i in range(M):
        p,y = input_number_list()
        P.append(p)
        Y.append(y)
        city[p].insert(bisect_left(city[p],y),y)
    for i in range(M):
        print('{:06}{:06}'.format(P[i],city[P[i]].index(Y[i])+1))
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    from builtins import int, map, list, print
    from collections import defaultdict, deque
    from bisect import bisect_left
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number_list = (lambda: list(map(int, input_list())))

    N, M = input_number_list()
    pref = [[0] for i in range(N + 1)]
    q = deque()
    for i in range(M):
        p, y = map(int, input_number_list())
        pref[p].append(y)
        q.append((p, y))
    for p in pref:
        p.sort()
    for p, y in q:
        print('{:06}{:06}'.format(p, bisect_left(pref[p], y)))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
A, op, B = input().split()
if op == "+":
    print(A + B)
else:
    print(A - B)


Fixed submission:
A, op, B = input().split()
A = int(A)
B = int(B)
if op == "+":
    print(A + B)
else:
    print(A - B)