Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
journey = [1]
dup = {}
for i in range(N+100000):
    journey.append(A[journey[-1] - 1])

end_idx, start_idx = 0, 0
dup = {}
for i, j in enumerate(journey):
    if j in dup:
        end_idx = i
        break
    else:
        dup[j] = 0
for i, j in enumerate(journey):
    if j == journey[end_idx]:
        start_idx = i
        break
        
if K >= start_idx:
    print(journey[K])
    exit()
b = end_idx - start_idx
m = (K - start_idx) % b
print(journey[start_idx + m])

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
journey = [1]
dup = {}
for i in range(N+100000):
    journey.append(A[journey[-1] - 1])

end_idx, start_idx = 0, 0
dup = {}
for i, j in enumerate(journey):
    if j in dup:
        end_idx = i
        break
    else:
        dup[j] = 0
for i, j in enumerate(journey):
    if j == journey[end_idx]:
        start_idx = i
        break

if K <= start_idx:
    print(journey[K])
    exit()
b = end_idx - start_idx
m = (K - start_idx) % b
print(journey[start_idx + m])
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
for i in range(-2000, 2000):
  for j in range(-2000, 2000):
    if i**5 - j**5 == X:
      print(i, j)
      exit()

Fixed submission:
X = int(input())
for i in range(-200, 200):
  for j in range(-200, 200):
    if i**5 - j**5 == X:
      print(i, j)
      exit()
Buggy python submission (verdict: Runtime Error):
print(len({input() for _ in range(int(input()))}))


Fixed submission:
A, B, C, D = map(int, input().split())
for _ in range(1000):
    C = C - B
    A = A - D
    if C <= 0:
        print("Yes")
        exit()
    if A <= 0:
        print("No")
        exit()
Buggy python submission (verdict: Runtime Error):
S = input()
if S.count(7):
  print("Yes")
else:
  print("No")

Fixed submission:
S = input()
if S.count('7'):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += math.gcd(math.gcd(i, j), k)
print(ans)

Fixed submission:
from math import gcd
K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(gcd(i, j), k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            f = math.gcd(math.gcd(i, j), k)
            ans += f
print(ans)

Fixed submission:
from math import gcd
K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(gcd(i, j), k)
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
X, Y, A, B, C = map(int, input().split())
qa = deque(sorted(list(map(int, input().split())), reverse=True))
qb = deque(sorted(list(map(int, input().split())), reverse=True))
qc = deque(sorted(list(map(int, input().split())), reverse=True))
ans = 0
for _ in range(X):
    if qa[0] >= qc[0]:
        ans += qa.popleft()
    else:
        ans += qc.popleft()

for _ in range(Y):
    if qb[0] >= qc[0]:
        ans += qb.popleft()
    else:
        ans += qc.popleft()
print(ans)

Fixed submission:
X, Y, A, B, C = map(int, input().split())
qa = sorted(list(map(int, input().split())), reverse=True)
qb = sorted(list(map(int, input().split())), reverse=True)
qc = sorted(list(map(int, input().split())), reverse=True)
chk = []
chk.extend(qa[:X]+qb[:Y]+qc)
chk.sort(reverse=True)
print(sum(chk[:X+Y]))
Buggy python submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, M = map(int, input().split())
if N == 1 or N == 0:
    guu = 0
else:
    guu = combinations_count(N, 2)
if M == 1 or N == 0:
    kisu = 0
else:
    kisu = combinations_count(M, 2)
print(guu + kisu)

Fixed submission:
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, M = map(int, input().split())
if N == 1 or N == 0:
    guu = 0
else:
    guu = combinations_count(N, 2)
if M == 1 or M == 0:
    kisu = 0
else:
    kisu = combinations_count(M, 2)
print(guu + kisu)
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
a, b, c = map(int,input().split())
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)
div = 0.5
if a ** div + b ** div < c ** div:
    print('Yes')
else:
    print('No')


Fixed submission:
import decimal
a, b, c = map(int,input().split())
a = decimal.Decimal(a)
b = decimal.Decimal(b)
c = decimal.Decimal(c)
if a.sqrt() + b.sqrt() < c.sqrt():
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):

N, M = map(int, input().split())
SC = set(sorted([tuple(map(int, input().split())) for _ in range(M)]))

ans = [-1] * N
for s, c in SC:
    if ans[s-1] == -1:
        ans[s-1] = c
if N >= 2:
    if ans[0] == -1 or ans[0] == 0:
        print(-1)
        exit()
kotae = ''
for a in ans:
    if a == -1:
        kotae += '0'
    else:
        kotae += str(a)
print(kotae)

