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

Fixed submission:
from collections import deque

N, M = map(int, input().split())

A = [[] for _ in range(N)]
for i in range(M):
    Am, Bm = map(int, input().split())
    Am -= 1
    Bm -= 1
    A[Am].append(Bm)
    A[Bm].append(Am)


is_visited = [False for _ in range(N)]
ans = [0 for _ in range(N)]
def bfs():
    queue = deque()
    queue.append(0)
    is_visited[0] = True
    while queue:
        pos = queue.popleft()
        for next_pos in A[pos]:
            if is_visited[next_pos] == False:
                is_visited[next_pos] = True
                queue.append(next_pos)
                ans[next_pos] = pos

bfs()

if False in is_visited:
    print("No")
else:
    print("Yes")
    for i in range(N-1):
        print(ans[i+1]+1)

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

N, M = map(int, input().split())

A = [[] for _ in range(M)]
for i in range(M):
    Am, Bm = map(int, input().split())
    Am -= 1
    Bm -= 1
    A[Am].append(Bm)
    A[Bm].append(Am)


is_visited = [False for _ in range(N)]
ans = [0 for _ in range(N)]
def bfs():
    queue = deque()
    queue.append(0)
    is_visited[0] = True
    while queue:
        pos = queue.popleft()
        for next_pos in A[pos]:
            if is_visited[next_pos] == False:
                is_visited[next_pos] = True
                queue.append(next_pos)
                ans[next_pos] = pos

bfs()

if False in is_visited:
    print("No")
else:
    print("Yes")
    for i in range(N-1):
        print(ans[i+1]+1)

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

N, M = map(int, input().split())

A = [[] for _ in range(M)]
for i in range(M):
    Am, Bm = map(int, input().split())
    Am -= 1
    Bm -= 1
    A[Am].append(Bm)
    A[Bm].append(Am)


is_visited = [False for _ in range(N)]
ans = [0 for _ in range(N)]
def bfs():
    queue = deque()
    queue.append(0)
    is_visited[0] = True
    while queue:
        pos = queue.popleft()
        for next_pos in A[pos]:
            if is_visited[next_pos] == False:
                is_visited[next_pos] = True
                queue.append(next_pos)
                ans[next_pos] = pos

bfs()
#print(is_visited)                                                                                     

if False in is_visited:
    print("No")
else:
    for i in range(N-1):
        print(ans[i+1]+1)
Problem p02741 (python)

Fixed submission:
K = int(input())

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


print (A[K-1])

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

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]


print A[K-1]
Problem p02743 (python)

Fixed submission:
import numpy as np

a, b, c = map(int, raw_input().split())

if b > a:
    temp = a
    a = b
    b = temp

res = c - a
res = res - b
temp = 4*a*b


if res <0:
    print "No"
elif res**2 > temp:
    print "Yes"
else:
    print "No"

Buggy submission (verdict: Runtime Error):
    a, b, c = map(int, input().split())
     
    if b > a:
        temp = a
        a = b
        b = temp
     
    res = c - a
    res = res - b
    temp = 4*a*b
     
    if res**2 > temp:
        print ("Yes")
    else:
        print ("No")

Buggy submission (verdict: Runtime Error):
File Edit Options Buffers Tools Python Help                                                                            
import numpy as np

a, b, c = map(int, raw_input().split())

if b > a:
    temp = a
    a = b
    b = temp

res = c - a
res = res - b
temp = 4*a*b

if res**2 > temp:
    print "Yes"
else:
    print "No"
Problem p02744 (python)

Fixed submission:
N = int(raw_input())

char_list = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]

prev = ["a"]

for i in range(1, N):
    temp = []
    for item in prev:
        item_list = []
        for j in range(len(item)):
            item_list.append(item[j])
        num_char = len(set(item_list))
        for j in range(num_char+1):
            temp.append(item+char_list[j])

    prev = temp


print ' '.join(map(str, prev))

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

if b > a:
    temp = a
    a = b
    b = temp

res = c - a
res = res - b
temp = 4*a*b

if res**2 > temp:
    print ("Yes")
else:
    print ("No")
Problem p02803 (python)

Fixed submission:
import Queue
import copy

