Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S = input()

# 桁数
N = len(S)
MOD = 10**9 + 7

# dp[i][j] := Sの上からi桁目までを考えた時、それを13で割った余りがjになる方法の数
dp = [[0 for _ in range(13)]for _ in range(N + 1)]

# １桁目について
if S[0] == "?":
    # ?に0, 1, ..., 9を入れることができる
    for i in range(10):
        dp[1][i] = 1
else:
    dp[1][S[0]] = 1

# 1, 2, ..., N-1桁から、
# 2, 3, ..., N桁についての遷移を考える
for i in range(1, N):
    for j in range(13):
        if S[i] == "?":
            for k in range(10):
                dp[i + 1][(j * 10 + k) % 13] += dp[i][j]
                dp[i + 1][(j * 10 + k) % 13] %= MOD
        else:
            dp[i + 1][(j * 10 + int(S[i])) % 13] += dp[i][j]
            dp[i + 1][(j * 10 + int(S[i])) % 13] %= MOD

print(dp[N][5] % MOD)


Fixed submission:
S = str(input())

# 桁数
N = len(S)
MOD = 10**9 + 7

# dp[i][j] := Sの上からi桁目までを考えた時、それを13で割った余りがjになる方法の数
dp = [[0 for _ in range(13)]for _ in range(N + 1)]

# １桁目について
if S[0] == "?":
    # ?に0, 1, ..., 9を入れることができる
    for i in range(10):
        dp[1][i] = 1
else:
    dp[1][int(S[0])] = 1

# 1, 2, ..., N-1桁から、
# 2, 3, ..., N桁についての遷移を考える
for i in range(1, N):
    for j in range(13):
        if S[i] == "?":
            for k in range(10):
                dp[i + 1][(j * 10 + k) % 13] += dp[i][j]
                dp[i + 1][(j * 10 + k) % 13] %= MOD
        else:
            dp[i + 1][(j * 10 + int(S[i])) % 13] += dp[i][j]
            dp[i + 1][(j * 10 + int(S[i])) % 13] %= MOD

print(dp[N][5] % MOD)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if W == 0 or H == 0:

elif x == W / 2 and y == H / 2:
    print(W * H / 2, 1)
else:
    print(W * H / 2, 0)


Fixed submission:
W, H, x, y = map(int, input().split())

if x == W / 2 and y == H / 2:
    print(W * H / 2, 1)
else:
    print(W * H / 2, 0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

pq = []
for i in range(N):
    for j in range(N):
        if i != j:
            x1 = xy[i][0]
            y1 = xy[i][1]
            x2 = xy[j][0]
            y2 = xy[j][1]
            pq.append((x2 - x1, y2 - y1))

ans = N
for p,q in pq:
    tmp = 0
    for i in range(N):
        for j in range(N):
            if i != j:
                x1 = xy[i][0]
                y1 = xy[i][1]
                x2 = xy[j][0]
                y2 = xy[j][1]
                if x2 - x1 == p and y2 - y1 == q:
                    tmp += 1
    ans = min(ans, N - tmp)

print(ans)


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

pq = []
for i in range(N):
    for j in range(N):
        if i != j:
            x1 = xy[i][0]
            y1 = xy[i][1]
            x2 = xy[j][0]
            y2 = xy[j][1]
            pq.append((x2 - x1, y2 - y1))

ans = N
for p,q in pq:
    tmp = 0
    for i in range(N):
        for j in range(N):
            if i != j:
                x1 = xy[i][0]
                y1 = xy[i][1]
                x2 = xy[j][0]
                y2 = xy[j][1]
                if x2 - x1 == p and y2 - y1 == q:
                    tmp += 1
    ans = min(ans, N - tmp)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
str_list = []
for i in range(len(s)):
    str_list.append(s[i])

cnt = 0
tf = True
while tf == True:
    tf = False
    cont_a = 0
    for i in range(len(str_list) - 2):
        if str_list[i] == "A" and str_list[i + 1] == "B" and str_list[i + 2] == "C":
            str_list[i] = "B"
            str_list[i + 1] = "C"
            str_list[i + 2] = "A"
            cnt +=1
            tf = True

# print(str_list)
print(cnt)


Fixed submission:
s = input()
# ABC -> BCA
# "BC"を纏めて考える
s = s.replace('BC', 'D')
# AとDだけからなる部分列において、各Dについて、左にあるAの数を数える
# 部分列は最終的に D...DA...Aとなる
ans = 0
cntA = 0
for i in range(len(s)):
    if s[i] == 'A':
        cntA += 1
    elif s[i] == 'D':
        ans += cntA
    # AとD以外(= B or C)の場合は一旦途切れる
    else:
        cntA = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = []
C = []
for i in range(M):
    b, c = list(map(int, input().split()))
    B.append(b)
    C.append(c)

C_arr = []
for i in range(M):
    for _ in range(B[i]):
        C_arr.append(C[i])

C_arr.sort(reverse=True)

A.sort()
ans = []
for i in range(N):
	if i < len(C_arr):
		ans_item = max(A[i], C_arr[i])
	else:
		ans_item = A[i]
	ans.append(ans_item)

print(sum(ans))


Fixed submission:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]

