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

Fixed submission:
n,a,b=map(int,input().split())
s=list(map(int,input().split()))
t=0

for i in range(n-1):
	t+=min(b,a*(s[i+1]-s[i]))

print(t)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
s=list(map(int,input().split())
t=0
for i in range(n-1):
	t+=min(b,a*(s[i+1]-s[i]))

print(t)
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split())
if x<a:
    print('0')
else:
    print('10')

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

if x<a:
  print('10')
else:
  print('0')

Buggy submission (verdict: Runtime Error):
X, A = int(input()).split()

if X > A:
  print 0
elif !(X<A):
  print 10
Problem p03061 (python)

Fixed submission:
from fractions import gcd

N = int(input())
A = [int(x) for x in input().split()]

L = [0] * (N + 1)
R = [0] * (N + 1)
for i in range(N):
    L[i + 1] = gcd(L[i], A[i])
for i in range(N - 1, 0, -1):
    R[i] = gcd(R[i + 1], A[i])

ans = 0
for i in range(N):
    ans = max(ans, gcd(L[i], R[i + 1]))
print(ans)

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

N = int(input())
A = [int(x) for x in input().split()]

memo = set()


def __gcd(a, b):
    if (a, b) in memo:
        return memo[a, b]
    else:
        if a < b:
            a, b = b, a
        memo.add((a, b))
        return gcd(a, b)


def _gcd(*A):
    return reduce(__gcd, A)


ans = 0
for i in range(N):
    B = A[:i] + A[i + 1:]
    x = _gcd(*B)
    ans = max(ans, x)
print(ans)
Problem p03128 (python)

Fixed submission:
N, M = map(int, input().split())
A = [int(x) for x in input().split()]

f = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
A = sorted(A, reverse=True)

dp = [float('-inf')] * (N + 1)
dp[0] = 0
for i in range(N + 1):
    for a in A:
        if i - f[a] >= 0:
            dp[i] = max(dp[i], dp[i - f[a]] + 1)

ans = ''
num, digit = N, dp[N]
while num > 0:
    for a in A:
        i = num - f[a]
        if i >= 0 and dp[i] == digit - 1:
            ans += str(a)
            num -= f[a]
            digit -= 1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(x) for x in input().split()]

f = {
    1: 2,
    2: 5,
    3: 5,
    4: 4,
    5: 5,
    6: 6,
    7: 3,
    8: 7,
    9: 6
}
A = sorted(A, reverse=True)

dp = [float('-inf')] * (N + 1)
dp[0] = 0
for i in range(N + 1):
    for a in A:
        if i - f[a] >= 0:
            dp[i] = max(dp[i], dp[i - f[a]] + 1)

ans = ''
num, digit = N, dp[N]
while num > 0:
    for a in A:
        if dp[num - f[a]] == digit - 1:
            ans += str(a)
            num -= f[a]
            digit -= 1
            break
print(ans)
Problem p03148 (python)

Fixed submission:
import sys
from collections import defaultdict
from itertools import accumulate

input = sys.stdin.readline

N, K = map(int, input().split())
sushi = defaultdict(list)
for i in range(N):
    t, d = map(int, input().split())
    sushi[t].append(d)

X, Y = [], []
for v in sushi.values():
    v = sorted(v, reverse=True)
    X.append(v[0])
    if len(v) > 1:
        Y += v[1:]
X = sorted(X, reverse=True)
Y = sorted(Y, reverse=True)

X = [0] + [x for x in accumulate(X)]
Y = [0] + [x for x in accumulate(Y)]

ans = 0
for i in range(1, min(len(X), K + 1)):
    j = K - i
    if j < len(Y):
        ans = max(ans, X[i] + Y[j] + i * i)
print(ans)

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

input = sys.stdin.readline

N, K = map(int, input().split())
sushi = defaultdict(list)
for i in range(N):
    t, d = map(int, input().split())
    sushi[t].append(d)

X, Y = [], []
for v in sushi.values():
    v = sorted(v, reverse=True)
    X.append(v[0])
    if len(v) > 1:
        Y += v[1:]
X = sorted(X, reverse=True)

X = [0] + [x for x in accumulate(X)]
Y = [0] + [x for x in accumulate(Y)]

