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

Fixed submission:
k, x = map(int, input().split())

n = k * 500

if n >= x:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
k, x = map(int, input().split())

n = k * 500

if n => x:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
k, x = map(int, input().split())

n = k * 500

if n = > x:
  print('Yes')
else:
  print('No')
Problem p02830 (python)

Fixed submission:
N = int(input()) 
a = input().split()
S = a[0]
T = a[1]

answer = ""

for i in range(N):
  answer += S[i]
  answer += T[i]
 
print(answer)

Buggy submission (verdict: Runtime Error):
a = [input() for i in range(3)]

N = int(a[0])
S = a[1]
T = a[2]

answer = ""

for i in range(N):
  answer += S[i]
  answer += T[i]
 
print(answer)
Problem p02995 (python)

Fixed submission:
import math
import fractions
A, B, C, D = map(int, input().split())

#B以下の整数の個数
x = B - (B // C) - (B // D)
#C,Dの最大公約数を求める
l = fractions.gcd(C, D)
#C,Dの最小公倍数を求める
temp = C * D // l 
#C,Dで重複して引いた数を足し合わせる
x += (B // temp)

#同様にA - 1以下の整数のうちの個数も求める
a = A - 1
y = a - (a // C) - (a // D)
y += (a // temp)

ans = x - y
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())

#B以下の整数の個数
x = B - (B // C) - (B // D)
#C,Dの最大公約数を求める
l = math.gcd(C, D)
#C,Dの最小公倍数を求める
temp = C * D // l 
#C,Dで重複して引いた数を足し合わせる
x += (B // temp)

#同様にA - 1以下の整数のうちの個数も求める
a = A - 1
y = a - (a // C) - (a // D)
y += (a // temp)

ans = x - y
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())

#B以下の整数の個数
x = B - (B // C) - (B // D)
#C,Dの最大公約数を求める
l = math.gcd(C, D)
#C,Dの最小公倍数を求める
temp = C * D // l 
#C,Dで重複して引いた数を足し合わせる
x += (B // temp)

#同様にA - 1以下の整数のうちの個数も求める
a = A - 1
y = a - (a // C) - (a // D)
y += (a // temp)

ans = x - y
print(ans)
Problem p03633 (python)

Fixed submission:
import fractions 
n = int(input())
t = [int(input()) for i in range(n)]
def lcm(a, b):
  return (a * b) // fractions.gcd(a, b)

#入力tについて、最小公倍数を求めればそれが答えとなる
if n == 1:
  print(t[0])
else:
  ans = lcm(t[0], t[1])
  for i in range(2, n):
    ans = lcm(ans, t[i])
  print(ans)

Buggy submission (verdict: Runtime Error):
import fractions 
n = int(input())
t = [int(input()) for i in range(n)]
t.sort()
def lcm(a, b):
  return (a * b) // fractions.gcd(a, b)

#入力tについて、最小公倍数を求めればそれが答えとなる
ans = lcm(t[0], t[1])
for i in range(2, n):
  ans = lcm(ans, t[i])

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions 
n = int(input())
t = [int(input()) for i in range(n)]

def lcm(a, b):
  return (a * b) // fractions.gcd(a, b)

#入力tについて、最小公倍数を求めればそれが答えとなる
ans = lcm(t[0], t[1])
for i in range(2, n):
  ans = lcm(ans, t[i])

print(ans)
Problem p02642 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

A.sort()
max_num = A[-1]
counter = Counter(A)
s = set()
cnt = 0
for a in A:
    if a in s:
        continue
    if counter[a] == 1:
        cnt += 1
    idx = 1
    while a * idx <= max_num:
        s.add(a * idx)
        idx += 1
print(cnt)

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

A.sort()
if A[0] == A[1]:
    cnt = N-1
else:
    cnt = N

for i in range(1, N):
    for j in range(i):
        if A[i] % A[j] == 0:
            cnt -= 1
            break

print(cnt)
Problem p02694 (python)

Fixed submission:
X = int(input())

tmp = 100
cnt = 0
while tmp < X:
    tmp = tmp + int(tmp*0.01)
    cnt += 1

print(cnt)

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

tmp = 100
cnt = 
while tmp < X:
    tmp = tmp + int(tmp*0.01)
    cnt += 1

print(cnt)
Problem p02732 (python)

Fixed submission:
from collections import Counter

def Get_nC2(n):
    return int(n*(n-1) / 2)


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

c = Counter(A_i)


total = sum(list(map(Get_nC2, c.values())))

for a_i in A_i:
    result =  total - Get_nC2(c[a_i]) + Get_nC2(c[a_i]-1)
    print(result)

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

def Get_nC2(n):
    return int(n*(n-1) / 2)


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

c = Counter(A_i)
cnt_dict = {}

total = sum(list(map(Get_nC2, tmp.values())))

for a_i in A_i:
    result =  total - Get_nC2(c[a_i]) + Get_nC2(c[a_i-1])
    print(result)

Buggy submission (verdict: Runtime Error):

def Get_nC2(n):
    return int(n*(n-1) / 2);


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

cnt_dict = {}
for a_i in A_i:
    cnt = 0
    if a_i in cnt_dict:
        print(cnt_dict[a_i])
        continue
    else:
    for j in range(min(A_i), max(A_i)+1):
        j_cnt = A_i.count(j)
        if a_i == j:
            j_cnt -= 1

        cnt += Get_nC2(j_cnt)

        cnt_dict[a_i] = cnt

        print(cnt)
Problem p02995 (python)

Fixed submission:
import fractions

A, B, C, D = map(int, input().split())

lcm = C * D // fractions.gcd(C, D)

div_c = (B // C) - (A // C)
if A // C != 0 and A % C == 0:
    div_c += 1
div_d = (B // D) - (A // D)
if A // D != 0 and A % D == 0:
    div_d += 1
div_cd = (B // (lcm)) - (A // (lcm))
if A // (lcm) != 0 and A % lcm == 0:
    div_cd += 1

ans = (B - A + 1) - (div_c + div_d - div_cd)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

lcm = C * D // math.gcd(C, D)

div_c = (B // C) - (A // C)
if A // C != 0 and A % C == 0:
    div_c += 1
div_d = (B // D) - (A // D)
if A // D != 0 and A % D == 0:
    div_d += 1
div_cd = (B // (lcm)) - (A // (lcm))
if A // (lcm) != 0 and A % lcm == 0:
    div_cd += 1

ans = (B - A + 1) - (div_c + div_d - div_cd)
print(ans)
Problem p02582 (python)

Fixed submission:
S = input()
ans = 0
if "RRR" in S:
    ans = 3
elif "RR" in S:
    ans = 2
elif "R" in S:
    ans = 1
else:
    ans = 0
print(ans)

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

ans = -10**18

for i in range(N):
    tmp_score = 0
    pos = i
    # ループになるまで移動
    for j in range(1, N+1):
        pos = P[pos]-1
        if K >= j:
            tmp_score += C[pos]
            ans = max(ans,tmp_score)
        if pos == i:
            break
    
    div = K // j
    mod = K % j

    if K >= j:
        tmp_score *= div
        ans = max(ans,tmp_score)
        # 端数ぶん移動
        # mod=0 のときは移動しない
        for _ in range(1, mod+1):
            pos = P[pos]-1
            tmp_score += C[pos]
            ans = max(ans,tmp_score)

print(ans)

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

ans = -10**18

for i in range(N):
    tmp_score = 0
    pos = i
    # ループになるまで移動
    for j in range(1, N+1):
        pos = P[pos]-1
        if K >= j:
            tmp_score += C[pos]
            ans = max(ans,tmp_score)
        if pos == i:
            break
    
    div = K // j
    mod = K % j

        if K >= j:
        tmp_score *= div
        ans = max(ans,tmp_score)
        # 端数ぶん移動
        # mod=0 のときは移動しない
        for _ in range(1, mod+1):
            pos = P[pos]-1
            tmp_score += C[pos]
            ans = max(ans,tmp_score)

print(ans)
Problem p02618 (python)

Fixed submission:
n=int(input())
for i in range(n):
  print(1)

Buggy submission (verdict: Runtime Error):
D = int(input())#D=365
c = list(map(int, input().split()))#0<=c<=100
s = [list(map(int, input().split())) for _ in range(D)]#0<=s<=20000

t = []
for d in range(D):
    t.append(s.index(max(s[d])) + 1)

for i in range(D):
    print(t[i])
Problem p02620 (python)

Fixed submission:
D = int(input())#D=365
c = [0] + list(map(int, input().split()))#0<=c<=100
s = [0] + [[0] + list(map(int, input().split())) for _ in range(D)]#0<=s<=20000

t = [0] + [int(input()) for _ in range(D)]

M = int(input())
dq = [list(map(int, input().split())) for _ in range(M)]


held = [[0] for _ in range(27)]
def culc_value(t):
    last = [0] * 27
    value = 0
    for d in range(1, D+1):
        type = t[d]
        held[type].append(d)
        value += s[d][type]
        last[type] = d
        for i in range(1, 27):
            value -= c[i] * (d - last[i])
    for i in range(1, 27):
        held[i].append(D+1)
    #print(held)
    return value


v_lastday = []
value = culc_value(t)

for d, q in dq:
    value += - s[d][t[d]] + s[d][q]

    # 変換前のt[d-1]のマイナス計算を直す
    ind = held[t[d]].index(d)
    r = held[t[d]][ind+1]
    l = held[t[d]][ind-1]
    x = r - l
    value -= ((x + 1) * x // 2) * c[t[d]]
    y = d - l
    z = r - d
    value += (((y + 1) * y // 2) + (z + 1) * z // 2) * c[t[d]]

    del held[t[d]][ind]
    t[d] = q
    held[q].append(d)
    held[q] = sorted(held[q])
    #print(held[q])

    # qに変換後のマイナス計算
    ind = held[q].index(d)
    r = held[q][ind+1]
    l = held[q][ind-1]
    x = r - l
    value += ((x + 1) * x // 2) * c[q]
    y = d - l
    z = r - d
    value -= (((y + 1) * y // 2) + (z + 1) * z // 2) * c[q]

    v_lastday.append(value)

for ans in v_lastday:
    print(ans)

Buggy submission (verdict: Runtime Error):
D = int(input())#D=365
c = list(map(int, input().split()))#0<=c<=100
s = [list(map(int, input().split())) for _ in range(D)]#0<=s<=20000

t = [int(input()) for _ in range(D)]

M = int(input())
dq = [list(map(int, input().split())) for _ in range(M)]

INF = 10**9


def culc_value(t):
    last = [0] * 26
    value = 0
    for d in range(D):
        type = t[d]
        value += s[d][type - 1]
        last[type - 1] = d + 1
        for i in range(26):
            value -= c[i] * (d + 1 - last[i])
    return value


v_lastday = []
value = culc_value(t)

for d, q in dq:
    value = value - s[d - 1][t[d - 1]] + s[d - 1][q - 1]

    # qに変換後のマイナス計算
    q_prev = 0
    q_next = 365
    for i in range(D):
        if t[i] == q and i + 1 != d:
            if q_prev < d:
                q_prev = i + 1
                continue
            elif d < q_next:
                q_next = i + 1
                break
    x = q_next - q_prev
    value += ((x + 1) * x // 2) * c[q - 1]
    y = d - q_prev
    z = q_next - d
    value -= (((y + 1) * y // 2) + (z + 1) * z // 2) * c[q - 1]

    # 変換前のt[d-1]のマイナス計算を直す
    r = t[d-1]
    r_prev = 0
    r_next = 365
    for i in range(D):
        if t[i] == r and i + 1 != d:
            if r_prev < d:
                r_prev = i + 1
                continue
            elif d < r_next:
                r_next = i + 1
                break
    x = r_next - r_prev
    value -= ((x + 1) * x // 2) * c[r - 1]
    y = d - r_prev
    z = r_next - d
    value += (((y + 1) * y // 2) + (z + 1) * z // 2) * c[r - 1]

    t[d - 1] = q
    v_lastday.append(value)

for x in v_lastday:
    print(x)


"""
for i in range(D):
    print(v[i])
"""
Problem p02645 (python)

Fixed submission:
S = input()
print(S[:3])

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

K = min(K, 50)
for _ in range(K):
    B = [0 for _ in range(N)]
    for i in range(N):
        l = max(0, i - A[i])
        r = min(N - 1, i + A[i])
        B[l] += 1
        if r+1 < N:
            B[r+1] -= 1
    
    for i in range(1, N):
        B[i] += B[i-1]
    
    A = B.copy()

print(" ".join(map(str, A)))
Problem p02647 (python)

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

for _ in range(K):
    B = [0] * N
    for i, d in enumerate(A):
        l = max(0, i-d)
        r = min(N-1, i+d)
        B[l] += 1
        if r+1 < N:
            B[r+1] -= 1
    
    for i in range(1, N):
        B[i] += B[i-1]
    
    A = B.copy()
    if min(A) == N:
        break

print(" ".join(map(str, A)))

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

K = min(K, 100)
for _ in range(K):
    B = [0 for _ in range(A)]
    for i in range(N):
        l = max(0, i - A[i])
        r = min(N - 1, i + A[i])
        B[l] += 1
        if r+1 < N:
            B[r+1] -= 1
    
    for i in range(1, N):
        B[i] += B[i-1]
    
    A = B.copy()

print(" ".join(map(str, A)))

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

K = min(K, 100)
for i in range(K):
    B = [0 for _ in range(A)]
    for i in range(N):
        l = max(0, i - A[i])
        r = min(N - 1, i + A[i])
        B[l] += 1
        if r+1 < N:
            B[r+1] -= 1
    
    for i in range(1, N):
        B[i] += B[i-1]
    
    A = B.copy()

print(" ".join(map(str, A)))
Problem p02675 (python)

Fixed submission:
N = input()
ans = ""
if N[-1] in ("2", "4", "5", "7", "9"):
    ans = "hon"
elif N[-1] in ("0", "1", "6", "8"):
    ans = "pon"
elif N[-1] in ("3"):
    ans = "bon"

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (ans[y] == 0):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])
Problem p02678 (python)

Fixed submission:
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (ans[y] == 0) and (y not in now):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(N):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0] * (N+1)
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (y not in now) and (ans[y] == 0):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])
Problem p02684 (python)

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

L = [0] * (N+1)
now = 1
p = []
f = False

for i in range(K):
    if L[now] == 1:
        f = True
        break
    p.append(now)
    L[now] = 1
    now = A[now-1]

if f:
    for i in range(len(p)):
        if p[i] == now:
            ans = p[i + (K - i) % len(p[i:])]
            break
else:
    ans = now

print(ans)

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

L = [0] * (N+1)
now = 1
p = []

for i in range(K):
    if L[now] == 1:
        break
    p.append(now)
    L[now] = 1
    now = A[now-1]

for i in range(len(p)):
    if p[i] == now:
        ans = p[i + (K - i) % len(p[i:])]

print(ans)
Problem p02690 (python)

Fixed submission:
X = int(input())

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            A = a
            B = b

print(str(A) + " " + str(B))

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

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            print(str(A) + " " + str(B))
            exit()
Problem p02713 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


K = int(input())

L = [[0] * (K+1) for _ in range(K+1)]
ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        x, y = sorted([a, b])
        if L[x][y] == 0:
            d = gcd(a, b)
            L[x][y] = d
        else:
            d = L[x][y]
        for c in range(1, K+1):
            x, y = sorted([d, c])
            if L[x][y] == 0:
                t = gcd(d, c)
                L[x][y] = t
                ans += t
            else:
                ans += L[x][y]


print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


K = int(input())

ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        gcd = gcd(a, b)
        for c in range(1, K+1):
            ans += gcd(gcd, c)

print(ans)
Problem p02730 (python)

Fixed submission:
S = input()

n = len(S)
ans = "No"
if S[:n//2] == S[n//2+1:][::-1]:
    S1 = S[:(n-1)//2]
    n1 = len(S1)
    if S1[:n1//2] == S1[(n1+1)//2:][::-1]:
        S2 = S[(n+3)//2-1:]
        n2 = len(S2)
        if S2[:n2//2] == S2[(n2+1)//2:][::-1]:
            ans = "Yes"

print(ans)

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

n = len(S)
ans = "No"
if S[:n//2] == S[n//2+1:][::-1]:
    S1 = S[:(n-1)//2]
    n1 = len(S1)
    if n1 % 2 == 1:
        if S1[:n1//2] == S1[(n1+1)//2:][::-1]:
            S2 = S[(n+3)//2-1:]
            n2 = len(S2)
        if S2[:n2//2] == S2[(n2+1)//2:][::-1]:
            ans = "Yes"

print(ans)
Problem p02743 (python)

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

if c - a - b > 0:
    if 4 * a * b < (c - a - b) ** 2:
        ans = "Yes"
    else:
        ans = "No"
else:
    ans = "No"


print(ans)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())

ans = 0
if H == 1 or W == 1:
    ans = 1
elif H % 2 == 0:
    ans = (W * H) // 2
else:
    ans = (W * (H - 1)) // 2 + (W + 1) // 2

print(ans)
Problem p02747 (python)

Fixed submission:
S = input()
ans = "No"
if len(S) % 2 == 0:
    if S == ("hi" * (len(S) // 2)):
        ans = "Yes"


print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input().split())
ans = "No"
if len(S) == 1:
    ans = "No"
else:
    for i in range(len(S)-1)
        if S[i] == "h":
            if S[i+1] == "i":
                ans = "Yes"

print(ans)
Problem p02765 (python)

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

if N >= 10:
    ans = R
else:
    ans = R + 100 * (10 - N)

print(ans)

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

if N >= 10:
    ans = R
else:
    ans = R - 100 * (10 - K)

print(ans)
Problem p02801 (python)

Fixed submission:
c = input()
print(chr(ord(c)+1))

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

ans = 0
mod = 10 ** 9 + 7

A.sort()
for i in range(N-K):
    fs = A[i+K] - A[i]
    ans += fs % mod

print(ans % mod)
Problem p02843 (python)

Fixed submission:
X = int(input())

if X < 100:
    print(0)
else:
    y = X - X // 100 * 100

    if y // (X // 100) < 5:
        print(1)
    elif y // (X // 100) == 5 and y % (X // 100) == 0:
        print(1)
    else:
        print(0)

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

y = X - X // 100 * 100
if y // (X // 100) < 5:
    print(1)
elif y // (X // 100) == 5 and y % (X // 100) == 0:
    print(1)
else:
    print(0)
Problem p02844 (python)

Fixed submission:
N = int(input())
S = list(map(int, list(input())))

cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            pin = [i, j, k]
            x = 0

            for a in S:
                if a == pin[x]:
                    x += 1
                    if x == 3:
                        cnt += 1
                        break

print(cnt)

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

cnt = 0

for i in range(1000):
    if 0 <= i < 10:
        a = "00" + str(i)
    elif 10 <= i < 100:
        a = "0" + str(i)
    elif 100 <= i:
        a = str(i)
    
    idx = 0
    for j in range(N):
        if S[i] == a[idx]:
            idx += 1
            if idx == 3:
                cnt += 1
                break

print(cnt)

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

cnt = 0

for i in range(1000):
    if 0 <= i < 10:
        a = "00" + str(i)
    elif 10 <= i < 100:
        a = "0" + str(i)
    elif 100 <= i:
        a = str(i)
    
    idx = 0
    for j in range(S):
        if S[i] == a[idx]:
            idx += 1
            if idx == 3:
                cnt += 1
                break

print(cnt)

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

cnt = 0

for i in range(1000):
    if 0 <= i < 10:
        a = "00" + str(i)
    elif 10 <= i < 100:
        a = "0" + str(i)
    elif 100 <= i:
        a = str(i)
    
    idx = 0
    for j in range(S):
        if S[i] == a[idx]:
            idx += 1
            if idx == 3:
                cnt += 1
                break

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

cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            pin = [i, j, k]
            x = 0

            for a in S:
                if a == pin[x]:
                    x += 1
                    if x = 3:
                        cnt += 1
                        break

print(cnt)

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

cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            flag1 = True
            flag2 = True

            for a in S:
                if flag1:
                    if a == i:
                        flag1 = False
                elif flag2:
                    if a == j:
                        flag2 = False
                elif a == k:
                    cnt += 1
                    break

print(cnt)
Problem p02848 (python)

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

ans = ""
for a in S:
    ans += chr((ord(a) + N - ord("A")) % 26 + ord("A"))

print(ans)

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

ans = ""
for a in S:
    ans += chr((ord(a) + N) % 26 - ord("A"))

print(ans)

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

ans = ""
for a in S:
    ans += chr((ord(a) + N) % 26 + ard("A"))

print(ans)
Problem p02866 (python)

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

if D[0] != 0:
    print(0)
else:
    D.sort()

    if D[1] == 0:
        print(0)
    else:
        mod = 998244353
        ans = 1
        distance = 0
        prev = 1
        now = 0

        for i in range(N):
            if D[i] == distance:
                now += 1
            elif D[i] == distance + 1:
                ans = (ans % mod) * (prev ** now % mod) % mod
                prev = now+0
                now = 1
                distance += 1
            else:
                ans = 0
                break
        else:
            ans = (ans % mod) * (prev ** now % mod) % mod
        
        print(ans)

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

if D[0] != 0:
    print(0)
else:
    D.sort()

    if D[1] == 0:
        print(0)
        break

    mod = 998244353
    ans = 1
    distance = 0
    prev = 1
    now = 0
    
    for i in range(N):
        if D[i] == distance:
            now += 1
        elif D[i] == distance + 1:
            ans = (ans % mod) * (prev ** now % mod) % mod
            prev = now+0
            now = 1
            distance += 1
        else:
            ans = 0
            break
    else:
        ans = (ans % mod) * (prev ** now % mod) % mod
    
    print(ans)

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

if D[0] != 0:
    print(0)
else:
    mod = 998244353
    D.sort()
    ans = 1
    distance = 0
    prev = 1
    now = 0
    for i in range(len(D)):
        if D[i] == distance:
            now += 1
        elif D[i] == distance + 1:
            ans = ans * prev ** now % mod
            prev = now+0
            now = 1
            distance += 1
        else:
            ans = 0
            break
    else:
        ans = ans * prev ** now % mod

print(ans)