# Cについて大きい順にソート
BC.sort(key=lambda x: x[1], reverse=True)

temp = []
for i in range(M):
        # CiをBi個追加
    temp += [BC[i][1]] * BC[i][0]
    if len(temp) > N:
        break

A += temp
A.sort(reverse=True)

print(sum(A[:N]))
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for r in range(0, 3001):
    for g in range(0, 3001):
        if (N - r * R - g * G) // B >= 0 and (N - r * R - g * G) % B == 0:
            ans += 1
print(ans)


Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0
for r in range(0, 3001):
    for g in range(0, 3001):
        if (N - r * R - g * G) // B >= 0 and (N - r * R - g * G) % B == 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S = input()

# 1の個数, 0の個数, 1の個数, ..., 1の個数
list10 = []
head = S[0]
cnt = 0

# 左端の1の数
if S[0] == "0":
    list10.append(0)

for i in range(N):
    if S[i] == head:
        cnt += 1
    else:
        list10.append(cnt)
        cnt = 1
        head = S[i]

    if i == N - 1:
        list10.append(cnt)

# 右端の1の数
if S[-1] == "0":
    list10.append(0)

# print(list10)

ans = 0
for j in range(0, len(list10), 2):
    h = j
    t = min(N - 1, j + 2 * K)
    # print(sum(list10[j:t + 1]), j)
    ans = max(ans, sum(list10[j:t + 1]))
print(ans)


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

# 1の個数, 0の個数, 1の個数, ..., 1の個数
list10 = []
head = S[0]
cnt = 0

# 左端の1の数
if S[0] == "0":
    list10.append(0)

for i in range(N):
    if S[i] == head:
        cnt += 1
    else:
        list10.append(cnt)
        cnt = 1
        head = S[i]

    if i == N - 1:
        list10.append(cnt)

# 右端の1の数
if S[-1] == "0":
    list10.append(0)

# print(list10)

ans = 0

cumsum = [0]
for li in list10:
    cumsum.append(cumsum[-1] + li)
# print(cumsum)

for j in range(1, len(cumsum), 2):
    h = j
    t = min(j + 2 * K, len(cumsum) - 1)
    ans = max(ans, cumsum[t] - cumsum[max(h - 1, 0)])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
tmp = []
for a in A:
    for b in B:
        tmp.append(a + b)
ans = []
for ab in tmp:
    for c in C:
        ans.append(ab + c)
ans.sort(reverse=True)
for i in range(K):
    print(ans[i])


Fixed submission:
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