Fixed submission:
import math
N = int(input())
print(math.ceil(N/2))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
SC = set([tuple(map(int, input().split())) for _ in range(M)])
chk = {}
for s, c in SC:
    if s in chk:
        print(-1)
        exit()
    else:
        chk[s] == 0
ans = [-1] * N
for s, c in SC:
    if ans[s-1] == -1:
        ans[s-1] = c
if N >= 2:
    if ans[0] == -1 or ans[0] == 0:
        print(-1)
        exit()
kotae = ''
for a in ans:
    if a == -1:
        kotae += '0'
    else:
        kotae += str(a)
print(kotae)

Fixed submission:
N, M = map(int, input().split())
SC = set(tuple(map(int, input().split())) for _ in range(M))

for i in range(10**N):
    num = str(i)
    if len(num) != N:
        continue
    chk = []
    for s, c in SC:
        if num[s-1] == str(c):
            chk.append(True)
        else:
            chk.append(False)
    if all(chk):
        print(num)
        exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

N, M, K = map(int, input().split())
uf = UnionFind(N)

friend =[[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    uf.union(a, b)
    friend[a].append(b)
    friend[b].append(a)

for i in range(k):
    c, d = map(int, input().split())
    c, d = c-1, d-1
    if uf.same(c, d):
        block[c].append(d)
        block[d].append(c)
ans = [0] * N
for i in range(N):
    ans[i] = uf.size(i) - len(friend[i]) - len(block[i]) - 1
print(*ans)


Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

N, M, K = map(int, input().split())
uf = UnionFind(N)

friend =[[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    uf.union(a, b)
    friend[a].append(b)
    friend[b].append(a)

for _ in range(K):
    c, d = map(int, input().split())
    c, d = c-1, d-1
    if uf.same(c, d):
        block[c].append(d)
        block[d].append(c)
ans = [0] * N
for i in range(N):
    ans[i] = uf.size(i) - len(friend[i]) - len(block[i]) - 1
print(*ans)
Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split())
if N >= 10:
  print(R)
  exit()
else:
print(100 * (10 - N) + R)

Fixed submission:
N, R = map(int, input().split())
if N >= 10:
  print(R)
  exit()
else:
	print(100 * (10 - N) + R)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
m = max(S.values())
for v in sorted(s for k, v in S.items() if v == m):
	print(v)

Fixed submission:
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
v = max(S.values())
s = sorted(S.most_common())
if len(S) == 1:
    print(list(S)[0])
    exit()
for k, val in s:
    if val == v:
        print(k)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
if len(S) == 1:
    print(list(S)[0])
    exit()
for k, val in sorted(S.most_common()):
    if val == max(S.values()):
        print(k)

Fixed submission:
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
v = max(S.values())
s = sorted(S.most_common())
if len(S) == 1:
    print(list(S)[0])
    exit()
for k, val in s:
    if val == v:
        print(k)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
if len(S) == 1:
    print(list(S)[0])
    exit()
for k, val in sorted(S.most_common()):
    if val == max(S.values()):
        print(k)

Fixed submission:
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
v = max(S.values())
s = sorted(S.most_common())
if len(S) == 1:
    print(list(S)[0])
    exit()
for k, val in s:
    if val == v:
        print(k)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
v = S.values()
if len(S) == 1:
    print(list(S)[0])
    exit()

for x in sorted([key for key, val in list(S.most_common()) if val == max(v)]):
    print(x)

Fixed submission:
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
v = max(S.values())
s = sorted(S.most_common())
if len(S) == 1:
    print(list(S)[0])
    exit()
for k, val in s:
    if val == v:
        print(k)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
v = S.values()
if len(S) == 1:
    print(list(S)[0])
    exit()

for x in sorted([key for key, val in list(S.most_common()) if val == max(v)]):
    print(x)

Fixed submission:
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
v = max(S.values())
s = sorted(S.most_common())
if len(S) == 1:
    print(list(S)[0])
    exit()
for k, val in s:
    if val == v:
        print(k)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
*P, = map(int, input().split())
# expec = tuple((P[i] * (P[i] + 1) / 2) / P[i] for i in range(N))
expec = tuple((P[i] + 1) / 2 for i in range(N))
ans = 0
for i in range(N-K+1):
    a = expec[i:i+K]
    s = sum(a)
    ans = max(ans, s)
print(ans)

Fixed submission:
N, K = map(int, input().split())
*P, = map(int, input().split())
cum = [0] * (N + 1)
for i in range(N):
    cum[i+1] = cum[i] + (P[i] * (P[i] + 1) / 2) / P[i]
ans = 0
for i in range(N-K+1):
    ans = max(ans, cum[i+K] - cum[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
*P, = map(int, input().split())
chk = 0
start_idx, end_idx = 0, 0
for i in range(N-K+1):
    if chk <= sum(P[i:i+K]):
        chk = sum(P[i:i+K])
        start_idx = i
        end_idx = i+K
ans = 0
for i in range(start_idx, end_idx):
    ans += (P[i] * (P[i] + 1) / 2) / P[i]
print(ans)


Fixed submission:
N, K = map(int, input().split())
*P, = map(int, input().split())
cum = [0] * (N + 1)
for i in range(N):
    cum[i+1] = cum[i] + (P[i] * (P[i] + 1) / 2) / P[i]
ans = 0
for i in range(N-K+1):
    ans = max(ans, cum[i+K] - cum[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
*P, = map(int, input().split())
expec = tuple((P[i] * (P[i] + 1) / 2) / P[i] for i in range(N))
ans = 0
for i in range(N-K+1):
    a = expec[i:i+K]
    s = sum(a)
    ans = max(ans, s)
print(ans)

Fixed submission:
N, K = map(int, input().split())
*P, = map(int, input().split())
cum = [0] * (N + 1)
for i in range(N):
    cum[i+1] = cum[i] + (P[i] * (P[i] + 1) / 2) / P[i]
ans = 0
for i in range(N-K+1):
    ans = max(ans, cum[i+K] - cum[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
*P, = map(int, input().split())
expec = tuple((P[i] * (P[i] + 1) / 2) / P[i] for i in range(N))
ans = 0
for i in range(N-K+1):
    a = expec[i:i+K]
    s = sum(a)
    ans = max(ans, s)
print(ans)

Fixed submission:
N, K = map(int, input().split())
*P, = map(int, input().split())
cum = [0] * (N + 1)
for i in range(N):
    cum[i+1] = cum[i] + (P[i] * (P[i] + 1) / 2) / P[i]
ans = 0
for i in range(N-K+1):
    ans = max(ans, cum[i+K] - cum[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
*P, = map(int, input().split())
expec = [(P[i] * (P[i] + 1) / 2) / P[i] for i in range(N)]
ans = 0
for i in range(N-K+1):
    ans = max(ans, sum(expec[i:i+K]))
print(ans)

Fixed submission:
N, K = map(int, input().split())
*P, = map(int, input().split())
cum = [0] * (N + 1)
for i in range(N):
    cum[i+1] = cum[i] + (P[i] * (P[i] + 1) / 2) / P[i]
ans = 0
for i in range(N-K+1):
    ans = max(ans, cum[i+K] - cum[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split())).sort(reverse=True)
ans = 0
if len(H) - K <= 0:
    print(0)
else:
    ans += sum(H[K:])
    print(ans)

Fixed submission:
N, K = map(int, input().split())
*H, = map(int, input().split())
H.sort(reverse=True)
ans = 0
if len(H) - K <= 0:
    print(0)
else:
    ans += sum(H[K:])
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
dp = [[float("inf") for j in range(H+1)] for i in range(N+1)]
for i in range(N):
    for j in range(H+1):
        if j <= A[i]:
            dp[i+1][j] = min(dp[i][j], B[i])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + B[i])
print(dp[N][H])

Fixed submission:
import sys
input = sys.stdin.readline
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
dp = [[float("inf") for j in range(H+1)] for i in range(N+1)]
for i in range(N):
    for j in range(H+1):
        if j <= A[i]:
            dp[i+1][j] = min(dp[i][j], B[i])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + B[i])
print(dp[N][H])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(a):
    x, l = map(int, input().split())
    A.append([x+l, x-l])
A.sort()
ans = 1
check1 = A[0]
for i in range(1, N):
    check2 = A[i]
    if check1[0] <= check2[1]:
        ans += 1
        check1 = check2
print(ans)

Fixed submission:
N = int(input())
A = []
for i in range(N):
    x, l = map(int, input().split())
    A.append([x+l, x-l])
A.sort()
ans = 1
check1 = A[0]
for i in range(1, N):
    check2 = A[i]
    if check1[0] <= check2[1]:
        ans += 1
        check1 = check2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
A, B, K = map(int, input().split())
for _ in range(K):
  if A >= 1:
    A -= 1
  elif B >= 1:
    B -= 1
  else:
    pass
print(A, B)

Fixed submission:
import sys
input = sys.stdin.readline
A, B, K = map(int, input().split())
chk = K - A
if chk > 0:
    if K - A - B >= 0:
        print(0, 0)
    else:
        print(0, A + B - K)
elif chk <= 0:
    print(A-K, B)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for a in range(N):
    for b in range(a):
        for c in range(b):
            if L[a] < L[b] + L[c] and L[b] < L[c] + L[a] and L[c] < L[a] + L[b]:
                ans += b - c
                break
print(ans)

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

def solve():
    N = int(input())
    Ls = list(map(int, input().split()))
    Ls.sort()

    # O(N^2 * logN)の全探索で解く
    ans = 0
    for a_i in range(N):
        for b_i in range(a_i+1, N):
            c_i = bisect.bisect_left(Ls, Ls[a_i]+Ls[b_i])
            if c_i > b_i:
                ans += c_i - b_i - 1
            else:
                pass

    print(ans)

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % == 0:
  print(2/N)
else:
  print((N - N/2) / N)

Fixed submission:
N = int(input())
print(((N + 1) // 2) / N)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % == 0:
  print(2/N)
else:
  print((N - N//2)/N)

Fixed submission:
N = int(input())
print(((N + 1) // 2) / N)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 2 == 0:
  print(2/N)
else:
  print((N//2) / (N//2)+1)

Fixed submission:
N = int(input())
print(((N + 1) // 2) / N)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
n = np.array(n)
m = np.array(m)
x = n % m
print(sum(x))

Fixed submission:
*A, = input()
*B, = input()
ans = 0
if A[0] == B[0]:
  ans += 1
if A[1] == B[1]:
  ans += 1
if A[2] == B[2]:
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
ans = math.ceil((A-1)/(B-1))
print(ans)

Fixed submission:
A, B = map(int, input().split())
ans = 0
tap = 0
for i in range(10000):
    if B == 1:
        break
    if i == 0:
        tap += A
        ans += 1
    if i >= 1:
        tap -= 1
        tap += A
        ans += 1
    if tap >= B:
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if B % A = 0:
  print(int(B//A * A))
else:
  print(B//A * A + 1)

Fixed submission:
A, B = map(int, input().split())
ans = 0
tap = 0
for i in range(10000):
    if B == 1:
        break
    if i == 0:
        tap += A
        ans += 1
    if i >= 1:
        tap -= 1
        tap += A
        ans += 1
    if tap >= B:
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
n = [x for x in range(1, N+1)]
print(sum(n[:-1]))

Fixed submission:
N = int(input())
print((N+1) * N // 2 - N)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
n = [x for x in range(1, N+1)]
print(sum(n[:-1]))

Fixed submission:
N = int(input())
print((N+1) * N // 2 - N)

Buggy python submission (verdict: Runtime Error):
N = int(input())
n = [x for x in range(1, N+1)]
print(sum[:-1])

Fixed submission:
N = int(input())
print((N+1) * N // 2 - N)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
ans = 0
for i in range(N):
    ans += n[i] % m[i]
print(ans)

Fixed submission:
N = int(input())
print((N+1) * N // 2 - N)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
ans = 0
for i in range(N):
    ans += n[i] % m[i]
print(ans)

Fixed submission:
N = int(input())
print((N+1) * N // 2 - N)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
n = np.array(n)
m = np.array(m)
x = n % m
print(sum(x))

Fixed submission:
N = int(input())
print((N+1) * N // 2 - N)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
n = np.array(n)
m = np.array(m)
x = n % m
print(sum(x))

Fixed submission:
N = int(input())
print((N+1) * N // 2 - N)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)
N, Q = map(int, input().split())
to = [[] for _ in range(N)]
ans = [0] * N
def dfs(v, p=-1):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x
dfs(0)
print(*ans)

Fixed submission:
A = int(input())
S = input()
if A >= 3200:
  print(S)
else:
  print("red")
Buggy python submission (verdict: Runtime Error):
N = int(input())
*V, = map(int, input().split())
V.sort()
ans = V[0]
for i in range(1, N):
    ans = mix(ans,V[i])
print(ans)

Fixed submission:
def mix(x, y):
    return (x + y) / 2
    
N = int(input())
*V, = map(int, input().split())
V.sort()
ans = V[0]
for i in range(1, N):
    ans = mix(ans,V[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
l = len(S)
dp = [[0] * 13 for _ in range(l+1)]
dp[0][0] = 1
MOD = 10 ** 9 + 7
mul = 1
for i in range(l):
    if S[-(i+1)] == '?':
        for j in range(10):
            for k in range(13):
                dp[i+1][(j * mul + k) % 13] += dp[i][k]
                dp[i+1][(j * mul + k) % 13] %= MOD
    else:
        j = int(S[-(i+1)])
        for k in range(13):
            dp[i+1][(j * mul + k) % 13] += dp[i][k]
            dp[i+1][(j * mul + k) % 13] %= MOD
    mul = mul * 10 % 13
print(dp[l][5])

Fixed submission:
A, B = map(int, input().split())
K = A + B
if K % 2 == 0:
    print(K//2)
else:
    print("IMPOSSIBLE")