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

Fixed submission:
from functools import reduce

MOD = 1000000000 + 7
LETTERS = ["A", "C", "G", "T"]
PROHIBIT = ["AGC", "ACG", "GAC", "AGGC", "AGTC", "ATGC"]

def main():
    n = int(input().strip())

    table = {}

    for first in LETTERS:
        for second in LETTERS:
            for third in LETTERS:
                codon = first+second+third
                if not codon in PROHIBIT:
                    table[codon] = [1]

    for i in range(n-3):
        for codon in table.keys():
            table[codon].append(0)

        for codon in table.keys():
            for append in LETTERS:
                three_letters = codon[1:] + append
                four_letters = codon + append

                if (not four_letters in PROHIBIT) and (not three_letters in PROHIBIT):
                    table[three_letters][i+1] = (table[three_letters][i+1] + table[codon][i]) % MOD

    print(reduce(lambda acc, x: (acc + x[-1]) % MOD, table.values(), 0))

if __name__ == "__main__":
    main()

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

MOD = 1_000_000_000 + 7
LETTERS = ["A", "C", "G", "T"]
PROHIBIT = ["AGC", "ACG", "GAC", "AGGC", "AGTC", "ATGC"]

def main():
    n = int(input().strip())

    table = {}

    for first in LETTERS:
        for second in LETTERS:
            for third in LETTERS:
                codon = first+second+third
                if not codon in PROHIBIT:
                    table[codon] = [1]

    for i in range(n-3):
        for codon in table.keys():
            table[codon].append(0)

        for codon in table.keys():
            for append in LETTERS:
                three_letters = codon[1:] + append
                four_letters = codon + append

                if (not four_letters in PROHIBIT) and (not three_letters in PROHIBIT):
                    table[three_letters][i+1] = (table[three_letters][i+1] + table[codon][i]) % MOD

    print(reduce(lambda acc, x: (acc + x[-1]) % MOD, table.values(), 0))

if __name__ == "__main__":
    main()
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())
count=0
while(H > 0):
    H -= A
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = list(map(int, input().split()))
atk = 0
for i in A:
    atk += i
if H > atk:
    print("No")
else:
    print("Yes")
Problem p02784 (python)

Fixed submission:
H, N = map(int, input().split())
A = list(map(int, input().split()))
atk = 0
for i in A:
    atk += i
if H > atk:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
210 5
31 41 59 26 53
Problem p02801 (python)

Fixed submission:
strlist = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
print(strlist[strlist.index(input()) + 1])

Buggy submission (verdict: Runtime Error):
strlist = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y"]
print(strlist[strlist.index(input()) + 1])
Problem p02811 (python)

Fixed submission:
K, X = map(int,input().split())
if 500 * K >= X:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
K, X = map(int,input().split())
if 500 * K => X:
    print("Yes")
else:
    print("No")
Problem p02921 (python)

Fixed submission:
weather1 = input()
weather2 = input()
match = 0
for i in range(0,3):
    if weather1[i] == weather2[i]:
        match += 1
print(match)

Buggy submission (verdict: Runtime Error):
weather1 = input().split()
weather2 = input().split()
match = 0
for i in range(0,2):
    if weather1[i] == weather2[i]:
        match += 1
print(match)

Buggy submission (verdict: Runtime Error):
weather1 = input().split()
weather2 = input().split()
match = 0
for i in range(0,2):
    if weather1[i] == weather2[i]:
        match += 1
print(count)

Buggy submission (verdict: Runtime Error):
weather1 = input().split()
weather2 = input().split()
match = 0
for i in range(0,2):
    if weather1[i] == weather2[i]:
        count += 1
print(count)
Problem p03316 (python)

Fixed submission:
num = input()
num2 = 0
for i in range(0, len(num)):
    num2 += int(num[i])
if int(num) % num2 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
num = int(input())
num2 = 0
for i in range(1, len(str(num))):
    num2 += int(str(num)[i])
if num % num2 == 0:
    print("Yes")
else:
    print("No")
Problem p04043 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a+b+c == 17:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a+b+c = 19:
    print("Yes")
else:
    print("No")
Problem p02696 (python)

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

if b > n:
    x = n
else:
    x = n // b * b - 1
