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

Fixed submission:
H,W=map(int, input().split())
S=["."+input()+"." for _ in range(H)]
S=["."*(W+2)]+S+["."*(W+2)]
ans="Yes"
for i in range(H):
  for j in range(W):
    if S[i][j]=="#" and S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
      ans="No"
print(ans)

Buggy submission (verdict: Runtime Error):
raw_input = input().split()[2:]
W = len(raw_input[0])
H = len(raw_input)
added_input = [row + '.' for row in raw_input] + ['.' * len(raw_input[0])]
for y in range(H):
    for x in range(W):
        if added_input[y][x] == '#' and added_input[y+1][x] \
        == added_input[y-1][x] == added_input[y][x+1] == added_input[y][x-1] == '.':
            print('NO')
            break
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
H,W=map(int,input().split())
nx=[1,0,-1,0]
ny=[0,1,0,-1]

field=[]
for i in range(H):
  field.append(list(input()))

for n in range(W):
  for m in range(H):
    if field[n][m]=='.':
      continue
    
    hope=0
    for j in range(4):
      x=n+nx[j]
      y=m+ny[j]
      
      if x<0 or W<=x or y<0 or H<=y:
        continue

      if field[x][y]=='#':
        hope=1
      
    if hope==0:
      print('No')
      exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
H,W=map(int,input().split())
nx=[1,0,-1,0,1,1,-1,-1]
ny=[0,1,0,-1,1,-1,1,-1]

field=[]
for i in range(H):
  field.append(list(input()))

for n in range(W):
  for m in range(H):
    if field[n][m]=='.':
      continue
    
    hope=0
    for j in range(8):
      x=n+nx[j]
      y=m+ny[j]
      
      if x<0 or W<=x or y<0 or H<=y:
        continue

      if field[x][y]=='#':
        hope=1
      
    if hope==0:
      print('No')
      exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
H,W=map(int,input().split())
nx=[1,0,-1,0,1,1,-1,-1]
ny=[0,1,0,-1,1,-1,1,-1]

field=[]
for i in range(H):
  field.append(list(split()))

for n in range(W):
  for m in range(H):
    if field[n][m]=='.':
      continue
      
    for j in range(8):
      x=n+nx[j]
      y=m+ny[j]

      if field[x][y]=='.':
        print('No')
        exit()
      else:
        pass
print('Yes')
Problem p03449 (python)

Fixed submission:
# -*- coding:utf-8 -*-
import sys
N=int(input())
List_1=list(map(int,input().split()))
List_2=list(map(int,input().split()))

answer=[]
score=0
for i in range(N):
  score+=sum(List_1[:i+1])
  score+=sum(List_2[i:])
  answer.append(score)
  score=0

print(max(answer))

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import sys
N=int(input())
List_1=[map(int,input()split())]
List_2=[map(int,input()split())]

answer=[]
for i in range(N):
  score+=sum(List_1[:i])
  score+=sum(List_2[i:])
  answer.append(score)
  score=0

print(max(answer))
Problem p03471 (python)

Fixed submission:
#coding: utf-8
N,Y=map(int,input().split(" "))
for x in range(N+1):
  for y in range(N+1-x):
    z=N-x-y
    if 10000*x+5000*y+1000*z==Y:
      print(str(x)," ",str(y)," ",str(z))
      exit()
print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
#coding: utf-8
N,Y=map(int,input().split(" "))
for x in range(N+1):
  for y in range(N+1-x):
	z=N-x-y
    if 10000*x+5000*y+1000*z==Y:
      print(str(x)," ",str(y)," ",str(z))
      exit()
print("-1 -1 -1")
Problem p03545 (python)

Fixed submission:
# -*- coding:utf-8 -*-
X=list(input())
A,B,C,D=map(int,X)
if A+B+C+D==7:
  A=str(A)
  B=str(B)
  C=str(C)
  D=str(D)
  print(A+'+'+B+'+'+C+'+'+D+'=7')
  exit()