# A+Bの上位K個
tmp = []
for a in A:
    for b in B:
        tmp.append(a + b)
tmp.sort(reverse=True)
tmp = tmp[:K]

ans = []
for ab in tmp:
    for c in C:
        ans.append(ab + c)
ans.sort(reverse=True)

for i in range(K):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
S=input()
l = len(S)
#keyencexxxxx
if s[:7]=="keyence":
  print("YES")
#kxxxxxeyence
elif s[:1]=="k" and s[l-6:]=="eyence":
  print("YES")
#kexxxxxyence
elif s[:2]=="ke" and s[l-5:]=="yence":
  print("YES")
#keyxxxxxence
elif s[:3]=="key" and s[l-4:]=="ence":
  print("YES")
#keyexxxxxnce
elif s[:4]=="keye" and s[l-3:]=="nce":
  print("YES")
#keyenxxxxxce
elif s[:5]=="keyen" and s[l-2:]=="ce":
  print("YES")
#keyencxxxxxe
elif s[:6]=="keyenc" and s[l-1:]=="e":
  print("YES")
#xxxxxkeyence
elif s[l-7:]=="keyence":
  print("YES")
else:
  print("NO")


Fixed submission:
S=input()
l = len(S)
#keyencexxxxx
if S[:7]=="keyence":
  print("YES")
#kxxxxxeyence
elif S[:1]=="k" and S[l-6:]=="eyence":
  print("YES")
#kexxxxxyence
elif S[:2]=="ke" and S[l-5:]=="yence":
  print("YES")
#keyxxxxxence
elif S[:3]=="key" and S[l-4:]=="ence":
  print("YES")
#keyexxxxxnce
elif S[:4]=="keye" and S[l-3:]=="nce":
  print("YES")
#keyenxxxxxce
elif S[:5]=="keyen" and S[l-2:]=="ce":
  print("YES")
#keyencxxxxxe
elif S[:6]=="keyenc" and S[l-1:]=="e":
  print("YES")
#xxxxxkeyence
elif S[l-7:]=="keyence":
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

G = [[] for _ in range(N + 1)]
for i in range(M):
    x, y = map(int, input().split())
    G[x] += [y]
# print(G)

dp = [-1] * (N + 1)


def func(n):
    if dp[n] != -1:
        return dp[n]
    cnt = 0
	# 先にノードが存在する場合
	# ノードが存在しない場合は、cnt=0のままforをすっ飛ばす
    for m in G[n]:
        cnt = max(cnt, func(m) + 1)
    dp[n] = cnt
    return cnt


for i in range(1, N + 1):
    func(i)

# print(dp)
print(max(dp))


Fixed submission:
# デフォルトだと再帰の上限が設定されている(1000)、足りない場合があるので上げる
import sys
sys.setrecursionlimit(10**9)


N, M = map(int, input().split())

G = [[] for _ in range(N + 1)]
for i in range(M):
    x, y = map(int, input().split())
    G[x] += [y]
# print(G)

dp = [-1] * (N + 1)


def func(n):
    if dp[n] != -1:
        return dp[n]
    cnt = 0
	# 先にノードが存在する場合
	# ノードが存在しない場合は、cnt=0のままforをすっ飛ばす
    for m in G[n]:
        cnt = max(cnt, func(m) + 1)
    dp[n] = cnt
    return cnt


for i in range(1, N + 1):
    func(i)

# print(dp)
print(max(dp))
Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())
train = [[0 for _ in range(N + 1)]for _ in range(N + 1)]
for _ in range(M):
    L, R = map(int, input().split())
    train[L][R] += 1
# print(train)

cumsum = [[0 for _ in range(N + 1)]for _ in range(N + 1)]

for i in range(1, N + 1):
    for j in range(1, N + 1):
        cumsum[i][j] = cumsum[i][j - 1] + train[i][j]
# print(cumsum)

