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

Fixed submission:
a,b,c = map(int, input().split())
d = c-(a-b)
if(d<0):
    d = 0
print(d)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
h.append(10000000000)
max = 0
flag = 0

for i in range(n):

    if h[i+1]<h[i]:
        h[i]=h[i]-1
    if h[i]>=max and h[i+1]>=h[i]:
        max = h[i]
    else:
        flag = 1
        break
if flag == 1:
    print('No')
else:
    print('Yes')
Problem p02847 (python)

Fixed submission:
s = input().rstrip().split(' ')
print(7 - ['SUN','MON','TUE','WED','THU','FRI','SAT'].index(s[0]))

Buggy submission (verdict: Runtime Error):
input_line = int(input())
for i in range(input_line):
	s = input().rstrip().split(' ')
return 7 - ['SUN','MON','TUE','WED','THU','FRI','SAT'].index(s[0])

Buggy submission (verdict: Runtime Error):
input_line = int(input())
for i in range(input_line):
  s = input().rstrip().split(' ')
  return 7 - ['SUN','MON','TUE','WED','THU','FRI','SAT'].index(s[0])
Problem p02688 (python)

Fixed submission:
import sys

L = []
"""
while True:
    l = input()
    if l == "":
        break
    else:
        L.append(list(map(int,l.split())))
        print(L)
"""
N,K = list(map(int,input().split()))

#print(N,K)

for a in range(2 * K):
    n = list(map(int,input().split()))
    L.append(n)

#print("End",L)

Num = list(range(1, N + 1, 1))
#print(Num)
new_L = L[1::2]
#print(new_L)

new_LL = sum(new_L, [])
for n in new_LL:
    if n in Num:
        Num.remove(n)

print(len(Num))

Buggy submission (verdict: Runtime Error):
L = []

while True:
    l = list(map(int, input().split()))
    if l:
        L.append(l)
    else:
        break

print(L)

N = L[0][0]
K = L[0][1]

Num = list(range(1, N + 1, 1))

new_L = L[2::2]

new_LL = sum(new_L, [])
for n in new_LL:
    if n in Num:
        Num.remove(n)

print(len(Num))

Buggy submission (verdict: Runtime Error):
L = []
while True:
    l = list(map(int, input().split()))
    if l:
        L.append(l)
    else:
        break

N = L[0][0]
K = L[0][1]

Num = list(range(1,N+1,1))

new_L = L[2::2]

new_LL = sum(new_L,[])
for n in new_LL:
    if n in Num:
        Num.remove(n)

print(len(Num))
Problem p02860 (python)

Fixed submission:
i = int(input()) 
s = input()
if i >= 1 and 100 >= i and i % 2 == 0 and i == len(s) and s.isalpha() and s.islower():
  n = (int)(i/2)
  t_0 = s[0]
  t_1 = s[n]
  for j in range(1, n):
    t_0 += s[j]
  for k in range(n + 1, i):
    t_1 += s[k]
  if t_0 == t_1:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
i = int(input()) 
s = input()
if i >= 1 and 100 >= i and i % 2 == 0 and i == len(s) and s.isalpha() and s.islower():
  t_0 = s[0]
  t_1 = s[i/2]
    for j in range(1, i/2):
      t_0 += s[j]
    for k in range(i/2 + 1, i):
      t_1 += s[k]
    if t_0 == t_1:
      print("Yes")
    else:
      print("No")

Buggy submission (verdict: Runtime Error):
i = int(input())
if i >= 1 and 100 >= i and i % 2 == 0:  
  s = input()
    if i == len(s) and s.isalpha() and s.islower():  
      t_0 = s[0]
      t_1 = s[i/2]
	  for j in range(1, i/2):
	    t_0 += s[j]
      for k in range(i/2 + 1, i):
        t_1 += s[k]
      if t_0 == t_1:
        print("Yes")
      else:
        print("No")

Buggy submission (verdict: Runtime Error):
i = int(input())
if i >= 1 and 100 >= i and i % 2 == 0:  
  s = input()
if i == len(s) and s.isalpha() and s.islower():  
  t_0 = s[0]
  t_1 = s[i/2]
	for j in range(1, i/2):
	  t_0 = t_0 + s[j]
    for k in range(i/2 + 1, i):
      t_1 = t_1 + s[k]
  if t_0 == t_1:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