elif A+B+C-D==7:
  A=str(A)
  B=str(B)
  C=str(C)
  D=str(D)
  print(A+'+'+B+'+'+C+'-'+D+'=7')
  exit()
elif A+B-C+D==7:
  A=str(A)
  B=str(B)
  C=str(C)
  D=str(D)
  print(A+'+'+B+'-'+C+'+'+D+'=7')
  exit()
elif A-B+C+D==7:
  A=str(A)
  B=str(B)
  C=str(C)
  D=str(D)
  print(A+'-'+B+'+'+C+'+'+D+'=7')
  exit()
elif A-B-C+D==7:
  A=str(A)
  B=str(B)
  C=str(C)
  D=str(D)
  print(A+'-'+B+'-'+C+'+'+D+'=7')
  exit()
elif A+B-C-D==7:
  A=str(A)
  B=str(B)
  C=str(C)
  D=str(D)
  print(A+'+'+B+'-'+C+'-'+D+'=7')
  exit()
elif A-B+C-D==7:
  A=str(A)
  B=str(B)
  C=str(C)
  D=str(D)
  print(A+'-'+B+'+'+C+'-'+D+'=7')
  exit()
elif A-B-C-D==7:
  A=str(A)
  B=str(B)
  C=str(C)
  D=str(D)
  print(A+'-'+B+'-'+C+'-'+D+'=7')
  exit()
else:
  print('None')

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
S=input()
sign=[+-]
for i in range(2):
  for j in range(2):
    for n in range(2):
      if eval(S[0]+sign[i]+S[1]+sign[j]+S[2]+sign[n]+S[3])==7:
        print(str(S[0]+sign[i]+S[1]+sign[j]+S[2]+sign[n]+S[3])+'=7')
        exit()

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
X=list(input())
A,B,C,D=map(int,X)
if A+B+C+D==7:
  print(A+'+'+B+'+'+C+'+'+D+'=7')
  exit()
if A+B+C-D==7:
  print(A+'+'+B+'+'+C+'-'+D+'=7')
  exit()
if A+B-C+D==7:
  print(A+'+'+B+'-'+C+'+'+D+'=7')
  exit()
if A-B+C+D==7:
  print(A+'-'+B+'+'+C+'+'+D+'=7')
  exit()
if A-B-C+D==7:
  print(A+'-'+B+'-'+C+'+'+D+'=7')
  exit()
if A+B-C-D==7:
  print(A+'+'+B+'-'+C+'-'+D+'=7')
  exit()
if A-B+C-D==7:
  print(A+'-'+B+'+'+C+'-'+D+'=7')
  exit()
if A-B-C-D==7:
  print(A+'-'+B+'-'+C+'-'+D+'=7')
  exit()
Problem p03574 (python)

Fixed submission:
# -*- coding:utf-8 -*-
H,W=map(int,input().split())
boxes=list()
pad=[0]*(W+2)
boxes.insert(0,pad)
for i in range(H):
  x=input()
  box=list()
  box.append(0)
  for j in range(W):
    if x[j]=='.':
      box.append(0)
    elif x[j]=='#':
      box.append(1)
  box.append(0) 
  boxes.insert(i+1,box)
boxes.insert(H+1,pad)
answers=list()
padd=[0]*W
for n in range(H):
  answer=list()
  for k in range(W):
    count=0
    if boxes[n][k]==1:
      count+=1
    if boxes[n][k+1]==1:
      count+=1
    if boxes[n][k+2]==1:
      count+=1
    if boxes[n+1][k]==1:
      count+=1
    if boxes[n+1][k+2]==1:
      count+=1
    if boxes[n+2][k]==1:
      count+=1
    if boxes[n+2][k+1]==1:
      count+=1
    if boxes[n+2][k+2]==1:
      count+=1
    if boxes[n+1][k+1]==1:
      count='#'
    else:
      count=str(count)
    answer.insert(k,count)
  answers.insert(n,answer)
