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

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

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

n = int(input())
av = list(map(int, input().split(' ')))
alcm = 1
for i in av:
  alcm = lcm(alcm, i)

tot = 0
for i in range(n):
  tot += alcm // av[i]

print(tot % 1000000007)

Buggy submission (verdict: Runtime Error):
def lcm(a, b):
    ca = a
    ca = b
    while b:
        a %= b
        a, b = b, a
    gcd = a
    return ca * cb // gcd


n = int(input())
a = list(map(int, input().split(" ")))
alcm = a[0]
for i in a:
    alcm = lcm(alcm, i)

tot = 0
for num in a:
    tot += alcm // num

print(tot % 1000000007)

Buggy submission (verdict: Runtime Error):
from collections import deque, Counter, defaultdict
from functools import lru_cache
from itertools import permutations
from heapq import (
    heappush,
    heappop,
    heapreplace,
    heappushpop,
    heapify,
    merge,
    nlargest,
    nsmallest,
)
from statistics import mean, median, mode


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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


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

clcm = 1
for num in a:
    clcm = lcm(clcm, num)

tot = 0
for num in a:
    tot = (tot + clcm // num) % 1000000007

print(tot)

Buggy submission (verdict: Runtime Error):
from collections import deque, Counter, defaultdict
from functools import lru_cache
from itertools import permutations
from heapq import (
    heappush,
    heappop,
    heapreplace,
    heappushpop,
    heapify,
    merge,
    nlargest,
    nsmallest,
)
from statistics import mean, median, mode


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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


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

clcm = 1
for num in a:
    clcm = lcm(clcm, num)

tot = 0
for num in a:
    tot += clcm // num

print(int(tot % (1e9 + 7)))
Problem p03107 (python)

Fixed submission:
s = input()
leng = len(s)
zero = s.count('0')
one = s.count('1')
print(2*min(zero, one))

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

cnt = 0

while '01' in s or '10' in s:
    if '01' in s:
        s = s.replace('01','', 1)
        print(s,cnt)
        cnt += 1
        continue
    if '10' in s:
        s = s.replace('10','', 1)
        print(s,cnt)
        cnt += 1
        continue

print(cnt*2)
Problem p03250 (python)

Fixed submission:
l = [int(i) for i in input().split()]
# sort()は破壊的です
# sorted()は破壊的じゃないです
l.sort(reverse=True)
print(l[0]*10 + l[1] + l[2])

Buggy submission (verdict: Runtime Error):
l = [int(i) for i in input().split()]
# sort()は破壊的じゃないです
l = l.sort
print(l[0]*10 + l[1] + l[2])
Problem p02726 (python)

Fixed submission:
n, x, y = map(int, input().split())
ans = [0 for _ in range(n)]
for i in range(1, n+1):
    for j in range(i+1, n+1):
        ans[min(j-i, abs(i-x)+abs(j-y)+1)] += 1


for i in range(1, n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

n, x, y = map(int, input().split())
ma = [[0]*n for _ in range(n)]
for i in range(n-1):
    ma[i][i+1] = 1
    ma[i+1][i] = 1

ma[x-1][y-1] = 1
ma[y-1][x-1] = 1
a = csr_matrix(ma)
b = shortest_path(a)
ans = [0]*(n-1)
for i in range(n):
  l = b[i]
  for num in l:
    if num != 0:
    	ans[int(num)-1] += 1

for i in ans:
  print(i//2)
Problem p02831 (python)

Fixed submission:
import  fractions

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

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

print(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 p02862 (python)

Fixed submission:
from functools import reduce
x, y = map(int, input().split())
mod = pow(10,9)+7

min_value = min(x, y)
max_value = max(x, y)
#print(min_value, max_value)
dif_value = max_value - min_value
#print(dif_value)
a_value   = min_value - dif_value
a_num     = int(a_value*2*(1/3))
#print(a_value, a_num)
n = dif_value + a_num
r = int(a_num*0.5)
#print(n, r)

def nCr(n,r,DIV):
  if r<n-r:
    r=n-r
  if r==0:
    return 1
  f=lambda x,y:x*y%DIV
  X=reduce(f,range(n-r+1,n+1))
  Y=reduce(f,range(1,r+1))
  return X*pow(Y,DIV-2,DIV)%DIV

if a_value % 3 == 0:
    print(nCr(n, r, mod))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
mod = pow(10, 9) + 7
class Combination:
    def __init__(self, N):
        self.fac = [1] * (N + 1)
        for i in range(1, N + 1):
            self.fac[i] = (self.fac[i - 1] * i) % mod
        self.invmod = [1] * (N + 1)
        self.invmod[N] = pow(self.fac[N], mod - 2, mod)
        for i in range(N, 0, -1):
            self.invmod[i - 1] = (self.invmod[i] * i) % mod

    def calc(self, n, k):  # nCk
        return self.fac[n] * self.invmod[k] % mod * self.invmod[n - k] % mod

x, y = map(int, input().split())
left, right = 0, 0
a, b = max(x, y), min(x, y)

if (2*b - a) % 3 == 0:
    d, s = a - b, (2*b - a)//3
    p, q = d + s, s
    C = Combination(p+q)
    print(C.calc(p+q, q))
else:
    print(0)
Problem p02881 (python)

Fixed submission:
n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)

    # divisors.sort()
    return divisors

n_list = make_divisors(n)
n_ans = []

for i in range(0, len(n_list)-1, 2):
    n_ans.append(n_list[i]+n_list[i+1])

n_ans.sort()

print(n_ans[0]-2)

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

#約数
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

list_n = make_divisors(n)

a = len(list_n)
ans = []
for i in range(0, a, 2):
    ans.append(list_n[i]+list_n[i+1])

ans.sort()

print(ans[0]-2)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
set_A = set()
dp = [0]*n
mod = pow(10, 9) + 7

for _ in range(m):
    set_A.add(int(input()))

if 1 not in set_A:
    dp[0] = 1
if 2 not in set_A:
    dp[1] = 1 + dp[0]

for i in range(2, n):
    if i + 1 not in set_A:
        dp[i] += (dp[i-1] + dp[i-2])%mod

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
list_score = []
for _ in range(m):
    list_score.append(int(input()))

dp = [0] * (n + 1)
mod = pow(10, 9) + 7

dp[0] = 1
list_score.sort()
if list_score[0] == 1:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, n + 1):
    if i not in list_score:
        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= mod

print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
list_score = []
for _ in range(m):
    list_score.append(int(input()))

dp = [0] * (n + 1)
mod = pow(10, 9) + 7

dp[0] = 1
list_score.sort()
if list_score[0] == 1:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, n + 1):
    if i in list_score:
        continue
    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= mod

print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
list_score = set([int(input()) for _ in range(m)])

dp = [0] * (n + 1)
mod = pow(10, 9) + 7

dp[0] = 1
if list_score[0] == 1:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, n + 1):
    if i in list_score:
        continue
    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= mod

