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

Fixed submission:

def computeMinimumNoOfOperations(candies, x):
    noOfOperations = 0
    for i in range(len(candies) - 1):
        if (candies[i] > x):
            candiesToEat = candies[i] - x
            candies[i] -= candiesToEat
            noOfOperations += candiesToEat
        if (candies[i] + candies[i + 1] > x):
            candiesToEat = candies[i] + candies[i + 1] - x
            candies[i + 1] -= candiesToEat
            noOfOperations += candiesToEat 
    return noOfOperations


def start():
    n, x = list(map(int, input().split()))
    candies = list(map(int, input().split()))
    return computeMinimumNoOfOperations(candies, x)

print(start())

Buggy submission (verdict: Runtime Error):

def computeMinimumNoOfOperations(candies, x):
    noOfOperations = 0
    for i in range(len(candies) - 1):
        if (candies[i] > x):
          candiesTocandiesToEat = candies[i] - x
          candies[i] -= candiesTocandiesToEat
          noOfOperations += candiesToEat
        if (candies[i] + candies[i + 1] > x):
            candiesToEat = candies[i] + candies[i + 1] - x
            candies[i + 1] -= candiesToEat
            noOfOperations += candiesToEat 
    return noOfOperations


def start():
    n, x = list(map(int, input().split()))
    candies = list(map(int, input().split()))
    return computeMinimumNoOfOperations(candies, x)

print(start())

Buggy submission (verdict: Runtime Error):


def computeMinimumNoOfOperations(candies, x):
  noOfOperations = 0
  for i in range(0, len(candies) - 1):
    if (candies[i] > x):
      eat = candies[i] - x
      candies[i] -= eat
      noOfOperations += eat
    if (candies[i] + candies[i + 1] > x):
      if (candies[i] > candies[i + 1]):
        eat = candies[i] - x
      	candies[i] -= eat
      	noOfOperations += eat 
      else:
        eat = candies[i + 1] - x
      	candies[i + 1] -= eat
      	noOfOperations += eat 
  return noOfOperations


def start():
  n, x = list(map(int, input().split()))
  candies = list(map(int, input().split()))
  return computeMinimumNoOfOperations(candies, x)

print(start())
Problem p03023 (python)

Fixed submission:
i = int(input())
degree = 180 * (i - 2)
print(degree)