for v in range(H):
  answe=''.join(answers[v])
  print(answe)

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
H,W=map(int,input().split())
boxes=list()
boxes[0]=[0]*W
boxes[H+1]=[0]*W
for i in range(H):
  boxes[i+1]=list()
  boxes[i+1][0]=0
  bowes[i+1][W+1]=0
  x=input()
  for j in range(W):
    if x[j]=='.':
      boxes[i+1][j+1]=0
    elif x[j]=='#':
      boxes[i+1][j+1]=1
answer=list()
for n in range(H):
  answer[n]=list()
  for k in range(W):
    count=0
    if boxes[n][k]==1:
      count+=1
    if boxes[n][k+1]==1:
      count+=1
    if boxes[n][k+2]==1:
      count+=1
    if boxes[n+1][k]==1:
      count+=1
    if boxes[n+1][k+2]==1:
      count+=1
    if boxes[n+2][k]==1:
      count+=1
    if boxes[n+2][k+1]==1:
      count+=1
    if boxes[n+2][k+2]==1:
      count+=1
    if count==0:
      answer[n][k]='#'
	else:
      answer[n][k]=str(count)
 for v in range(H):
  answe=''.join(answer[v])
  print(answe)
Problem p03680 (python)

Fixed submission:
# -*- coding:utf-8 -*-
import sys

a=[int(i)-1 for i in sys.stdin]
N=a[0]+1
a=a[1:]

done=[False]*N

ans=0
i=0

while True:
  if done[i]==False:
    done[i]=True
    ans+=1
    if a[i]==1:
      break
    i=a[i]

  
  else:
    ans=-1
    break
    
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
import sys

a=[int(i)-1 for i in sys.stdin]
N=l[0]+1
a=a[1:]

done=[False]*N

ans=0
i=0

while True:
  if done[i]==False:
    done[i]=True
    ans+=1
    if a[i]==1:
      break
    i=a[i]

  
  else:
    ans=-1
    break
    
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-
N=int(input())
button=[]
for i in range(N):
  button.append(int(input()))

number=0
count=0
footprint=[0]
while number!=1:
  number=button[number]-1
  count+=1
    if number in footprint:
      print(-1)
      exit()
  footprint.append(number)
print(count)
Problem p03861 (python)

Fixed submission:
#-*- coding:utf-8 -*-
a,b,x=map(int,input().split())