ans = 0
for i in range(1, K + 1):
    j = K - i
    if j < len(Y):
        ans = max(ans, X[i] + Y[j] + i * i)
print(ans)
Problem p03330 (python)

Fixed submission:
from itertools import permutations

N, C = map(int, input().split())
D = [[int(x) for x in input().split()] for _ in range(C)]
c = [[int(x) for x in input().split()] for _ in range(N)]

n_color = [[0 for _ in range(C)] for _ in range(3)]
for i in range(N):
    for j in range(N):
        X = c[i][j] - 1
        n_color[(i + j + 2) % 3][X] += 1

ans = float('inf')
for paint in permutations(range(C), 3):
    cost = 0
    for ij3 in range(3):
        Y = paint[ij3]
        for X in range(C):
            cost += D[X][Y] * n_color[ij3][X]
    ans = min(ans, cost)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import permutations

N, C = map(int, input().split())
D = [[int(x) for x in input().split()] for _ in range(C)]
c = [[int(x) for x in input().split()] for _ in range(N)]

n_color = [[0 for _ in range(3)] for _ in range(C)]
for i in range(N):
    for j in range(N):
        X = c[i][j] - 1
        n_color[(i + j + 2) % 3][X] += 1

ans = float('inf')
for paint in permutations(range(C), 3):
    cost = 0
    for ij3 in range(3):
        Y = paint[ij3]
        for X in range(C):
            cost += D[X][Y] * n_color[ij3][X]
    ans = min(ans, cost)
print(ans)
Problem p03380 (python)

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

a_i = max(a)
a_j = 0
min_d = float('inf')
for a_k in a:
    if a_k == a_i:
        continue
    d = abs(a_i / 2 - a_k)
    if d < min_d:
        min_d = d
        a_j = a_k
print(a_i, a_j)

Buggy submission (verdict: Runtime Error):
import itertools
from scipy.special import comb

n = int(input())
a = list(map(int, input().split()))

ans = [0, 0]
max_comb = 0
combs = {}
for a_i, a_j in itertools.combinations(a, 2):
    if a_j > a_i:
        tmp = a_j
        a_j = a_i
        a_i = tmp

    if (a_i, a_i - a_j) in combs:
        continue

    c = comb(a_i, a_j, exact=True)
    combs[(a_i, a_j)] = c
    # print(a_i, a_j, c)
    if c > max_comb:
        max_comb = c
        ans[0], ans[1] = a_i, a_j

print(ans[0], ans[1])

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
a = list(map(int, input().split()))

ans = [0, 0]
max_comb = 0
for a_i, a_j in itertools.combinations(a, 2):
    if a_j > a_i:
        tmp = a_j
        a_j = a_i
        a_i = tmp

    comb = len(list(itertools.combinations(range(a_i), a_j)))
    if comb > max_comb:
        max_comb = comb
        ans[0], ans[1] = a_i, a_j

print(ans[0], ans[1])
Problem p03386 (python)

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

for i in range(a, min(a + k, b - k + 1)):
    print(i)
for i in range(max(a, b - k + 1), b + 1):
    print(i)

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

z = list(range(a, b + 1))
ans = sorted(list(set(z[:k]) | set(z[-k:])))
for x in ans:
    print(x)

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

z = list(range(a, b + 1))
ans = sorted(list(set(z[:k]) | set(z[-k:])))
print(ans)
Problem p03450 (python)

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


class WeightedUnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.diff_weight = [0 for i in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            root = self.find(self.par[x])
            self.diff_weight[x] += self.diff_weight[self.par[x]]
            self.par[x] = root
            return root

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

    def union(self, x, y, w):
        w += self.weight(x)
        w -= self.weight(y)
        x = self.find(x)
        y = self.find(y)
        if x != y:
            self.par[y] = x
            self.diff_weight[y] = w

    def weight(self, x):
        self.find(x)
        return self.diff_weight[x]

    def diff(self, x, y):
        return self.weight(y) - self.weight(x)


uf = WeightedUnionFind(N)
ans = 'Yes'
for _ in range(M):
    L, R, D = map(int, input().split())
    L -= 1
    R -= 1
    if uf.is_same(L, R):
        if uf.diff(L, R) != D:
            ans = 'No'
            break
    else:
        uf.union(L, R, D)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

N, M = map(int, input().split())
L, R, D = [None] * M, [None] * M, [None] * M
for i in range(M):
    L[i], R[i], D[i] = map(int, input().split())

x = {}
if M > 0:
    x[L[0]] = 0
ans = 'Yes'
for l, r, d in zip(L, R, D):
    if l in x and r in x:
        if x[r] - x[l] != d:
            ans = 'No'
            break
    elif l in x:
        x[r] = x[l] + d
    elif r in x:
        x[l] = x[r] - d
    else:
        raise Exception
print(ans, x)
Problem p03547 (python)

Fixed submission:
X, Y = input().split()

if X < Y:
    print('<')
elif X > Y:
    print('>')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
N, Z, W = map(int, input().split())
A = [int(x) for x in input().split()]

memo = [[None for _ in range(2)] for _ in range(2010)]


def f(i, p, x, y):
    """
    i番目にx, yが手持ちのとき、プレイヤーpが引いたときのスコア
    """
    if i == N:
        return abs(x - y)
    if memo[i][p]:
        return memo[i][p]

    if p == 0:
        score = float('-inf')
        for j in range(i, N):
            score = max(score, f(j + 1, 1, A[j], y))
    else:
        score = float('inf')
        for j in range(i, N):
            score = min(score, f(j + 1, 0, x, A[j]))

    memo[i][p] = score
    return score


print(f(0, 0, Z, W))
Problem p03550 (python)

Fixed submission:
N, Z, W = map(int, input().split())
A = [int(x) for x in input().split()]

if N == 1:
    print(abs(A[0] - W))
else:
    print(max(abs(A[N - 2] - A[N - 1]), abs(A[N - 1] - W)))

Buggy submission (verdict: Runtime Error):
N, Z, W = map(int, input().split())
A = [int(x) for x in input().split()]

memo = [[None for _ in range(2)] for _ in range(2010)]


def f(i, p, x, y):
    """
    i番目にx, yが手持ちのとき、プレイヤーpが引いたときのスコア
    """
    if i == N:
        return abs(x - y)
    if memo[i][p]:
        return memo[i][p]

    if p == 0:
        score = float('-inf')
        for j in range(i, N):
            score = max(score, f(j + 1, 1, A[j], y))
    else:
        score = float('inf')
        for j in range(i, N):
            score = min(score, f(j + 1, 0, x, A[j]))

    memo[i][p] = score
    return score


print(f(0, 0, Z, W))

Buggy submission (verdict: Runtime Error):
N, Z, W = map(int, input().split())
A = [int(x) for x in input().split()]

memo = [[None for _ in range(2)] for _ in range(N + 1)]


def f(i, p, x, y):
    """
    i番目にx, yが手持ちのとき、プレイヤーpが引いたときのスコア
    """
    if i == N:
        return abs(x - y)
    if memo[i][p]:
        return memo[i][p]

    if p == 0:
        score = float('-inf')
        for j in range(i, N):
            score = max(score, f(j + 1, 1, A[j], y))
    else:
        score = float('inf')
        for j in range(i, N):
            score = min(score, f(j + 1, 0, x, A[j]))

    memo[i][p] = score
    return score


print(f(0, 0, Z, W))
Problem p03565 (python)

Fixed submission:
S2 = input()
T = input()

N = len(S2)


def check(S, T):
    for i in range(len(S)):
        if S[i] == '?' or S[i] == T[i]:
            continue
        else:
            return False
    return True


S = 'UNRESTORABLE'
if len(T) <= N:
    C = []
    for i in range(N - len(T) + 1):
        j = i + len(T)
        if (S2[i] == T[0] or S2[i] == '?') and check(S2[i:j], T):
            S = list(S2)
            S[i:j] = list(T)
            S = ''.join(S).replace('?', 'a')
            C.append(S)
    if len(C) > 0:
        S = sorted(C)[0]
print(S)

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

N = len(S2)

index = -1
q_num = 0
q_index = -1
tmp = 0
for i in range(N):
    if S2[i] == '?':
        tmp += 1
        q_num = max(q_num, tmp)
        if len(T) <= q_num:
            q_index = i - q_num + 1
    else:
        tmp = 0
    if S2[i] == T[0] and i + len(T) <= N:
        index = i

if len(T) > N:
    S = list('UNRESTORABLE')
elif len(T) <= q_num:
    S = list(S2)
    S[q_index:q_index + len(T)] = list(T)
    for i in range(N):
        if S[i] == '?':
            S[i] = 'a'
elif index == -1:
    S = list('UNRESTORABLE')
else:
    S = [None] * N
    for i in range(len(S)):
        if i > index:
            if S2[i] == T[i - index]:
                S[i] = S2[i]
            elif S2[i] == '?':
                S[i] = T[i - index]
            else:
                S = list('UNRESTORABLE')
        else:
            if S2[i] == '?':
                S[i] = 'a'
            else:
                S[i] = S2[i]
print(''.join(S))

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

index = S2.find(T[0])
if index == -1:
    S = list('UNRESTORABLE')
elif len(S2) - index < len(T):
    S = list('UNRESTORABLE')
else:
    S = [None] * len(S2)
    for i in range(len(S)):
        if i > index:
            if S2[i] == T[i - index]:
                S[i] = S2[i]
            elif S2[i] == '?':
                S[i] = T[i - index]
            else:
                S = list('UNRESTORABLE')
        else:
            if S2[i] == '?':
                S[i] = 'a'
            else:
                S[i] = S2[i]
print(''.join(S))
Problem p03599 (python)

Fixed submission:
from operator import itemgetter

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


def f(x, y):
    max_i = F // x
    max_j = F // y
    arr = []
    for i in range(max_i + 1):
        for j in range(max_j + 1):
            a = x * i + y * j
            if a <= F:
                arr.append(a)
    return list(set(arr))


water = f(100 * A, 100 * B)
sugar = f(C, D)

ans = []
for w in water:
    if w == 0:
        continue
    for s in sugar:
        if w + s <= F and s / w <= E / 100:
            ans.append((w + s, s, s / (w + s)))
ans = sorted(ans, key=itemgetter(2), reverse=True)
print(ans[0][0], ans[0][1])

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


def f(x, y):
    max_i = F // x
    max_j = F // y
    arr = []
    for i in range(max_i + 1):
        for j in range(max_j + 1):
            a = x * i + y * j
            if 0 < a < F:
                arr.append(a)
    return sorted(list(set(arr)))


water = f(100 * A, 100 * B)
sugar = f(C, D)

ans = []
for w in water:
    for s in sugar:
        if w + s <= F and s / w * 100 <= E:
            ans.append((w + s, s))
ans = sorted(ans, key=lambda x: x[1] / x[0], reverse=True)
print(ans[0][0], ans[0][1])
Problem p04013 (python)

Fixed submission:
from itertools import product

N, A = map(int, input().split())
x = [int(x) for x in input().split()]

X = max(max(x), A)
dp = [[0 for _ in range(2 * N * X + 1)] for _ in range(N + 1)]
dp[0][N * X] = 1

for j, t in product(range(1, N + 1), range(2 * N * X + 1)):
    y = x[j - 1] - A
    if t - y < 0 or t - y > 2 * N * X:
        dp[j][t] = dp[j - 1][t]
    elif 0 <= t - y <= 2 * N * X:
        dp[j][t] = dp[j - 1][t] + dp[j - 1][t - y]
print(dp[N][N * X] - 1)

Buggy submission (verdict: Runtime Error):
from itertools import product

N, A = map(int, input().split())
x = [int(x) for x in input().split()]

max_x = max(max(x), A)
dp = [[[0 for _ in range(N * max_x)] for _ in range(N + 1)] for _ in range(N + 1)]
dp[0][0][0] = 1

for j, k, s in product(range(1, N + 1), range(N + 1), range(N * max_x)):
    if s < x[j - 1]:
        dp[j][k][s] = dp[j - 1][k][s]
    elif k >= 1 and s >= x[j - 1]:
        dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]]

