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

Fixed submission:
import heapq

N, M = list(map(int,input().split()))
A = []
for i in range(N):
    in1, in2 = list(map(int,input().split()))
    A.append([in1, in2])

A = sorted(A)
ans = 0
day = 1
cnt = 0
x = []

for i in range(M):
    while(cnt < N):
        if A[cnt][0] == day:
            heapq.heappush(x, -A[cnt][1])
            cnt += 1
        else:
            break
    if x:  ans -= heapq.heappop(x)
    day += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

A = sorted(A)
ans = 0
day = 1
cnt = 0
x = []

for i in range(M):
    while(cnt < N):
        if A[cnt][0] == day:
            heapq.heappush(x, -A[cnt][1])
            cnt += 1
        else:
            break
    if x:  ans -= heapq.heappop(x)
    day += 1

print(ans)
Problem p02954 (python)

Fixed submission:
import math
from itertools import groupby

def rlE(S: str):
    grouped = groupby(S)
    res = []
    for k, v in grouped:
        res.append((k, (len(list(v)))))
    return res

S = input()
ans = [0 for _ in range(len(S))]
cnt = 0
rS = rlE(S)
rS.append(["", 0])
temp = rS[0][1] - 1

while(cnt < len(rS) - 1):
    ans[temp] = math.ceil(rS[cnt][1] / 2) + rS[cnt + 1][1] - math.ceil(rS[cnt + 1][1] / 2)
    ans[temp + 1] = math.ceil(rS[cnt + 1][1] / 2) + rS[cnt][1] - math.ceil(rS[cnt][1] / 2)
    temp += (rS[cnt + 1][1] + rS[cnt + 2][1])
    cnt += 2
print(*ans)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define INF 100000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = inx(x, y)
#define print(x) cout << x << "\n"
#define printv(vec) rep(i, vec.size()) cout << vec[i] << " "; print("");
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;

/*
ダブリング
10**100のビットがたっているか否かってC++でわかる?
*/

void solve(){
	
	string S;
	cin >> S;
	ll length = S.size();
	vvl v(60, vl(length));
	vl ans(length);
	rep(i, length){
		if(S[i] == 'R') v[0][i] = i + 1;
		else v[0][i] = i - 1;
	}
	rep(i, 59) rep(j, length) v[i + 1][j] = v[i][v[i][j]];
	rep(i, length) ans[v[59][i]] += 1;
	printv(ans);
	
}	

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
    
	return 0;
	
}

Buggy submission (verdict: Runtime Error):
import math

def rlE(S: str):
    grouped = groupby(S)
    res = []
    for k, v in grouped:
        res.append((k, (len(list(v)))))
    return res

S = input()
ans = [0 for _ in range(len(S))]
cnt = 0
rS = rlE(S)
rS.append(["", 0])
temp = rS[0][1] - 1

while(cnt < len(rS) - 1):
    ans[temp] = math.ceil(rS[cnt][1] / 2) + rS[cnt + 1][1] - math.ceil(rS[cnt + 1][1] / 2)
    ans[temp + 1] = math.ceil(rS[cnt + 1][1] / 2) + rS[cnt][1] - math.ceil(rS[cnt][1] / 2)
    temp += (rS[cnt + 1][1] + rS[cnt + 2][1])
    cnt += 2
print(*ans)
Problem p02990 (python)

Fixed submission:
from functools import reduce

def cin():  return list(map(int,input().split()))

def cmb(n, r):
    INF = 10 ** 9 + 7
    r = min(n - r, r)
    if r == 0:  return 1
    numer = reduce(lambda x, y: (x * y) % INF, range(n, n - r, -1))
    denom = reduce(lambda x, y: (x * y) % INF, range(1, r + 1))
    return (numer * pow(denom, INF - 2, INF)) % INF

def nHr(n, r):  
    if n == 0:  return 1
    return cmb(n + r - 1, n)

N, K = cin()

INF = 10 ** 9 + 7

