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

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [0 for _ in range(n + 1)]
INF = 10 ** 9
for i in range(1, n + 1):
    c = [dp[i - b[aj]] for aj in a if i >= b[aj]]
    if len(c) > 0:
        dp[i] = max(c) + 1
    else:
        dp[i] = -INF

x = n
i = 0
ans = ''
while(True):
    for aj in a:
        if x - b[aj] >= 0 and dp[x - b[aj]] == dp[n] - i - 1:
            i += 1
            x -= b[aj]
            ans += str(aj)
            break
    if i == dp[n]:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [0 for _ in range(n + 1)]
INF = 10 ** 9
for i in range(1, n + 1):
    c = [dp[i - b[aj]] for aj in a if i >= b[aj]]
    if len(c) > 0:
        dp[i] = max(c) + 1
    else:
        dp[i] = -INF

x = n
i = 0
ans = ''
while(True):
    for aj in a:
        if dp[x - b[aj]] == dp[n] - i - 1:
            i += 1
            x -= b[aj]
            ans += str(aj)
            break
    if i == dp[n]:
        break
print(ans)
Problem p03166 (python)

Fixed submission:
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 5 + 100)

def rec(v, dp, E):
    if dp[v] != -1:
        return dp[v]
    x = 0
    for w in E[v]:
        x = max(x, rec(w, dp, E) + 1)
    dp[v] = x
    return x

n, m = map(int, input().split())
E = defaultdict(list)
for i in range(m):
    x, y = map(int, input().split())
    E[x - 1].append(y - 1)

dp = [-1 for _ in range(n)]
ans = 0
for i in range(n):
    ans = max(ans, rec(i, dp, E))
print(ans)

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

def rec(v, dp, E):
    if dp[v] != -1:
        return dp[v]
    x = 0
    for w in E[v]:
        x = max(x, rec(w, dp, E) + 1)
    dp[v] = x
    return x

n, m = map(int, input().split())
E = defaultdict(list)
for i in range(m):
    x, y = map(int, input().split())
    E[x - 1].append(y - 1)

dp = [-1 for _ in range(n)]
ans = 0
for i in range(n):
    ans = max(ans, rec(i, dp, E))
print(ans)
Problem p03240 (python)

Fixed submission:
N = int(input())
x = [None for _ in range(N)]
y = [None for _ in range(N)]
h = [None for _ in range(N)]
for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())
    if h[i] > 0:
        a = [x[i], y[i], h[i]]
for cx in range(0, 101):
    for cy in range(0, 101):
        hh = a[2] + abs(a[0] - cx) + abs(a[1] - cy)
        flag = True
        for i in range(N):
            h_i = max(hh - abs(x[i] - cx) - abs(y[i] - cy), 0)
            if h_i != h[i]:
                flag = False
        if flag:
            print(cx, cy, hh)
            exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
x = [None for _ in range(N)]
y = [None for _ in range(N)]
h = [None for _ in range(N)]
hh = [0 for _ in range(N)]
flag = False
for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())
for cx in range(0, 101):
    for cy in range(0, 101):
        for i in range(N):
            hh[i] = h[i] + abs(x[i] - cx) + abs(y[i] - cy)
            if hh[i] < 1:
                hh[i] = None
        if (min(hh) == max(hh)) and (min(hh) >= 1):
            print(cx, cy, hh[0])
            exit()
Problem p03244 (python)

Fixed submission:
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
a = Counter(v[::2]).most_common()
b = Counter(v[1::2]).most_common()
if len(a) == 1:
    a.append([0, 0])
if len(b) == 1:
    b.append([0, 0])
if a[0][0] == b[0][0]:
    if a[1][1] > b[1][1]:
        print(n - a[1][1] - b[0][1])
    else:
        print(n - a[0][1] - b[1][1])
