Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02727 (python)

Fixed submission:
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)

P = P[:X]
Q = Q[:Y]

P.sort()
Q.sort()
R.sort(reverse=True)

p_i = 0
q_i = 0

for ri in R:
    if p_i >= len(P) and q_i >= len(Q):
        break
    if p_i >= len(P):
        if ri >= Q[q_i]:
            Q[q_i] = ri
            q_i += 1
    elif q_i >= len(Q):
        if ri >= P[p_i]:
            P[p_i] = ri
            p_i += 1
    elif ri < P[p_i] and ri < Q[q_i]:
        break
    elif ri > P[p_i] and ri > Q[q_i]:
        d1 = ri - P[p_i]
        d2 = ri - Q[q_i]
        if d1 > d2:
            P[p_i] = ri
            p_i += 1
        else:
            Q[q_i] = ri
            q_i += 1
    elif ri > P[p_i] and ri < Q[q_i]:
        P[p_i] = ri
        p_i += 1
    else:
        Q[q_i] = ri
        q_i += 1


# print(P, Q)
ans = sum(P) + sum(Q)
print(ans)

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)

P = P[:X]
Q = Q[:Y]

P.sort()
Q.sort()
R.sort(reverse=True)

p_i = 0
q_i = 0

for ri in R:
    if p_i >= len(P) and q_i >= len(Q):
        break
    if ri < P[p_i] and ri < Q[q_i]:
        break

    if p_i >= len(P):
        if ri >= Q[q_i]:
            Q[q_i] = ri
            q_i += 1
    elif q_i >= len(Q):
        if ri >= P[p_i]:
            P[p_i] = ri
            p_i += 1
    elif ri > P[p_i] and ri > Q[q_i]:
        d1 = ri - P[p_i]
        d2 = ri - Q[q_i]
        if d1 > d2:
            P[p_i] = ri
            p_i += 1
        else:
            Q[q_i] = ri
            q_i += 1
    elif ri > P[p_i] and ri < Q[q_i]:
        P[p_i] = ri
        p_i += 1
    else:
        Q[q_i] = ri
        q_i += 1


# print(P, Q)
ans = sum(P) + sum(Q)
print(ans)

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = list(map(int, input().split()))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse=True)
Q.sort(reverse=True)

P = P[:X]
Q = Q[:Y]

P.sort()
Q.sort()
R.sort(reverse=True)

p_i = 0
q_i = 0

for ri in R:
    if ri < P[p_i] and ri < Q[q_i]:
        break
    elif ri > P[p_i] and ri > Q[q_i]:
        d1 = ri - P[p_i]
        d2 = ri - Q[q_i]
        if d1 > d2:
            P[p_i] = ri
            p_i += 1
        else:
            Q[q_i] = ri
            q_i += 1
    elif ri > P[p_i] and ri < Q[q_i]:
        P[p_i] = ri
        p_i += 1
    else:
        Q[q_i] = ri
        q_i += 1


# print(P, Q)
ans = sum(P) + sum(Q)
print(ans)
Problem p02814 (python)

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