def main():
    H, W = map(int, raw_input().split())
    S = []

    for i in range(H):
        S.append(list(raw_input()))


    def bfs(start, S2):
        q = Queue.Queue()
        q.put(start)
        candidates = [[0, 1], [1, 0], [0, -1], [-1, 0]]
        dist = [[0]*W for _ in range(H)]
        S2[start[0]][start[1]] = "#"
        while not q.empty():
            i = q.get()
            x = i[0]
            y = i[1]

            for candi in candidates:
                x_new = x + candi[0]
                y_new = y + candi[1]

                if x_new < H and x_new >= 0:
                    if y_new < W and y_new >=0:
                        if S2[x_new][y_new] == ".":
                            dist[x_new][y_new] = dist[x][y] + 1
                            S2[x_new][y_new] = "#"
                            q.put([x_new, y_new])

        ans = 0
        for i in range(H):
            ans = max(ans, max(dist[i]))

        return ans

    ans = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                S2 = copy.deepcopy(S)
                ans_temp = bfs([i, j], S2)
#                print i, j, ans_temp                                                                                                                     
                ans = max(ans, ans_temp)


    print ans


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
mport Queue
import copy

def main():
    H, W = map(int, raw_input().split())
    S = []

    for i in range(H):
        S.append(list(raw_input()))


    def bfs(start, S2):
        q = Queue.Queue()
        q.put(start)
        candidates = [[0, 1], [1, 0], [0, -1], [-1, 0]]
        dist = [[0]*W for _ in range(H)]
        while not q.empty():
            i = q.get()
            x = i[0]
            y = i[1]
            S2[x][y] = "#"

            for candi in candidates:
                x_new = x + candi[0]
                y_new = y + candi[1]

                if x_new < H and x_new >= 0:
                    if y_new < W and y_new >=0:
                        if S2[x_new][y_new] == ".":
                            dist[x_new][y_new] = dist[x][y] + 1
                            q.put([x_new, y_new])

        ans = 0
        for i in range(H):
            ans = max(ans, max(dist[i]))

        return ans

    ans = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] == ".":
                S2 = copy.deepcopy(S)
                ans = max(ans, bfs([i, j], S2))

    print ans


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

Fixed submission:
X = int(raw_input())

nmax = 100000

array = [0]*(nmax+1)
array[0] = 1

value_list = [100,101,102,103,104,105]

for i in range(nmax+1):
    for value in value_list:
        if i - value >= 0:
            if array[i-value] == 1:
                array[i] = 1

print array[X]

Buggy submission (verdict: Runtime Error):
X = int(raw_input())

nmax = 100000

array = [0]*nmax
array[0] = 1

value_list = [100,101,102,103,104,105]

for i in range(nmax):
    for value in value_list:
        if i - value >= 0:
            if array[i-value] == 1:
                array[i] = 1

print array[X]
Problem p03145 (python)

Fixed submission:
x, y, z = map(int, raw_input().split())
print x*y/2

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, raw_input().split())
return x*z/2
Problem p03163 (python)

Fixed submission:
def main():

    N, W = map(int, raw_input().split())
    dp = [0]*(W+1)
 
    for i in xrange(N):
        w, v = map(int, raw_input().split())
        for j in xrange(W, w-1, -1):
            x = dp[j-w] + v
            if x > dp[j]:
                dp[j] = x
 
    print dp[-1]

main()

Buggy submission (verdict: Runtime Error):
, W = map(int, raw_input().split())
a = []
for i in range(N):
    a.append(map(int, raw_input().split()))

dp = [0]*(W+1)

for i in range(N):
    w = a[i][0]
    v = a[i][1]
    for j in range(W, w-1, -1):
        x = dp[j-w] + v
        if x > dp[j]:
            dp[j] = x

print dp[-1]
Problem p03164 (python)

Fixed submission:
def main():
    N, W =map(int, input().split())

    weights = []
    values = []
    for i in range(N):
        wi, vi =map(int, input().split())
        weights.append(wi)
        values.append(vi)

    sum_v = sum(values)

    INF = 10**9+7

    dp = [[INF]*(sum_v+1) for _ in range(N+1)]
    dp[0][0] = 0


    for i in range(N):
        wi = weights[i]
        vi = values[i]
        for j in range(sum_v+1):
            if j < vi:
                dp[i+1][j] = dp[i][j]
            else:
                dp[i+1][j] = min(dp[i][j], dp[i][j-vi]+ wi)

    for j in range(sum_v+1):
        if dp[N][j] <= W:
            ans = j

    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():

    N, W = map(int, raw_input().split())
    dp = [0]*(W+1)
 
    for i in xrange(N):
        w, v = map(int, raw_input().split())
        for j in xrange(W, w-1, -1):
            x = dp[j-w] + v
            if x > dp[j]:
                dp[j] = x
 
    print dp[-1]

main()
Problem p02783 (python)

Fixed submission:
h,a = map(int,input().split())
c = 0
while(True):
    h = h - a
    if(h <= 0):
        c += 1
        break

    c += 1