print(b//x-(a-1)//x)

Buggy submission (verdict: Runtime Error):
#-*- coding:utf-8 -*-
a,b,x=map(int,input().split())

count=0
if x<=b and a!=b:
  Base=0
  for i in range(a,b+1):
    if i%x==0:
      Base=i
      break
  for j in range(Base,b+1,Base):
     count+=1
elif a==b and a%x==0:
    count+=1
print(count)

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

for in range(a,b+1):
  if i%x==0:
    Base=i
    break
count=1
num=2
while Base<=b:
  Base*=num
  count+=1
    
print(count)
Problem p03963 (python)

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

answer=K
if N>1:
  for _ in range(N-1):
    answer*=(K-1)

print(answer)

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

answer=K
if N>1:
  for _ range(N-1):
    answer*=(K-1)

print(answer)
Problem p04001 (python)

Fixed submission:
#coding:utf-8
S=str(input())
n=len(S)-1
answer=0
for i in range(2**(n)):
  formula=S[0]
  for j in range(n):
    if ((i>>j)&1):
      formula+="+"
    formula+=S[j+1]
  answer+=sum(map(int,formula.split("+")))
print(answer)

Buggy submission (verdict: Runtime Error):
#coding:utf-8
S=input()
n=len(S)-1
answer=0
for i in range(2**n):
  formula=list(S)
  for j in range(n):
    if ((i<<j)&1):
      formula=S.insart("+",j+1)
  for i,elem in enumerate(formula):
    num=""
    if elem=="+" or i==len(formula)-1:
      answer+=int(num)
      num=0
    else:
      num+=elem
print(answer)
Problem p03455 (python)

Fixed submission:
def f():
    a, b = input().split()
    a, b = int(a), int(b)
    rem = int(a) * int(b) % 2
    if rem == 1:
        print('Odd')
        return
    if rem == 0:
        print('Even')
        return


f()

Buggy submission (verdict: Runtime Error):
# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if distance - duration % 2 == 0:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if distance % 2 != duration % 2:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')
Problem p03457 (python)

Fixed submission:
# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if distance % 2 != duration % 2:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
import math


# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = math.sqrt((x - self.now_x) * (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if (t - self.now_t) % 2 != (x + y - (self.now_x + self.now_y)) % 2:
            return False
        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
import math


# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = math.sqrt((x - self.now_x) * (y - self.now_y))
        duration = t - self.now_t
        print('distance', distance)
        print('duration', duration)
        if duration < distance:
            return False

        if (t - self.now_t) % 2 != (x + y - (self.now_x + self.now_y)) % 2:
            return False
        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('NO')
        exit()
print('YES')
Problem p03471 (python)

Fixed submission:
def get_pattern(n, y):
    X = 10
    Y = 5
    Z = 1

    y //= 1000
    for nx in range(n+1):
        m = n - nx
        for ny in range(m+1):
            nz = m - ny
            sum = nx * X + ny * Y + nz * Z
            if y == sum:
                return (nx, ny, nz)
    return (-1, -1, -1)


n, y = [int(x) for x in input().split()]
a, b, c = get_pattern(n, y)
print(a, b, c)

Buggy submission (verdict: Runtime Error):
def get_pattern(n, y):
    X = 10
    Y = 5
    Z = 1

    y //= 1000
    for nx in range(n+1):
        m = n - nx
        for ny in range(m+1):
            nz = m - ny
            sum = nx * X + ny * Y + nz * Z
            if y == sum:
                return f'{nx} {ny} {nz}'
    return '-1 -1 -1'


n, y = [int(x) for x in input().split()]
print(get_pattern(n, y))

Buggy submission (verdict: Runtime Error):
def get_pattern(n, y):
    X = 10
    Y = 5
    Z = 1

    y //= 1000
    for nx in range(n+1):
        m = n - nx
        for ny in range(m+1):
            nz = m - ny
            sum = nx * X + ny * Y + nz * Z
            if y == sum:
                return f'{nx} {ny} {nz}'
    return '-1 -1 -1'


n, y = [int(x) for x in input().split()]
print(get_pattern(n, y))
Problem p03494 (python)

Fixed submission:
import numpy as np
# Me


def f():
    i = int(input())
    nums = np.array(list(map(int, input().split())))
    # nums = [int(x) for x in input().split()]
    c = 0
    while True:
        if any(nums % 2 == 1):
            break
        c += 1
        nums = nums / 2
    print(c)


f()


# Other

Buggy submission (verdict: Runtime Error):
def f():
    _ = int(input())
    nums = np.array(list(map(int, input().split())))
    # nums = [int(x) for x in input().split()]
    c = 0
    while True:
        if any(nums % 2 == 1):
            break
        c += 1
        nums = nums / 2
    print(c)


f()

Buggy submission (verdict: Runtime Error):
def f():
    _ = int(input())
    nums = np.array(list(map(int, input().split())))
    # nums = [int(x) for x in input().split()]
    c = 0
    while True:
        if any(nums % 2 == 1):
            break
        c += 1
        nums = nums / 2
    print(c)


f()
Problem p03545 (python)

Fixed submission:
# -*- coding: utf-8 -*-

a, b, c, d = map(str, input())

sign = "+-"
for i in range(2):
    for j in range(2):
        for k in range(2):
            if int(eval(a+sign[i]+b+sign[j]+c+sign[k]+d)) == 7:
                print(str(a+sign[i]+b+sign[j]+c+sign[k]+d) + "=7")
                exit()

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input())
sign = "+-"
for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+sign[i]+b+sign[j]+c+sign[k]+d) == 7:
                print(str(a+sign[i]+b+sign[j]+c+sign[k]+d)+"=7")