for _ in range(Q):
    p, q = map(int, input().split())
    tmp = 0
    for i in range(p, q + 1):
        tmp += cumsum[i][q] - cumsum[i][p - 1]
    print(tmp)


Fixed submission:
N, M, Q = map(int, input().split())
train = [[0 for _ in range(N + 1)]for _ in range(N + 1)]
for _ in range(M):
    L, R = map(int, input().split())
    train[L][R] += 1
# print(train)

cumsum = [[0 for _ in range(N + 1)]for _ in range(N + 1)]

for i in range(1, N + 1):
    for j in range(1, N + 1):
        cumsum[i][j] = cumsum[i][j - 1] + train[i][j]
# print(cumsum)

for _ in range(Q):
    p, q = map(int, input().split())
    tmp = 0
    for i in range(p, q + 1):
        tmp += cumsum[i][q] - cumsum[i][p - 1]
    print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
    # 単体の時は必ず成立する
    ans += 1
    # iについて、どのbitが立っているか
    visited = set()
    for d in range(20):
        if A[i] & 1 << d:
            visited.add(d)

    for j in range(i + 1, N):
        flag = True
        # jについて、どのbitが立っているか
        for d in range(20):
            if A[j] & 1 << d:
                if d not in visited:
                    visited.add(d)
                else:
                    flag = False
        # 重複がなければ、(i,j)は条件を満たす
        if flag == True:
            ans += 1
            continue
        # 重複があった場合、(i,j)は条件を満たさない
        # また、これ以上jを調べるのは無駄なので次のiへ
        else:
            break
print(ans)


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

ans = 0
tmp = A[0]
end = 0

# ^ = XOR演算子
for start in range(N):

    while end < N - 1 and (tmp ^ A[end + 1] == tmp + A[end + 1]):
        end += 1
        tmp += A[end]

    ans += (end - start + 1)
    tmp -= A[start]

    if start == end and end < N - 1:
        end += 1
        tmp += A[end]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
n = len(s)
char_list = []
for i in range(n):
    if s[i] not in char_list:
        char_list.append(s[i])
char_list.sort()
# print(char_list)

cnt = 0
str_list = []
for i in range(len(char_list)):
    for j in range(n):
        if s[j] == char_list[i]:
            for k in range(j, n + 1):
                str_list.append(s[j:k + 1])
    if len(list(set(str_list))) < K:
        continue
    else:
        str_list = list(set(str_list))
        str_list.sort()
        print(str_list[K - 1])
        # print(str_list)
        exit()


Fixed submission:
s = input()
K = int(input())
str_list = []
for i in range(len(s)):
    for j in range(K):
        str_list.append(s[i:i + j + 1])