ans = 0
for k in range(1, N + 1):
    ans += dp[N][k][k * A]
print(ans)

Buggy submission (verdict: Runtime Error):
N, A = map(int, input().split())
x = [int(x) for x in input().split()]

max_x = max(x)
dp = [[[0 for _ in range((N + 1) * max_x)] for _ in range(N + 1)] for _ in range(N + 1)]
dp[0][0][0] = 1

for j in range(1, N + 1):
    for k in range(N + 1):
        for s in range((N + 1) * max_x):
            if s < x[j - 1]:
                dp[j][k][s] = dp[j - 1][k][s]
            elif k >= 1 and s >= x[j - 1]:
                dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]]

ans = 0
for k in range(1, N + 1):
    ans += dp[N][k][k * A]
print(ans)
Problem p02999 (python)

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

if x >= a:
  print(10)
elif x < a:
  print(0)
else:
  pass

Buggy submission (verdict: Runtime Error):
x, a = int(input())
 
if x >= a:
  print(10)
elif x < a:
  print(0)
else:
  pass

Buggy submission (verdict: Runtime Error):
x, a = input()

if x >= a:
  print(10)
elif x < a:
  print(0)
else:
  pass
Problem p03000 (python)

Fixed submission:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
count = 1
for i in range(N):
    D += L[i]
    if D > X:
        print(count)
        exit()
    else:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python3