print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
list_score = []
for _ in range(m):
    list_score.append(int(input()))

dp = [0]*(n+1)
mod = pow(10, 9) + 7

dp[0] = 1
if list_score[0] == 1:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, n+1):
    if i in list_score:
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
list_score = []
for _ in range(m):
    list_score.append(int(input()))

dp = [0]*(n+1)
mod = pow(10, 9) + 7

dp[0] = 1
if list_score[0] == 1:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, n+1):
    if i in list_score:
        continue
    dp[i] = dp[i-1] + dp[i-2]

print(dp[n]%mod)
Problem p03127 (python)

Fixed submission:
import fractions

n = int(input())
list_A = list(map(int, input().split()))
ans = fractions.gcd(list_A[0], list_A[1])
for i in range(2, n):
    ans = fractions.gcd(ans, list_A[i])

print(ans)

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

ans = 0
min_value = max(list_A)
for s in list_A:
    if s % 2 == 1:
        ans = 1
        break
    if s <= min_value:
        min_value = s
        ans = s
if max(list_A) == min(list_A)
    ans = list_A[0]
print(ans)
Problem p03208 (python)

Fixed submission:
n, k = map(int, input().split())
list_H = [int(input()) for _ in range(n)]

list_H.sort()
ans = []

for i in range(n-k+1):
    ans.append(list_H[i+k-1]-list_H[i])

print(min(ans))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
list_H = [int(input()) for _ in range(n)]

list_H.sort()
ans = []

for i in range(n-k+1):
    ans.append(list_H[i+2]-list_H[i])

print(min(ans))
Problem p03252 (python)

Fixed submission:
from collections import Counter
s=input()
t=input()
list_S=Counter(s)
list_T=Counter(t)

if sorted(list_S.values()) == sorted(list_T.values()):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

st = list(zip(s, t))
st.sort(key=lambda x:x[1])
dic_ST = set()
ans = "Yes"

for i in range(len(s)-1):
    if st[i][1] == st[i+1][1]:
        if st[i][0] != st[i+1][0]:
            ans = "No"
        if st[i][0] in dic_ST:
            ans = " No"
    else:
        dic_ST.add(st[i][0])

if st[-2][1] == st[-1][1]:
    if st[-2][0] != st[-1][0]:
        ans = "No"
    if st[-1][0] in dic_ST:
        ans = " No"
else:
    dic_ST.add(st[-1][0])

print(ans)
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500000)
 
N = int(input())
ABC = [list(map(int, input().split())) for i in range(N-1)]
Q, K = map(int, input().split())
D = [0] * (N+1)
L = [[] for i in range(N+1)]
for a, b, c in ABC:
    L[a].append([b, c])
    L[b].append([a, c])
 
 