else:
    print(n- a[0][1] - b[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
a = Counter(v[::2]).most_common(2)
b = Counter(v[1::2]).most_common(2)
if a[0][0] == b[0][0]:
    if a[1][1] > b[1][1]:
        print(n - a[1][1] - b[0][1])
    else:
        print(n - a[0][1] - b[1][1])
else:
    print(n- a[0][1] - b[0][1])
Problem p03262 (python)

Fixed submission:
from fractions import gcd
import numpy as np
n, x0 = map(int, input().split())
x = np.abs(np.array(list(map(int, input().split()))) - x0)
xx = x[0]
for i in range(1, n):
    xx = gcd(xx, x[i])
print(xx)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
n, x0 = map(int, input().split())
x = np.abs(np.array(list(map(int, input().split()))) - x0)
xx = x[0]
for i in range(1, n):
    xx = math.gcd(xx, x[i])
print(xx)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
n, x0 = map(int, input().split())
x = np.array(list(map(int, input().split()))) - x0
xx = x[0]
for i in range(1, n):
    xx = math.gcd(xx, x[i])
print(xx)
Problem p03289 (python)

Fixed submission:
S = input()
k = 0
if S[0] == 'A' and S[2:-1].count('C') == 1:
    for i in range(len(S)):
        if S[i].isupper():
            if k == 2:
                print('WA')
                exit()
            k += 1
    print('AC')
else:
    print('WA')

Buggy submission (verdict: Runtime Error):
S = input()
k = 0
if S[0] == 'A' and S[3:-1].count('C') == 1:
    for i in range(len(S)):
        if S[i].isupper()
            if k == 2:
                print('WA')
                break
            k += 1
    print('AC')
else:
    print('WA')
Problem p03308 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
a.sort()
print(a[-1] - a[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split())).sort()
print(a[-1] - a[0])
Problem p03565 (python)

Fixed submission:
sp = list(input())
t = list(input())
n = len(sp)
s = []
for i in range(len(t), n + 1):
    flag = True
    for j in range(len(t)):
        if sp[n - i + j] != t[j] and sp[n - i + j] != '?':
            flag = False
            break
    if flag:
        s.append('')
        ss = sp
        ss[n - i:n - i + len(t)] = t
        for j in range(n):
            if ss[j] == '?':
                s[-1] += 'a'
            else:
                s[-1] += ss[j]
if s == []:
    print('UNRESTORABLE')
else:
    s.sort()
    print(s[0])

Buggy submission (verdict: Runtime Error):
sp = list(input())
t = list(input())
n = len(sp)
for i in range(len(t), n + 1):
    flag = True
    for j in range(len(t)):
        if sp[n - i + j] != t[j] and sp[n - i + j] != '?':
            flag = False
            break
    if flag:
        s = ''
        sp[n - i:n - i + len(t)] = t
        for j in range(n):
            if sp[j] == '?':
                s += 'a'
            else:
                s += ss[j]
        print(s)
        exit()
print('UNRESTORABLE')
Problem p03599 (python)

Fixed submission:
a, b, c, d, e, f = map(int, input().split())
x = []
y = []
t = 100 * e / (100 + e)
for i in range(f // (100 * a) + 1):
    bb = f - 100 * a * i
    for j in range(bb // (100 * b) + 1):
        if 100 * (a * i + b * j) in x:
            continue
        else:
            x.append(100 * (a * i + b * j))
for i in range(f // c + 1):
    dd = f - c * i
    for j in range(dd // d + 1):
        if c * i + d * j in y:
            continue
        else:
            y.append(c * i + d * j)
y.sort()
rr = 0
ans = []
for i, xi in enumerate(x):
    for j, yi in enumerate(y):
        if xi + yi == 0:
            continue
        r = 100 * yi / (xi + yi)
        if r > t:
            break
        elif xi + yi <= f and rr <= r:
            ans = [xi + yi, yi]
            rr = r
print(ans[0], ans[1])

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
x = []
y = []
t = 100 * e / (100 + e)
for i in range(f // (100 * a) + 1):
    bb = f - 100 * a * i
    for j in range(bb // (100 * b) + 1):
        if 100 * (a * i + b * j) in x:
            continue
        else:
            x.append(100 * (a * i + b * j))
for i in range(f // c + 1):
    dd = f - c * i
    for j in range(dd // d + 1):
        if c * i + d * j in y:
            continue
        else:
            y.append(c * i + d * j)
y.sort()
rr = 0
ans = []
for i, xi in enumerate(x):
    for j, yi in enumerate(y):
        if xi + yi == 0:
            continue
        r = 100 * yi / (xi + yi)
        if r > t:
            break
        elif xi + yi <= f and rr < r:
            ans = [xi + yi, yi]
            rr = r
print(ans[0], ans[1])
Problem p03638 (python)

Fixed submission:
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))
m = h * w
X = []

for i, ai in enumerate(a):
    X += [i + 1 for _ in range(ai)]

for hi in range(h):
    if hi % 2 == 0:
        print(*X[hi * w:(hi + 1) * w])
    else:
        print(*X[hi * w:(hi + 1) * w][::-1])

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))
X = [[0 for j in range(w)] for i in range(h)]

xi = -1
hi = 0
for i, ai in enumerate(a):
    for j in range(xi + 1, min(xi + ai + 1, w)):
        X[hi][j] = i + 1
    if j == w - 1:
        hi += 1
        j = -1
        for j in range(max(0, xi + ai + 1 - w)):
            X[hi][j] = i + 1
    xi = j

for i in range(h):
    if i % 2 == 0:
        print(*X[i])
    else:
        print(*X[i][::-1])

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))
X = [[0 for j in range(w)] for i in range(h)]

xi = -1
hi = 0
for i, ai in enumerate(a):
    for j in range(xi + 1, min(xi + ai + 1, w)):
        X[hi][j] = i + 1
    if j == w - 1:
        hi += 1
        j = -1
        for j in range(max(0, xi + ai + 1 - w)):
            X[hi][j] = i + 1
    xi = j

for i in range(h):
    if i % 2 == 0:
        print(*X[i])
    else:
        print(*X[i][::-1])
Problem p03837 (python)

Fixed submission:
import copy

def warshall_floyd(V, E):
    INF = 10 ** 9
    d = [[[INF, 0] for j in range(V + 1)] for i in range(V + 1)]
    for i, j, c in E:
        d[i][j] = [c, 0]
        d[j][i] = [c, 0]
    for k in range(1, V + 1):
        for i in range(1, V):
            for j in range(i, V + 1):
                dk = d[i][k][0] + d[k][j][0]
                if d[i][j][0] > dk:
                    d[i][j] = [dk, k]
                    d[j][i] = [dk, k]
    return d

def find_path(i, j, d, E):
    k = d[i][j][1]
    if k == 0:
        E[i][j] += 1
        E[j][i] += 1
        return E
    E = find_path(i, k, d, E)
    E = find_path(k, j, d, E)
    return E

n, m = map(int, input().split())
E = [[None for j in range(n + 1)] for i in range(n + 1)]
E_list = []
for i in range(m):
    a, b, c = map(int, input().split())
    E_list.append([a, b, c])
    E[a][b] = 0
    E[b][a] = 0
d = warshall_floyd(n, E_list)
ans = 0
for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        E = find_path(i, j, d, E)
for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        if E[i][j] == 0:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import copy

def warshall_floyd(V, E):
    INF = 10 ** 9
    d = [[[INF, []] for j in range(V + 1)] for i in range(V + 1)]
    for i, j, c in E:
        d[i][j] = [c, []]
        d[j][i] = [c, []]
    for k in range(1, V + 1):
        for i in range(1, V):
            for j in range(i, V + 1):
                dk = d[i][k][0] + d[k][j][0]
                if d[i][j][0] > dk:
                    root = copy.copy(d[i][k][1]) + [k] + copy.copy(d[k][j][1])
                    d[i][j] = [dk, root]
                    d[j][i] = [dk, root]
    return d

n, m = map(int, input().split())
E = [[None for j in range(n + 1)] for i in range(n + 1)]
E_list = []
for i in range(m):
    a, b, c = map(int, input().split())
    E_list.append([a, b, c])
    E[a][b] = 0
    E[b][a] = 0
d = warshall_floyd(n, E_list)
ans = m
for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        k = i
        for r in d[i][j][1]:
            if E[r][k] == 0:
                ans -= 1
            E[r][k] += 1
            E[k][r] += 1
            k = r
        if E[j][k] == 0:
            ans -= 1
        E[j][k] += 1
        E[k][j] += 1
print(ans)
Problem p03846 (python)

Fixed submission:
from collections import defaultdict

MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for ai in a:
    d[ai] += 1
ans = 1
if n % 2:
    for k, v in d.items():
        if k > 0 and v == 2:
            ans *= 2
        elif k == 0 and v == 1:
            ans *= 1
        else:
            ans = 0
            break
        ans = ans % MOD
else:
    for v in d.values():
        if v == 2:
            ans *= 2
        else:
            ans = 0
            break
        ans = ans % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 5 + 1)

def dfs(i, n, a, L):
    # x + y = n - 1
    # x - y = a
    # x = (n - 1 + a) / 2
    # y = (n - 1 - a) / 2
    if i == n:
        return 1
    if a [i] == 0:
        x = [(n - 1 + a[i]) // 2]
    else:
        x = [(n - 1 + a[i]) // 2, (n - 1 - a[i]) // 2]
    t = 0
    MOD = 10 ** 9 + 7
    for xi in x:
        if L[xi] == 0:
            L[xi] = i + 1
            t += dfs(i + 1, n, a, L)
            L[xi] = 0
    return t % MOD

n = int(input())
a = list(map(int, input().split()))
L = [0 for _ in range(n)]
ans = dfs(0, n, a, L)
print(ans)

Buggy submission (verdict: Runtime Error):
def dfs(i, n, a, L):
    # x + y = n - 1
    # x - y = a
    # x = (n - 1 + a) / 2
    # y = (n - 1 - a) / 2
    if i == n:
        return 1
    if a [i] == 0:
        x = [(n - 1 + a[i]) // 2]
    else:
        x = [(n - 1 + a[i]) // 2, (n - 1 - a[i]) // 2]
    t = 0
    MOD = 10 ** 9 + 7
    for xi in x:
        if L[xi] == 0:
            L[xi] = i + 1
            t += dfs(i + 1, n, a, L)
            L[xi] = 0
    return t % MOD

n = int(input())
a = list(map(int, input().split()))
L = [0 for _ in range(n)]
ans = dfs(0, n, a, L)
print(ans)

Buggy submission (verdict: Runtime Error):
import copy

def dfs(i, n, a, L):
    # x + y = n - 1
    # x - y = a
    # x = (n - 1 + a) / 2
    # y = (n - 1 - a) / 2
    if i == n:
        return 1
    if a [i] == 0:
        x = [(n - 1 + a[i]) // 2]
    else:
        x = [(n - 1 + a[i]) // 2, (n - 1 - a[i]) // 2]
    t = 0
    MOD = 10 ** 9 + 7
    for xi in x:
        if L[xi] == 0:
            Li = copy.copy(L)
            Li[xi] = i + 1
            t += dfs(i + 1, n, a, Li)
    return t % MOD

n = int(input())
a = list(map(int, input().split()))
L = [0 for _ in range(n)]
ans = dfs(0, n, a, L)
print(ans)
Problem p03855 (python)

Fixed submission:
import sys
from collections import Counter

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

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        elif self.rank[x] > self.rank[y]:
            self.par[y] = x
        else:
            self.par[y] = x
            self.rank[x] += 1

sys.setrecursionlimit(10 ** 5 + 1)

n, k, l = map(int, input().split())
Ur = UnionFind(n)
for i in range(k):
    p, q = map(int, input().split())
    Ur.union(p, q)

Ut = UnionFind(n)
for i in range(l):
    r, s = map(int, input().split())
    Ut.union(r, s)

x = [(Ur.find(i + 1), Ut.find(i + 1)) for i in range(n)]
c = Counter(x)
ans = []
for i in range(n):
    ans.append(c[x[i]])
print(' '.join([str(a) for a in ans]))

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

def dfs(i, V, E, num):
    V[i] = num
    for j in E[i]:
        if V[j] > 0:
            continue
        V = dfs(j, V, E, num)
    return V

n, k, l = map(int, input().split())
Er = defaultdict(list)
for i in range(k):
    p, q = map(int, input().split())
    Er[p].append(q)
    Er[q].append(p)
Et = defaultdict(list)
for i in range(l):
    r, s = map(int, input().split())
    Et[r].append(s)
    Et[s].append(r)

Vr_group = [None]
Vr = [0 for _ in range(n + 1)]
j = 1
for i in range(1, n + 1):
    if Vr[i] > 0:
        continue
    Vr = dfs(i, Vr, Er, j)
    Vr_group.append({t for t in range(1, n + 1) if Vr[t] == j})
    j += 1

Vt_group = [None]
Vt = [0 for _ in range(n + 1)]
j = 1
for i in range(1, n + 1):
    if Vt[i] > 0:
        continue
    Vt = dfs(i, Vt, Et, j)
    Vt_group.append({t for t in range(1, n + 1) if Vt[t] == j})
    j += 1

ans = []
for i in range(1, n + 1):
    ans.append(len(Vr_group[Vr[i]] & Vt_group[Vt[i]]))
print(' '.join([str(x) for x in ans]))
Problem p04013 (python)

Fixed submission:
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
ans = 0
if x_max >= a:
    dp = [[0 for j in range(2 * x_sum + 1)] for i in range(2)]
    dp[0][x_sum] = 1
    for i in range(1, n + 1):
        idx = i % 2
        y = x[i - 1] - a
        for j in range(2 * x_sum + 1):
            if 0 <= j - y <= 2 * x_sum:
                dp[idx][j] = dp[1 - idx][j] + dp[1 - idx][j - y]
            else:
                dp[idx][j] = dp[1 - idx][j]
    ans = dp[n % 2][x_sum] - 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
x_sum = sum(x)
if x_max < a:
    print(0)
else:
    dp = [[[0 for k in range(x_sum + 1)] for j in range(n + 1)] for i in range(n + 1)]
    dp[0][0][0] = 1
    for i in range(1, n + 1):
        for j in range(n + 1):
            for k in range(x[i - 1]):
                dp[i][j][k] = dp[i - 1][j][k]
            if j > 0:
                for k in range(x[i - 1], x_sum + 1):
                    dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]]

    ans = 0
    for j in range(1, n + 1):
        ans += dp[-1][j][j * a]
    print(ans)

Buggy submission (verdict: Runtime Error):
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
dp = [[[0 for k in range(n * x_max + 1)] for j in range(n + 1)] for i in range(n + 1)]
dp[0][0][0] = 1
for i in range(1, n + 1):
    for j in range(n + 1):
        for k in range(x[i - 1]):
            dp[i][j][k] = dp[i - 1][j][k]
        if j > 0:
            for k in range(x[i - 1], n * x_max + 1):
                dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i - 1]]
ans = 0
for j in range(1, n + 1):
    ans += dp[-1][j][j * a]
print(ans)
Problem p02677 (python)

Fixed submission:
import math
A, B, H, M = map(int,input().split())
Ha = H*math.pi/6 + M*math.pi/360
Ma = M*math.pi/30
if Ha == Ma:
    print(abs(A-B))
else:
    print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(Ha-Ma)))

Buggy submission (verdict: Runtime Error):
A, B, H, M = map(int,input().split())
Ha = H*math.pi/6 + M*math.pi/360
Ma = M*math.pi/30
if Ha == Ma:
    print(abs(A-B))
else:
    print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(Ha-Ma)))
Problem p02756 (python)

Fixed submission:
from collections import deque
S = deque(input())
Q = int(input())
Qr = [list(input().split()) for i in range(Q)]
isForward = True
for i in range(Q):
    if Qr[i][0] == "1":
        isForward = not(isForward)
    elif (isForward and  Qr[i][1] == "1") or (not(isForward) and Qr[i][1] == "2"):
        S.appendleft(Qr[i][2])
    else:
        S.append(Qr[i][2])
S = list(S)
if not(isForward):
    S.reverse()
print("".join(S))

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
if Q != 1:
    Qr = [list(input().split()) for i in range(Q)]
isForward = True
for i in range(Q):
    if Qr[i][0] == "1":
        isForward = not(isForward)
    elif (isForward and  Qr[i][1] == "1") or (not(isForward) and Qr[i][1] == "2"):
        S = Qr[i][2] + S
    else:
        S = S + Qr[i][2]
if not(isForward):
    S = S[::-1]
print(S)
Problem p02882 (python)

Fixed submission:
import math
a,b,x = list(map(int,input().split()))
h = x/(a**2)
if b == h:
    ans = 0
elif h<=b/2:
    ans = math.degrees(math.atan(b**2/(2*a*h)))
else:
    ans = 90-math.degrees(math.atan(a/(2*(b-h))))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b,x = list(map(int,input().split()))
h = x/(a**2)
if h<=b/2:
    ans =  math.degrees(math.atan(b**2/(2*a*h)))
else:
    ans = 90-math.degrees(math.atan(a/(2*(b-h))))
print(ans)
Problem p02957 (python)

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

if (A+B)%2 == 0:
    print((A+B)//2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
ans ="Yes"
highest = H[0]
for i in range(N-1):
    if H[i+1]<highest-1:
        ans ="No"
        break
    highest = max(highest,H[i+1])

print(ans)
Problem p02993 (python)

Fixed submission:
S=list(input())
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print("Bad")
else: print("Good")

Buggy submission (verdict: Runtime Error):
S = list(input())
if S[0]==S[1]orS[1]==S[2]orS[2]==S[3]:
  print("Bad")
else: print("Good")
Problem p02995 (python)

Fixed submission:
import fractions
def CntMultiples(a, b, n):
    return b//n - a//n + int(a%n==0)

A,B,C,D = map(int,input().split())
print(B-A+1-(CntMultiples(A, B, C) + CntMultiples(A, B, D) - \
             CntMultiples(A, B, (C*D)//(fractions.gcd(C, D)))))

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
print(B-A+1-(CntMultiples(A, B, C) + CntMultiples(A, B, D) - CntMultiples(A, B, (C*D)//math.gcd(C, D))))

import math
def CntMultiples(a, b, n):
    return b//n - a//n + int(a%n==0)

Buggy submission (verdict: Runtime Error):
import math

def CntMultiples(a, b, n):
    return b//n - a//n + int(a%n==0)

A,B,C,D = map(int,input().split())
print(B-A+1-(CntMultiples(A, B, C) + CntMultiples(A, B, D) - CntMultiples(A, B, (C*D)//math.gcd(C, D))))

Buggy submission (verdict: Runtime Error):
import math

def CntMultiples(a, b, n):
    return b//n - a//n + int(a%n==0)

A,B,C,D = map(int,input().split())
print(B-A+1-(CntMultiples(A, B, C) + CntMultiples(A, B, D) - CntMultiples(A, B, (C*D)//math.gcd(C, D))))
Problem p02999 (python)

Fixed submission:
X, A = map(int,input().split())
print(int(X>=A)*10)

Buggy submission (verdict: Runtime Error):
X, A = map(int,input().split())
if A//X ==0:
    print(0)
else: print(10)

Buggy submission (verdict: Runtime Error):
X, A = map(int,input().split())
if A//X ==0:
  print(0)
else: print(10)
Problem p03000 (python)

Fixed submission:
N, X = map(int,input().split())
L = list(map(int,input().split()))
ans = 1
D = L[0]
while D<=X and ans<N+1:
    ans+=1
    if ans < N+1: #N+1回以降ははねない
        D+=L[ans-1]
print(ans)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())
L = list(map(int,input().split()))
ans = 1
D = L[0]
while D<=X and ans<N+1:
    D+=L[ans]
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())
L = list(map(int,input().split()))
D = 0
ans = 0
while D<=X and ans<N+1:
    D+=L[ans]
    ans+=1
print(ans)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
if N == 2:
    ans = max(A)
else:
    GCDF, GCDB = [0]*N, [0]*N
    GCDF[1],GCDB[-2] = A[0], A[N-1]
    for i in range(2, N):
        GCDF[i] = gcd(GCDF[i-1],A[i-1])
        GCDB[-(i+1)] = gcd(GCDB[-i], A[-i])
    GCDm = [0]*N
    GCDm[0] = GCDB[0]
    GCDm[N-1] = GCDF[N-1]
    for i in range(1, N-1):
        GCDm[i] = gcd(GCDF[i],GCDB[i])
    ans = max(GCDm)
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
A = list(map(int,input().split()))
minflg = 0
mingcd = A[1]
for i in range(N):
    gcd = fractions.gcd(mingcd,A[i])
    if gcd < mingcd:
        mingcd = gcd
        minflg = i
if minflg == 0 and N > 2:
    if fractions.gcd(A[0],A[2]) > math.fractions(A[1],A[2]):
        minflg = 1
if minflg > 0:
    mingcd = A[minflg-1]
else: mingcd = A[minflg+1]
    
for i in range(N):
    if i != minflg:
        gcd = fractions.gcd(mingcd,A[i])
        if gcd < mingcd:
            mingcd = gcd
print(mingcd)
Problem p03145 (python)

Fixed submission:
a, b, c = map(int,input().split())
print(int(min(a*b/2,b*c/2,c*a/2)))

Buggy submission (verdict: Runtime Error):
Copy
a, b, c = map(int,input().split())
print(int(min(a*b/2,b*c/2,c*a/2)))