print(c)

Buggy submission (verdict: Runtime Error):
h = int(input())
li = []
li.append(h)
c=1
while(h >  1):
    h= int(h/2)
    for i in range(2**c):   #計算量がクソ多くなる
        li.append(h)
    c += 1

#print(li)
print(len(li))
Problem p02861 (python)

Fixed submission:
import itertools

if __name__ == '__main__':

    n = int(input())
 

    town = [[]for i in range(n)]

    for i in range(n):
        x,y = map(int,input().split()) 
        town[i].append(x)
        town[i].append(y)
    

    p = [i for i in range(n)]
  

    p_list = list(itertools.permutations(p))

    total = 0
    for i in range(len(p_list)):
        sum = 0
    
        for j in range(n-1):
            x1,y1 = int(town[p_list[i][j]][0]), int(town[p_list[i][j]][1])
            x2,y2 = int(town[p_list[i][j+1]][0]), int(town[p_list[i][j+1]][1])
    
            sum = sum + ((x2-x1)**2+(y2-y1)**2)**0.5
       

        total = total + sum
       

    
    print(total/float(len(p_list)))

Buggy submission (verdict: Runtime Error):
import itertools

if __name__ == '__main__':

    n = int(input())
    town =[input() for i in range(n)]

    p = [i for i in range(n)]
  

    p_list = list(itertools.permutations(p))

    total = 0
    for i in range(len(p_list)):
        sum = 0
    
        for j in range(n-1):
            x1,y1 = int(town[p_list[i][j]][0]), int(town[p_list[i][j]][2])
            x2,y2 = int(town[p_list[i][j+1]][0]), int(town[p_list[i][j+1]][2])
    
            sum = sum + ((x2-x1)**2+(y2-y1)**2)**0.5
       

        total = total + sum
       

    
    print(total/float(len(p_list)))

Buggy submission (verdict: Runtime Error):
import itertools

if __name__ == '__main__':

    n = int(input())
    town =[input() for i in range(n)]

    p = [i for i in range(n)]
  

    p_list = list(itertools.permutations(p))

    distance = []

    total = 0
    for i in range(len(p_list)):
        sum = 0
    
        for j in range(n-1):
            x1,y1 = int(town[p_list[i][j]][0]), int(town[p_list[i][j]][2])
            x2,y2 = int(town[p_list[i][j+1]][0]), int(town[p_list[i][j+1]][2])
    
            sum = sum + ((x2-x1)**2+(y2-y1)**2)**0.5
       

        total = total + sum
       
	print(total/len(p_list))
Problem p02953 (python)

Fixed submission:
from sys import stdin

N = int(stdin.readline().rstrip())
h_lst = [int(x) for x in stdin.readline().rstrip().split()][::-1]

if len(h_lst) < 1:
  print("Yes")
else:
  f = "Yes"
  prev = h_lst[0]
  for i in h_lst[1:]:
    if prev - i >= 0:
      prev = i
    elif prev - i == -1:
      prev = i - 1
    else:
      f = "No"
      break

print(f)

Buggy submission (verdict: Runtime Error):
from sys import stdin

N = int(stdin.readline().rstrip())
h_lst = [int(x) for x in stdin.readline().rstrip().split()][::-1]

if len(h_lst) == 1:
  print("Yes")
else:
  f = "Yes"
  prev = h_lst[0]
  for i in h_lst[1:]:
    if prev - i >= 0:
      prev = i
    elif prev - i == -1:
      prev = i - 1
    else:
      f = "No"
      break

print(f)
Problem p03260 (python)

Fixed submission:
from sys import stdin

A,B = [int(x) for x in stdin.readline().rstrip().split()]

if(A*B % 2 == 0): print('No')
else: print('Yes')

Buggy submission (verdict: Runtime Error):
from sys import stdin

def gcd(a, b):
	while b: a, b = b, a % b
	return a

N, X = [int(x) for x in stdin.readline().rstrip().split()]
x_lst = sorted(set([abs(int(x)-X) for x in stdin.readline().rstrip().split()]))

if len(x_lst) == 1:
  print(x_lst[0])
else:
  prev_x = x_lst[0]
  for x in x_lst[1:]:
    prev_x = gcd(prev_x, x)
    if prev_x == 1: break
  print(prev_x)
Problem p03006 (python)

Fixed submission:
from collections import Counter
n = int(input())
list_ = [tuple(map(int, input().split())) for i in range(n)]
list_.sort()

if n == 1:
    print(1)