def dfs(n, np):
    for nc in L[n]:
        if nc[0] == np:
            continue
        else:
            D[nc[0]] = D[n] + nc[1]
            dfs(nc[0], n)
 
 
dfs(K, 0)
for i in range(Q):
    x, y = map(int, input().split())
    print(D[x] + D[y])

Buggy submission (verdict: Runtime Error):
n = int(input())
list_ABC = [list(map(int, input().split())) for i in range(n - 1)]
q, k = map(int, input().split())
list_XY = [ list(map(int,input().split(" "))) for i in range(q)]
D = [0] * (n + 1)
L = [[] for i in range(n + 1)]
for a, b, c in list_ABC:
    L[a].append([b, c])
    L[b].append([a, c])

def dfs(n, np):
    for ne in L[n]:
        if ne[0] == np:
            continue
        else:
            D[ne[0]] = D[n] + ne[1]
            dfs(ne[0], n)

dfs(k, 0)

for x, y in list_XY:
    print(D[x]+D[y])

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

n = int(input())
list_ABC = [ list(map(int,input().split(" "))) for i in range(n-1)]
q, k = map(int, input().split())
list_XY = [ list(map(int,input().split(" "))) for i in range(q)]

ma = [[0]*n for _ in range(n)]
for a, b, c in list_ABC:
    ma[a-1][b-1] = c
    ma[b-1][a-1] = c

a = csr_matrix(ma)
b = shortest_path(a, directed=False).astype(int)