ans = [N - K + 1]
for i in range(2, K + 1):
    b = nHr(K - i, i)
    cnt = 0
    tmp = N - K - (i + 1)
    if tmp >= 0:
        cnt += b * nHr(tmp, i + 1)
        cnt %= INF
    tmp += 1
    if tmp >= 0:
        cnt += 2 * b * nHr(tmp, i)
        cnt %= INF
    tmp += 1
    if tmp >= 0:
        cnt += nHr(tmp, i - 1) * b
        cnt %= INF
    ans.append(cnt)

for i in range(K):  print(ans[i])

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

def cin():  return list(map(int,input().split()))

def cmb(n, r):
    INF = 10 ** 9 + 7
    r = min(n - r, r)
    if r == 0:  return 1
    numer = reduce(lambda x, y: (x * y) % INF, range(n, n - r, -1))
    denom = reduce(lambda x, y: (x * y) % INF, range(1, r + 1))
    return (numer * pow(denom, INF - 2, INF)) % INF

def nHr(n, r):  
    if n == 0:  return 1
    return cmb(n + r - 1, n)

INF = 10 ** 9 + 7

N, K = cin()
ans = [N - K + 1]
for i in range(2, K + 1):
    cnt = cmb(N - K + 1, i) * nHr(K - i, i)
    ans.append(cnt % INF)

for i in range(K):  print(ans[i])

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

def cin():  return list(map(int,input().split()))

def cmb(n, r):
    INF = 10 ** 9 + 7
    r = min(n - r, r)
    if r == 0:  return 1
    numer = reduce(lambda x, y: (x * y) % INF, range(n, n - r, -1))
    denom = reduce(lambda x, y: (x * y) % INF, range(1, r + 1))
    return (numer * pow(denom, INF - 2, INF)) % INF

def nHr(n, r):  
    if n == 0:  return 1
    return cmb(n + r - 1, n)

INF = 10 ** 9 + 7

N, K = cin()
ans = [N - K + 1]
for i in range(2, K + 1):
    cnt = cmb(N - K + 1, i) * nHr(K - i, i)
    ans.append(cnt % INF)

for i in range(K):  print(ans[i])
Problem p03038 (python)

Fixed submission:
import heapq

N, M = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [list(map(int,input().split())) for i in range(M)]
B = sorted(B, key = lambda x: x[1])[::-1]

heapq.heapify(A)
cnt = 0
for i in range(M):
    for _ in range(B[i][0]):  heapq.heappush(A, max(heapq.heappop(A), B[i][1]))
    cnt += B[i][0]
    if cnt >= N:  break
print(sum(A))

Buggy submission (verdict: Runtime Error):
import heapq

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

N, M = cin()
A = cin()
B = []
for i in range(M):
    in1 = cin()
    B.append(in1)
B = sorted(B, key = lambda x: x[1])

heapq.heapify(A)
cnt = 0
for i in range(M):
    for _ in range(B[i][0]):  heapq.heappush(A, max(heapq.heappop(A), B[i][1]))
    cnt += B[i][0]
    if cnt >= N:  break
print(sum(A))
Problem p03208 (python)

Fixed submission:
N, K = map(int, input().split())
h = sorted([int(input()) for i in range(N)])
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = [int(input()) for i in range(N)].sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))
Problem p03209 (python)

Fixed submission:
def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

N, X = cin()
a = [0 for _ in range(N)] # 全体の枚数
p = [0 for _ in range(N)] # パティの枚数
a[0] = 1
p[0] = 1

for i in range(1, N):
    a[i] = 2 * a[i - 1] + 3
    p[i] = 2 * p[i - 1] + 1
    
def f(N, X):
    if N == 0:  
        if X <= 0: return 0
        else:  return 1
    if X <= 1 + a[N - 1]:  return f(N - 1, X - 1)
    return 1 + p[N - 1] + f(N - 1, X - 2 - a[N - 1])

ans = f(N, X)
print(ans)

Buggy submission (verdict: Runtime Error):
N, X = cin()
a = [0 for _ in range(N)] # 全体の枚数
p = [0 for _ in range(N)] # パティの枚数
a[0] = 1
p[0] = 1

for i in range(1, N):
    a[i] = 2 * a[i - 1] + 3
    p[i] = 2 * p[i - 1] + 1
    