Problem p04001 (python)

Fixed submission:
s = list(input())
sum = 0
for i in range(2 ** (len(s)-1)):
  st = str(s[0])
  for j in range(len(s)-1):
    if (i >> j) & 1:
      st = st + "+" + str(s[j+1])
    else:
      st = st + str(s[j+1])
      
  for item in st.split('+') :
    sum += int(item)
print(sum)

Buggy submission (verdict: Runtime Error):
s = input().split("")
sum = 0
for i in range(2 ** (len(s)-1)) :
  st = str(s[0])
  for j in range(len(s)-1) : 
    if ((i >> j) & 1) :
      st = st + "+" + str(s[j+1])
    else :
      st = st + str(s[j+1])
  
  for item in st.split('+') :
    sum += int(item)
print(sum)
Problem p03292 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(a[2]-a[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
a.sort()[2]
print(a[2]-a[0])
Problem p03377 (python)

Fixed submission:
a,b,x = map(int,input().split())
if (x-a)<=b and x>=a:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if (x-a)<=b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if (x-a)<b:
    print("YES")
else:
    print("NO")
Problem p03477 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input())
l = a+b
r = c+d
if l>r:
    print("Left")
elif l<r:
    print("Right")
else:
    print("Balanced")
Problem p03773 (python)

Fixed submission:
a,b = map(int,input().split())
print((a+b)%24)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
print((a+b)//24)
Problem p03860 (python)

Fixed submission:
s = input().split()[1]
s_ini = list(s)[0]
print("A{}C".format(s_ini))

Buggy submission (verdict: Runtime Error):
s = input().split()[1]
s_ini = list(s)[0]
print(A{}C.format(s_ini))
Problem p04030 (python)

Fixed submission:
s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s):
    if s[i] == "B":
        try:
            output.pop(-1)
        except:
            pass
    else:
        output.append(s[i])
print("".join(output))

Buggy submission (verdict: Runtime Error):
s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s-1):
    if s[i+1] =="B":
        output[i] = "D"
    output.append(s[i])
output2 = [j for j in output if j.isdigit()]
print("".join(output2))
Problem p03292 (python)

Fixed submission:
a = list(map(int, input().split()))
a.sort()
ans = a[-1]-a[0]
print(ans)

Buggy submission (verdict: Runtime Error):
a = input(int()).split()
sort_a = sorted(a)
ans = sort_a[-1]-sort_a[0]
Problem p03292 (python)

Fixed submission:
import math

a,b,c = map(int,input().split())
lst = []
lst.append(a)
lst.append(b)
lst.append(c)
lst.sort()

print(lst[2] - lst[1] + (lst[1] - lst[0]))

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

Buggy submission (verdict: Runtime Error):
s = str(input())
t = str(input())
 
if s == t:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = str(input())
t = str(input())
s =  ''.join(sorted(s))
t = ''.join(sorted(t))

if s == t:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s,t = map(str,input().split())
s =  ''.join(sorted(s))
t = ''.join(sorted(t))
 
print(s)
print(t)
if s == t:
    print("yes")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
s =  ''.join(sorted(s))
t = ''.join(sorted(t))

print(s)
print(t)
if s == t:
    print("yes")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
import math
a = int(input())
b = int(input())
c = int(input())

lst = []
lst.append(a)
lst.append(b)
lst.append(c)
lst.sort()

print(lst[2] - lst[1]  + (lst[1] -lst[0]))
Problem p03292 (python)

Fixed submission:
a_l = [int(a_v) for a_v in input().split()]
a_l.sort()
print(abs(a_l[0]-a_l[1])+abs(a_l[1]-a_l[2]))

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
S.sort()
T.sort()
if S == T:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
s_i = [int(s_v) for s_v in input().split()]
sum_cost = abs(s_i[1] - s_i[2])
a = abs(s_i[0] - s_i[1])
b = abs(s_i[0] - s_i[2])
if(a >= b):
	sum_cost += b
else:
	sum_cost += c