# -*- coding: utf-8 -*-

N, X = map(int, input().split())
L = list(map(int, input().split()))

D = 0
count = 1
for i in range(N+1):
    D += L[i]
    if D > X:
        print(count)
        exit()
    else:
        count += 1
Problem p03071 (python)

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

a, b =  map(int, input().split())
#print("{} {}".format(a, b))
point = 0
for i in range(2):
    if a >= b:
        point += a
        a -= 1
    else:
        point += b
        b -= 1
print(point)

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

n = int(input())
h = input().split()
count = 0
flag = 0

for i in range(n):
    #print(i)
    for j in range(i):
        if h[i] < h[i-1-j]:
            #print("{} {}".format(h[i-j], h[i]))
            flag = 1
            break
    if flag == 0:
        count += 1
    else:
        flag = 0

print(count)
Problem p02999 (python)

Fixed submission:
x,a=map(int,input().split())
print(0 if x<a else 10)

Buggy submission (verdict: Runtime Error):
x,a=map(int,input().split())
if x>a
 print("0")
else x<=a
 print("10")
Problem p03000 (python)

Fixed submission:
X,A = map(int,input().split())
L = list(map(int,input().split()))
 
d = 0
count = 1
for l in L:
    d = d + l
    if A>= d:
        count += 1
        
    
print(count)

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

d=0
count=1
for l in L
    d=d+1
    if X>=d:
      count +=1
      
print(count)

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

d=0
count=1
for l in L
 d=d+1
  if X>=d:
  count +=1
print(count)

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

d=0
count=1
for l in L
 d=d+1
 if X>=d:
  count +=1
print(count)
Problem p03037 (python)

Fixed submission:
n,m = [int(i) for i in input().split()]
rang = []
lmax = 0
rmin = 10**10
for i in range(m):
    l,r = [int(i) for i in input().split()]
    lmax = max(l,lmax)
    rmin = min(r,rmin)

print(max(rmin - lmax + 1,0))

Buggy submission (verdict: Runtime Error):
a, b= map(int, input().split())
A=[]
A = [list(input().split())   for i in range(a)]
B=[]
for i in A:
  s=int(i[0])
  v=int(i[1])+1
  for j in range(s,v):
    B.append(j)
C = [x for x in set(B) if B.count(x) > 1]
print(len(C))
Problem p03067 (python)

Fixed submission:
a, b, c = map(int,input().split())
if a > c > b or b > c > a :
  print('Yes')
else :
  print('No')

Buggy submission (verdict: Runtime Error):
a,b.c = map(int,input().split())
if a < c < b or a > c > b:
    print("OK")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b.c = map(int,input().split())
if a < b:
  if c < b:
    print("OK")
  else:
    print("NO")
else:
  if c < a:
    print("OK")
  else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b.c =map(int,input().split())
if a<b:
  if c<b:
    print("OK")
  else:
    print("NO")