else:
    ab = []
    for i in range(len(list_)-1):
        x_1, y_1 = list_[i]
        
        for j in range(i+1, len(list_)):
            x_2, y_2 = list_[j]
            a = x_2 - x_1
            b = y_2 - y_1
            ab.append((a, b))

    p, q = Counter(ab).most_common()[0][0]

    res = 0
    while len(list_):
        res += 1
        x, y = list_.pop(0)
        while True:
            if (x+p, y+q) in list_:
                list_.remove((x+p, y+q))
                x, y = x+p, y+q
            else:
                break

    print(res)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
list_ = [tuple(map(int, input().split())) for i in range(n)]
list_.sort()

ab = []
for i in range(len(list_)-1):
    x_1, y_1 = list_[i]
    
    for j in range(i+1, len(list_)):
        x_2, y_2 = list_[j]
        a = x_2 - x_1
        b = y_2 - y_1
        ab.append((a, b))

p, q = Counter(ab).most_common()[0][0]

res = 0
while len(list_):
    res += 1
    x, y = list_.pop(0)
    while True:
        if (x+p, y+q) in list_:
            list_.remove((x+p, y+q))
            x, y = x+p, y+q
        else:
            break

print(res)
Problem p03111 (python)

Fixed submission:
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
inf = 10**4

def bamboo_connect(i, a, b, c):
    if i == N:
        if all((a, b, c)):
            return abs(a-A) + abs(b-B) + abs(c-C) - 30
        else:
            return inf
    no_connect = bamboo_connect(i+1, a, b, c)
    choice_a = bamboo_connect(i+1, a+l[i], b, c) + 10
    choice_b = bamboo_connect(i+1, a, b+l[i], c) + 10
    choice_c = bamboo_connect(i+1, a, b, c+l[i]) + 10
    return min(no_connect, choice_a, choice_b, choice_c)

print(bamboo_connect(0, 0, 0, 0))

Buggy submission (verdict: Runtime Error):
N, A, B, C = map(int, input().split())
l = [int(input() for i in range(n))]
inf = 10**4

def bamboo_connect(i, a, b, c):
    if i == N:
        if all(a, b, c):
            return abs(a-A) + abs(b-B) + abs(c-C) - 30
        else:
            return inf
    no_connect = bamboo_connect(i+1, a, b, c)
    choice_a = bamboo_connect(i+1, a+l[i], b, c) + 10
    choice_b = bamboo_connect(i+1, a, b+l[i], c) + 10
    choice_c = bamboo_connect(i+1, a, b, c+l[i]) + 10
    return min(no_connect, choice_a, choice_b, choice_c)

print(bamboo_connect(0, 0, 0, 0))
Problem p03210 (python)

Fixed submission:
print('YES' if input() in ['3', '5', '7'] else 'NO')