print(sum_cost)
Problem p03294 (python)

Fixed submission:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

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

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

N = input()
N = int(N)
a = list(map(int,input().split()))
m = lcm(*a)
x = 0
for j in range(N):
  x += (m-1) % a[j]
print(x)

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

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)

N = input()
N = int(N)
a=list(map(int,input().split()))
m = lcm(*a)
print(m)
x = 0
for j in range(N):
  x += (m-1) % a[j]
print(x)
Problem p03292 (python)

Fixed submission:
# coding: utf-8

A = list(map(int,input().split()))
A.sort(reverse = True)
ans = 0
A.append(A[-1])
for i in range(len(A)-1):
    ans +=A[i]-A[i+1]
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
'''
A = list(map(int,input().split()))
A.sort(reverse = True)
ans = 0
A.append(A[-1])
for i in range(len(A)-1):
    ans +=A[i]-A[i+1]
print(ans)
'''
S = input()
T = input()
f=0
for i in range(len(S)+1):
    if S == T:
        f=1
    S = (S[-1]+S)[:-1]
    
if f==0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
# coding: utf-8
'''
A = list(map(int,input().split()))
A.sort(reverse = True)
ans = 0
A.append(A[-1])
for i in range(len(A)-1):
    ans +=A[i]-A[i+1]
print(ans)
'''
S = input()
T = input()
f=0
for i in range(len(S)+1):
    if S == T:
        print('Yes')
        f=1
        break
    S = (S[-1]+S)[:-1]
if f==0:
    print('No')
Problem p03351 (python)

Fixed submission:
a,b,c,d = map(int, input().split())
if abs(a-c)<=d or (abs(a-b)<=d and abs(b-c)<=d):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
LIST = []
for i in range(len(s)-1):
    j=i+1
    while j<=len(s):
        if s[i:j] not in LIST:
            LIST.append(s[i:j])
            LIST.sort()
            LIST[0:K]
        j+=1

print(LIST[K-1])

Buggy submission (verdict: Runtime Error):
X = int(input())
b=1
MAX=1
if X!=1:
    while b<X/2:
        p=2
        b+=1
        while b**p <= X:
            if b**p > MAX:
                MAX = b**p
            p+=1
print(MAX)

Buggy submission (verdict: Runtime Error):
X = int(input())
b=1
MAX=1
if X!=1:
    while b<X:
        p=2
        b+=1
        while b**p <= X:
            if b**p > MAX:
                MAX = b**p
            p+=1
print(MAX)

Buggy submission (verdict: Runtime Error):
X = int(input())
b=1
MAX=1
if X!=1:
    while b<X:
        p=2
        b+=1
        while b**p <= X:
            if b**p > MAX:
                MAX = b**p
            p+=1
print(MAX)

Buggy submission (verdict: Runtime Error):
X = int(input())
b=0
MAX=0
while b<X:
    p=2
    b+=1
    while b**p <= X:
        if b**p > MAX:
            MAX = b**p
            p+=1
print(MAX)
Problem p03370 (python)

Fixed submission:

fist = list(map(int, input().split()))
N = fist[0]
X = fist[1]
DList=[]
kosu=0
for i in range(N):
    DList.append(int(input()))
X -= sum(DList)
kosu += len(DList)

sD = min(DList)

while X >= sD:
    X -= sD
    kosu += 1
print(kosu)

Buggy submission (verdict: Runtime Error):
fist = list(map(int, input().split()))
N = fist[0]
X = fist[1]
DList=[]
kosu=0
for i in range(N):
    DList.append(int(input()))
X -= sum(DList)
kosu += len(DList)

sD = min(Dlist)

while X >sD:
    X -= sD
    kosu += 1
    print(kosu)
Problem p03292 (python)

Fixed submission:
a=list(map(int,input().split(' ')))
a=sorted(a)
print(a[2]-a[0])

Buggy submission (verdict: Runtime Error):
input()
a=list(map(int,input().split(' ')))
sum=0
for i in a:
    sum+=i-1
print(sum)