def f(N, X):
    if N == 0:  
        if X <= 0: return 0
        else:  return 1
    if X <= 1 + a[N - 1]:  return f(N - 1, X - 1)
    return 1 + p[N - 1] + f(N - 1, X - 2 - a[N - 1])

ans = f(N, X)
print(ans)
Problem p02759 (python)

Fixed submission:
N = int(input())

print(N//2 + N%2)

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

print(N//2 + N%2)
Problem p02785 (python)

Fixed submission:
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
H.sort()

if N >= K:
    print(sum(H[0:N-K]))
else:
    print(0)

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

print(sum(H[0:N-K]))
Problem p02831 (python)

Fixed submission:
import fractions

# 入力
A,B = map(int,input().split())

print(int((A * B) // fractions.gcd(A, B)))

Buggy submission (verdict: Runtime Error):
import fractions

# 入力
A,B = map(int,input().split())

print(int((A * B) // math.fractions(A, B)))

Buggy submission (verdict: Runtime Error):
import math

# 入力
A,B = map(int,input().split())

print(int((A * B) // math.gcd(A, B)))

Buggy submission (verdict: Runtime Error):

import math

# 入力
A,B = map(int,input().split())

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

print(int(lcm(A, B)))

Buggy submission (verdict: Runtime Error):
import math

# 入力
A,B = map(int,input().split())

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

print(lcm(A, B))
Problem p02571 (python)

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

l = len(T)

if l == len(S):
    cnt = 0
    for i in range(l):
        if S[i] != T[i]:
            cnt += 1
    print(cnt)
    exit()

ans = []
for i in range(len(S)-l):
    cnt = 0
    for n in range(l):
        if S[i+n] != T[n]:
            cnt += 1
    ans.append(cnt)
    
print(min(ans))

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

l = len(T)

ans = []
for i in range(len(S)-l):
    cnt = 0
    for n in range(l):
        if S[i+n] != T[n]:
            cnt += 1
    ans.append(cnt)
    
print(min(ans))
Problem p02572 (python)

Fixed submission:
from itertools import accumulate

n = int(input())
a = list(map(int, input().split()))
b = list(accumulate(a))
sum = 0

for i in range(len(a)):
    sum += a[i]*(b[-1] - b[i])
    sum %= 10**9 + 7

print(sum)

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

start_v = (sum(A) - A[0])*A[0]

ans = start_v
for i in range(2, N):
    ans += int((start_v - sum(A[1:i])*A[0])*A[i-1]/A[0])

print(ans%(10**9 + 7))
Problem p02689 (python)

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
g = [[] for _ in range(N+1)]

for _ in range(M):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)

cnt = 0
for n in range(1,N+1):
    for i in g[n]:
        if H[n-1] <= H[i-1]:
            break
    else:
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]

cnt = 0
for n in range(1,N+1):
    adj = []
    adj.append([n])
    for i in AB:
        if n in i:
            adj.append(i)
    adj = set(sum(adj,[]))
    adj_H = [H[s-1] for s in adj]
    if max(adj_H) == H[n-1] and adj_H.count(max(adj_H)) == 1:
        ans.append(n)
        cnt += 1

print(cnt)
Problem p03208 (python)

Fixed submission:
import numpy as np

N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

sH = np.array(sorted(H), dtype=np.int64)
shift = sH[K-1:]
diff = shift - sH[:len(shift)]
ans = min(diff)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]

sH = np.array(sorted(H), dtype=np.int64)
shift = sH[K-1:]
diff = shift - sH[:K]
ans = min(diff)
print(ans)
Problem p02580 (python)

Fixed submission:
import sys
input = sys.stdin.readline

h, w, m = map(int, input().split())
col = [0]*w
row = [0]*h
ypos = []
xpos = []
bomb = []

for i in range(m):
    H, W = map(lambda x: int(x) - 1, input().split())
    col[W] += 1
    row[H] += 1
    bomb.append((H, W))

maxcol = max(col)
maxrow = max(row)

xpos = [h for h, x in enumerate(col) if x == maxcol]
ypos = [w for w, y in enumerate(row) if y == maxrow]

ans = maxcol + maxrow - 1
bomb = set(bomb)

for i in ypos:
    for j in xpos:
        if (i, j) not in bomb:
            ans += 1
            print(ans)
            exit()
print(ans)

Buggy submission (verdict: Runtime Error):
h, w, m = map(int, input().split())
dp= [[0]*w for i in range(h)]
dpcol = [0]*w
dprow = [0]*h
ypos = []
xpos = []
anscol = 0
ansrow = 0
ans = 0

for i in range(m):
    H, W = map(lambda x: int(x) - 1, input().split())
    dp[H][W] = 1
    dpcol[W] += 1
    dprow[H] += 1

for i in range(w): #列の最大値
    if dpcol[i] > anscol:
        anscol = dpcol[i]
        xpos = [i]
    elif dpcol[i] == anscol:
        xpos.append(i)

for i in range(h):
    if dprow[i] > ansrow:
        ansrow = dprow[i]
        ypos = [i]
    elif dprow[i] == ansrow:
        ypos.append(i)

for i in ypos:
    for j in xpos:
        if dp[i][j] == 1:
            ans = anscol + ansrow - 1
        else:
            ans = anscol + ansrow
            print(ans)
            exit()
print(ans)

Buggy submission (verdict: Runtime Error):
h, w, m = map(int, input().split())
dp= [[0]*w for i in range(h)]
dpcol = [0]*w
dprow = [0]*h
ypos = []
xpos = []
anscol = 0
ansrow = 0
ans = 0

for i in range(m):
    H, W = map(lambda x: int(x) - 1, input().split())
    dp[H][W] = 1
    dpcol[W] += 1
    dprow[H] += 1

for i in range(w): #列の最大値
    if dpcol[i] > anscol:
        anscol = dpcol[i]
        xpos = [i]
    elif dpcol[i] == anscol:
        xpos.append(i)

for i in range(h):
    if dprow[i] > ansrow:
        ansrow = dprow[i]
        ypos = [i]
    elif dprow[i] == ansrow:
        ypos.append(i)

for i in range(len(ypos)):
    for j in range(len(xpos)):
        if dp[ypos[i]][xpos[j]] == 1:
            ans = anscol + ansrow - 1
        else:
            ans = anscol + ansrow
            print(ans)
            exit()
print(ans)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int, input().split())
dp= [[0]*W for i in range(H)]
dph = [0]*W
dpw = [0]*H
dphpos = []
dpwpos = []
ansh = 0
answ = 0
ans = 0

for i in range(M):
    h, w = map(lambda x: int(x) - 1, input().split())
    dp[h][w] = 1
    dph[w] += 1
    dpw[h] += 1

for i in range(W): #列の最大値
    if dph[i] > ansh:
        ansh = dph[i]
        dphpos = [i]
    elif dph[i] == ansh:
        dphpos.append(i)

for i in range(H):
    if dpw[i] > answ:
        answ = dpw[i]
        dpwpos = [i]
    elif dpw[i] == answ:
        dpwpos.append(i)

for i in range(len(dphpos)):
    for j in range(len(dpwpos)):
        if dp[dpwpos[j]][dphpos[i]] == 1:
            ans = max(ans, ansh + answ - 1)
        else:
            ans = ansh + answ
print(ans)
Problem p02623 (python)

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

A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0

a = [0]
b = [0]

for i in range(n):
    a.append(a[i] + A[i])

for i in range(m):
    b.append(b[i] + B[i])

j = m

for i in range(n + 1):
    if a[i] > k:
        break
    while a[i] + b[j] > k:
        j -= 1
    else:
        ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

cnt = 0
ac = 0
bc = 0

while cnt < k:
    if ac == len(A):
        cnt += B[bc]
        if cnt <= k:
            bc += 1
        else:
            break
    if bc == len(B):
        cnt += A[ac]
        if cnt <= k:
            ac += 1
        else:
            break
    if ac == len(A) and bc == len(B):
        break
    if A[ac] < B[ac]:
        cnt += A[ac]
        if cnt <= k:
            ac += 1
        else:
            break
    else:
        cnt += B[bc]
        if cnt <= k:
            bc += 1
        else:
            break

print(ac + bc)
Problem p02624 (python)

Fixed submission:
n = int(input())
l = [1]*(n + 1)
ans = 0

for i in range(2, n + 1):
    for j in range(i, n + 1, i):
        l[j] += 1

for i in range(1, n + 1):
    ans += i*l[i]

print(ans)

Buggy submission (verdict: Runtime Error):
import sympy

n = int(input())
ans = 0

for i in range(1, n + 1):
    ans += i*sympy.divisor_count(i)

print(ans)
Problem p02762 (python)

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

n, m, k = map(int, input().split())
F = [[] for i in range(n)]
B = [set() for i in range(n)]
l = [0]*n

for i in range(m):
    a, b = map(int, input().split())
    F[a - 1].append(b - 1)
    F[b - 1].append(a - 1)

for i in range(k):
    c, d = map(int, input().split())
    B[c - 1].add(d - 1)
    B[d - 1].add(c - 1)

seen = [0]*n
cnt = 0
r = []

def dfs(x):
    if seen[x] == 0:
        r[cnt].add(x)
        seen[x] = 1
        for i in F[x]:
            dfs(i)

for i in range(n):
    if seen[i] == 0:
        r.append(set())
        dfs(i)
        cnt += 1

ans = [0]*n

for i in r:
    lr = len(i)
    for j in i:
        ans[j] = lr - len(F[j]) - len(i & B[j]) - 1

print(*ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
F = [[] for i in range(n)]
B = [set() for i in range(n)]
l = [0]*n

for i in range(m):
    a, b = map(int, input().split())
    F[a - 1].append(b - 1)
    F[b - 1].append(a - 1)

for i in range(k):
    c, d = map(int, input().split())
    B[c - 1].add(d - 1)
    B[d - 1].add(c - 1)

seen = [0]*n
cnt = 0
r = []

def dfs(x):
    if seen[x] == 0:
        r[cnt].add(x)
        seen[x] = 1
        for i in F[x]:
            dfs(i)

for i in range(n):
    if seen[i] == 0:
        r.append(set())
        dfs(i)
        cnt += 1

ans = [0]*n

for i in r:
    lr = len(i)
    for j in i:
        ans[j] = lr - len(F[j]) - len(i & B[j]) - 1

print(*ans)
Problem p02831 (python)

Fixed submission:
import fractions

a, b = map(int, input().split())

ans = a*b/fractions.gcd(a, b)
print(int(ans))

Buggy submission (verdict: Runtime Error):
import fractions

a, b = map(int, input().split())

ans = a*b/math.gcd(a, b)
print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

ans = a*b/math.gcd(a, b)
print(int(ans))
Problem p02990 (python)

Fixed submission:
import math

def comb(n, r, mod):
    return math.factorial(n + r - 1)//(math.factorial(n - 1)*math.factorial(r))%mod

n, k = map(int, input().split())
mod = 10**9 + 7
red = n - k

for i in range(k):
    ans = 0
    redmod = red - i
    if redmod < 0:
        print(0)
        continue
    redplace = 2 + i
    bluemod = k - (i + 1)
    if i == 0:
        bluemod = 0
    blueplace = i + 1
    ans += comb(redplace, redmod, mod)*comb(blueplace, bluemod, mod)
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
import math

def comb(n, r, mod):
    return math.factorial(n + r - 1)//(math.factorial(n - 1)*math.factorial(r))%mod

n, k = map(int, input().split())
mod = 10**9 + 7
red = n - k

for i in range(k):
    ans = 0
    redmod = red - i
    redplace = 2 + i
    bluemod = k - (i + 1)
    if i == 0:
        bluemod = 0
    blueplace = i + 1
    ans += comb(redplace, redmod, mod)*comb(blueplace, bluemod, mod)
    print(ans%mod)
Problem p03774 (python)

Fixed submission:
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
dist = 10**9


for i, j in ab:
    for k in range(m):
        dist1 = abs(i - cd[k][0]) + abs(j - cd[k][1])
        if dist1 < dist:
            dist = dist1
            ch = k + 1
    print(ch)
    dist = 10**9

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
dist = 10**9


for i, j in ab:
    for k in range(n):
        dist1 = abs(i - cd[k][0]) + abs(j - cd[k][1])
        if dist1 < dist:
            dist = dist1
            ch = k + 1
    print(ch)
    dist = 10**9
Problem p02659 (python)

Fixed submission:
from decimal import * 
import math
a,b = input().split()
a = int(a)
b = Decimal(b)
print(int(a*b))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
s = 1
if 0 in a:
    print(0)
else:
    for i in a:
        s *= i
        if s > 10**18:
            print(-1)
            break
    if s <= 10**18:
        print(s)
Problem p02688 (python)

Fixed submission:
n,k = map(int,input().split())
person = [0]*n
for i in range(k):
    d = int(input())
    A = list(map(int,input().split()))
    for j in range(len(A)):
        person[A[j]-1] = 1
print(person.count(0))

Buggy submission (verdict: Runtime Error):
n,k = list(map(int,input().strip().split()))
temp = []
ans = int(0)
for i in range(k+1):
    d = int(input())
    li = list(map(int,input().split()))
    for j in range(d):
        temp += str(li[j])
for m in range(n+1):
    b  = str(m + 1)
    a = temp.count(b)
    if a == 0:
        ans += 1
print(ans)
Problem p02712 (python)

Fixed submission:
n = int(input())
s = 0
for i in range(1, n+1):
    if i % 15 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        s += i
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(sum(n)-sum(n/3)*3-sum(n/5)*5+sum(n/15)*15)
Problem p02831 (python)

Fixed submission:
a,b = map(int,input().split())
import fractions
g = fractions.gcd(a,b)

print(round(a*b/g))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
import fraction
g = fraction.gcd(a,b)

print(round(a*b/g))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
import math
g = math.gcd(a,b)

print(round(a*b/g))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
g = math.gcd(a,b)

print(round(a*b/g))
Problem p02847 (python)

Fixed submission:
s = input()
l = ['SUN','MON','TUE','WED','THU','FRI','SAT']
i = 7-l.index(s)
print(i)

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

def bisect(M,m):
    while(abs(M-m)>1):
        mid = (M+m)//2
        if a*mid + b*len(str(mid)) <= x:
            m = mid
        else:
            M = mid
            
    return m
print(bisect(10**9+1,0))
Problem p02987 (python)

Fixed submission:
c = 0 ; a = []

s = input()

for i in range(4):
    if s[i] not in  a:
        a.append(s[i])
    else:
        c += 1
    
if len(a) == 2 and c == 2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=sorted(input())
s.replace(s[0],"").replace(s[2],"")

print(s)
Problem p03011 (python)

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

A.sort()

print(A[0]+A[1])

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

A.sort()

print(A[0]+A[1])
Problem p02577 (python)

Fixed submission:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**6)

def main():
    N = int(input())
    def calcSumOfDigit(x):
        str_x = str(x)
        acc = 0
        for s in str_x:
            acc += int(s)
            acc %= 9
        return acc
    
    print("Yes" if calcSumOfDigit(N)==0 else "No")
    return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

def main():
    N = int(input())
    def calcSumOfDigit(x,acc=0):
        if x == 0:
            return acc
        else:
            return calcSumOfDigit(x//10,acc+x%10)
    def judge(x):
        return x % 9 == 0
    print("Yes" if judge(calcSumOfDigit(N)) else "No")
    return


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

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

def solve(a,b,c,k):
  if a >= k:
    return k
  elif a + b >= k:
    return a
  else:
    return a-(k-a-b)
    
print(solve(A,B,C,K))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

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

def take_card(a,b,c,k,s=0):
  if k<=0:
    return s
  else:
    if a > 0:
      return take_card(a-1,b,c,k-1,s+1)
    elif b > 0:
      return take_card(a,b-1,c,k-1,s)
    else:
      return take_card(a,b,c-1,k-1,s-1)
    
print(take_card(A,B,C,K))