for x, y in list_XY:
    print(b[x-1,k-1]+b[k-1,y-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

n = int(input())
list_ABC = [ list(map(int,input().split(" "))) for i in range(n-1)]
q, k = map(int, input().split())
list_XY = [ list(map(int,input().split(" "))) for i in range(q)]

ma = np.zeros((n,n), dtype=np.int16)
for a, b, c in list_ABC:
    ma[a-1, b-1] = c
    ma[b-1, a-1] = c

a = csr_matrix(ma)
b = dijkstra(a, directed=False).astype(int)

for x, y in list_XY:
    print(b[x-1, k-1]+b[k-1, y-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

n = int(input())
list_ABC = [ list(map(int,input().split(" "))) for i in range(n-1)]
q, k = map(int, input().split())
list_XY = [ list(map(int,input().split(" "))) for i in range(q)]

ma = np.zeros((n,n))
for a, b, c in list_ABC:
    ma[a-1, b-1] = c
    ma[b-1, a-1] = c

a = csr_matrix(ma)
b = dijkstra(a, directed=False).astype(int)

for x, y in list_XY:
    print(b[x-1, k-1]+b[k-1, y-1])
Problem p02571 (python)

Fixed submission:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(S: str, T: str):
    return len(T) - max(sum(s == t for s, t in zip(S[i:], T)) for i in range(len(S) - len(T) + 1))


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    print(f'{solve(S, T)}')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(S: str, T: str):
    return len(T) - max(sum(s == t for s, t in zip(S[i:], T)) for i in range(len(S) - len(T)))


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    print(f'{solve(S, T)}')


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

Fixed submission:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(r: int):
    return r*r


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    r = int(next(tokens))  # type: int
    print(f'{solve(r)}')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys
import numpy as np

INF = float('inf')


def solve(N: int, x: "List[int]", y: "List[int]"):
    def distance(x1, y1, x2, y2):
        return np.linalg.norm(np.array([x1, y1]) - np.array([x2, y2]))

    l = [[distance(x[i], y[i], x[j], y[j]) if j >
          i else 0 for j in range(N)] for i in range(N - 1)]

    return np.average([sum(l[r[i]][r[i+1]] if r[i] < r[i+1] else l[r[i+1]][r[i]] for i in range(N-1))
                       for r in its.permutations(range(N))])


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    print(f'{solve(N, x, y)}')


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

Fixed submission:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(N: int):
    def manhattan_distance(x1, y1, x2, y2):
        return abs(x1-x2) + abs(y1-y2)
    return min(manhattan_distance(1, 1, i, N//i) for i in range(1, int(math.sqrt(N))+1) if N % i == 0)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(f'{solve(N)}')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys
import numpy as np

INF = float('inf')


def solve(N: int):
    def manhattan_distance(x1, y1, x2, y2):
        return abs(x1-x2) + abs(y1-y2)
    return min(manhattan_distance(1, 1, i, N//i) for i in range(1, int(math.sqrt(N))+1) if N % i == 0)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(f'{solve(N)}')


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

Fixed submission:
S = input()
T = input()
  
cnt = []
for i in range(len(S)-len(T)+1):
	mismatch = 0
	for j in range(len(T)):
		if S[i+j] != T[j]:
			mismatch += 1
	cnt.append(mismatch)
	
print(min(cnt))

Buggy submission (verdict: Runtime Error):
S, T = input().split("\n")

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

Buggy submission (verdict: Runtime Error):
S, T = input().split("\n")

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

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

cnt = 0
for i in range(len(S)-len(T)+1):
	if S[i] == T[0]:
		for j in 1 <= j <= len(T)+1:
			if S[i+j] != T[j]:
				cnt += 1

print(cnt)
Problem p02572 (python)

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

ans = 0
mod = 7 + 10**9

s = sum(A)
for i in range(N):
	s -= A[i]
	ans += s * A[i]
	ans %= mod

print(ans)

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

mod = 7 + 10**9
for i in A:
	A[i] %= mod
for j in range(N-1): 
	for	k in range(j+1, N):
		t = A[j] * A[k] 
		ans += t

ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
#N = int(input())
#A = list(map(int, input().split()))
n, a = input().split("\n")
N = int(n)
A = list(map(int, a.split()))

mod = 7 + 10**9
s = 0

for i in range(N-1): 
	for	j in range(i+1, N):
		t = A[i] * A[j] % mod
		s += t

ans = s % mod
print(ans)

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

for i in range(N-1): 
	for	j in range(i+1, N):
		t = A[i]*A[j] % (10**9+7)
		sum = sum(t)

print(sum)

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

for i in range(N-1) and j in range(i+1, N):
	t = A[i]*A[j] % (10**9+7)
	sum = sum(t)

print(sum)
Problem p02622 (python)

Fixed submission:
def solve(string):
    s, t = string.split()
    return str(len(s) - sum(_s == _t for _s, _t in zip(s, t)))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Buggy submission (verdict: Runtime Error):
def solve(string):
    s, t = string.split()
    return str(len(s) - sum(_s == _t for _s, _t in zip(s, t))                                                               pass


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
Problem p02712 (python)

Fixed submission:
def solve(string):
    return str(sum(i for i in range(int(string) + 1) if i % 3 > 0 and i % 5 > 0))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Buggy submission (verdict: Runtime Error):
def solve(string):
    return str(sum(i for i in range(n + 1) if i % 3 > 1 and i % 5 > 1))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
Problem p02847 (python)

Fixed submission:
def solve(string):
    l = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
    return str(7 - l.index(string.strip()))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read()))

Buggy submission (verdict: Runtime Error):
def solve(string):
    l = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
    return str(7 - l.index(string))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read()))
Problem p02860 (python)

Fixed submission:
def solve(string):
    n, s = string.split()
    n = int(n)
    return "Yes" if s[:n // 2] == s[n // 2:] else "No"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Buggy submission (verdict: Runtime Error):
def solve(string):
    n, s = string.split()
    n = int(n)
    return "Yes" if s[:n // 2] == s[n // 2:] else "No"


if __name__ == '__main__':
    print(solve(input()))
Problem p02935 (python)

Fixed submission:
def solve(string):
    n, *v = map(int, string.split())
    v = sorted(v, reverse=True)
    return str(sum(_v / 2**i for i, _v in enumerate(v[:-1], start=1)) + v[-1] / 2**(n - 1))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Buggy submission (verdict: Runtime Error):
N = int(input())
V = [float(v) for v in input().split()]
V.sort(revese=True)
for i in range(N):
    if len(V) == 1:
        print(V[0])
        exit()
    v1 = V.pop()
    v2 = V.pop()
    V.append((v1 + v2) / 2)

Buggy submission (verdict: Runtime Error):
def solve(string):
    n, *v = map(int, string.split())
    v = sorted(v, reverse=True)
    return str(sum(_v / 2**i for i, _v in enumerate(v[:-1], start=1)) + v[-1] / 2**(n - 1))


if __name__ == '__main__':
    print(solve(input()))
Problem p02959 (python)

Fixed submission:
def solve(string):
    n, *ab = map(int, string.split())
    a, b = ab[:n + 1], ab[n + 1:]
    _sum = sum(a)
    for i, _b in enumerate(b[::-1]):
        if a[n - i] < _b:
            _b -= a[n - i]
            a[n - i] = 0
            a[n - i - 1] = max(0, a[n - i - 1] - _b)
        else:
            a[n - i] -= _b
    return str(_sum - sum(a))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(2)])))

Buggy submission (verdict: Runtime Error):
def solve(string):
    n, *ab = map(int, string.split())
    a, b = ab[:n + 1], ab[n + 1:]
    _sum = sum(a)
    for i, _b in enumerate(b[::-1]):
        if a[n - i] < _b:
            _b -= a[n - i]
            a[n - i] = 0
            a[n - i - 1] = max(0, a[n - i - 1] - _b)
        else:
            a[n - i] -= _b
    return str(_sum - sum(a))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(n)])))