str_list = sorted(list(set(str_list)))
# print(str_list)
ans = str_list[K - 1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
n = len(s)
char_list = []
for i in range(n):
    if s[i] not in char_list:
        char_list.append(s[i])
char_list.sort()
# print(char_list)

cnt = 0
str_list = []
for i in range(len(char_list)):
    for j in range(n):
        if s[j] == char_list[i]:
            for k in range(j, n + 1):
                str_list.append(s[j:k + 1])
    if len(list(set(str_list))) < K:
        continue
    else:
        str_list = list(set(str_list))
        str_list.sort()
        print(str_list[K - 1])
        # print(str_list)
        exit()


Fixed submission:
s = input()
K = int(input())
str_list = []
for i in range(len(s)):
    for j in range(K):
        str_list.append(s[i:i + j + 1])
str_list = sorted(list(set(str_list)))
# print(str_list)
ans = str_list[K - 1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, C = map(int, input().split())

# x = 0 に v = 0 の寿司があると考える
X = [0]
V = [0]

for _ in range(N):
    x, v = map(int, input().split())
    X.append(x)
    V.append(v)
# print(X)
# print(V)

# 0, v_1, v_1+v_2, v_1+v_2+v_3, ...
cumsum1 = [0]
for i in range(1, N + 1):
    cumsum1.append(cumsum1[-1] + V[i])

# 0, v_N, v_N+v_N-1, v_N+v_N-1+v_N-2, ...
cumsum2 = [0]
for i in range(N, 0, -1):
    cumsum2.append(cumsum2[-1] + V[i])

# print(cumsum1)
# print(cumsum2)

# 歩く範囲を弧ABと考える(A<=B)
# x_A = 0, x_1, x_2, ..., x_N
# x_B = x_A, ..., x_N
ans = 0

for i in range(N + 1):
    for j in range(i + 1, N + 1):
        # print(i, j)
        a = X[i]
        b = X[j]
        if i == 0:
            # 反時計回り(反転しない)
            ans = max(ans, cumsum1[j] - b)
            # 時計回り(反転しない)
            ans = max(ans, cumsum2[N + 1 - j] - (C - b))
        else:
            # O -> A -> B(反転)
            ans = max(ans, cumsum1[i] + cumsum2[N + 1 - j] - 2 * a - (C - b))
            # O -> B -> A(反転)
            ans = max(ans, cumsum1[i] + cumsum2[N + 1 - j] - 2 * (C - b) - a)

print(ans)


Fixed submission:
N, C = map(int, input().split())

# x = 0 に v = 0 の寿司があると考える
X = [0]
V = [0]

for _ in range(N):
    x, v = map(int, input().split())
    X.append(x)
    V.append(v)

# 0, v_1, v_1+v_2, v_1+v_2+v_3, ...
cumsum1 = [0]
for i in range(1, N + 1):
    cumsum1.append(cumsum1[-1] + V[i])

# 0, v_N, v_N+v_N-1, v_N+v_N-1+v_N-2, ...
cumsum2 = [0]
for i in range(N, 0, -1):
    cumsum2.append(cumsum2[-1] + V[i])

# 歩く範囲を弧ABと考える(A<=B)
# x_A = 0, x_1, x_2, ..., x_N
# x_B = x_A, ..., x_N

# 0, v_1-x_1, v_1+v_2-x_2, v_1+v_2+v_3-x_3, ...
f1 = [0]
# 0, v_1-2*x_1, v_1+v_2-2*x_2, v_1+v_2+v_3-2*x_3, ...
f2 = [0]
for i in range(1, N + 1):
    f1.append(cumsum1[i] - X[i])
    f2.append(cumsum1[i] - 2 * X[i])

f1_max = [0]
for i in range(1, N + 1):
    f1_max.append(max(f1_max[-1], f1[i]))
f2_max = [0]
for i in range(1, N + 1):
    f2_max.append(max(f2_max[-1], f2[i]))

ans = 0
# Bを全探索（固定する）
for i in range(N + 1):
    if i == 0:
        continue
    else:
        # 0 -> B(反時計回り、反転なし)
        ans = max(ans, cumsum1[i] - X[i])
        # 0 -> B(時計回り、反転なし)
        ans = max(ans, cumsum2[N + 1 - i] - (C - X[i]))
        # 0 -> A -> B(反転)
        ans = max(ans, f2_max[i - 1] + cumsum2[N + 1 - i] - (C - X[i]))
        # 0 -> B -> A(反転)
        ans = max(ans, f1_max[i - 1] + cumsum2[N + 1 - i] - 2 * (C - X[i]))

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
N = B - A + 1
nums = list(range(A, B + 1))
ans = set()

for i in range(min(K, N)):
    ans.add(nums[i])

nums.reverse()
for i in range(min(K, N)):
    ans.add(nums[i])


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


Fixed submission:
A, B, K = map(int, input().split())

ans = set()
for i in range(A, min(B + 1, A + K)):
    ans.add(i)

for i in range(max(A, B - K + 1), B + 1):
    ans.add(i)
ans = sorted(list(ans))
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
N = B - A + 1
nums = list(range(A, B + 1))
ans = set()

for i in range(min(K, N)):
    ans.add(nums[i])

nums.reverse()
for i in range(min(K, N)):
    ans.add(nums[i])


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


Fixed submission:
A, B, K = map(int, input().split())

ans = set()
for i in range(A, min(B + 1, A + K)):
    ans.add(i)

for i in range(max(A, B - K + 1), B + 1):
    ans.add(i)
ans = sorted(list(ans))
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

l = B - A + 1

nums = list(range(A, B + 1))
ans = set(nums[:min(K, l + 1)]) | set(nums[-min(K, l):])
ans = list(ans)
ans.sort()
for i in ans:
    print(i)


Fixed submission:
A, B, K = map(int, input().split())

ans = set()
for i in range(A, min(B + 1, A + K)):
    ans.add(i)

for i in range(max(A, B - K + 1), B + 1):
    ans.add(i)
ans = sorted(list(ans))
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
if B - A + 1 <= K:
    for i in range(A, B + 1):
        print(i)
    exit()

nums = list(range(A, B + 1))
ans = set(nums[:K]) | set(nums[-K:])
ans = list(ans)
ans.sort()
for i in ans:
    print(i)


Fixed submission:
A, B, K = map(int, input().split())

ans = set()
for i in range(A, min(B + 1, A + K)):
    ans.add(i)

for i in range(max(A, B - K + 1), B + 1):
    ans.add(i)
ans = sorted(list(ans))
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
nums = list(range(A, B + 1))
ans = set(nums[:K]) | set(nums[-K:])
ans = list(ans)
ans.sort()
for i in ans:
    print(i)


Fixed submission:
A, B, K = map(int, input().split())

ans = set()
for i in range(A, min(B + 1, A + K)):
    ans.add(i)

for i in range(max(A, B - K + 1), B + 1):
    ans.add(i)
ans = sorted(list(ans))
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())
red = [list(map(int, input().split())) for _ in range(N)]
blue = [list(map(int, input().split())) for _ in range(N)]

# x座標でソート
blue.sort(key=lambda x: x[1])

# y座標で降順ソート
red.sort(reverse=True)

# print(blue)
# print(red)

# blue_list = [0] * N
red_list = [0] * N


for b in range(N):
    for r in range(N):
        if red_list[r] == 1:
            continue
        if red[r][0] < blue[b][0] and red[r][1] < blue[b][1]:
            # print(b, r)
            # blue_list[b] = 1
            red_list[r] = 1
            break

print(sum(blue_list))


Fixed submission:
N = int(input())
red = [list(map(int, input().split())) for _ in range(N)]
blue = [list(map(int, input().split())) for _ in range(N)]
# y座標で降順ソート
red.sort(reverse=True)
# x座標でソート
blue.sort(key=lambda x: x[1])

# print(blue)
# print(red)
blue_list = [0] * N
red_list = [0] * N


for b in range(N):
    for r in range(N):
        if blue_list[b] == 1 or red_list[r] == 1:
            continue
        if red[r][0] < blue[b][0] and red[r][1] < blue[b][1]:
            # print(b, r)
            blue_list[b] = 1
            red_list[r] = 1
            break

print(sum(blue_list))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
for i in range(1, 3501):
    for j in range(1, 3501):
        tmp = 4 * i * j - N * j - N * i
        if tmp != 0 and (N * i * j) % tmp == 0:
            k = (N * i * j) // (4 * i * j - N * j - N * i)
            if k>0:
                print(i, j, k)
                exit()


Fixed submission:
N = int(input())
for i in range(1, 3501):
    for j in range(1, 3501):
        tmp = 4 * i * j - N * j - N * i
        if tmp != 0 and (N * i * j) % tmp == 0:
            k = (N * i * j) // (4 * i * j - N * j - N * i)
            if k>0:
                print(i, j, k)
                exit()
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))