else:
  if c<a:
    print("OK")
  else:
    print("NO")
Problem p03068 (python)

Fixed submission:
n=int(input())
s=input()
k=int(input())
num = 0
for i in s:
  if i == s[k-1]:
    num +=1
  else:
    s = s.replace(s[num],'*')
    num +=1
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
for i in s:
  if i == s[k]:
  else:
    s = s.replace(i,'*')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
num = 0
for i in s:
  if i == s[k]:
    num +=1
  else:
    s = s.replace(i,'*')
    num +=1

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
num = 0
for i in s:
  print(i)
  if i == s[k]:
    num +=1
  else:
    s = s.replace(i,'*')
    num +=1

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
num = 0
for i in s:
  print(i)
  if i == s[k]:
    num +=1
  else:
    s = s.replace(s[num],'*')
    num +=1
Problem p03071 (python)

Fixed submission:
a, b = map(int, input().split())
sum=0
if a >= b:
    sum += a
    a -= 1
    if a >= b:
        sum += a
    else:
        sum += b
else:
    sum += b
    b -=1
    if a < b:
        sum += b
    else:
        sum +=a
print(sum)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
sum=0
if a >= b:
    sum += a
    a -= 1
    if a >= b:
        sum += a
    else:
        sum += b
else:
    sum += b
	b -=1
    if a < b:
        sum += b
    else:
        sum +=a
print(sum)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
sum=0
if a >= b:
    sum += a
    a -= 1
    if a >= b:
        sum += a
    else:
        sum += b
else:
    sum += b
    if a < b:
        sum += b
    else:
        sum +=a
print(sum)
Problem p03085 (python)

Fixed submission:
a = input()

if a == 'A' or a =='T':
  if a == 'A':
    print('T')
  else:
    print('A')
else:
  if a == 'G':
    print('C')
  else:
    print('G')

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

if a == 'A' or a =='T':
  if a == 'A':
    print('T')
  else:
    print('A')
else:
  if a == 'G':
    print('C')
  else:
    print('G')
Problem p03109 (python)

Fixed submission:
S = input().split("/")
if int(S[1]) < 5:
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
a = int(input().split("/"))
if a[1] <= 4:
    print('Heisei')
else:
    print('TBD')

Buggy submission (verdict: Runtime Error):
a = input().split("/")
if a[1] <= 4:
    print('Heisei')
else:
    print('TBD')

Buggy submission (verdict: Runtime Error):
a = input().split("/")
print(a)
if a[1] <= 4:
    print('Heisei')
else:
    print('TBD')
Problem p03110 (python)

Fixed submission:
a = int(input())
A=[]
for i in range(a):
  array = input().split(' ')
  A.append(array)

sum=0
for j in A:
  if j[1]=='JPY':
    sum += int(j[0])
  else:
    sum += float(j[0])*380000
print(sum)

Buggy submission (verdict: Runtime Error):
a = int(input())
A=[]
for i in range(a):
  array = input().split(' ')
  A.append(array)

sum=0
for j in A:
  if j[1]=='JPY':
    sum += int(j[0])
  else:
    sum += int(j[0])*380000
print(sum)
Problem p03125 (python)

Fixed submission:
a, b = map(int, input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)

Buggy submission (verdict: Runtime Error):
a, b = map(int(input().split()))
if b % a == 0:
    print(a+b)
else:
    print(b-a)
Problem p03146 (python)

Fixed submission:
s = int(input())
A = []

A.append(s)
a = s
for i in range(10000):
    if a % 2 == 0:
        a = int(a/2)
        A.append(a)
    else:
        a = 3*a+1
        A.append(a)
    if A.count(a) == 2:
        print(len(A))
        break

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

A = []

A.append(s)
a = s
for i in range(10000):
    if a % 2 == 0:
        a = int(a/2)
        A.append(a)
    else:
        a = 3*a+1
        A.append(a)
    if A.count(a) == 2:
        print(len(A))
        break

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

A = []

A.append(s)
a = s
for i in range(10000):
    if a % 2 == 0:
        a = int(a/2)
        A.append(a)
    else:
        a = 3*a+1
        A.append(a)
    if A.count(a) == 2:
        print(a)
        break