i = int(input())
if ( i >= 0 and 100 >= i and (i % 2 == 0) ):  
  s = input()
  t_0 = s[0]
  t_1 = s[i/2]
	for j in range(1, i/2):
	  t_0 = t_0 + s[j]
    for k in range(i/2 + 1, i):
      t_1 = t_1 + s[k]
  if (t_0 == t_1):
    print('Yes')
  else:
    print('No')
Problem p02711 (python)

Fixed submission:
n = str(input())

if n[0] =='7' or n[1] =='7' or n[2] =='7':
  print('Yes')
else:
  print('No')

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

if n[0] ==7 or n[1] ==7 or n[2] ==7:
  print('Yes')
else:
  print('No')
Problem p02754 (python)

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

cnt_blk = n // (b+r)
res_b = cnt_blk*b
num = cnt_blk*(b+r) + b

if num > n:
  res_b += b - (num - n)
else:
  res_b += b
      
print(res_b)

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

num = 0
count = 0
res = ''

while num <= n:
  if count % 2 == 0:
    res += 'b'*b
    num += b
  else:
    res += 'r'*r
    num += r
  count += 1

ans = 0
for i in range(n):
  if res[i] == 'b':
    ans += 1
print(ans)
Problem p02627 (python)

Fixed submission:
n = input()
if n.isupper(): 
    print("A")
else :
    print('a')

Buggy submission (verdict: Runtime Error):
n = int(input())
if ord('n')>90:
  print('a')
else:
  print("A")
Problem p02699 (python)

Fixed submission:
#A
s,w = map(int,input().split())
if w>=s :
    print('unsafe')
else :
    print('safe')

Buggy submission (verdict: Runtime Error):
s,w =int(input())
if w>=s:
  print('UNSAFE')