for i in range(N):
  a.append(a[i]+1)
  a.append(a[i]-1)

ans=[]

for i in range(min(a), max(a)+1):
  ans.append(a.count(i))

print(max(ans))

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

d = [0]*(10**5+1)
for i in range(N):
  d[a[i]]+=1

ans=0
for i in range(10**5):
  ans = max(ans, d[i-1]+d[i]+d[i+1])

print(ans)

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

for i in range(N):
  a.append(a[i]+1)
  a.append(a[i]-1)

ans=0

for i in range(min(a), max(a)+1):
  ans = max(ans, a.count(i))

print(ans)

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

d = [0]*(10**5+1)
for i in range(N):
  d[a[i]]+=1

ans=0
for i in range(10**5):
  ans = max(ans, d[i-1]+d[i]+d[i+1])

print(ans)

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

for i in range(N):
  a.append(a[i]+1)
  a.append(a[i]-1)

ans=0

for i in range(min(a), max(a)+1):
  ans = max(ans, a.count(i))

print(ans)

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

d = [0]*(10**5+1)
for i in range(N):
  d[a[i]]+=1

ans=0
for i in range(10**5):
  ans = max(ans, d[i-1]+d[i]+d[i+1])

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(n)]

#最初はボタン１が光っている
index = 1
#押した回数0からスタート
count = 0