Buggy submission (verdict: Runtime Error):
i = int(input())
degree = 180 * (i - 2)
print(degree
Problem p03448 (python)

Fixed submission:
input_num = [int(input()) for i in range(4)]

coin_list = input_num[0:3]
result_yen = input_num[3]

count = 0

for yen_500 in range(coin_list[0]+1):
    for yen_100 in range(coin_list[1]+1):
        for yen_50 in range(coin_list[2]+1):
            if result_yen == yen_500*500 + yen_100*100 + yen_50 *50:
                count += 1
                
print(count)

Buggy submission (verdict: Runtime Error):
num_list = [int(input()) for i in range(3)]
result_yen = int(intput())

count = 0

for yen_500 in range(coin_list[0]):
    for yen_100 in range(coin_list[1]):
        for yen_50 in range(coin_list[2]):
            if result_yen == yen_500*500 + yen_100*100 + yen_50 *50:
                count += 1
                
print(count)

Buggy submission (verdict: Runtime Error):
num_list = [int(input()) for i in range(3)]
result_yen = int(intput())

count = 0

for yen_500 in range(coin_list[0]):
    for yen_100 in range(coin_list[1]):
        for yen_50 in range(coin_list[2]):
            if result_yen == yen_500*500 + yen_100*100 + yen_50 *50:
                count += 1
                
print(count)
Problem p03455 (python)

Fixed submission:
input_nums = input().split()

product = 1

for num in input_nums:
  product = product * int(num)
  
if(product % 2 == 0):
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
input_nums = input().split()

product = 1

for num in input_nums:
  product = product * num
  
if(product % 2 == 0):
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
input_nums = input().split()

product = 1

for num in lnput_nums:
  product = product * num
  
if(product % 2 == 0):
  print('Even')
else:
  print('Odd')

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

if s[0] * s[0] % 2 == 0:
  print('Even')
else:
  print('Odd')
Problem p03026 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

n = int(input())
edges = [[] for _  in range(n)]

for _ in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

height = [None for _ in range(n)]
root = 0
height[root] = 0

def build(node):
    for to in edges[node]:
        if height[to] == None:
            height[to] = height[node] + 1
            build(to)

build(root)

enum = [(-h, i) for i, h in enumerate(height)]
enum.sort()

tree = [None] * n
clst = sorted(map(int, input().split()))

for c, hi in zip(clst, enum):
    h, i = hi
    tree[i] = c

print(sum(clst[:-1]))
print(*tree)

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

for _ in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

height = [None for _ in range(n)]
root = 0
height[root] = 0

def build(node):
    for to in edges[node]:
        if height[to] == None:
            height[to] = height[node] + 1
            build(to)

build(root)

enum = [(-h, i) for i, h in enumerate(height)]
enum.sort()

score = 0
tree = [None] * n
clst = sorted(map(int, input().split()))

for c, hi in zip(clst, enum):
    h, i = hi
    tree[i] = c

print(sum(clst[:-1]))
print(*tree)
Problem p03142 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
revEdges = [[] for _ in range(n)]
for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    revEdges[b].append(a)

visited = [False] * n
lst = []
def search(x):
    if not visited[x]:
        visited[x] = True
        for to in edges[x]:
            search(to)
        lst.append(x)

for i in range(n):
    search(i)
lst.reverse()
dic = {}
for i in range(n):
    dic[lst[i]] = i

parent = [-1] * n
for i in lst:
    if not revEdges[i]:
        continue
    maxScore = -1
    index = -1
    for fr in revEdges[i]:
        if maxScore <= dic[fr]:
            maxScore = dic[fr]
            index = fr
    parent[i] = index

for i in range(n):
    print(parent[i] + 1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
revEdges = [[] for _ in range(n)]
for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    revEdges[b].append(a)

visited = [False] * n
lst = []
def search(x):
    if not visited[x]:
        visited[x] = True
        for to in edges[x]:
            search(to)
        lst.append(x)

for i in range(n):
    search(i)
lst.reverse()
dic = {}
for i in range(n):
    dic[lst[i]] = i

parent = [-1] * n
for i in lst:
    if not revEdges[i]:
        continue
    maxScore = n
    index = n
    for fr in revEdges[i]:
        if maxScore <= dic[fr]:
            maxScore = dic[fr]
            index = fr
    parent[i] = fr

for i in range(n):
    print(parent[i] + 1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
isRoot = [True] * n
for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    isRoot[b] = False

for i in range(n):
    if isRoot[i]:
        root = i
        break
INF = 10 ** 20
stack = [(root, -1, 0)]
height = [-INF] * n
parent = [None] * n
def search(stack):
    node, par, score = stack.pop()
    if score > height[node]:
        height[node] = score
        parent[node] = par
        for to in edges[node]:
            stack.append((to, node, score + 1))

while stack:
    search(stack)

for i in range(n):
    print(parent[i]
Problem p03157 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def main():
    h, w = map(int, input().split())
    mp = ["X" * (w + 2)] + ["X" + input() + "X" for _ in range(h)] + ["X" * (w + 2)]
    checked = [[False] * (w + 2) for _ in range(h + 2)]
    vec = ((1, 0), (0, -1), (-1, 0), (0, 1))


    def search(stack):
        x, y = stack.pop()
        if mp[y][x] == "#":
            b_cnt = 1
            w_cnt = 0
            another = "."
        else:
            b_cnt = 0
            w_cnt = 1
            another = "#"
        for dx, dy in vec:
            nx, ny = x + dx, y + dy
            if not checked[ny][nx] and mp[ny][nx] == another:
                checked[ny][nx] = True
                stack.append((nx, ny))
        return w_cnt, b_cnt

    ans = 0
    for y in range(1, h + 1):
        for x in range(1, w + 1):
            if not checked[y][x]:
                checked[y][x] = True
                stack = []
                stack.append((x, y))
                w_cnt = b_cnt = 0
                while stack:
                    w_add, b_add = search(stack)
                    w_cnt += w_add
                    b_cnt += b_add
                ans += w_cnt * b_cnt

    print(ans)

main()

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

def main():
    h, w = map(int, input().split())
    mp = ["X" * (w + 2)] + ["X" + input() + "X" for _ in range(h)] + ["X" * (w + 2)]
    checked = [[False] * (w + 2) for _ in range(h + 2)]
    vec = ((1, 0), (0, -1), (-1, 0), (0, 1))


    def search(x, y):
        checked[y][x] = True
        if mp[y][x] == "#":
            b_cnt = 1
            w_cnt = 0
            another = "."
        else:
            b_cnt = 0
            w_cnt = 1
            another = "#"
        for dx, dy in vec:
            nx, ny = x + dx, y + dy
            if not checked[ny[nx] and mp[ny][nx] == another:
                w_add, b_add = search(nx, ny)
                w_cnt += w_add
                b_cnt += b_add
        return w_cnt, b_cnt

    ans = 0
    for y in range(1, h + 1):
        for x in range(1, w + 1):
            if not checked[y][x]:
                w_cnt, b_cnt = search(x, y)
                ans += w_cnt * b_cnt

    print(ans)

main()
Problem p03302 (python)

Fixed submission:
def ilinp(): return list(map(int, input().split()))
def slinp(): return input().split()
def iinp(): return int(input())

a, b = ilinp()
if a + b == 15:
  print("+")
elif a* b == 15:
  print("*")
else:
  print("x")

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left as bl
from bisect import bisect_right as br
from itertools import combinations as cmb
from itertools import combinations_with_replacement as cmbwr
from itertools import permutations as prm
from itertools import accumulate as acm
from math import gcd
from math import ceil
from math import factorial as fact
from collections import deque
from collections import Counter
from heapq import heappop as hpp
from heapq import heappush as hps
import sys
sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
direct = ((1, 0), (0, 1), (-1, 0), (0, -1))
def ilinp(): return list(map(int, input().split()))
def slinp(): return input().split()
def iinp(): return int(input())

a, b = ilinp()
if a + b == 15:
  print("+")
elif a* b == 15:
  print("*")
else:
  print("x")
Problem p03354 (python)

Fixed submission:
def solve():
  n, m = map(int,input().split())
  plst = list(map(int,input().split()))
  pare_inds = [i for i in range(n)]
  belongs = [[] for i in range(n)]
  
  def get_root(x):
    p = pare_inds[x]
    if p == x:
      return x
    a = get_root(p)
    pare_inds[x] = a
    return a
  
  for i in range(m):
    x, y = map(int,input().split())
    x, y = x - 1, y - 1
    r_x, r_y  = get_root(x), get_root(y)
    if r_x < r_y:
      pare_inds[y] = r_x
      pare_inds[r_y] = r_x
    else:
      pare_inds[x] = r_y
      pare_inds[r_x] = r_y
  
  for i in range(n):
    belongs[get_root(i)].append(i)
  #print(belongs)
  #print(plst)
  ans = 0
  for lst in belongs:
    lst2 = [plst[i] - 1 for i in lst]
    lst.sort()
    lst2.sort()
    ind1 = 0
    ind2 = 0
    end = len(lst)
    while ind1 < end and ind2 < end:
      if lst[ind1] == lst2[ind2]:
        ans += 1
        ind1 += 1
        ind2 += 1
      elif lst[ind1] < lst2[ind2]:
        ind1 += 1
      else:
        ind2 += 1
  
  print(ans)
solve()

Buggy submission (verdict: Runtime Error):
def solve():
  n, m = map(int,input().split())
  plst = list(map(int,input().split()))
  pare_inds = [i for i in range(n)]
  belongs = [[] for i in range(n)]
  
  def get_root(x):
    p = pare_inds[x]
    if p == x:
      return (x, 0)
    a = get_root(p)
    pare_inds[x] = a
    return a
  
  for i in range(m):
    x, y = map(int,input().split())
    x, y = x - 1, y - 1
    r_x, r_y  = get_root(x), get_root(y)
    if r_x < r_y:
      pare_inds[y] = r_x
      pare_inds[r_y] = r_x
    else:
      pare_inds[x] = r_y
      pare_inds[r_x] = r_y
  
  for i in range(n):
    belongs[get_root(i)].append(i)
  
  ans = 0
  for lst in belongs:
    for i in lst:
      if plst[i] - 1 in lst:
        ans += 1
  
  print(ans)
solve()
Problem p03359 (python)

Fixed submission:
a,b = map(int,input().split())
if b >= a: print(a)
else: print(a - 1)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
h,w = map(int,input().split())
lst = []
for i in range(h):
  lst.append([s for s in input()])
def dfs(x,y):
  if lst[x][y] == '#':
    lst[x][y] = '.'
    if x + 1 <= h - 1:
      dfs(x + 1,y)
    if x - 1 >= 0:
      dfs(x - 1,y)
    if y + 1 <= w - 1:
      dfs(x, y + 1)
    if y - 1 >= 0:
      dfs(x,y - 1)
flag = True
for i in range(h):
  for j in range(w):
    if lst[i][j] == '#':
      if (i - 1 >= 0 and lst[i - 1][j] == "#") or (i + 1 < h and lst[i + 1][j] == "#") or (j - 1 >= 0 and lst[i][j - 1] == "#") or (j + 1 < w and lst[i][j + 1] == "#"):
        dfs(i,j)
      else:
        flag = False
        break
if flag:
  print("Yes")
else:
  print("No")
Problem p03361 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
h,w = map(int,input().split())
lst = []
for i in range(h):
  lst.append([s for s in input()])
def dfs(x,y):
  if lst[x][y] == '#':
    lst[x][y] = '.'
    if x + 1 <= h - 1:
      dfs(x + 1,y)
    if x - 1 >= 0:
      dfs(x - 1,y)
    if y + 1 <= w - 1:
      dfs(x, y + 1)
    if y - 1 >= 0:
      dfs(x,y - 1)
flag = True
for i in range(h):
  for j in range(w):
    if lst[i][j] == '#':
      if (i - 1 >= 0 and lst[i - 1][j] == "#") or (i + 1 < h and lst[i + 1][j] == "#") or (j - 1 >= 0 and lst[i][j - 1] == "#") or (j + 1 < w and lst[i][j + 1] == "#"):
        dfs(i,j)
      else:
        flag = False
        break
if flag:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
lst = []
for i in range(h):
  lst.append([s for s in input()])
def dfs(x,y):
  if lst[x][y] == '#':
    lst[x][y] = '.'
    if x + 1 <= h - 1:
      dfs(x + 1,y)
    if x - 1 >= 0:
      dfs(x - 1,y)
    if y + 1 <= w - 1:
      dfs(x, y + 1)
    if y - 1 >= 0:
      dfs(x,y - 1)
flag = True
for i in range(h):
  for j in range(w):
    if lst[i][j] == '#':
      if (i - 1 >= 0 and lst[i - 1][j] == "#") or (i + 1 < h and lst[i + 1][j] == "#") or (j - 1 >= 0 and lst[i][j - 1] == "#") or (j + 1 < w and lst[i][j + 1] == "#"):
        dfs(i,j)
      else:
        flag = False
        break
if flag:
  print("Yes")
else:
  print("No")
Problem p03399 (python)

Fixed submission:
print(min(int(input()),int(input())) + min(int(input()),int(input())))

Buggy submission (verdict: Runtime Error):
print(min(int(input()),int(input())) + min(int(input()) + int(input())))
Problem p03450 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
def search(i, total):
  for dist, to in edges[i]:
    if dists[to] == None:
      dists[to] = total + dist
      if not search(to, total + dist):
        return False
    else:
      if dists[to] == total + dist:
        continue
      else:
        return False
  return True

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
  l, r, d = map(int, input().split())
  l -= 1
  r -= 1
  edges[l].append((d, r))
  edges[r].append((-d, l))

dists = [None] * n

for i in range(n):
  if dists[i] == None:
    dists[i] = 0
    if not search(i, 0):
      print("No")
      break
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
def search(i, total):
  for dist, to in edges[i]:
    if dists[to] == None:
      dists[to] = total + dist
      if not search(to, total + dist):
        return False
    else:
      if dists[to] == total + dist:
        continue
      else:
        return False
  return True

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
  l, r, d = map(int, input().split())
  l -= 1
  r -= 1
  edges[l].append((d, r))
  edges[r].append((-d, l))

dists = [None] * n

for i in range(n):
  if dists[i] == None:
    dists[i] = 0
    if not search(i, 0):
      print("No")
      break
else:
  print("Yes")
Problem p03488 (python)

Fixed submission:
def main():
  s = input()
  x, y = map(int, input().split())
  lens = len(s)
  ind = 0
  if "T" in s:
    ind = s.index("T")
    x -= ind
  else:
    ind = lens
    x -= lens
  x_lst = []
  y_lst = []
  direct = 0
  while ind < lens:
    acc = 0
    if s[ind] == "F":
      while ind < lens and s[ind] == "F":
        ind += 1
        acc += 1
      if direct == 0:
        x_lst.append(acc)
      else:
        y_lst.append(acc)
  
    elif s[ind] == "T":
      while ind < lens and s[ind] == "T":
        ind += 1
        acc += 1
      direct = (direct + acc) % 2
  x = abs(x)
  y = abs(y)  
  sumx = sum(x_lst)
  sumy = sum(y_lst)
  if sumx < x or (sumx - x) % 2 or sumy < y or (sumy - y) % 2:
    print("No")
  else:
    target_x = (sumx - x) // 2
    target_y = (sumy - y) // 2
    canx = [False] * (target_x + 1)
    canx[0] = True
    cany = [False] * (target_y + 1)
    cany[0] = True
  
    break_flag = False
    for v in x_lst:
      for i in range(target_x - v + 1):
        if canx[i]:
          canx[i + v] = True
          if i + v == target_x:
            break_flag = True
            break
      if break_flag:
        break
    
    break_flag = False
    for v in y_lst:
      for i in range(target_y - v + 1):
        if cany[i]:
          cany[i + v] = True
          if i + v == target_y:
            break_flag = True
            break
      if break_flag:
        break
  
    if canx[target_x] and cany[target_y]:
      print("Yes")
    else:
      print("No")

main()

Buggy submission (verdict: Runtime Error):
def main():
  s = input()
  x, y = map(int, input().split())
  lens = len(s)
  ind = 0
  if "T" in s:
    ind = s.index("T")
    x -= ind
  else:
    ind = lens
    x -= lens
  x_lst = []
  y_lst = []
  direct = 0
  while ind < lens:
    acc = 0
    if s[ind] == "F":
      while ind < lens and s[ind] == "F":
        ind += 1
        acc += 1
      if direct == 0:
        x_lst.append(acc)
      else:
        y_lst.append(acc)
  
    elif s[ind] == "T":
      while ind < lens and s[ind] == "T":
        ind += 1
        acc += 1
  
      direct = (direct + acc) % 2
  
  sumx = sum(x_lst)
  sumy = sum(y_lst)
  if sumx < x or (sumx - x) % 2 or sumy < y or (sumy - y) % 2:
    print("No")
  else:
    target_x = (sumx - x) // 2 + x
    target_y = (sumy - y) // 2 + y
    canx = [False] * (sumx + 1)
    canx[0] = True
    cany = [False] * (sumy + 1)
    cany[0] = True
  
    break_flag = False
    for v in x_lst:
      for i in range(sumx - v + 1):
        if canx[i]:
          canx[i + v] = True
          if i + v == target_x:
            break_flag = True
            break
      if break_flag:
        break
    
    break_flag = False
    for v in y_lst:
      for i in range(sumy - v + 1):
        if cany[i]:
          cany[i + v] = True
          if i + v == target_y:
            break_flag = True
            break
      if break_flag:
        break
  
    if canx[target_x] and cany[target_y]:
      print("Yes")
    else:
      print("No")

main()
Problem p03600 (python)

Fixed submission:
INF = 10 ** 20
n = int(input())
edges = [list(map(int, input().split())) for _ in range(n)]
dist = [[INF] * n for _ in range(n)]

edgeList = []
for i in range(n):
    for j in range(i, n):
        edgeList.append((edges[i][j], i, j))
edgeList.sort()

for k in range(n):
    edgesk = edges[k]
    for i in range(n):
        disti = dist[i]
        edgesik = edges[i][k]
        for j in range(n):
            if disti[j] > edgesik + edgesk[j]:
                disti[j] = edgesik + edgesk[j]

ans = 0
for c, i, j in edgeList:
    minCost = INF
    for k in range(n):
        if k in (i, j):continue
        if minCost > dist[i][k] + dist[k][j]:
            minCost = dist[i][k] + dist[k][j]
    if c > minCost:
        print(-1)
        break
    if c < minCost:
        ans += c
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
INF = 10 ** 20
n = int(input())
edges = [list(map(int, input().split())) for _ in range(n)]
dist = [[INF] * n for _ in range(n)]

edgeList = []
for i in range(n):
    for j in range(i, n):
        edgeList.append((edges[i][j], i, j))
edgeList.sort()

for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j] = min(dist[i][j], edges[i][k] + edges[k][j])
ans = 0
for c, i, j in edgeList:
    minCost = min([dist[i][k] + dist[k][j] for k in range(n) if (k != i and k != j)])
    if c > minCost:
        print(-1)
        break
    if c < minCost:
        ans += c

else:
    print(ans)
Problem p03681 (python)

Fixed submission:
def kaijou(num):
  ac = 1
  for i in range(num):
    ac = ((i + 1) * ac) % (10 ** 9 + 7)
  return ac
[n,m] = list(map(int,input().split()))
x = abs(n - m)
ans = 0
if (x >= 2):
  ans = 0
elif (x == 1):
  ans = (kaijou(m) * kaijou(n)) % (10 ** 9 + 7)
elif (x == 0):
  ans = (kaijou(m) * kaijou(n) * 2) % (10 ** 9 + 7)
print(ans)

Buggy submission (verdict: Runtime Error):
def kaijou2(num):
  return kaijou(num,1)
def kaijou(num,ac):
  if (num == 0):
    return ac
  else:
    return kaijou(num - 1,(ac * num) % (10 ** 9 + 7))

[n,m] = list(map(int,input().split()))
x = abs(n - m)
ans = 0
if (x >= 2):
  ans = 0
elif (x == 1):
  ans = (kaijou2(m) * kaijou2(n)) % (10 ** 9 + 7)
elif (x == 0):
  ans = (kaijou2(m) * kaijou2(n) * 2) % (10 ** 9 + 7)
print(ans)
Problem p03997 (python)

Fixed submission:
print((int(input()) + int(input())) * int(input()) // 2)

Buggy submission (verdict: Runtime Error):
print( (int(input()) + int(input()) * int(input()) // 2)
Problem p03633 (python)

Fixed submission:

def gcd(a, b):
    if a < b:
        c = a
        a = b
        b = c

    r = a % b

    while r > 0:
        a = b
        b = r
        r = a % b

    return b

    # ll gcd(ll a, ll b) {
    #   if (a < b)
    #     swap(a, b);
    #   ll r = a % b;
    #
    #   while (r) {
    #     a = b;
    #     b = r;
    #     r = a % b;
    #   }
    #
    #   return b;
    # }


N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
# a = list(map(int, input().split()))

ans = a[0]

for i in range(N):
    if i == 0:
        continue

    g = gcd(ans, a[i])
    ans = ans * a[i] // g

print(ans)

Buggy submission (verdict: Runtime Error):
import urllib.request
from bs4 import BeautifulSoup
import re
import sys
import os
import time
import subprocess
import datetime


def gcd(a, b):
    if a < b:
        c = a
        a = b
        b = c

    r = a % b

    while r > 0:
        a = b
        b = r
        r = a % b

    return b

    # ll gcd(ll a, ll b) {
    #   if (a < b)
    #     swap(a, b);
    #   ll r = a % b;
    #
    #   while (r) {
    #     a = b;
    #     b = r;
    #     r = a % b;
    #   }
    #
    #   return b;
    # }


N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
# a = list(map(int, input().split()))

ans = a[0]

for i in range(N):
    if i == 0:
        continue

    g = gcd(ans, a[i])
    ans = ans * a[i] // g

print(ans)