else:
  print("SAFE")
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
c = 0
for i in range((n//2)):
    if s[i] == s[i+(n//2)]:
        c+= 1
if c*2 == n:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
for i in range((n//2)+1):
    if s[i] == s[i+(n//2)]:
        c+= 1
if c*2 == n:
    print("Yes")
else:
    print("No")
Problem p02627 (python)

Fixed submission:
n=input()
if n.islower():
  print('a')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
n=input()
if n.islower:
  print(a)
else:
  print(A)
Problem p02723 (python)

Fixed submission:
s=list(input())
if s[3]==s[2] and s[5]==s[4]:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
s=input()
if s[3]==s[2] and s[5]==s[4]:
print('Yes')
else:
print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
if s[3]==s[2] and s[5]==s[4]:
print('Yes')
else:
print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
if s[3]=s[2] and s[5]=s[4]:
print('Yes')
else:
print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
if s[3]=s[4] and s[5]=s[6]:
print('Yes')
else:
print('No')
Problem p02759 (python)

Fixed submission:
n=int(input())
if n%2==0:
    print(n//2)
else:
    print((n+1)//2)

Buggy submission (verdict: Runtime Error):
n=input()
print(round(n/2))
Problem p02777 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
u=input()
if u=='red':
    print(a-1,b)
else:
    print(a,b-1)
Problem p02873 (python)

Fixed submission:
s=input()

def sigma(n):
  return n*(n+1)//2

total=0
if s[0]=='>':
  cnt=s.find('<')
  if cnt==-1:
    cnt=len(s)
    s=''
  else:
    s=s[cnt:]
  total+=sigma(cnt)
  
flag=True
while flag:
  l=[]
  index1=s.find('>')
  if index1!=-1:
    for i in range(index1):
      l.append(s[i])
    s=s[index1:]
  else:
    l.extend(['<']*len(s))
    s=''
    flag=False
  index2=s.find('<')
  if index2!=-1:
    for i in range(index2):
      l.append(s[i])
    s=s[index2:]
  else:
    l.extend(['>']*len(s))
    s=''
    flag=False
  cnt1=l.count('>')
  cnt2=l.count('<')
  if cnt2<=cnt1:
    total+=sigma(cnt1)+sigma(cnt2-1)
  else:
    total+=sigma(cnt2)+sigma(cnt1-1)

print(total)

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

def sigma(n):
  return n*(n+1)//2

total=0
cnt=0
while s[0]=='>':
  cnt+=1
  s=s[1:]
total+=sigma(cnt)
  
flag=True
while flag:
  l=[]
  if '>' in s:
    for i in range(s.find('>')):
      l.append(s[i])
    s=s[s.find('>'):]
  else:
    l.extend(['<']*len(s))
    s=''
    flag=False
  if '<' in s:
    for i in range(s.find('<')):
      l.append(s[i])
    s=s[s.find('<'):]
  else:
    l.extend(['>']*len(s))
    s=''
    flag=False
  if l.count('<')<=l.count('>'):
    total+=sigma(l.count('>'))+sigma(l.count('<')-1)
  else:
    total+=sigma(l.count('<'))+sigma(l.count('>')-1)

print(total)
Problem p02897 (python)

Fixed submission:
n=int(input())
if n%2==0:
    print(1/2)
else:
    print((n+1)/2/n)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%2==0:
    print(1/2)
else:
    print((n+1)/2/n
Problem p02623 (python)

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

#n, m, k = 3, 4, 730
#a = [60, 90, 120]
#b = [80, 150, 80, 150]

a = [0] + a
for i in range(n):
    a[i + 1] = a[i] + a[i + 1]

b = [0] + b
for i in range(m):
    b[i + 1] = b[i] + b[i + 1]
    
ans = 0
for i in range(n + 1):
    for j in range(max(0, ans - i + 1), m + 1):
        if a[i] + b[j] <= k:
            ans = i + j
        else:
            break

print(ans)

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

#n, m, k = 3, 4, 730
#a = [60, 90, 120]
#b = [80, 150, 80, 150]

a = [0] + a
for i in range(n):
    a[i + 1] = a[i] + a[i + 1]

b = [0] + b
for i in range(m):
    b[i + 1] = b[i] + b[i + 1]
    
ans = 0
for i in range(n + 1):
    for j in range(ans - i + 1, m + 1):
        if a[i] + b[j] <= k:
            ans = i + j
        else:
            break

print(ans)

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

suma = [0]
for i in range(n):
    suma.append(suma[i] + a[i])
    
sumb = [0]
for i in range(m):
    sumb.append(sumb[i] + b[i])
    
ans = 0
for i in range(n + 1):
    for j in range(ans - i + 1, m + 1):
        if suma[i] + sumb[j] <= k:
            ans = i + j

print(ans)
Problem p02577 (python)

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

# Input#
n = list(input())
# n, k = map(int, input().split())
# a = list(map(int, input().split()))
sum = 0
for i in n:
    sum += int(i)

if sum % 9 == 0:
    print("Yes")
else:
    print("No")


# print("{}".format(ans))

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

# Input#
n = int(input())
# n, k = map(int, input().split())
# a = list(map(int, input().split()))

sum = 0
while n > 9:
    sum += n % 10
    n = int(n / 10)

sum += int(n)
if sum % 9 == 0:
    print("Yes")
else:
    print("No")


# print("{}".format(ans))
Problem p02623 (python)

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

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans = 0
j = M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
def readBook(i, j, time, cnt):
    if time < 0:
        return cnt - 1
    if i == N and j == M:
        return cnt
    elif i == N:
        res = readBook(i, j + 1, time - B[j], cnt + 1)
    elif j == M:
        res = readBook(i + 1, j, time - A[i], cnt + 1)
    else:
        res = max(readBook(i + 1, j, time - A[i], cnt + 1), readBook(i, j + 1, time - B[j], cnt + 1))
    return res


N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

print(readBook(0, 0, K, 0))
Problem p02729 (python)

Fixed submission:
from scipy.misc import comb

n, m = map(int, input().split())
print(comb(n, 2, exact=True)+comb(m,2, exact=True))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

n, m = map(int, input().split())
print(comb(n, 2, exact=True)+comb(m,2, exact=True))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

n, m = map(int, input().split())
print(comb(n, 2, exact=True)+comb(m,2, exact=True))
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())

print(6 - (a + b))

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

print(6 - (a + b))

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


print(6 - (a + b))
Problem p02793 (python)

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

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

mod = int(1e9+7)
def ext_gcd(a, b, x, y):
    if b==0:
        x[0] = 1
        y[0] = 0
        return a
    g = ext_gcd(b, a%b, y, x)
    y[0]-=a//b*x[0]
    return g

def mod_inv(a):
    x = [0]
    y = [0]
    ext_gcd(a, mod, x, y)
    return (x[0]%mod + mod)%mod;

n = int(input())
vs = list(map(int, input().split()))
l = 1
for x in vs:
    l = lcm(l, x)
l = l%mod;
ans = 0
for x in vs:
    ans = (ans + ((l*mod_inv(x))%mod))%mod
print(ans)

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

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

mod = int(1e9+7)

n = int(input())
vs = map(int, input().split())
l = 1
for x in vs:
    l = lcm(l, x)

ans = 0
for x in vs:
    ans = (ans + ((l/x)%mod))%mod
print(ans)
Problem p02594 (python)

Fixed submission:
N = int(input())
if N >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
if N >= 30:
  print(Yes)
else:
  print(No)
Problem p02659 (python)

Fixed submission:
a,b = input().split()
A=int(a)
B=int(b.replace('.',''))
print((A*B)//100)

Buggy submission (verdict: Runtime Error):
a,b = input().split()
A=int(a)
b.replace('.','')
B=int(b)
print(A*B)

Buggy submission (verdict: Runtime Error):
a,b = input().rstrip().split()
A=int(a)
b.replace('.','')
B=int(b)
print(A*B)

Buggy submission (verdict: Runtime Error):
a,b = input().rstrip().split()
A=int(a)
b.replace('.','')
B=int(b)
print(a*b)

Buggy submission (verdict: Runtime Error):
a,b = input().rstrip().split()
A=int(a)
b.replace('.')
B=int(b)
print(a*b)
Problem p02623 (python)

Fixed submission:
n, m, k = map(int, input().split(' '))
ans = 0

a_ls = [0] + list(map(int, input().split(' ')))
b_ls = [0] + list(map(int, input().split(' ')))

for i in range(1, n+1):
    a_ls[i] += a_ls[i-1]
for i in range(1, m+1):
    b_ls[i] += b_ls[i-1]

b_cnt = m
for a_cnt in range(0, n+1):
    if a_ls[a_cnt] > k:
        continue
    while a_ls[a_cnt] + b_ls[b_cnt] > k:
        b_cnt -= 1
    ans = max(ans, a_cnt + b_cnt)

print(ans)

Buggy submission (verdict: Runtime Error):
for i in range(1, N + 1):
    A_ls[i] += A_ls[i - 1]
for i in range(1, M + 1):
    B_ls[i] += B_ls[i - 1]

b_cnt, rst = M, 0
for a_cnt in range(N + 1):
    if A_ls[a_cnt] > K:
        break
    while A_ls[a_cnt] + B_ls[b_cnt] > K:
        b_cnt -= 1
    rst = max(rst, a_cnt + b_cnt)
print(rst)
Problem p02689 (python)

Fixed submission:

N, M = map(int, input().split(' '))
H_ls = list(map(int, input().split(' ')))
edge = [ [] for i in range(N)]
cnt = 0
for i in range(M):
    a, b = map(int, input().split(' '))
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)
for i in range(N):
    is_peak = True
    for neighbor in edge[i]:
        if H_ls[i] <= H_ls[neighbor]:
            is_peak = False
            break
    if is_peak:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(' '))
H_ls = list(map(int, input().split(' ')))
edge, rst = [ [] for i in range(N) ], 0
for i in range(M):
    a, b = map(int, input().split(' '))
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)
for i in range(N):
    for j in edge[i]:
        is_peak = True
        if H_ls[i] <= H_ls[j]:
            is_peak = False
    if not is_peak:
        rst += 1
print(rst)
Problem p03774 (python)

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

# input
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
cd = [list(map(int, input().split())) for i in range(M)]

# solve & output
for i in range(N):
    min_diff = 10 ** 9
    for j in range(M):
        diff = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if min_diff > diff:
            min_diff = diff
            ans = j + 1
    print(ans)

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

# input
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
cd = [list(map(int, input().split())) for i in range(M)]

# solve & output
for i in range(N):
    min_diff = 10 ** 8
    for j in range(M):
        diff = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if min_diff > diff:
            min_diff = diff
            ans = j + 1
    print(ans)
Problem p02699 (python)

Fixed submission:
a,b = (map(int,input().split()))
if a <= b:
    print('unsafe')
if a > b:
    print('safe')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a <= b:
    print('unsafe')
elif:
    print('safe')
Problem p02711 (python)

Fixed submission:
a = input()
if '7' in a:
   print('Yes')
else:
   print('No')

Buggy submission (verdict: Runtime Error):
a = input()
b = [int(c) for c in a]

d = len(a)
e = b + 1
i = 0
while i < e:
    e = a[i]
    if e == '7':
        print('Yes')
        break
    elif e == a:
          print('No')
        
    i += 1

Buggy submission (verdict: Runtime Error):
a = input()
b = [int(c) for c in a]

d = len(a)
e = b + 1
i = 0
while i < e:
    e = a[i]
    if e == '7':
        print('Yes')
        break
    elif e == a:
          print('No')
        
    i += 1

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

b = len(a)
c = b + 1
i = 0
while i < c:
    c = a[i]
    if c == 7:
        print('Yes')
        break
    elif c==a:
          print('No')
        
    i += 1

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

b = len(a)
c = b + 1
i = 0
while i < c:
    c = a[i]
    if c == 7:
        print('yes')
        break
    elif c==a:
          print('no')
        
    i += 1

Buggy submission (verdict: Runtime Error):
a = input().split()
b = len(a)
c = b + 1
i = 0
while i < c:
    c = a[i]
    if c == 7:
        print('yes')
        break
    elif c==a:
          print('no')
        
    i += 1

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

b = a + 1
i = 0
while i < b:
    c = a[i]
    if c == 7:
        print('yes')
        break
    elif c==a:
          print('no')
        
    i += 1

Buggy submission (verdict: Runtime Error):
a = map(str,input())
b = a + 1
i = 0
while i < b:
    c = a[i]
    if c == 7:
        print('yes')
        break
    elif c==a:
          print('no')
        
    i += 1

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

i = 0
while i <= len(a):
    c = a[i]
    if c == 7:
        print('yes')
        break
    
    i += 1
    if i==b:
        print('no')

Buggy submission (verdict: Runtime Error):
a = map(str,input())
b = len(a)
i = 0
while i<=b:
    c = a[i]
    if c==7:
        print('yes')
        break
    
    i += 1
    if i==b:
        print('no')
Problem p02712 (python)

Fixed submission:
a = int(input())
ans = 0
i = 1
while i <= a:
    if i%15 == 0:
        i += 1
        continue
    elif i%3 == 0:
        i += 1
        continue
    elif i%5 == 0:
        i += 1
        continue
    ans += i
    i += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
a = input()
ans = 0
i = 1
for i in range(0,a,1):
    if i%3 == 0:
        i += 1
        continue
    elif i%5 == 0:
        i += 1
        continue
    ans += a
    
print(ans)
Problem p02659 (python)

Fixed submission:
# Multiplication 3
A, B = input().split()
A = int(A)
B = int(B.replace('.', ''))
ans = (A*B) // 100
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
ans = int((A*B) // 1)
print(ans)
Problem p02819 (python)

Fixed submission:
# Next Prime
import numpy as np

# input
X = int(input())

# solve
prime = 0
numbers = np.array(list(range(2, 10**5 + 4)))

while prime < X:
    prime = numbers[0]
    numbers = numbers[numbers % prime != 0]

# output
print(prime)

Buggy submission (verdict: Runtime Error):
# Next Prime
import numpy as np

# input
X = int(input())

# solve
primes = np.array([])
numbers = np.array(list(range(2, 10**5 + 1)))
while len(numbers) > 0:
    primes = np.append(primes, numbers[0])
    numbers = numbers[numbers % numbers[0] != 0]

res = int(min(primes[primes >= X]))

# output
print(res)
Problem p02831 (python)

Fixed submission:
# Snack
from collections import deque
import numpy as np
import math


# input
A, B = map(int, input().split())
A, B = max(A,B), min(A,B)

# solve
# -----------------
# 約数列挙
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = deque()
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return list(divisor_list)
# -----------------

div_A = make_divisor_list(A)
div_B = make_divisor_list(B)

rem = [b for b in div_B if b not in div_A]

if len(rem) != 0:
    for b in [b for b in div_B if b not in div_A]:
        if A * b % B == 0:
            res = A * b
            break
else:
    res = A

# output
print(res)

Buggy submission (verdict: Runtime Error):
# Snack
from collections import deque
import numpy as np
import math


# input
A, B = map(int, input().split())
A, B = max(A,B), min(A,B)

# solve
# -----------------
# 約数列挙
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = deque()
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return list(divisor_list)
# -----------------

div_A = make_divisor_list(A)
div_B = make_divisor_list(B)

for b in [b for b in div_B if b not in div_A]:
    if A * b % B == 0:
        res = A * b
        break

# output
print(res)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = [0] * (N+1)
for _ in range(M):
    i = int(input())
    a[i] = 1

dp = [0] * (N+2)
dp[N] = 1
mod = 1000000007

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

print(dp[0])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [0] * (N+1)
for _ in range(M):
    i = int(input())
    a[i] = 1
dp = [0] * (N+2)
dp[N] = 1
mod = 1_000_000_007

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

print(dp[0])