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

Fixed submission:
n = int(input())
L_dict, R_dict = {}, {}
i = 0
for ipt in input().split():
    try:
        L_dict[i + int(ipt)] += 1
    except KeyError:
        L_dict[i + int(ipt)] = 1
    try:
        R_dict[i - int(ipt)] += 1
    except KeyError:
        R_dict[i - int(ipt)] = 1
    i += 1
cnt = 0
for Lk, Lv in L_dict.items():
    try:
        cnt += R_dict[Lk] * Lv
    except KeyError:
        pass
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
L, R = [0] * n, [0] * n
i = 0
for ipt in input().split():
    L[i] = i + ipt 
    R[i] = i - ipt
    i += 1
def make_dic(L):
    L_set = set(L)
    return dict([(i, L.count(i)) for i in L_set])
L_dic, R_dic = make_dic(L), make_dic(R)
cnt = 0
for Lk, Lv in L_dic.items():
    try:
        cnt += R_dic[Lk] * Lv
    except KeyError:
        pass
print(cnt)
Problem p02692 (python)

Fixed submission:
n, a, b, c = map(int, input().split())
abc = list((a, b, c))
ans = [0] * n
dic = {'A': 0, 'B': 1, 'C': 2}
flag = True
s = [input() for i in range(n)]
for i in range(n):
    if abc[dic[s[i][0]]] == 0 and abc[dic[s[i][1]]] == 0:
        flag = False
        break
    elif sum(abc) == 2 and abc[dic[s[i][0]]] == 1 and abc[dic[s[i][1]]] == 1 and i != n - 1:
        ps = (set(s[i]) & set(s[i + 1])).pop()
        ms = (set(s[i]) - set(ps)).pop()
        abc[dic[ps]] += 1
        abc[dic[ms]] -= 1
        ans[i] = ps
    elif abc[dic[s[i][0]]] <= abc[dic[s[i][1]]]:
        abc[dic[s[i][0]]] += 1
        abc[dic[s[i][1]]] -= 1
        ans[i] = s[i][0]
    else:
        abc[dic[s[i][0]]] -= 1
        abc[dic[s[i][1]]] += 1
        ans[i] = s[i][1]
if flag:
    print('Yes')
    print(*ans, sep='\n')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n, a, b, c = map(int, input().split())
abc = list((a, b, c))
ans = [0] * n
dic = {'A': 0, 'B': 1, 'C': 2}
flag = True
s = [input() for i in range(n)]
for i in range(n):
    if abc[dic[s[i][0]]] == 0 and abc[dic[s[i][1]]] == 0:
        flag = False
        break
    elif sum(abc) == 2 and abc[dic[s[i][0]]] == 1 and abc[dic[s[i][1]]] == 1:
        ps = (set(s[i]) & set(s[i + 1])).pop()
        ms = (set(s[i]) - set(ps)).pop()
        abc[dic[ps]] += 1
        abc[dic[ms]] -= 1
        ans[i] = ps
    elif abc[dic[s[i][0]]] <= abc[dic[s[i][1]]]:
        abc[dic[s[i][0]]] += 1
        abc[dic[s[i][1]]] -= 1
        ans[i] = s[i][0]
    else:
        abc[dic[s[i][0]]] -= 1
        abc[dic[s[i][1]]] += 1
        ans[i] = s[i][1]
if flag:
    print('Yes')
    print(*ans, sep='\n')
else:
    print('No')
Problem p02702 (python)

Fixed submission:
M = 2019
s = input()
tot, ten, ans = 0, 1, 0
cnt = [0] * M
for si in s[::-1]:
    cnt[tot] += 1
    tot += int(si) * ten
    tot %= M
    ans += cnt[tot]
    ten *= 10
    ten %= M
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
for l in range(len(s)):
    r = l + 1
    while r < len(s) and int(s[l:r]) % 2019 != 0:
        r += 1
    if int(s[l:r]) % 2019 == 0:
        cnt += 1
        print(i, j, s[i:j])
print(cnt)
Problem p02715 (python)