Buggy submission (verdict: Runtime Error):
n=[int(input()) for i in range(int(input()))]
print(sum(n) - max(n)//2)
Problem p03262 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

n, x = map(int, input().split())
town = map(int, input().split())

dist = map(lambda y: abs(x - y), town)
res = reduce(gcd, dist)
print(res)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while a > 0:
        if a < b:
            a, b = b, a
        a = a % b
    return b

n, x = map(int, input().split())
town = map(int, input().split())

distance = (abs(x-y) for y in town)
print(distance)
for d in distance:
    res = gcd(next(d), next(d))

print(res)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while a > 0:
        a, b = b, a%b
    return b

n, x = map(int, input().split())
town = list(map(int, input().split()))

res = abs(town[0] - x)
for t in town[1:]:
    d = abs(t - x)
    res = gcd(res, d)

print(res)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while a > 0:
        a = a % b
        a, b = b, a
    return b

n, x = map(int, input().split())
town = list(map(int, input().split()))

res = abs(town[0] - x)
for t in town[1:]:
    d = abs(t - x)
    res = gcd(res, d)

print(res)

Buggy submission (verdict: Runtime Error):
from math import gcd

n, x = map(int, input().split())
town = list(map(int, input().split()))

res = abs(town[0] - x)
for t in town[1:]:
    d = abs(t - x)
    res = gcd(res, d)

print(res)

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

n, x = map(int, input().split())
town = map(int, input().split())

dist = map(lambda y: abs(x - y), town)
res = reduce(gcd, dist)
print(res)

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

n, x = map(int, input().split())
town = map(int, input().split())

dist = map(lambda y: abs(x - y), town)
res = reduce(gcd, dist)
print(res)
Problem p03289 (python)

Fixed submission:
s = input()
if s[0] == 'A':
    s = s[1:]
    if s[1:-1].count('C') == 1:
        for char in s:
            if char != 'C' and char == char.upper():
                break
        else:
            print('AC')
            exit()
print('WA')

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == 'A':
    s = s[1:]
    if s[1:-2].cont('C') == 1:
        s.remove('C')
        if s == s.lower():
            print('AC')
            exit()
print('WA')
Problem p03338 (python)

Fixed submission:
n = int(input())
s = input()
list_ = []

for i in range(n):
    x = set(s[:i])
    y = set(s[i:])
    cnt = 0
    for j in x:
        if j in y:
            cnt += 1
    list_.append(cnt)

print(max(list_))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
list_ = []

for i in range(1, n-1):
    x = set(s[:i])
    y = set(s[i:])
    cnt = 0
    for j in x:
        if j in y:
            cnt += 1
    list_.append(cnt)

print(max(list_))
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
arr = range(a, b+1)
for i in sorted(set(arr[:k]) | set(arr[-k:])):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
arr = list(range(a, b+1))
for i in sorted(set(arr[:k]) | set(arr[-k:])):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
arr = list(range(a, b+1))
for i in sorted(set((arr[:k]+arr[-k:]))):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
arr = list(range(a, b+1))
for i in sorted(set(arr[:k]|arr[-k:])):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
arr = list(range(a, b+1))
for i in sorted(set(arr[:k]+arr[-k:])):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
arr = list(range(a, b+1))
for i in set(arr[:k]+arr[-k:]):
    print(i)
Problem p03475 (python)

Fixed submission:
n = int(input())
station = [tuple(map(int, input().split())) for _ in range(n-1)]

for i in range(n-1):
    res = 0
    for j in range(i, n-1):
        c, s, f = station[j]
        if res == 0:
            res += s + c
        else:
            res += max(s-res, ((res+(f-1))//f)*f - res) + c
    print(res)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
station = (tuple(map(int, input().split())) for _ in range(n-1))

for i in range(n):
    res = 0
    for j in range(i, n-1):
        c, s, f = station[j]
        res += max(s - res, (res+f-1)//f*f - res) + c
    print(res)
Problem p03477 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
print('Left' if a+b>c+d else 'Balanced' if a+b==c+d else 'Right')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input())
print('Left' if a+b>c+d else 'Balanced' if a+b==c+d else 'Right')
Problem p03607 (python)

Fixed submission:
n = int(input())

s = set()
for _ in range(n):
    s ^= {input()}

print(len(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]

s = set()
for a_ in a:
    s ^= a

print(len(s))
Problem p03679 (python)

Fixed submission:
x, a, b = map(int, input().split())
print('delicious' if a >= b else 'safe' if x >= b-a else 'dangerous')

Buggy submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
print('delicious' if a >= b else 'safe' x >= b-a else 'dangerous')

Buggy submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
print('delicious' if a >= b else 'safe' x >= b-1 else 'dangerous')
Problem p03711 (python)

Fixed submission:
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

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

if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

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

if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    print(Yes)
else:
    print(No)
Problem p03739 (python)

Fixed submission:
n = int(input())
arr = [0] + [int(x) for x in input().split()]

def exec(sign):
    a = [x for x in arr]
    res = 0

    x = 0
    for i in range(n):
        x += a[i]
        tmp = sign - (x + a[i+1])
        if sign < 0:
            tmp = min(tmp, 0)
        else:
            tmp = max(tmp, 0)
        res += abs(tmp)
        a[i+1] += tmp
        sign *= (-1)
    return res

print(min(exec(1), exec(-1)))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]

res = 0
x = 0
for i in range(n-1):
    x += a[i]
    sign = (x // abs(x)) * (-1)
    tmp = sign - (x + a[i+1])
    if sign < 0:
        tmp = min(tmp, 0)
    else:
        tmp = max(tmp, 0)
    res += abs(tmp)
    a[i+1] += tmp

print(res)
Problem p03796 (python)

Fixed submission:
ans=1
n=int(input())
for i in range(1,n+1):
    ans*=i
    ans=ans%(10**9+7)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 1
for i in range(n):
    ans *= i + 1
    asn %= (10**9 + 7)
print(ans)
Problem p03838 (python)

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

d = abs(abs(y) - abs(x))

if (x > 0 and y <= 0) or (x >= 0 and y < 0) or (x < 0 and y > 0):
    d += 1
elif x > y:
    d += 2

print(d)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
d = abs(abs(y) - abs(x))
if x // abs(x) == y // abs(y):
    if x > y:
        d += 2
else:
    d += 1

print(d)