answer = max(0, (a*x)//b - a*(x//b))

print(answer)

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

if b-1 > n:
    x = n
else:
    x = (n // (b-1)) * (b-1)
answer = max(0, (a*x)//b - a*(x//b))

print(answer)

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

answer = 0
if b-1 > n:
    x = n
else:
    x = (n // (b-1)) * (b-1)
answer = (a*x)//b - a*(x//b)

print(answer)
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
answer = 1
for _ in range(n):
    d += l[answer-1]
    if d > x:
        break
    answer += 1
print(answer)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
answer = 1
while True:
    d += l[answer-1]
    if d > x:
        break
    answer += 1
print(answer)
Problem p03061 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
answer = sorted(a)[1]
if n == 2:
    pass
else:
    for b in reversed(range(answer)):
        cnt = 2
        flag = True
        for i in range(n):
            if a[i] % answer != 0:
                cnt -= 1
            if cnt == 0:
                flag = False
                break
        if flag:
            break
        answer -= 1
print(answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
answer = sorted(a)[1]
for b in range(answer).reverse():
    cnt = 2
    flag = True
    for i in range(n):
        if a[i] % answer != 0:
            cnt -= 1
        if cnt == 0:
            flag = False
    if flag:
        break
    answer -= 1
print(answer)
Problem p03071 (python)

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

print(max(max(a,b)*2-1, a+b))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
pre = s[0]
max_cnt = 0
stack = []
cnt = 0
s += '2'
if pre == '0':
    k -= 1
    stack = [0, 0]

for a in s:
    if a == pre:
        cnt += 1
    else:
        if a == '1':
            k -= 1
        if k < 0:
            stack.pop(0)
        stack.append(cnt)
        cnt = 1
        pre = a
        max_cnt = max(max_cnt, sum(stack))

print(max_cnt)
Problem p03633 (python)

Fixed submission:
import sys
from collections import defaultdict, deque
from functools import reduce
import math

input = sys.stdin.readline

def chmax(a, b):
    if a > b:
        return a
    else:
        return b
    
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def main():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    print(lcm(*T))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict, deque
from functools import reduce
import math

input = sys.stdin.readline

def chmax(a, b):
    if a > b:
        return a
    else:
        return b

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def main():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    print(lcm(*T))


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

Fixed submission:
import numpy as np
n, m = map(int, input().split())
g = [input() for _ in range(n)]
maze = np.array(list(map(list, g)))

from collections import deque


def dfs(s, maze):
    H, W = maze.shape

    visited = np.array([[-1 for _ in range(W)] for _ in range(H)])
    visited[s[0]][s[1]] = 0

    actions = [(-1,0),(1,0),(0,-1),(0,1)]
    queue = deque([s])

    while queue:
        x,y = queue.popleft()
        for action in actions:
            nx = x + action[0]
            ny = y + action[1]
            if nx in range(H) and ny in range(W) and maze[(nx,ny)]=='.' and visited[(nx,ny)]==-1:
                visited[(nx,ny)] = visited[(x,y)] + 1
                queue.append((nx,ny))
    return np.max(visited)
    
ret = -1
H, W = maze.shape

for sx in range(H):
    for sy in range(W):
        if maze[sx][sy] == '.':
            ret = max(dfs((sx,sy), maze), ret)
print(ret)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
g = [input() for _ in range(n)]
maze = np.array(list(map(list, g)))

from collections import deque


def dfs(s, maze):
    H, W = maze.shape

    visited = np.array([[-1 for _ in range(W)] for _ in range(H)])
    visited[s[0]][s[1]] = 0

    actions = [(-1,0),(1,0),(0,-1),(0,1)]
    queue = deque([s])

    while queue:
        x,y = queue.popleft()
        for action in actions:
            nx = x + action[0]
            ny = y + action[1]
            if nx in range(H) and ny in range(W) and maze[(nx,ny)]=='.' and visited[(nx,ny)]==-1:
                visited[(nx,ny)] = visited[(x,y)] + 1
                queue.append((nx,ny))
    return np.max(visited)
    
ret = -1

for sx in range(H):
    for sy in range(W):
        if maze[sx][sy] == '.':
            ret = max(dfs((sx,sy), maze), ret)
print(ret)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
maze = []
for i in range(H):
    maze.append(list(input()))

import numpy as np    
from collections import deque

s = (2, 0)

def dfs(s, maze):
    H, W = maze.shape

    visited = np.array([[-1 for _ in range(W)] for _ in range(H)])
    visited[s[0]][s[1]] = 0

    actions = [(-1,0),(1,0),(0,-1),(0,1)]
    queue = deque([s])

    while queue:
        c = queue.popleft()
        for action in actions:
            nc = [0,0]
            nc[0] = c[0] + action[0]
            nc[1] = c[1] + action[1]
            if nc[0] in range(H) and nc[1] in range(W) and maze[tuple(nc)]=='.' and visited[tuple(nc)]==-1:
                visited[tuple(nc)] = visited[tuple(c)] + 1
                queue.append(nc)
    return np.max(visited)

ret = -1

for sx in range(H):
    for sy in range(W):
        if maze[sx][sy] == '.':
            ret = max(dfs((sx,sy), maze), ret)
print(ret)
Problem p03418 (python)

Fixed submission:
result = 0
N, K = list(map(int , input().split()))
for b in range(K + 1, N + 1):
    result += (N // b) * (b - K) + max(N - (N // b) * b - max(K - 1, 0), 0)
print(result)

Buggy submission (verdict: Runtime Error):
result = 0
for b in range(K + 1, N + 1):
    result += (N // b) * (b - K) + max(N - (N // b) * b - max(K - 1, 0), 0)
print(result)
Problem p03436 (python)

Fixed submission:
H, W = map(int,input().split())
s = []
black = 0
for i in range(H):
    tmp = list(input())
    s.append(tmp)
    for j in range(W):
        if tmp[j] == "#":
            black += 1
white = H*W - black
 
 
q = [(0,0,0)]
s[0][0] = "#"
while q:
    i, j, cnt = q.pop(0)
    for di, dj in [(1,0),(0,1),(-1,0),(0,-1)]:
        ni, nj = i+di, j+dj
        if ni == H-1 and nj == W-1:
            print(white-cnt-2)
            exit(0)
        elif 0 <= ni < H and 0 <= nj < W and s[ni][nj] == ".":
            s[ni][nj] = "#"
            q.append((ni,nj,cnt+1))
print(-1)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = np.array([list(input()) for _ in range(H)])
s = np.pad(s, 1, "constant")
white = (s == ".").sum()
q = [(0, 1, 1)]

goal = False
s[1][1] = '#'
while q:
    d, x, y = q.pop(0)
    if x ==H and y == W :
        print(white - (d + 1))
        goal = True
    for dx, dy in [[0,1], [0, -1], [1,0], [-1,0]]:
        x = x + dx
        y = y + dy
        if s[x][y] == '.':
            s[x][y] = '#'
            q.append((d+1, x, y))
if not goal:
    print(-1)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = np.array([list(input()) for _ in range(H)])
s = np.pad(s, 1, "constant")
white = (s == ".").sum()
q = [(0, 1, 1)]

while q:
    d, x, y = q.pop(0)
    if x ==H and y == W :
        print(white - (d + 1))
        exit()
    for dx, dy in [[0,1], [0, -1], [1,0], [-1,0]]:
        x = x + dx
        y = y + dy
        if s[x][y] == '.':
            s[x][y] = '#'
            q.append((d+1, x, y))
print(-1)
Problem p03449 (python)

Fixed submission:
import numpy as np

N = int(input())
a1 = list(map(int, input().split(' ')))
a2 = list(map(int, input().split(' ')))
count = np.zeros(N)
a = np.array([a1,a2])
for i in range(N):
    count[i] += a.T[i].sum()
    count[i] += a[0][:i].sum()
    count[i] += a[1][i+1:].sum() if i+1 < N else 0
print(int(count.max()))

Buggy submission (verdict: Runtime Error):
N = int(input())
a1 = list(map(int, input().split(' ')))
a2 = list(map(int, input().split(' ')))
count = np.zeros(N)
a = np.array([a1,a2])
for i in range(N):
    count[i] += a.T[i].sum()
    count[i] += a[0][:i-1].sum() if i-1 >=0 else 0
    count[i] += a[1][i:].sum()
print(int(count.max())
Problem p03633 (python)

Fixed submission:
import fractions
from functools import reduce
 
  
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
def lcm_list(numbers):
    return reduce(lcm, numbers)
 
N = int(input())
 
t = []
for _ in range(N):
  t.append(int(input()))
 
print(lcm_list(t))

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


def lcm_list(numbers):
    return reduce(fractions.lcm, numbers)

N = int(input())

t = []
for _ in range(N):
  t.append(int(input()))

print(lcm_list(t))
Problem p03777 (python)

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

if a == b:
  print('H')
else:
  print('D')

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

if a == b:
  print('H')
else:
  print('D')

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

if a == b:
  print('H')
else:
  print('D')
Problem p02717 (python)

Fixed submission:
a, b, c = input().split()
print(c + ' ' + a + ' ' + b)

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()
print(c + ' ' + a + ' '

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()
print(f'{c} {a} {b}')
Problem p03251 (python)

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

x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(X)
y.append(Y)

x.sort(reverse=True)
y.sort()

if x[0] < y[0]:
    print("No War")
else:
    print("War")

Buggy submission (verdict: Runtime Error):
N = int(input())
M = int(input())
X = int(input())
Y = int(input())

x = [input() for i in range(N)]
y = [input() for i in range(M)]

x.sort(reverse=True)
y.sort()

if x[0] < y[0]:
    print("No War")
else:
    print("War")
Problem p02732 (python)

Fixed submission:
import collections
import math


if __name__ == '__main__':
    N= int(input())
    a = list(map(int, input().split()))
    c = collections.Counter(a)
    result = 0
    for i in set(a):
        # c[i]の中から2個選ぶ
        result += (c[i]*(c[i]-1))/2

    for i in a:
        d = c[i]
        print(int(result - (d*(d-1))/2 + ((d-1)*(d-2))/2))

Buggy submission (verdict: Runtime Error):
import collections
import math

# 組み合わせ算出
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if __name__ == '__main__':
    N= int(input())
    a = list(map(int, input().split()))
    c = collections.Counter(a)
    result = 0
    for i in set(a):
        result += combinations_count(c[i], 2)

    for i in a:
        d = c[i]
        print(result -  combinations_count(d, 2) + combinations_count(d-1, 2))

Buggy submission (verdict: Runtime Error):
import math

# 組み合わせ算出
def combinations_count(n, r):
    if n == 1:
        return 0
    if n == 0:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if __name__ == '__main__':

    N= int(input())

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

    for i in range(N):
        total = 0

        b = a[:i] + a[i+1:]

        c = collections.Counter(b)

        for j in set(a):

            total = total + combinations_count(c[j], 2)

        print(total)
Problem p02755 (python)

Fixed submission:
import math

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

ans =  -1

for i in range(2000):
    if math.floor(i * 0.08) == a and math.floor(i * 0.10) == b:
        ans = i
        break

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
import math

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

# a =< x < a + 1:
min_a = math.ceil(a/0.08)

max_a = (a+1)/0.08

min_b = math.ceil(b/0.10)

max_b = (b+1)/0.10

ans_list = []

flag = True

while(min_a =< max_a):
    ans_list.append(min_a)
    min_a += 1
while(min_b =< max_b):
    ans_list.append(min_b)
    min_b += 1
ans_list.sort()
ans = Counter(ans_list)
for i in ans:
    if ans[i] > 1:
        print(i)
        flag = False
        break
if flag:
    print(-1)

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

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

# a =< x < a + 1:
min_a = int(a/0.08)

max_a = int((a+1)/0.08)

min_b = int(b/0.10)

max_b = int((b+1)/0.10)

ans_list = []

while(min_a < max_a):
    ans_list.append(min_a)
    min_a += 1
while(min_b < max_b):
    ans_list.append(min_b)
    min_b += 1
ans_list.sort()
ans = Counter(ans_list)
for i in ans:
    if ans[i] > 1:
        print(i)
        flag = False
        break
if flag:
    print(-1)
Problem p02811 (python)

Fixed submission:
a,b=map(int,input().split())
 
if (500*a >= b):
  print("Yes")
else:
  print("No")

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

if (500*a => b):
  print("Yes")
else:
  print("No")
Problem p02717 (python)

Fixed submission:
X,Y,Z= input().split()
d=X
a=Y
b=d
d=a
a=Z
c=d

print(a, b, c)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
S=sum(a)
p=0
for i in range(n):
       if a[i]>=S/(4*m):
              p+=1
if p>=m:
       print("Yes")
else:
       print("No")

Buggy submission (verdict: Runtime Error):
s= input().split(' ')
s[0]=X
s[1]=Y
s[2]=Z
d=X
a=Y
b=d
d=a
a=c
c=d

print(a, b, c)
Problem p02761 (python)

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

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1
if l[0] == 0:
    if n != 1:
        r = False
        
for i in range(1, n):
    if l[i] == -1:
        l[i] = 0
        
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1

for i in range(1, n+1):
    if l[i] == -1:
        l[i] = 0
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1

for i in range(1, 3):
    if l[i] == -1:
        l[i] = 0
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)
Problem p02973 (python)

Fixed submission:
import bisect
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(input())
now = [-A[0]]
 
for i in range(1, N):
 
    index = bisect.bisect_right(now, -A[i])
    if index == len(now):
        now.append(-A[i])
    else:
        now[index] = -A[i]
print(len(now))

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(input())
now = [-A[0]]
 
for i in range(1, N):
 
    index = bisect.insort_right(now, -A[i])
    if index == len(now):
        now.append(-A[i])
    else:
        now[index] = -A[i]
 
print(len(now))
Problem p03434 (python)

Fixed submission:
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab == False:
    alice += i
    ab = True
  else:
    bob += i
    ab = False
    
print(alice - bob)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab == False:
	alice += i
    ab = True
  else:
    bob += i
    ab = False
    
print(alice - bob)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab = False:
	alice += i
  else:
    bob += i
    
print(alice - bob)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if a % 2 == 1 and b % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
if a % 2 == 1 and b % 2 == 1:
  print("Odd")
else:
  print("Even")
Problem p04031 (python)

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

mn = min(l)
mx = max(l)

ms = 10**9
for j in range(mn, mx+1):
    s = sum([(i-j)**2 for i in l])
    ms = min(ms, s)
    
print(ms)

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

mn = min(l)
mx = max(l)

ms = 10**9
ll = [0]*n
for j in range(mn, mx+1):
  	for i in range(n):
      ll[i] = (l[i] - j)**2
    s = sum(ll)
    ms = min(ms, s)
    
print(ms)
Problem p02705 (python)

Fixed submission:
import math

r  = int(input())
print(math.pi * 2 * r)

Buggy submission (verdict: Runtime Error):
r  = int(input())
print(math.pi * 2 * r)
Problem p02756 (python)

Fixed submission:
S = input()
q = int(input())
head = ""
tail = ""
rev_cnt = 1
for ind in range(q):
    cur_list = list(input().split())
    #print(cur_list)
    if int(cur_list[0]) == 1:
        rev_cnt *= -1
    else:
        f = int(cur_list[1])
        c = cur_list[2]
        if f == 1:
            if rev_cnt == 1:
                head += c
            else:
                tail += c
        elif f == 2:
            if rev_cnt == 1:
                tail += c
            else:
                head += c
            
S = head[::-1] + S + tail   
if rev_cnt == -1:
    S = S[::-1]
    
print("".join(S))

Buggy submission (verdict: Runtime Error):
S = list(input().split())
q = int(input())
d = deque(S)
rev_cnt = 0
for ind in range(q):
    cur_list = list(input().split())
    #print(cur_list)
    if int(cur_list[0]) == 1:
        rev_cnt += 1
    else:
        f = int(cur_list[1])
        c = cur_list[2]
        if (rev_cnt + f) % 2 == 0:
            d.append(c)
        else:
            d.appendleft(c)         
S = list(d)
if rev_cnt %2 == 1:
    S.reverse()
print("".join(S))
Problem p02724 (python)

Fixed submission:
X = int(input())
 
num_500 = X // 500
num_5 = (X - (X // 500) * 500 ) // 5
 
print(1000*num_500 + 5 * num_5)

Buggy submission (verdict: Runtime Error):
X = map(int, input())

num_500 = X // 500
num_5 = (X - (X // 500)*500 ) % 5

print(1000*num_500 + 5 * num_5)

Buggy submission (verdict: Runtime Error):
X = map(int, input())

happy = ((X // 500) * 1000 ) + ((X % 5) * 5)
print(happy)