while count < N:
  
  if a[index-1]==2:
    count += 1
    print(count)
    exit()
    
  else:
    count += 1
    #次に光るボタン
    index=a[index-1]

print(-1)


Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]

#最初はボタン１が光っている
index = 1

#押した回数0からスタート
count = 0

while count < N:
  
  if a[index-1]==2:
    count += 1
    #print(str(2) + "!!")
    print(count)
    exit()
    
  else:
    #ボタン押す
    count += 1
    #次に光るボタンの番号
    index=a[index-1]
    #print(str(index) + "!!")

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
ans = 1

for i in range(a, b + 1):
    ans = ans * i

if ans > 0:
    print("Positive")
elif ans == 0:
    print("Zero")
elif ans < 0:
    print("Negative")

Fixed submission:
a, b = map(int, input().split())
ans = 1

if a > 0 and b > 0:
    print("Positive")
elif a == 0:
    print("Zero")
elif a < 0 and b > 0:
    print("Zero")
elif b == 0:
    print("Zero")
elif a < 0 and b < 0:
    diff = b - a
    if diff % 2 == 0:
        print("Negative")
    elif diff % 2 != 0:
        print("Positive")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
step=0
for i in range(n-1):
  if a[i]>a[i+1]:
    humi+=a[i]-a[i+1]
    a[i+1]=a[i]
print(step)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
step=0
for i in range(n-1):
  if a[i]>a[i+1]:
    step+=a[i]-a[i+1]
    a[i+1]=a[i]
print(step)
Buggy python submission (verdict: Runtime Error):
n=int(input())
K=input()
if len(k)<=n:
  print(k)
else:
  a=k[0:n+1]
  print(a+"...")

Fixed submission:
n=int(input())
k=input()
if len(k)<=n:
  print(k)
else:
  a=k[:n]
  print(a+"...")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(input().split()))
for i in range(1,n+1):
    print(a.count(str(i)))

Fixed submission:
r=int(input())
print(2*r*3.141592)
Buggy python submission (verdict: Runtime Error):
n=int(input())
man=list(map,int(input().split()))
can=list[]
for i in range(1,101):
  for j in range(len(man)):
    p=(man[j]-i)**2
	pp+=p
  can.append(pp)
can.sort(key=int)
print(can[0])
  

Fixed submission:
n=int(input())
man=list(map(int,input().split()))
can=[]
for i in range(1,101):
	pp=0
	for j in range(len(man)):
		bp=(man[j]-i)**2
		pp+=bp
	can.append(pp)
can.sort(key=int)
print(can[0])