Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import  defaultdict
s = input()
K = int(input())

idx_dict = defaultdict(list)

for i, c in enumerate(s):
    idx_dict[c].append(i)
results = set()
abc = "abcdefghijklmnopqrstuvwxyz"

for al in abc:
    idxs = idx_dict[al]
    count = len(idxs)
    if count == 0:
        continue

    lens = [1 for i in range(count)]
    while len(results) < K:
        useIdx = -1
        useStr = "あああ"
        for i in range(count):
            i1 = idxs[i]
            i2 = idxs[i] + lens[i]
            if i2 <= len(s):
                ss = s[i1:i2]
                if useStr > ss:
                    useStr = ss
                    useIdx = i
        if useIdx < 0:
            break
        lens[useIdx] += 1
        results.add(useStr)
sorted = list(results)
sorted.sort()
print(sorted[K - 1])


Fixed submission:
s = input()
sLen = len(s)
K = int(input())

result = set()
for i in range(sLen):
    for j in range(1, K + 1):
        if i + j > sLen:
            break
        ss = s[i:i+j]
        result.add(ss)
print(sorted(result)[K - 1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

results = set()
abc = "abcdefghijklmnopqrstuvwxyz"

for al in abc:
    idxs = []
    last = 0
    while True:
        f = s.find(al, last)
        if f < 0:
            break
        idxs.append(f)
        last = f + 1
    count = len(idxs)
    if count == 0:
        continue

    lens = [1 for i in range(count)]
    while len(results) < K:
        useIdx = -1
        useStr = "あああ"
        for i in range(count):
            i1 = idxs[i]
            i2 = idxs[i] + lens[i]
            if i2 <= len(s):
                ss = s[i1:i2]
                if useStr > ss:
                    useStr = ss
                    useIdx = i
        if useIdx < 0:
            break
        lens[useIdx] += 1
        results.add(useStr)
sorted = list(results)
sorted.sort()
print(sorted[K - 1])


Fixed submission:
s = input()
sLen = len(s)
K = int(input())

result = set()
for i in range(sLen):
    for j in range(1, K + 1):
        if i + j > sLen:
            break
        ss = s[i:i+j]
        result.add(ss)
print(sorted(result)[K - 1])
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
Sij = [input() for _ in range(H)]

diff = [[-1, 0], [1, 0], [0, -1], [0, 1]]
def is_isolated(y, x):
    if Sij[y][x] != "#":
        return False
    for d in diff:
        y2 = y + d[0]
        x2 = x + d[1]
        if y2 >= 0 and y2 < H and x2 >= 0 and x2 < W:
            if Sij[y2][x2] == "#":
                return False
    return True

out = "Yes"
for y in range(H):
    for x in range(W):
        if is_isolated(x, y):
            out = "No"
            break
print(out)

Fixed submission:
H, W = map(int, input().split())
Sij = [input() for _ in range(H)]

diff = [[-1, 0], [1, 0], [0, -1], [0, 1]]
def is_isolated(y, x):
    if Sij[y][x] != "#":
        return False
    for d in diff:
        y2 = y + d[0]
        x2 = x + d[1]
        if y2 >= 0 and y2 < H and x2 >= 0 and x2 < W:
            if Sij[y2][x2] == "#":
                return False
    return True

out = "Yes"
for y in range(H):
    for x in range(W):
        if is_isolated(y, x):
            out = "No"
            break
print(out)
Buggy python submission (verdict: Runtime Error):
N = int(input())

out = [i * 2 for i in range(1, N + 1)]

print(*out, " ")


Fixed submission:
N = int(input())

sosuu = []

def next_sosuu():
    if len(sosuu) == 0:
        sosuu.append(2)
        return 2
    if len(sosuu) == 1:
        sosuu.append(3)
        return 3
    curr = sosuu[-1] + 2

    while True:
        flag = True
        for s in sosuu:
            if curr % s == 0:
                flag = False
                break
        if flag:
            sosuu.append(curr)
            return curr
        curr += 2

results = []
while len(results) < N:
    n = next_sosuu()
    if n % 5 == 1:
        results.append(n)

txt = ""
for r in results:
    txt += str(r) + " "
txt = txt[0:-1]
print(txt)
Buggy python submission (verdict: Time Limit Exceeded):
N, C = map(int, input().split())
Xi = [list(map(int, input().split())) for _ in range(N)]

# 真上に0があると考える。下から⇢にいくか←にいくかで区別

#右方向に進んだときの累積Caloryと累積max
R_cal = [0 for i in range(N)]
R_max = [0 for i in range(N)]
for i in range(N):
    if i == 0:
        R_cal[i] = Xi[i][1] - Xi[i][0]
        R_max[i] = max(R_cal[i], 0)
    else:
        d = Xi[i][0] - Xi[i - 1][0]
        R_cal[i] = R_cal[i - 1] + Xi[i][1] - d
        R_max[i] = max(R_cal[i], R_max[i - 1])

#右方向に進んだときの累積max
L_cal = [0 for i in range(N)]
L_max = [0 for i in range(N)]
for i in range(N - 1, -1, -1):
    if i == N - 1:
        L_cal[i] = Xi[i][1] - (C - Xi[i][0])
        L_max[i] = max(L_cal[i], 0)
    else:
        d = Xi[i + 1][0] - Xi[i][0]
        L_cal[i] = L_cal[i + 1] + Xi[i][1] - d
        L_max[i] = max(L_cal[i], L_max[i + 1])

#右方向にとにかくすすむ
max_value = 0
for i in range(N):
    cal = R_cal[i]
    l_cal = 0
    if i < N - 1:
        l_cal = max(L_max[i + 1:]) - Xi[i][0]
    if l_cal > 0:
        cal += l_cal
    max_value = max(cal, max_value)
#左にとにかくすすむ
for i in range(N - 1, -1, -1):
    cal = L_cal[i]
    r_cal = 0
    if i > 0:
        r_cal = max(R_max[:i]) - (C - Xi[i][0])
    if r_cal > 0:
        cal += r_cal
    max_value = max(cal, max_value)
print(max_value)

Fixed submission:
N, C = map(int, input().split())
Xi = [list(map(int, input().split())) for _ in range(N)]

#両端に(0,0)があると考えると楽なので追加
Xi.insert(0, [0, 0])
Xi.append([C, 0])

# 真上に0があると考える。下から⇢にいくか←にいくかで区別
#右方向に進んだときの累積Caloryと累積max
total = 0
R_max = [0 for i in range(N + 2)]
for i in range(1, N + 1):
    total += Xi[i][1] - (Xi[i][0] - Xi[i - 1][0])
    R_max[i] = max(total, R_max[i - 1])

#右方向に進んだときの累積max
total = 0
L_max = [0 for i in range(N + 2)]
for i in range(N, 0, -1):
    total += Xi[i][1] - (Xi[i + 1][0] - Xi[i][0])
    L_max[i] = max(total, L_max[i + 1])

max_value = 0
for i in range(0, N + 1):
    i2 = N - i - 1
    #右方向にとにかくすすむ
    cal = R_max[i] + L_max[i + 1] - Xi[i][0]
    max_value = max(cal, max_value)

    #左にとにかくすすむ
    cal = R_max[i] + L_max[i + 1] - (C - Xi[i + 1][0])
    max_value = max(cal, max_value)
print(max_value)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10000)

N, Y = map(int, input().split())
Y = Y // 1000

def find(num, yen):
    if num == 0:
        if yen == 0:
            return [0, 0, 0]
        return None
    #残り全部1万円でも足りない or 残り全部1000円でもオーバーするなら打ち切り
    if num * 10 < yen or num > yen:
        return None

    if yen >= 10:
        r = find(num - 1, yen - 10)
        if r != None:
            r[0] += 1
            return r
    if yen >= 5:
        r = find(num - 1, yen - 5)
        if r != None:
            r[1] += 1
            return r
    if yen >= 1:
        r = find(num - 1, yen - 1)
        if r != None:
            r[2] += 1
            return r
    return None

r = find(N, Y)
if r is None:
    print(-1, -1, -1)
else:
    print(r[0], r[1], r[2])

Fixed submission:
N, Y = map(int, input().split())
Y = Y // 1000

for y10 in range(0, N + 1):
    remain = N - y10
    if y10 * 10 > Y:
        break
    for y5 in range(0, remain + 1):
        y1 = N - y10 - y5
        t = y1 + y5 * 5 + y10 * 10
        if t == Y:
            print(y10, y5, y1)
            exit()
print(-1, -1, -1)
Buggy python submission (verdict: Time Limit Exceeded):
s = raw_input()
k = int(raw_input())
count = 0
for n in s:
	count += int(n)**(5*(10**14))
	if count>=k:
		print n
		break

Fixed submission:
s = raw_input()
k = int(raw_input())
count = 0
for n in s:
	count += ((int(n)**5)**10)**12
	if count>=k:
		print n
		break
Buggy python submission (verdict: Runtime Error):
x,y = map(raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y:
	print ">"
elif x<y:
	print "<"
else:
	print"="

Fixed submission:
x,y = map(str,raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y:
	print ">"
elif x<y:
	print "<"
else:
	print "="

Buggy python submission (verdict: Runtime Error):
x,y = map(raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y :
	print ">"
elif x<y :
	print "<"
else :
	print"="

Fixed submission:
x,y = map(str,raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y:
	print ">"
elif x<y:
	print "<"
else:
	print "="

Buggy python submission (verdict: Runtime Error):
x,y = map(raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y :
	print ">"
elif x<y :
	print "<"
else :
	print"="

Fixed submission:
x,y = map(str,raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y:
	print ">"
elif x<y:
	print "<"
else:
	print "="

Buggy python submission (verdict: Runtime Error):
x,y = map(int(raw_input().split(),16))
if x>y :
	print ">"
elif x<y :
	print "<"
else :
	print "="

Fixed submission:
x,y = map(str,raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y:
	print ">"
elif x<y:
	print "<"
else:
	print "="
Buggy python submission (verdict: Runtime Error):
a,b,c = map(str,raw_input().split())
d,e,f = map(str,raw_input().split())
if a==f and b==e and c==d:
	print 'YES' 
else:
	print 'NO'

Fixed submission:
a = raw_input()
b = raw_input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
	print 'YES' 
else:
	print 'NO'

Buggy python submission (verdict: Runtime Error):
a,b,c = map(str,raw_input().split())
d,e,f = map(str,raw_input().split())
if a==f and b==e and c==d :
	print "YES" 
else :
	print "NO"

Fixed submission:
a = raw_input()
b = raw_input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
	print 'YES' 
else:
	print 'NO'

Buggy python submission (verdict: Runtime Error):
a,b,c = map(raw_input().split())
d,e,f = map(raw_input().split())
if a==f and b==e and c==d:
	print 'YES'
else:
	print 'NO'

Fixed submission:
a = raw_input()
b = raw_input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
	print 'YES' 
else:
	print 'NO'

Buggy python submission (verdict: Runtime Error):
a,b,c = map(raw_input().split())
d,e,f = map(raw_input().split())
if a==f and b==e and c==d :
	print "YES" 
else :
	print "NO"

Fixed submission:
a = raw_input()
b = raw_input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
	print 'YES' 
else:
	print 'NO'
Buggy python submission (verdict: Runtime Error):
n = (int)raw_input()
print "ABC" + (str)n

Fixed submission:
n = raw_input()
print "ABC" + n
Buggy python submission (verdict: Runtime Error):
num,time = map(int, raw_input().split())
t = raw_input().split()
ans = time
for i in range(0,num-1):
  a = int(t[i+1])-int(t[i]) 
	if a < time:
		ans += a
	else:
		ans += time
print ans

Fixed submission:
num,time = map(int, raw_input().split())
t = raw_input().split()
ans = time
for i in range(0,num-1):
	if int(t[i+1])-int(t[i]) < time:
		ans += int(t[i+1])-int(t[i])
	else:
		ans += time
print ans

Buggy python submission (verdict: Runtime Error):
num,time = map(int, raw_input().split())
t = raw_input().split()
ans = 0
for i in t:
	if i<time:
		ans += i
	else:
	ans += time
ans += time
ans -= t[len(t)]
print ans

Fixed submission:
num,time = map(int, raw_input().split())
t = raw_input().split()
ans = time
for i in range(0,num-1):
	if int(t[i+1])-int(t[i]) < time:
		ans += int(t[i+1])-int(t[i])
	else:
		ans += time
print ans

Buggy python submission (verdict: Runtime Error):
num,time = map(int, raw_input().split())
t = raw_input().split()
ans = 0
for i in t:
	if i<time:
		ans += i
	else:
	ans += time
ans += time
ans -= t[len(t)-1]
print ans

Fixed submission:
num,time = map(int, raw_input().split())
t = raw_input().split()
ans = time
for i in range(0,num-1):
	if int(t[i+1])-int(t[i]) < time:
		ans += int(t[i+1])-int(t[i])
	else:
		ans += time
print ans

Buggy python submission (verdict: Runtime Error):
num,time = map(int,raw_input().split())
t = map(int, raw_input().split())
ans = 0
for i in range(len(t)-1):
	if t(i)<time:
		ans += t(i)
	else:
	ans += time
ans += time
print ans

Fixed submission:
num,time = map(int, raw_input().split())
t = raw_input().split()
ans = time
for i in range(0,num-1):
	if int(t[i+1])-int(t[i]) < time:
		ans += int(t[i+1])-int(t[i])
	else:
		ans += time
print ans

Buggy python submission (verdict: Runtime Error):
num,time = map(int,raw_input().split())
t = map(int, raw_input().split())
ans = 0
for i in range(len(t)-1):
	if t[i]<time:
		ans += t[i]
	else:
	ans += time
ans += time
print ans

Fixed submission:
num,time = map(int, raw_input().split())
t = raw_input().split()
ans = time
for i in range(0,num-1):
	if int(t[i+1])-int(t[i]) < time:
		ans += int(t[i+1])-int(t[i])
	else:
		ans += time
print ans
Buggy python submission (verdict: Runtime Error):
o,e = map(str, raw_input().split())
s = ""
for i in range(len(o)):
	s += o[i]+e[i]
print s

Fixed submission:
o = raw_input()
e = raw_input()
s = ""
l = len(o)
if len(e)>l:
	l = len(e)
for i in range(l):
	if i<len(o):
		s = s+o[i]
	if i<len(e):
		s = s+e[i]
print s

Buggy python submission (verdict: Runtime Error):
o,e = map(str, raw_input().split())
s = ""
for i,j in o,e:
	s += i
	s += j
print s

Fixed submission:
o = raw_input()
e = raw_input()
s = ""
l = len(o)
if len(e)>l:
	l = len(e)
for i in range(l):
	if i<len(o):
		s = s+o[i]
	if i<len(e):
		s = s+e[i]
print s
Buggy python submission (verdict: Runtime Error):
a,b,c = map(str, raw_input().split())
print b[1]

Fixed submission:
a,b,c = map(str, raw_input().split())
print a[0] + b[0] + c[0]
Buggy python submission (verdict: Runtime Error):
# from math import factorial
# from collections import defaultdict, deque
#  from heapq import heappush, heappop, heapify

# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]
# edges = defaultdict(list)
# for _ in range(N - 1):
#     a, b = [int(i) for i in input().split(" ")]
#     edges[a-1].append(b-1)
import math

A, B = [int(i) for i in input().split(" ")]
a, b = [], []
m = math.gcd(A, B)
# print(m)
i = 1
while i <= m:
  if A % i == 0:
     a.append(i)
  if B % i == 0:
     b.append(i)
  i += 1
c = list(sorted(set(a) & set(b)))
ans = []
# print(c)
for i in c:
   for a in ans:
       if a == 1: continue
       if i % a == 0:
          break
   else:
      ans.append(i) 
print(len(ans)) 


Fixed submission:
# from math import factorial
# from collections import defaultdict, deque
#  from heapq import heappush, heappop, heapify

# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]
# edges = defaultdict(list)
# for _ in range(N - 1):
#     a, b = [int(i) for i in input().split(" ")]
#     edges[a-1].append(b-1)
import math

A, B = [int(i) for i in input().split(" ")]

def solve(n):
    ans, i = [], 1
    while i * i <= n:
        div, mod = divmod(n, i)
        if mod == 0:
            ans.append(i)
            if i != div:
                ans.append(div)
        i += 1
    return list(sorted(ans))  # 順番気にしないならソートせずにより高速

a = solve(A)
b = solve(B)
c = list(sorted(set(a) & set(b)))
# print(c)

ans = []
for i in c:
   for a in ans:
       if a == 1: continue
       if i % a == 0:
          break
   else:
      ans.append(i) 
# print(ans)
print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]

N, K, Q = [int(i) for i in input().split(" ")]
As = [int(input()) for _ in range(Q)]
buff = [K for _ in range(N)]
for a in As:
  for i in range(N):
    # if buff[i] == 0: continue
    if i + 1 == a:
      buff[i] += 0
    else:
      buff[i] -= 1
for b in buff:
    if b > 0: print("Yes")
    else: print("No")



Fixed submission:
# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]

N, K, Q = [int(i) for i in input().split(" ")]
As = [int(input()) for _ in range(Q)]
buff = [K for _ in range(N)]
for a in As:
  i = a - 1
  buff[i] += 1
for b in buff:
    if b - Q > 0: print("Yes")
    else: print("No")
Buggy python submission (verdict: Runtime Error):
# from math import factorial
# from collections import defaultdict, deque
#  from heapq import heappush, heappop

# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]
# A = int(input())

A, B = [int(i) for i in input().split(" ")]
total = A
ans = 1
if B == 1: return 0
while True:
   if B <= total: break
   ans += 1
   total += A  -1
print(ans)




Fixed submission:
# from math import factorial
# from collections import defaultdict, deque
#  from heapq import heappush, heappop

# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]
# A = int(input())

A, B = [int(i) for i in input().split(" ")]
total = A
ans = 1
while True:
   if B <= total: break
   ans += 1
   total += A  -1
if B == 1:  print(0)
else: print(ans)
Buggy python submission (verdict: Runtime Error):
package main

import (
	"fmt"
)

func main() {
	var A, B int
	fmt.Scan(&A)
	fmt.Scan(&B)
	if (A + B) % 2 == 0 {
		fmt.Println((A + B) / 2)
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}


Fixed submission:
A, B = [int(i) for i in input().split(" ")]
if (A + B) % 2 == 0: print((A + B) // 2)
else: print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
package main

import (
	"fmt"
	"math"
)

func main() {
	var A, B int
	fmt.Scan(&A)
	fmt.Scan(&B)
	if (A + B) % 2 == 0 {
		fmt.Println((A + B) / 2)
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}


Fixed submission:
A, B = [int(i) for i in input().split(" ")]
if (A + B) % 2 == 0: print((A + B) // 2)
else: print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
from scipy.special import perm, comb
N, K = [int(p) for p in input().split(" ")]

def nHr(n, r):
    return comb(n+r-1, r, exact=True)

MOD = 10**9 + 7
def f(i):
    if N-K-i+1 >= 0:
        return nHr(i, K-i) * nHr(i+1, N-K-i+1) % MOD
    return 0
for i in range(K):
    print(f(i+1))

Fixed submission:
N, K = [int(p) for p in input().split(" ")]

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

def nHr(n, r):
    return comb(n+r-1, r, mod)

mod = 10**9 + 7
def f(i):
    if N-K-i+1 >= 0:
        return nHr(i, K-i) * nHr(i+1, N-K-i+1) % mod
    return 0

for i in range(K):
    print(f(i+1))
Buggy python submission (verdict: Runtime Error):
print(3 * N)

Fixed submission:
print((int(input())-2) * 180)

Buggy python submission (verdict: Runtime Error):
90 * N

Fixed submission:
print((int(input())-2) * 180)
Buggy python submission (verdict: Runtime Error):
n = len([s for s in S if s == "x"])
if n >= 8: print("NO") 
else: print("YES")

Fixed submission:
n = len([s for s in input() if s == "x"])
if n < 8: print("YES")
else: print("NO")
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N = int(input())
b_arr = list(map(lambda b: int(b), input().split()))
a_arr = list(range(N))

for n in range(N-1, -1, -1):
    if (n == N-1) or (n == N-2):
        a_arr[N-1] = b_arr[N-2]
        a_arr[N-2] = b_arr[N-2]
    elif b_arr[n+1] >= b_arr[n]:
        a_arr[n+1] = b_arr[n]
        a_arr[n] = b_arr[n]
    else:
        a_arr[n] = b_arr[n]

print(sum(a_arr)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N = int(input())
b_arr = list(map(lambda b: int(b), input().split()))
a_arr = list(range(N))

for n in range(N-1, -1, -1):
    if (n == N-1) or (n == N-2):
        a_arr[N-1] = b_arr[N-2]
        a_arr[N-2] = b_arr[N-2]
    elif b_arr[n+1] >= b_arr[n]:
        a_arr[n+1] = b_arr[n]
        a_arr[n] = b_arr[n]
    else:
        a_arr[n] = b_arr[n]

print(sum(a_arr))
Buggy python submission (verdict: Runtime Error):
import sys
from heapq import *
sys.setrecursionlimit(10**8)

input = sys.stdin.readline

tree = [[] for _ in range(200001)]
res = [0]*200001

def dfs(p, pre):
    for child in tree[p]:
        if child == pre: continue
        res[child] += res[p]
        dfs(child, p)

def main():
    """ main """
    N, Q = map(int, input().split())
    for _ in range(N-1):
        a,b = map(int, input().split())
        tree[a].append(b)
        tree[b].append(a)
    for _ in range(Q):
        p,x = map(int, input().split())
        res[p] += x
    dfs(1, 0)

    print(*res[1:N+1])

if __name__ == '__main__':
    main()


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

if a >= 3200:
    print(s)
else:
    print('red')

Buggy python submission (verdict: Runtime Error):
import sys
from heapq import *
sys.setrecursionlimit(10**8)
 
input = sys.stdin.readline
tree = [[] for _ in range(200001)]
scores = [0 for _ in range(200001)]

def dfs(pre, p):
    for child in tree[p]:
        if child == pre: continue
        scores[child] += scores[p]
        dfs(p, child)

def main():
    N, Q = map(int, input().split())
    for _ in range(N-1):
        a, b = map(int, input().split())
        tree[a].append(b)
        tree[b].append(a)

    for _ in range(Q):
        p, x = map(int, input().split())
        scores[p] += x
    dfs(0, 1)
    print(' '.join(map(str, scores[1:N+1])))

if __name__ == '__main__':
    main()

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

if a >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N = int(input())
words = list()
count = 0
for _ in range(N):
    words.append(sorted(input()))

for i in range(N):
    for j in range(i+1, N):
        if words[i] == words[j]: count += 1

print(count)

Fixed submission:
N = int(input())
words = []
dic = {}
count = 0

for _ in range(N):
    words.append(str(sorted(input())))

for word in words:
    if word in dic:
        count += dic[word]
        dic[word] += 1
    else:
        dic[word] = 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
words = list()
count = 0
for _ in range(N):
    words.append(sorted(input()))

for i in range(N):
    for j in range(i+1, N):
        if words[i] == words[j]: count += 1

print(count)

Fixed submission:
N = int(input())
words = []
dic = {}
count = 0

for _ in range(N):
    words.append(str(sorted(input())))

for word in words:
    if word in dic:
        count += dic[word]
        dic[word] += 1
    else:
        dic[word] = 1

print(count)
Buggy python submission (verdict: Runtime Error):
inputs = input().split()
a, b = inputs[0], inputs[1]
prod = a*b

if prod % 2 == 0:
    print('Even')
else:
    print('Odd')

Fixed submission:
inputs = input().split()
a, b = int(inputs[0]), int(inputs[1])
prod = a*b

if prod % 2 == 0:
    print('Even')
else:
    print('Odd')