Fixed submission:
MOD = 10**9 + 7
n, k = map(int, input().split())
d = [0] + [pow(k // i, n, MOD) for i in range(1, k + 1)]
for i in range(k, 0, -1):
    for j in range(2*i, k + 1, i):
        d[i] -= d[j]
        d[i] %= MOD
print(sum(i * d[i] % MOD for i in range(1, k + 1)) % MOD)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = 10**9 + 7
sg = [0] * (k + 1)
for i in range(k, 0, -1):
    sg[i] += i * pow(k // i, n, p)
    m = 2
    while m*i <= k:
        sg[i] = (sg[i] - sg[m*i]) % p
        m += 1
print(sum(sg) % MOD)
Problem p02730 (python)

Fixed submission:
def is_palindrome(s):
    len_s = len(s)
    ans = True
    for i in range(len_s // 2):
        if s[i] != s[-(i + 1)]:
            ans = False
    return ans

s = input()
len_s = len(s)
ans = True
if is_palindrome(s) == False:
    ans = False
if is_palindrome(s[0:(len_s - 1) // 2]) == False or is_palindrome(s[(len_s + 1) // 2:len_s]) == False:
    ans = False
if ans:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def is_p(s):
    return s == s[::-1]
s = input()
n = len(s)
l, r = (n - 1)//2, l + 1
print('Yes' if is_p(s) and is_p(s[:l]) and is_p(s[r:]) else 'No')
Problem p02756 (python)

Fixed submission:
from collections import deque
s = input()
q = int(input())
ans = deque(s)
rev = 0
for i in range(q):
    qi = input()
    if qi[0] == '1':
        rev += 1
    else:
        if qi[2] == '1' and rev % 2 == 0:
            ans.appendleft(qi[4])
        elif qi[2] == '2' and rev % 2 == 0:
            ans.append(qi[4])
        if qi[2] == '1' and rev % 2 == 1:
            ans.append(qi[4])
        elif qi[2] == '2' and rev % 2 == 1:
            ans.appendleft(qi[4])

parity = rev % 2
if parity:
    ans.reverse()
    for i in ans:
        print(i, end='')
else:
    for i in ans:
        print(i, end='')

Buggy submission (verdict: Runtime Error):
from collections import deque
s = input()
q = int(input())
ans = deque(s)
rev = 0
for i in range(q):
    qi = input()
    if qi[0] == '1':
        rev += 1
    else:
        if qi[2] == '1' and rev % 2 == 0:
            ans.appendleft(qi[4])
        elif qi[2] == '2' and rev % 2 == 0:
            ans.append(qi[4])
        if qi[2] == '1' and rev % 2 == 1:
            ans.append(qi[4])
        elif qi[2] == '2' and rev % 2 == 1:
            ans.appendleft(qi[4])

parity = rev % 2
if parity:
    for i in ans[::-1]:
        print(i, end='')
else:
    for i in ans:
        print(i, end='')
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
number = ['x' for i in range(n)]
flag = True
for i in range(m):
    s, c = map(int, input().split())
    if n != 1 and s == 1 and c ==0:
        flag = False
    if number[s - 1] != 'x' and  number[s - 1] != c:
        flag = False
    number[s - 1] = c

if number[0] == 'x' and 1 < n:
    number[0] = 1
if number[0] == 'x' and 1 == n:
    number[0] = 0
for i in range(1, n):
    if number[i] == 'x':
        number[i] = 0

if flag:
    for i in range(n):
        print(number[i], end='')
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = [-1] * n
exist = True
for i in range(m):
    s, c = map(int, input().split())
    if (n != 1 and (s, c) == (1, 0)) or (ans[s - 1] != -1 and ans[s - 1] != c):
        exist = False
        break
    else:
        ans[s - 1] = c

if exist:
    for i in range(n):
    if n != 1 and i == 0:
        if ans[i] == -1:
            ans[i] = 1
    else:
        if ans[i] == -1:
            ans[i] = 0

    print(*ans, sep='')
else:
    print(-1)
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
expp = [(i + 1) / 2 for i in p]
cumu, cumu_expp = 0, []
for i in expp:
    cumu += i
    cumu_expp.append(cumu)

max_expp = cumu_expp[k - 1]
for i in range(n - k):
    sumpk = cumu_expp[i + k] - cumu_expp[i]
    if max_expp < sumpk:
        max_expp = sumpk
print(max_expp)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
expp = [(i + 1) / 2 for i in p]
cumu, cumu_expp = 0, []
for i in expp:
    cumu += i
    cumu_expp.append(cumu)

max_expp = 0
for i in range(n - k + 1):
    sumpk = cumu_expp[i + k] - cumu_expp[i]
    if max_expp < sumpk:
        max_expp = sumpk
print(max_expp)
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())

submission = []
for i in range(n):
    submission.append([])

for i in range(m):
    pi, si = input().split()
    submission[int(pi) - 1].append(si)
    
n_ac = 0
n_penalty = 0
for i in range(n):
    if "AC" in submission[i]:
        n_ac += 1
        ac_index = submission[i].index('AC')
        n_penalty += ac_index
print(n_ac, n_penalty)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
s = [[] for i in range(n)]
for i in range(m):
    p, S = input().split()
    s[int(p) - 1] += [S]
print(sum('AC' in si for si in s), end=' ')
print(sum(si[:si.index('AC')].count('WA') for si in s))
Problem p02803 (python)

Fixed submission:
from collections import deque
h, w = map(int, input().split())
square = [list(input()) for i in range(h)]
def bfs(si, sj):
    que = deque()
    que.append((si, sj))
    d = [[float('inf')] * w for i in range(h)]
    d[si][sj] = 0
    move = [(-1, 0), (0, 1), (1, 0), (0, -1)]
    while que:
        i, j = que.popleft()
        for mi, mj in move:
            ni, nj = i + mi, j + mj
            if 0 <= ni < h and 0 <= nj < w and square[ni][nj] != '#' and d[ni][nj] == float('inf'):
                que.append((ni, nj))
                d[ni][nj] = d[i][j] + 1
    return d[i][j]

max_num = 0
for i in range(h):
    for j in range(w):
        if square[i][j] == '.':
            max_ij = bfs(i, j)
            max_num = max(max_num, max_ij)
print(max_num)

Buggy submission (verdict: Runtime Error):
from collections import deque
h, w = map(int, input().split())
square = [list(input()) for i in range(h)]
INF = 100
def bfs(si, sj):
    que = deque([(si, sj)])
    d = [[INF] * w for i in range(h)]
    d[si][sj] = 0
    move = [(-1, 0), (0, 1), (1, 0), (0, -1)]
    while que:
        i, j = que.popleft()
        for mi, mj in move:
            ni, nj = i + mi, j + mj
            if 0 <= ni < h and 0 <= nj < w and square[ni][nj] = '.' and d[ni][nj] == INF:
                que.append((ni, nj))
                d[ni][nj] = d[i][j] + 1
    return d[i][j]

max_num = 0
for i in range(h):
    for j in range(w):
        if square[i][j] == '.':
            max_ij = bfs(i, j)
            max_num = max(max_num, max_ij)
print(max_num)
Problem p02971 (python)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = a.copy()
b.sort()
a_max = b[-1]
a_second = b[-2]
for i in range(n):
    if a[i] == a_max:
        print(a_second)
    else:
        print(a_max)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
sa = sorted(a)
am, asl = sa[-1], sa[-2]
print(*[asl if ai == am else am for ai in a], sep='\n')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
sa = a.sort()
am, asl = sa[-1], sa[-2]
for i in range(n):
    print(asl if a[i] == am else am)
Problem p02993 (python)

Fixed submission:
s = input()
flag = 1
n = len(s)
for i in range(1, n):
    if s[i - 1] == s[i]:
        flag = 0
if flag:
    print('Good')
else:
    print('Bad')

Buggy submission (verdict: Runtime Error):
s = input()
flag = 1
for i in range(1, n):
    if s[i - 1] == s[i]:
        flag = 0
if flag:
    print('Yes')
else:
    print('No')
Problem p02994 (python)

Fixed submission:
n, l = map(int, input().split())
taste, taste_abs = [l + i for i in range(n)], [abs(l + i) for i in range(n)]
index = taste_abs.index(min(taste_abs))
taste.pop(index)
print(sum(taste))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
taste_abs = [abs(l + i) for i in range(n)]
index = taste_abs.index(min(taste_abs))
taste.pop(index)
print(sum(taste))
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
d = [0 for i in range(n + 1)]
count = 1
for i in range(1, n + 1):
    d[i] = d[i - 1] + l[i - 1]
    if d[i] <= x:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
d = [0]
i = 0
while d[-1] + l[i] <= x:
    d.append(d[-1] + l[i])
    i += 1
print(len(d))

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
d, i = l[0], 1
count = 1
while d <= x:
    d += l[i]
    count += 1
    i += 1
print(count)
Problem p03030 (python)

Fixed submission:
n = int(input())
review = []
for i in range(n):
    s, p = input().split()
    review.append([s, int(p), i + 1])
rev_sorted1 = sorted(review, key = lambda x: x[1] , reverse = True)
rev_sorted2 = sorted(rev_sorted1, key = lambda x: x[0], reverse = False)
for i in rev_sorted2:
    print(i[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
review = []
for i in range(n):
    s, p = input().split()
    review.append([s, int(p), i + 1])
rev_sorted = sorted(review, key = lambda x: (x[0], x[1]), reverse = (False, True))
for i in rev_sorted:
    print(i[2])
Problem p03062 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
sum_abs, min_abs, cnt_minus = 0, 10**9, 0
for ai in a:
    if ai < 0:
        cnt_minus += 1
    abs_ai = abs(ai)
    sum_abs += abs_ai
    if abs_ai < min_abs:
        min_abs = abs_ai
if cnt_minus % 2 == 0 or 0 in a:
    print(sum_abs)
else:
    print(sum_abs - 2*min_abs)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
sum_abs, min_abs, cnt_minus = 0, 10**9, 0
for ai in a:
    if ai < 0:
        cnt_minus += 1
    abs_ai = abs(ai)
    sum_abs += abs_ai
    if abs_ai < min_abs:
        min_abs = abs_ai
if cnt_minus % 2 == 0 or a in 0:
    print(sum_abs)
else:
    print(sum_abs - 2*min_abs)
Problem p03126 (python)

Fixed submission:
n, m = map(int, input().split())
all = {int(i) for i in range(1, m + 1)}
for _ in range(n):
    k, *i_th = map(int, input().split())
    all &= set(i_th)
print(len(all))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
all = {int(i) for i in range(1, i + 1)}
for _ in range(n):
    k, *i_th = map(int, input().split())
    all &= set(list(i_th))
print(len(all))
Problem p03162 (python)

Fixed submission:
N = int(input())
abc = [[int(j) for j in input().split()] for i in range(N)]
dp = [[0] * 3]
for day in range(N):
    dp += [[max([dp[-1][p] + abc[day][n] for p in range(3) if p != n]) for n in range(3)]]
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
abc = [[int(j) for j in input().split()] for i in range(n)]
dp = [[0] * 3]
for day in range(N):
    dp += [[max([dp[-1][p] + abc[day][n] for p in range(3) if p != n]) for n in range(3)]]
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
abc = [[int(j) for j in input().split()] for i in range(n)]
dp = [[0] * 3]
for day in range(N):
    dp += [[max([dp[-1][p] + abc[day][n] for p in range(3) if p != n]) for n in range(3)]]
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = [int(i) for i in input().split()]
dp = [0]
for i in range(1, n):
    dp += [min([dp[-j] + abs(h[i] - h[i - j]) for j in range(1, min(i, k) + 1)])]
print(dp[-1])
Problem p03262 (python)

Fixed submission:
from fractions import gcd
n, X = map(int, input().split())
x = sorted([int(i) for i in input().split()] + [X])
diff_x = [x[i + 1] - x[i] for i in range(n)]
if len(diff_x) == 1:
    print(diff_x[0])
else:
    d = gcd(diff_x[0], diff_x[1])
    for i in range(2, n):
        d = gcd(d, diff_x[i])
    print(d)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n, X = map(int, input().split())
x = sorted([int(i) for i in input().split()] + [X])
diff_x = [x[i + 1] - x[i] for i in range(n)]
if len(diff_x) == 1:
    print(diff_x[0])
else:
    gcd = gcd(diff_x[0], diff_x[1])
    for i in range(2, n):
        gcd = gcd(gcd, diff_x[i])
    print(gcd)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n, X = map(int, input().split())
x = sorted([int(i) for i in input().split()] + [X])
diff_x = [x[i + 1] - x[i] for i in range(n)]
if len(diff_x) == 1:
    print(diff_x[0])
else:
    gcd = gcd(diff_x[0], diff_x[1])
    for i in range(2, n - 1):
        gcd = gcd(gcd, diff_x[i])
    print(gcd)
Problem p03324 (python)

Fixed submission:
d, n = map(int, input().split())
print([i*100**d for i in range(1, 102) if i != 100][n - 1])

Buggy submission (verdict: Runtime Error):
d, n = map(int, input().split())
print([i*100**d for i in range(1, 101) if i != 100][n - 1])

Buggy submission (verdict: Runtime Error):
d, n = map(int, input().split())
print([i*100**d for i in range(101) if i != 100][n])
Problem p03352 (python)

Fixed submission:
x = int(input())
max_pow = []
for i in range(2, int(x**0.5) + 1):
    j = 2
    while i**j <= x:
        j += 1
    max_pow.append(i**(j - 1))
print(1 if x == 1 else max(max_pow))

Buggy submission (verdict: Runtime Error):
x = int(input())
print(max([i**j for i in range(1, int(x**0.5) + 1) for j in range(2, min(10, x + 1)) if i**j <= x]))
Problem p03387 (python)

Fixed submission:
a, b, c = map(int, input().split())
diff_max = 3*max(a, b, c) - sum([a, b, c])
if diff_max % 2:
    print((diff_max + 3) // 2)
else:
    print(diff_max // 2)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
diff_max = 3*max(a, b, c) - sum(a, b, c)
if diff_max % 2:
    print((diff_max + 3) // 2)
else:
    print(diff_max // 2)
Problem p03401 (python)

Fixed submission:
n = int(input())
a = [0] + [int(i) for i in input().split()] + [0]
d1a = [abs(a[i + 1] - a[i]) for i in range(n + 1)]
d2a = [abs(a[i + 1] - a[i - 1]) for i in range(1, n + 1)]
sum_a = sum(d1a)
for i in range(1, n + 1):
    print(sum_a + d2a[i - 1] - (d1a[i - 1] + d1a[i]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [0] + [int(i) for i in input().split()] + [0]
d1a = [abs(a[i + 1] - a[i]) for i in range(n + 1)]
d2a = [abs(a[i + 1] - a[i - 1]) for i in range(1, n + 1)]
sum_a = sum(a)
for i in range(1, n + 1):
    print(sum_a + d2a[i] - (d1a[i - 1] + d1a[i]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [0] + [int(i) for i in input().split()] + [0]
d1a = [abs(a[i + 1] - a[i]) for i in range(n + 1)]
d2a = [abs(a[i + 1] - a[i - 1]) for i in range(1, n + 1)]
sum_a = sum(a)
for i in range(1, n + 1):
    print(sum(a) + d2a[i] - (d1a[i - 1] + d1a[i]))
Problem p03415 (python)

Fixed submission:
c = [input() for i in range(3)]
for i in range(3):
    print(c[i][i], end='', sep='')

Buggy submission (verdict: Runtime Error):
c = [input() for i in range(3)]
print(c[i][i] for i in range(3), sep='')
Problem p03436 (python)

Fixed submission:
from collections import deque
h, w = map(int, input().split())
cnt_b = 0
s = []
for i in range(h):
    si = input()
    cnt_b += si.count('#')
    s.append(si)

def bfs(i0, j0):
    INF = 1000
    search = deque([(i0, j0)])
    d = [[INF] * w for i in range(h)]
    d[i0][j0] = 1
    while search:
        i, j = search.popleft()
        if (i, j) == (h - 1, w - 1):
            break
        for di, dj in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            ni, nj = i + di, j + dj
            if 0 <= ni < h and 0 <= nj < w and s[ni][nj] == '.' and d[ni][nj] == INF:
                search.append((ni, nj))
                d[ni][nj] = d[i][j] + 1
    return d[i][j] if d[h - 1][w - 1] != INF else 0 
solvable = bfs(0, 0)
print(h*w - cnt_b - solvable if solvable else -1)

Buggy submission (verdict: Runtime Error):
from collections import deque
h, w = map(int, input().split())
cnt_b = 0
s = []
for i in range(h):
    si = input()
    cnt_b += si.count('#')
    s.append(si)

def bfs(i0, j0):
    INF = 1000
    search = deque([(i0, j0)])
    d = [[INF] * w for i in range(h)]
    d[i0][j0] = 1
    while search:
        i, j = search.popleft()
        if (i, j) == (h - 1, w - 1):
            break
        for di, dj in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            ni, nj = i + di, j + dj
            if 0 <= ni < h and 0 <= nj < w and s[ni][nj] == '.' and d[ni][nj] == INF:
                search.append((ni, nj))
                d[ni][nj] = d[i][j] + 1
    return d[i][j] if d[i][j] != INF else 0 
solvable = bds(0, 0)
print(h*w - cnt_b - solvable if solvable else -1)

Buggy submission (verdict: Runtime Error):
from collections import deque
h, w = map(int, input().split())
cnt_b = 0
s = []
for i in range(h):
    si = input()
    cnt_b += si.count('#')
    s.append(si)

def bfs(i0, j0):
    INF = 1000
    search = deque([(i0, j0)])
    d = [[INF] * w for i in range(h)]
    d[i0][j0] = 1
    while search:
        i, j = search.popleft()
        if (i, j) == (h - 1, w - 1):
        for di, dj in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            ni, nj = i + di, j + dj
            if 0 <= ni < h and 0 <= nj < w and s[ni][nj] == '.' and d[ni][nj] == INF:
                search.append((ni, nj))
                d[ni][nj] = d[i][j] + 1
    return d[i][j]
print(h*w - cnt_b - bfs(0, 0))
Problem p03456 (python)

Fixed submission:
a, b = input().split()
is_square = False
for i in range(1, 317):
  if i**2 == int(a + b):
    is_square = True
    break
print('Yes' if is_square else 'No')

Buggy submission (verdict: Runtime Error):
a, b = input().split()
is_square = False
for i in range(1, 101):
  if i**2 == int(a * b):
    is_square = True
    break
print('Yes' if is_square else 'No')
Problem p03470 (python)

Fixed submission:
n = int(input())
set_d = set()
for i in range(n):
  d = int(input())
  set_d.add(d)
print(len(set_d))

Buggy submission (verdict: Runtime Error):
n = int(input())
set_d = set()
for i in range(n):
  d = int(input())
  set_d |= d
print(len(set_d))
Problem p03474 (python)

Fixed submission:
a, b = map(int, input().split())
s = input()
try:
  ac, bc = int(s[:a]), int(s[a + 1:])
  flag = True
except ValueError:
  flag = False
print('Yes' if flag and s[a] == '-' else 'No')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
s = input()
try:
  ac, bc = int(s[:a]), int(s[a + 1:])
  flag = True
except ValueError:
  flag = False
print('Yes' if flag else 'No')
Problem p03478 (python)

Fixed submission:
n, a, b = map(int, input().split())
s = 0
for i in range(1, n + 1):
  t = sum([int(j) for j in str(i)])
  if a <= t <= b:
    s += i
print(s)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
s = 0
for i in range(1, n + 1):
  t = sum(list(str(i)))
  if a <= sum(list(str(i))) <= b:
    s += t
print(s)
Problem p03543 (python)

Fixed submission:
n = input()
print('Yes' if len(set(n[:3])) == 1 or len(set(n[1:4])) == 1 else 'No')

Buggy submission (verdict: Runtime Error):
n = input()
print('Yes' if len(set(list(n[:3]))) == 1 or len(set(list(n[1:4]))) == 1 'No')

Buggy submission (verdict: Runtime Error):
n = input()
print('Yes' if len(set(n[:3])) == 1 or len(set(n[1:4])) == 1 'No')
Problem p03635 (python)

Fixed submission:
n, m = map(int, input().split())
print((n - 1) * (m - 1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
print((n - 1) * (m - 1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
print((n - 1) * (m - 1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
print((n - 1) * (m - 1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
print((n - 1) * (m - 1))

Buggy submission (verdict: Runtime Error):
n, ma = map(int, input())
print((n - 1) * (m - 1))
Problem p03351 (python)

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

x = abs(a - b)
y = abs(b - c)
z = abs(a - c)

if x <= d and y <= d:
    print("Yes")
elif z <= d:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

x = abs(a - b)
y = abs(b - c)
z = abs(a - c)

if x <= d and y <= d:
    print("Yes")
elif x > d and z <= d:
    print("Yes")
else:
    print("No")
Problem p03455 (python)

Fixed submission:
# 正の整数aとb
a, b = map(int, input().split())
# aとbの積が偶数か奇数か判別する

# 積が奇数なら'Odd'、偶数なら'Even'と出力する
if int(a * b / 2) < int(a * b / 2 + 0.5):
    print('Odd')
else:
    print('Even')

Buggy submission (verdict: Runtime Error):
# 正の整数aとb

# aとbの積が偶数か奇数か判別する
a = int( input() )
b = int( input() )

# 積が奇数なら'Odd'、偶数なら'Even'と出力する
if int(a * b / 2) == int(a * b / 2 + 0.5):
    print('even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
# 正の整数aとb

# aとbの積が偶数か奇数か判別する
a = int( input() )
b = int( input() )

# 積が奇数なら'Odd'、偶数なら'Even'と出力する
if int(a * b / 2) == int(a * b / 2 - 0.5):
    print('Odd')
else:
    print('even')
Problem p04029 (python)

Fixed submission:
N = int( input() )

candy = int( N * ( N + 1 ) / 2 )

print(candy)

Buggy submission (verdict: Runtime Error):
candy = N * N /2 + N /2

print(candy)

Buggy submission (verdict: Runtime Error):
c = N * (N + 1 )/2

print(c)

Buggy submission (verdict: Runtime Error):
candy = N * (N + 1 )/2

print(candy)