half = [i//2 for i in A]

def f(v):
    r = 0
    while v % 2 == 0:
        v /= 2
        r += 1
    return r

from fractions import gcd
def f2(x, y):
    return (x * y) // gcd(x, y)

d = f(A[0])
for ai in A:
    if d != f(ai):
        print(0)
        break
else:
    lcm = 1
    for ai in half:
        lcm = f2(lcm, ai)

    r = M // lcm
    ans = (r + 1) // 2
    print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

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

# A = list(set(A))

def lcm(x, y):
    return (x * y) // gcd(x, y)

p = lcm(A[0]//2, A[1]//2)
q = lcm(A[0], A[1])
for i in range(1, N-1):
    print(i)
    p = lcm(p, A[i]//2)
    q = lcm(q, A[i])
# print(p, q)

n = ((M - p) / q) + 1
print(int(n))

Buggy submission (verdict: Runtime Error):
from fractions import gcd

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

A = set(A)
half = [i/2 for i in A]
# print(half)

# def lcm(x, y):
#     return (x * y) // gcd(x, y)


a = 1
for hi in half:
    a *= hi

b = 1
for ai in A:
    b *= ai
b //= 2
# print(a, b)

n = ((M - a) / b) + 1
print(int(n))
Problem p02888 (python)

Fixed submission:
N = int(input())
L = map(int, input().split())
SL = sorted(list(L))
# print('SL', SL)
import bisect

ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ab = SL[i] + SL[j]
        # print(i, j)
        # print(SL[i], SL[j])
        r = bisect.bisect_left(SL, ab)
        l = j + 1
        # print('r', r)
        # print('l', l)
        # print('---')
        ans += max(0, r - l)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
# L = map(int, input().split())
L = [int(i) for i in input().split()]
# SL = sorted(list(L))
SL = L.sort()
# print('SL', SL)
import bisect

ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ab = SL[i] + SL[j]
        # print(i, j)
        # print(SL[i], SL[j])
        r = bisect.bisect_left(SL, ab)
        l = j + 1
        # print('r', r)
        # print('l', l)
        # print('---')
        ans += max(0, r - l)

print(ans)
Problem p02947 (python)

Fixed submission:
from math import factorial

N = int(input())
d = {}
for _ in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    if not d.get(s_sorted):
        d[s_sorted] = 1
    else:
        d[s_sorted] += 1

ans = 0
for _, v in d.items():
    if v == 1:
        continue
    ans += v * (v - 1) // 2

print(round(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial

N = int(input())
d = {}
for _ in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    if not d.get(s_sorted):
        d[s_sorted] = 1
    else:
        d[s_sorted] += 1

ans = 0
for _, v in d.items():
    if v == 1:
        continue
    x = factorial(v) / factorial(2) / factorial(v - 2)
    ans += x

print(round(ans))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from math import factorial

N = int(input())
st = set()
d = defaultdict(int)
for _ in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    if s_sorted in st:
        d[s_sorted] += 1
    else:
        st.add(s_sorted)

ans = 0
for _, v in d.items():
    tmp = v + 1
    x = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    ans += x

print(round(ans))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from math import factorial

N = int(input())
st = set()
d = defaultdict(int)
for _ in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    if s_sorted in st:
        d[s_sorted] += 1
    else:
        st.add(s_sorted)

ans = 0
for _, v in d.items():
    x = factorial(v + 1) / factorial(2)
    ans += x

print(round(ans))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from math import factorial

N = int(input())
# S = []
st = set()
d = defaultdict(int)
for _ in range(N):
    s = input()
    s_sorted = "".join(sorted(s))
    if s_sorted in st:
        d[s_sorted] += 1
    else:
        st.add(s_sorted)

ans = 0
for _, v in d.items():
    x = factorial(v + 1) / factorial(2)
    ans += x

print(round(ans))
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

N = int(input())

G = []
for i in range(N):
    G.append([])

color = [None] * N

for i in range(N-1):
    u, v, w = list(map(int, input().split()))
    G[u-1].append([v-1, w])
    G[v-1].append([u-1, w])

# for i in range(N):
#     print(G[i])

def dfs(v, c):
    color[v] = c

    # vと隣接する点
    for p, d in G[v]:
        # 訪問済み
        if color[p] is not None:
            continue
        if d % 2 == 0:
            dfs(p, c)
        else:
            dfs(p, c ^ 1)  # 排他的論理和で0, 1をひっくり返す

# 0の頂点を0で塗る
dfs(0, 0)

# print(color)
for col in color:
    print(col)

Buggy submission (verdict: Runtime Error):
N = int(input())

G = []
for i in range(N):
    G.append([])

color = [None] * N

for i in range(N-1):
    u, v, w = list(map(int, input().split()))
    G[u-1].append([v-1, w])
    G[v-1].append([u-1, w])

# for i in range(N):
#     print(G[i])

def dfs(v, c):
    color[v] = c

    # vと隣接する点
    for p, d in G[v]:
        # 訪問済み
        if color[p] is not None:
            continue
        if d % 2 == 0:
            dfs(p, c)
        else:
            dfs(p, c ^ 1)  # 排他的論理和で0, 1をひっくり返す

# 0の頂点を0で塗る
dfs(0, 0)

# print(color)
for col in color:
    print(col)
Problem p03080 (python)

Fixed submission:
N = int(input())
S = input()

r = 0
b = 0
for si in S:
    if si == 'R':
        r += 1
    else:
        b += 1

if r > b:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

r = 0
b = 0
for si in S:
    if s == 'R':
        r += 1
    else:
        b += 1

if r > b:
    print('Yes')
else:
    print('No')
Problem p03109 (python)

Fixed submission:
def main():
    s = input()
    
    m = int(s[5]+s[6])
    d = int(s[8]+s[9])

    if m < 4:
        print("Heisei")
    elif m == 4 and d <= 30:
        print("Heisei")
    else:
        print("TBD")




if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;

  if (s <= "2019/04/30") {
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }
}
Problem p03164 (python)

Fixed submission:
N, W = list(map(int, input().split()))
WE = []
V = []
INF = float('inf')
for i in range(N):
    w, v = list(map(int, input().split()))
    WE.append(w)
    V.append(v)

MAX_V = (10 ** 3) * 100 + 1

# DP[i+1][j]: i番目までの品物から価値の総和がjとなるように選んだときの、重さの総和の最小値
DP = []
for i in range(N+1):
    a = [INF] * (MAX_V + 1)
    DP.append(a)

DP[0][0] = 0

for i in range(N):
    for j in range(MAX_V):
        if j < V[i]:  # 作りたい価値の総和よりも、価値が大きい
            DP[i+1][j] = DP[i][j]
        else:
            DP[i+1][j] = min(DP[i][j], DP[i][j-V[i]] + WE[i])

r = 0
for i in range(MAX_V+1):
    if DP[N][i] <= W:
        r = i

print(r)

# for i in range(N+1):
    # print(DP[i][:20])

Buggy submission (verdict: Runtime Error):
N, W = list(map(int, input().split()))
WE = []
V = []
for i in range(N):
    w, v = list(map(int, input().split()))
    WE.append(w)
    V.append(v)

# MAX_W = 10 ** 5
MAX_W = 10 ** 9

# DP[i][j]: i以降の品物で重さj以下のときの価値の最大
DP = []
for i in range(N):
    a = [None] * (MAX_W + 1)
    DP.append(a)
DP.append([0] * (MAX_W+1))

for i in range(N-1, -1, -1):
    for j in range(MAX_W+1):
        if i == N:  # i番目の品物はない
            DP[i][j] == 0
        elif j < WE[i]:  # この重さの品物は入れないから無視
            DP[i][j] = DP[i+1][j]
        else:
            DP[i][j] = max(DP[i+1][j], DP[i+1][j-WE[i]]+V[i])

# for i in range(N):
#     print(DP[i][:10])
print(DP[0][W])

Buggy submission (verdict: Runtime Error):
N, W = list(map(int, input().split()))
WE = []
V = []
for i in range(N):
    w, v = list(map(int, input().split()))
    WE.append(w)
    V.append(v)

# MAX_W = 10 ** 5
MAX_W = 10 ** ９

# DP[i][j]: i以降の品物で重さj以下のときの価値の最大
DP = []
for i in range(N):
    a = [None] * (MAX_W + 1)
    DP.append(a)
DP.append([0] * (MAX_W+1))

for i in range(N-1, -1, -1):
    for j in range(MAX_W+1):
        if i == N:  # i番目の品物はない
            DP[i][j] == 0
        elif j < WE[i]:  # この重さの品物は入れないから無視
            DP[i][j] = DP[i+1][j]
        else:
            DP[i][j] = max(DP[i+1][j], DP[i+1][j-WE[i]]+V[i])

# for i in range(N):
#     print(DP[i][:10])
print(DP[0][W])

Buggy submission (verdict: Runtime Error):
N, W = list(map(int, input().split()))
WE = []
V = []
for i in range(N):
    w, v = list(map(int, input().split()))
    WE.append(w)
    V.append(v)

MAX_W = 10 ** 5

# DP[i][j]: i以降の品物で重さj以下のときの価値の最大
DP = []
for i in range(N):
    a = [None] * (MAX_W + 1)
    DP.append(a)
DP.append([0] * (MAX_W+1))

for i in range(N-1, -1, -1):
    for j in range(MAX_W+1):
        if i == N:  # i番目の品物はない
            DP[i][j] == 0
        elif j < WE[i]:  # この重さの品物は入れないから無視
            DP[i][j] = DP[i+1][j]
        else:
            DP[i][j] = max(DP[i+1][j], DP[i+1][j-WE[i]]+V[i])

# for i in range(N):
#     print(DP[i][:10])
print(DP[0][W])
Problem p03214 (python)

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

avg = sum(A) / N
ans = float('inf')
ansf = -1
for i, ai in enumerate(A):
    diff = abs(ai - avg)
    if diff < ans:
        ans = diff
        ansf = i

print(ansf)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

# avg = sum(A) / N
sum_a = sum(a)
ans = float('inf')
ansf = -1
for i, ai in enumerate(A):
    # diff = abs(ai - avg)
    diff = abs(N * ai - sum_a)
    if diff < ans:
        ans = diff
        ansf = i

print(ansf)
Problem p03238 (python)

Fixed submission:
def main():
    n = int(input())
    if n == 1:
        print("Hello World")
    else:
        a = int(input())
        b = int(input())
        print(a + b)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            print(X, Y, H)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict


def main():
    N = int(input())
    pairs = []
    for _ in range(N):
        pair = [int(e) for e in input().split()]
        pairs.append(pair)

    d = defaultdict(int)
    for pair in pairs:
        x, y, h = pair

        for X in range(101):
            for Y in range(101):
                H = h + (abs(X - x) + abs(Y - y))
                d[(X, Y, H)] += 1

    for k, v in d.items():
        if v == N:
            X, Y, H = k
            print(X, Y, H)


if __name__ == '__main__':
    main()
Problem p03262 (python)

Fixed submission:
import fractions


def func(l):
    r = fractions.gcd(l[0], l[1])    
    for i in range(1, len(l) - 1):
        r = fractions.gcd(r, l[i + 1])
    return r


def main():
    n, x = map(int, input().split())
    xl = [int(i) for i in input().split()]
    xl.append(x)
    xl.sort()
    
    if n == 1:
      print(abs(xl[1] - xl[0]))
      return
    
    dl = []
    for i in range(len(xl) - 1):
        d = xl[i + 1] - xl[i]
        dl.append(d)

    print(func(dl))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fractions


def func(l):
    r = fractions.gcd(l[0], l[1])
    for i in range(1, len(l) - 1):
        r = fractions.gcd(r, l[i + 1])
    return r


def main():
    n, x = map(int, input().split())
    xl = [int(i) for i in input().split()]
    xl.append(x)
    xl.sort()
    
    dl = []
    for i in range(len(xl) - 1):
        d = xl[i + 1] - xl[i]
        dl.append(d)

    print(func(dl))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fraction


def func(l):
    r = math.gcd(l[0], l[1])
    for i in range(1, len(l) - 1):
        r = math.gcd(r, l[i + 1])
    return r


def main():
    n, x = map(int, input().split())
    xl = [int(i) for i in input().split()]
    xl.append(x)
    xl.sort()
    
    dl = []
    for i in range(len(xl) - 1):
        d = xl[i + 1] - xl[i]
        dl.append(d)

    print(func(dl))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def func(l):
    r = math.gcd(l[0], l[1])
    for i in range(1, len(l) - 1):
        r = math.gcd(r, l[i + 1])
    return r


def main():
    n, x = map(int, input().split())
    xl = [int(i) for i in input().split()]
    xl.append(x)
    xl.sort()
    
    dl = []
    for i in range(len(xl) - 1):
        d = xl[i + 1] - xl[i]
        dl.append(d)

    print(func(dl))


if __name__ == '__main__':
    main()
Problem p03274 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    x = [int(i) for i in input().split()]

    n = []
    p = []
    ans = []
    for xi in x:
        if xi < 0:
            n.append(xi)
        else:
            p.append(xi)

    # print(n,p)

    # i: nから選ぶ個数
    # k-i: pから選ぶ個数
    for i in range(k+1):
        # print(i, k-i, k)
        if i > len(n):
            continue
        if k-i > len(p):
            continue

        if i == 0:
            ans.append(p[k-1])
        elif k - i == 0:
            ans.append(-n[-k])
        else:
            nd = -n[-i]
            pd = p[k-i-1]
            ans.append(nd + pd + min(nd, pd))

    # print(ans)
    print(min(ans))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    x = [int(i) for i in input().split()]

    n = []
    p = []
    ans = []
    for xi in x:
        if xi < 0:
            n.append(xi)
        else:
            p.append(xi)

    # print(n,p)

    # i: nから選ぶ個数
    # k-i: pから選ぶ個数
    for i in range(k):
        if i > len(n):
            continue
        if k-i > len(p):
            continue

        if i != 0:
          nd = -n[-i]
          pd = p[k-i-1]
          ans.append(nd + pd + min(nd, pd))
        else:
          ans.append(p[k-1])

    # print(ans)
    print(min(ans))







if __name__ == '__main__':
    main()
Problem p03316 (python)

Fixed submission:
def main():
    s = input()
    total = 0
    for i in range(len(s)):
        total += int(s[i])

    if int(s) % total == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    total = 0
    for i in range(len(s)):
        total += int(s[i])

    if int(s) % total == 0:
        print("Yes")
    else:
        print("No")


def main2():
    n = int(input())
    total = 0
    tmp = n
    while tmp > 0:
        total += n % 10
        tmp = tmp // 10

    if n % total == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main2()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    total = 0
    for i in range(len(s)):
        total += int(s[i])

    if int(s) % total == 0:
        print("Yes")
    else:
        print("No")


def main2():
    n = int(input())
    total = 0
    tmp = n
    while tmp > 0:
        total += n % 10
        tmp //= 10

    if n % total == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main2()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    total = 0
    for i in range(len(s)):
        total += int(s[i])

    if int(s) % total == 0:
        print("Yes")
    else:
        print("No")


def main2():
    n = int(input())
    total = 0
    tmp = n
    while tmp > 0:
        total += n % 10
        tmp /= 10

    if n % total == 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main2()
Problem p03352 (python)

Fixed submission:
def main():
    n = int(input())

    # for i in range(1, n + 1):
    #     if

    # i = 1
    # while i * i <= n:
    #     i += 1
    #
    # print((i - 1) ** 2)

    ans = [1]
    for i in range(2, n + 1):
        j = 2
        while i ** j <= n:
            ans.append(i ** j)
            j += 1

    print(max(ans))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())

    # for i in range(1, n + 1):
    #     if

    # i = 1
    # while i * i <= n:
    #     i += 1
    #
    # print((i - 1) ** 2)

    ans = [1]
    for i in range(2, n + 1):
        j = 2
        while i ** j <= n:
            ans.append(i ** j)
            j += 1

    print(max[ans])


if __name__ == '__main__':
    main()
Problem p03371 (python)

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

r = []

# Cピザを使わない
t1 = A * X + B * Y
r.append(t1)

# Cピザをmin(A*2, B*2)まで買う
x = min(X, Y)
ab = 2 * x
t2 = ab * C + (X - x) * A + (Y - x) * B
r.append(t2)

# Cピザで賄う
x = max(X, Y)
ab = 2 * x
t3 = ab * C
r.append(t3)

print(min(r))

Buggy submission (verdict: Runtime Error):
ans = max(A, B) * (X + Y)
for i in range(2 * 10 ** 5 + 100):
    c = i // 2
    x = i * C + max(X - c, 0) * A + max(Y - c, 0) * B
    ans = min(ans, x)

print(ans)
Problem p03407 (python)

Fixed submission:
v =  [int(i) for i in input().split()]

if v[0] + v[1] >= v[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
r = []
b = []
for i in range(N):
    r.append([int(i) for i in input().split()])

for i in range(N):
    b.append([int(i) for i in input().split()])

sorted_r = sorted(r, key=lambda r:r[0], reverse=True)
sorted_b = sorted(b)

ans = 0
for e1 in sorted_b:
    for e2 in sorted_r:
        if e2[0] < e1[0] and e2[1] < e1[1]:
            ans += 1
            sorted_r.remove(e2)
            break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = []
for i in range(N):
    s.append(input())

M = int(input())
t = []
for i in range(M):
    t.append(input())

#print(s)
#print(t)
max_score = 0

for e in s:
    score = s.count(e) - t.count(e)
    if score > max_score:
        max_score = score

print(max_score)
Problem p03424 (python)

Fixed submission:
def main():
    n = int(input())
    s = input().split()

    if "Y" in s:
        print("Four")
    else:
        print("Three")


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    s = [int(i) for i in input().split()]

    if "Y" in s:
        print("Four")
    else:
        print("Three")


if __name__ == '__main__':
    main()
Problem p03565 (python)

Fixed submission:
def main():
    S = input()
    T = input()

    SR = S[::-1]
    TR = T[::-1]

    restore = False
    pos = 0
    r = ""
    for i in range(len(S)):
        r += SR[:i]
        for j, si in enumerate(SR[i:]):
            if si == '?':
                r += TR[pos]
                pos += 1
            elif si == TR[pos]:
                r += TR[pos]
                pos += 1
            else:
                break
            # print(i, si, pos)
            if pos == len(T):
                restore = True
                break
        if restore:
            r += SR[i+j+1:]
            break
        pos = 0
        r = ""

    if restore:
        r = r.replace('?', 'a')
        r = r[::-1]
        print(r)
    else:
        print('UNRESTORABLE')


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

if len(S) < len(T):
    print('UNRESTORABLE')
else:
    raise Exception()
    # pos = []
    # # Sのi文字目をスタートとしたときにマッチするか
    # for i in range(len(S)-len(T)+1):
    #     # print('S[i]', S[i])
    #     match = True
    #     for j in range(len(T)):
    #         # print('-', T[j], S[i+j])
    #         if T[j] == S[i+j] or S[i+j] == '?':
    #             pass
    #         else:
    #             match = False
    #     if match:
    #         pos.append(i)

    # # print(pos)
    # if len(pos) == 0:
    #     print('UNRESTORABLE')
    # else:
    #     ans = 'z' * 51
    #     for pi in pos:
    #         r = ''
    #         for j in range(pi):
    #             if S[j] == '?':
    #                 r += 'a'
    #             else:
    #                 r += S[j]
    #         r += T
    #         for j in range(pi+len(T), len(S)):
    #             if S[j] == '?':
    #                 r += 'a'
    #             else:
    #                 r += S[j]
    #         ans = min(ans, r)
    #     print(ans)
Problem p03611 (python)

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

    c = [0] * (100000 + 1)
    for ai in A:
        c[ai] += 1

    ans = 0
    for i in range(len(c) - 2):
        ans = max(ans, c[i] + c[i+1] + c[i+2])
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = list(map(int, input().split()))

    c = [0] * (100000 + 1)
    for ai in A:
        c[ai+1] += 1
        c[ai] += 1
        c[ai+2] += 1

    print(max(c))

if __name__ == "__main__":
    main()