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

Fixed submission:
#112_D
N,M=map(int,input().split())
#M//N以下のMの約数の最大
divisors=[]
for i in range(1,int(M**.5)+1):
    if M%i==0:
        divisors.append(i)
        if i!=(M//i):
            divisors.append(M//i)
Ans=1
for x in sorted(divisors):
    if M//N>=x:
        Ans=x
    else:
        break
print(Ans)

Buggy submission (verdict: Runtime Error):
#112_D
N,M=map(int,input().split())
#M//N以下のMの約数の最大
divisors=[]
for i in range(1,int(M**.5)+1):
    if M%i==0:
        divitors.append(i)
        if i!=(M//i):
            divitors.append(M//i)
Ans=1
for x in divitors:
    if M//N>=x:
        Ans=x
    else:
        break
print(Ans)
Problem p03263 (python)

Fixed submission:
#109_D
H,W=map(int,input().split())
A=[]
Ans=[]
for i in range(H):
    a=list(map(int,input().split()))
    if i%2==0:
        A+=a
    else:
        A+=a[::-1]
for i in range(H*W-1):
    if A[i]%2==1:
        A[i]-=1
        A[i+1]+=1
        y1=i//W+1
        x1=i%W+1 if y1%2==1 else W-i%W
        y2=(i+1)//W+1
        x2=(i+1)%W+1 if y2%2==1 else W-(i+1)%W
        Ans.append([y1,x1,y2,x2])
print(len(Ans))
for ans in Ans:
    print(*ans)

Buggy submission (verdict: Runtime Error):
#109_D
H,W=map(int,input().split())
A=[]
Ans=[]
for i in range(N):
    a=list(map(int,input().split()))
    if i%2==0:
        A+=a
    else:
        A+=a[::-1]
for i in range(H*W-1):
    if A[i]%2==1:
        A[i]-=1
        A[i+1]+=1
        y1=i//W+1
        x1=i%W+1 if y1%2==1 else W-i%W
        y2=(i+1)//W+1
        x2=(i+1)%W+1 if y2%2==1 else W-(i+1)%W
        Ans.append([y1,x1,y2,x2])
print(len(Ans))
for ans in Ans:
    print(*ans)
Problem p03282 (python)

Fixed submission:
#106_C
S=input()
K=int(input())
ans=0
for i in range(len(S)):
    if S[i]!='1':
        ans=i
        break

print('1' if K<=ans else S[ans])

Buggy submission (verdict: Runtime Error):
#106_C
S=input()
K=int(input())
for i in range(len(S)):
    if S[i]!='1':
        ans=i
        break

print('1' if K<=ans else S[ans])

Buggy submission (verdict: Runtime Error):
#106_C
S=input()
K=int(input())
for i in range(len(S)):
    if S[i]!='1':
        ans=i
        break
print(ans)
print('1' if K<=ans else S[ans])

Buggy submission (verdict: Runtime Error):
#106_C
S=input()
K=int(input())
for i in range(len(S)):
    if S[i]!='1':
        ans=i
        break

print(1 if K<=ans else S[ans])
Problem p03338 (python)

Fixed submission:
#098_B
n=int(input())
s=input()
print(max([len(set(s[:i])&set(s[i:])) for i in range(1,n)]))

Buggy submission (verdict: Runtime Error):
#098_B
n=int(input())
s=input()
print(max([len(set(s[:i])&set(s[i:])) for i in range(1,n-1)]))
Problem p03436 (python)

Fixed submission:
#088_D
import queue
h, w = map(int, input().split())
inf = 10 ** 5
s = [input() for _ in range(h)]
d = [[inf]*w for _ in range(h)]

que = queue.Queue()
que.put((0, 0))
d[0][0] = 0
while not que.empty():
    qx, qy = que.get()
    if qx == h-1 and qy == w-1:
        break
        
    for dx, dy in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
        px, py = qx+dx, qy+dy
        if 0 <= px < h and 0<= py < w:
            if s[px][py] == '#':
                continue
            elif d[px][py] != inf:
                continue
            d[px][py] = d[qx][qy] + 1
            que.put((px, py))
            
if d[h-1][w-1] == inf:
    print(-1)
else:
    print(h * w - (d[h-1][w-1]+1) - sum(s[i].count('#') for i in range(h)))

Buggy submission (verdict: Runtime Error):
#088_D
import queue
h, w = map(int, input().split())
inf = 10 ** 5
s = [input() for _ in range(h)]
d = [[inf]*w for _ in range(h)]

que = queue.Queue()
que.put((0, 0))
d[0][0] = 0
while not que.empty():
    qx, qy = que.get()
    if qx == h-1 and qy == w-1:
        break
        
    for dx, dy in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
        px, py = qx+dx, qy+dy
        if 0 <= px < h and 0<= py < w:
            if s[px][py] == '#':
                continue
            elif d[px][py] != inf:
                continue
            d[px][py] = d[qx][qy] + 1
            que.put((px, py))
            
if dp[h-1][w-1] == inf:
    print(-1)
else:
    print(h * w - (d[h-1][w-1]+1) - sum(s[i].count('#') for i in range(h)))
Problem p03501 (python)

Fixed submission:
#080_A
n,a,b=map(int,input().split())
print(min(a*n,b))

Buggy submission (verdict: Runtime Error):
#080_A
n,a,b=map(int,input().split())
print(min(a*t,b))
Problem p03579 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10 ** 7)
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)


colors = [0] * n
def dfs(v, color):
    colors[v] = color
    for to in edges[v]:
        if colors[to] == color:
            return False
        if colors[to] == 0 and (not dfs(to, -color)):
            return False

    return True

if dfs(0, 1):
    x = colors.count(1)
    print(x * (n - x) - m)

else:
    print(n * (n - 1) // 2 - m)

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


colors = [0] * n
def dfs(v, color):
    colors[v] = color
    for to in edges[v]:
        if colors[to] == color:
            return False
        if colors[to] == 0 and (not dfs(to, -color)):
            return False

    return True

if dfs(0, 1):
    x = colors.count(1)
    print(x * (n - x) - m)

else:
    print(n * (n - 1) // 2 - m)
Problem p03635 (python)

Fixed submission:
#069_A
n,m=map(int,input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
#069_A
n,m=map(input().split())
print((n-1)*(m-1))
Problem p03651 (python)

Fixed submission:
from fractions import gcd
n, k = map(int, input().split())
a = list(map(int, input().split()))

a_gcd = a[0]
for i in range(1, n):
    a_gcd = gcd(a_gcd, a[i])
ans = True
if k > max(a):
    ans = False
if k % a_gcd != 0:
    ans = False
if k in a:
    ans = True

print('POSSIBLE' if ans else 'IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
from math import gcd
n, k = map(int, input().split())
a = list(map(int, input().split()))

a_gcd = a[0]
for i in range(1, n):
    a_gcd = gcd(a_gcd, a[i])
ans = True
if k > max(a):
    ans = False
if k % a_gcd != 0:
    ans = False
if k in a:
    ans = True

print('POSSIBLE' if ans else 'IMPOSSIBLE')
Problem p03679 (python)

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

Buggy submission (verdict: Runtime Error):
#054_A
a,b=map(int,input().split())
print('Draw' if a==b else 'Alice' if (a-2)%13>(b-2)%13 else 'Bob')
Problem p03716 (python)

Fixed submission:
import heapq
n = int(input())
a = list(map(int, input().split()))

l = a[:n]
heapq.heapify(l)
memo_l = [0 for _ in range(n+1)]
memo_l[0] = sum(a[:n])

for i in range(1, n+1):
    memo_l[i] = memo_l[i-1]
    if l[0] < a[n+i-1]:
        x = heapq.heappop(l)
        heapq.heappush(l, a[n+i-1])
        memo_l[i] += a[n+i-1] - x


r = [-a[-i] for i in range(1, n+1)]
heapq.heapify(r)
memo_r = [0 for _ in range(n+1)]
memo_r[0] = sum(a[-n:])

for i in range(1, n+1):
    memo_r[i] = memo_r[i-1]
    if abs(r[0]) > a[-n-i]:
        x = heapq.heappop(r)
        heapq.heappush(r, -a[-n-i])
        memo_r[i] += x + a[-n-i]


ans = - 10 ** 20
for i in range(n+1):
    ans = max(ans, memo_l[i] - memo_r[n-i])

print(ans)

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

l = a[:n]
heapq.heapify(l)
memo_l = [0 for _ in range(n+1)]
memo_l[0] = sum(a[:n])

for i in range(1, n+1):
    memo_l[i] = memo_l[i-1]
    if l[0] < a[n+i-1]:
        x = heapq.heappop(l)
        heapq.heappush(l, a[n+i-1])
        memo_l[i] += a[n+i-1] - x


r = [-a[-i] for i in range(1, n+1)]
heapq.heapify(r)
memo_r = [0 for _ in range(n+1)]
memo_r[0] = sum(a[-n:])

for i in range(1, n+1):
    memo_r[i] = memo_r[i-1]
    if abs(x) > a[-n-i]:
        x = heapq.heappop(r)
        heapq.heappush(r, -a[-n-i])
        memo_r[i] += x + a[-n-i]


ans = - 10 ** 20
for i in range(n+1):
    ans = max(ans, memo_l[i] - memo_r[n-i])

print(ans)
Problem p03837 (python)

Fixed submission:
#051_D
inf = 10 ** 10
n, m = map(int, input().split())
d = [[inf for _ in range(n)] for _ in range(n)]
for i in range(n):
    d[i][i] = 0
edges = []
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
    edges.append((a-1, b-1, c))

def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
                
warshall_floyd(d)

ans = m
for u, v, c in edges:
    flg = False
    for i in range(n):
        if d[i][v] + c == d[i][u]:
            flg = True
    
    if flg:
        ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
#051_D
from heapq import heappop, heappush
inf = 10 ** 10
d = [[inf for _ in range(n)] for _ in range(n)]
for i in range(n):
    d[i][i] = 0
n, m = map(int, input().split())
edges = []
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
    edges.append((a-1, b-1))

def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
                
warshall_floyd(d)

ans = 0
for u, v in edges:
    for i in range(n):
        if i == u or i == v:
            continue
        if d[u][i] + d[i][v] == d[u][v]:
            ans += 1
            break

print(ans)
Problem p03854 (python)

Fixed submission:
#049_C
s = input()[::-1]
k = ['maerd', 'remaerd', 'esare', 'resare']

tmp = 0
flg = True
while tmp < len(s):
    check = False
    for x in k:
        if s[tmp: tmp + len(x)] == x:
            check = True
            tmp += len(x)
    if check == False:
        flg = False
        break
        
print('YES' if flg else 'NO')

Buggy submission (verdict: Runtime Error):
#049_C
s = input()

def dfs(x):
    if x == s:
        return True
    if len(x) > len(s):
        return False

    if any (dfs(x + k) for k in ['dream', 'dreamer', 'erase', 'eraser']):
        return True
    
    return False

print('YES' if dfs('') else 'NO')
Problem p04046 (python)

Fixed submission:
h, w, a, b = map(int, input().split())
mod = 10 ** 9 + 7
n = h + w

f = [1 for _ in range(n)]
f_inv = [1 for _ in range(n)]
for i in range(1, n):
    f[i] = f[i-1] * i % mod
    f_inv[i] = pow(f[i], mod-2, mod)


def comb(n, k):
    return (f[n] * f_inv[k] % mod) * f_inv[n-k] % mod

ans = comb(h+w-2, h-1)
for i in range(b):
    ans -= comb(h-a+i-1, i) * comb(a+w-i-2, a-1) % mod
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
h, w, a, b = map(int, input().split())
mod = 10 ** 9 + 7
n = h + w

f = [1 for _ in range(n)]
for i in range(1, n):
    f[i] = f[i-1] * i

def f_inv(x):
    return pow(f[x], mod-2, mod)

def comb(n, k):
    return (f[n] * f_inv[k] % mod) * f_inv[n-k] % mod

ans = comb(h+w-2, h-1)
for i in range(b):
    print(h-a+i, i)
    print(a+w-i-2, a-1)
    ans -= comb(h-a+i-1, i) * comb(a+w-i-2, a-1) % mod
    ans %= mod

print(ans)
Problem p02582 (python)

Fixed submission:
x = max(map(len,input().split("S")))
print(x)

Buggy submission (verdict: Runtime Error):
x = max(map(len,input().split(S)))
print(x)
Problem p02612 (python)

Fixed submission:
N = int(input())
x = 0
while x < N :
  x = x + 1000
print(x-N)

Buggy submission (verdict: Runtime Error):
N = map(int,input())
x = 0
while x < N :
  x = x + 1000
print(x-N)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
i=0
for a in range(0,A+1):
  for b in range(0,B+1):
    for c in range(0,C+1):
      if 500*a + 100*b + 50*c == X:
        i = i+1
print(i)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

for a in range(0,A+1):
  y = X-500*a
  if y<500:
    break

for b in range(0,B+1):
  z = y-100*b
  if z<100:
    break

for c in range(0,C+1):
  w = z-50*a
  if w<50:
    break
if w != 0:
  print(0)
else:
  d = (X-y)/500
  e = (y-z)/100
  f = (z-w)/50
  i = -1
  for n in range(0,d+1):
    if B-e-5*n >= 0:
      i=i+1
  for m in range(0,e+5*i):
    if C-f-2*m >= 0:
      i=i+1
  print(i)
Problem p03455 (python)

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

Buggy submission (verdict: Runtime Error):
x = input().split()
y = int(x[0])*int(x[1])
if y%2 = 1:
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
x = imput().split()
y = int(x[0])*int(x[1])
if y % 2:
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
x = imput().split()
y = int(x[0])*int(x[1])
if y%2 = 1:
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
x = split().input()
y = int(x[0])*int(x[1])
if y%2 = 0:
  print(Even)
else:
  print(Odd)

Buggy submission (verdict: Runtime Error):
if a*b % =0:
	print(even)
else:
    print(odd)
Problem p03478 (python)

Fixed submission:
N,A,B = map(int,input().split())
a=0
b=0
c=0
d=0
e=0
y=0
for i in range(1,N+1,1):
  n = str(i)
 
  if int(n)==10000:
    e=n[0]
    d=n[1]
    c=n[2]
    b=n[3]
    a=n[4]
  if 1000<=int(n)<10000:
    d=n[0]
    c=n[1]
    b=n[2]
    a=n[3]
  if 100<=int(n)<1000:
    c=n[0]
    b=n[1]
    a=n[2]
  if 10<=int(n)<100:
    b=n[0]
    a=n[1]
  if int(n)<10:
    a=n[0]
  x = int(d) + int(c) + int(b) + int(a) + int(e)
  if A <= x <= B:
    y = y + int(n)
print(y)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
for M in range(1,N+1,1)
  n =　str(M)
  a=0
  b=0
  c=0
  d=0
  e=0
  y=0
  if N=10000:
    e=n[0]
  if 1000<=N<10000:
    d=n[0]
    c=n[1]
    b=n[2]
    a=n[3]
  if 100<=N<1000:
    c=n[0]
    b=n[1]
    a=n[2]
  if 10<=N<100:
    b=n[0]
    a=n[1]
  if N<10:
    a=n[0]
  x = int(d) + int(c) + int(b) + int(a) + int(e)
  if A <= x <= B:
    y = y + int(n)
  print(y)
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(count("1"))
Problem p03494 (python)

Fixed submission:
import math 
N = int(input())
A = map(int,input().split())
B = map(bin,A)
def Y(x):
  y = len(x)-x.rfind("1")-1
  return y
C = map(Y,B)
print(min(C))

Buggy submission (verdict: Runtime Error):
import math 
N = input()
a =list(map(int,input().split()))
for i in a:
  B = min(len(bin(i)) -  bin(i).rfind("1") - 1)
print(B)

Buggy submission (verdict: Runtime Error):
import math 
N = input().int()
A = map(int,input().split())
B = map(bin,A)
def Y(x):
  y = len(x)-x.rfind("1")-1
  return y
C = map(Y,B)
print(min(C))

Buggy submission (verdict: Runtime Error):
N = input().int()
A = map(int,input().split())
B = map(bin,A)
def Y(x):
  y = len(x)-x.rfind("1")-1
  return y
C = map(Y,B)
print(min(C))
Problem p02681 (python)

Fixed submission:
pass1 = str(input())
pass2 = str(input())
  
pass2_org = pass2[0:-1]
  
if pass1 == pass2_org:
    print(f'Yes')
else:
    print(f'No')

Buggy submission (verdict: Runtime Error):
    pass1 = str(input())
    pass2 = str(input())
    
    pass2_org = pass2[0:-1]
    
    if pass1 == pass2_org:
        print(f'Yes')
    else:
        print(f'No')
Problem p03486 (python)

Fixed submission:
S = sorted(list(str(input())))
T = sorted(list(str(input())),reverse=True)

for i in range(min(len(S),len(T))):
    if S[i] < T[i]:
        print('Yes')
        break
    elif S[i] == T[i]:
        if i+1 == len(S) < len(T):
            print('Yes')
            break
        elif i+1 == len(T):
            print('No')
            break
        else:
            continue
    else:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
S = sorted(list(str(input())))
T = sorted(list(str(input())),reverse=True)

print('YNeos'[S>=::2])
Problem p03494 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

cnt = 0
flg = True

while flg == True:
    for i in range(N):
        if A[i]%2 == 1:
            flg = False
            break
    if flg == True:
        cnt += 1
        A = [a/2 for a in A]

print(cnt)

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

flg = True
cnt = 0

while flg = True:
    for i in range(N):
        if A[i]%2 = 1 then:
            flg = False
            break
    cnt += 1
    A = [a/2 for a in A]

print(cnt)
Problem p03693 (python)

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

if (100*r + 10*g + b) % 4 == 0:
    print('YES')
else:
    print('NO')

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

if (100*r + 10*g + b) % 4 == 0:
    print(f'YES')
else:
    print(f'NO')

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

if (100*r + 10*g + b) % 4 == 0:
    print(f'YES')
else:
    print(f'NO')

Buggy submission (verdict: Runtime Error):
r, g, b = map(int,input())

if (100*r + 10*g + b) % 4 == 0:
    print(f'YES')
else:
    print(f'NO')
Problem p03103 (python)

Fixed submission:
n,M = map(int,input().split())
d = []
for i in range(n):
    a,b = map(int,input().split())
    d.append([a,b])
 
d.sort(key=lambda x:x[0])

sum_ = 0
cnt = 0
for ab in d:
    if cnt + ab[1] > M:
        sum_ += ab[0] * (M-cnt)
        break
    else:
        cnt += ab[1]
        sum_ += ab[0]*ab[1]
print(sum_)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
d = []
for i in range(n):
    a,b = map(int,input().split())
    d.append([a,b])
 
d.sort(key=lambda x:x[0])

sum_ = 0
cnt = 0
for ab in d:
    if cnt + ab[1] > M:
        sum_ += ab[0] * (M-cnt)
        break
    else:
        cnt += ab[1]
        sum_ += ab[0]*ab[1]
print(sum_)
Problem p03160 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
inf = 10 ** 10
dp = [inf] * n
dp[0] = 0
for i in range(n - 1):
    temp = abs(h[i + 1] - h[i])
    dp[i + 1] = min(dp[i + 1], temp + dp[i])
    if i + 2 < n:
        temp = abs(h[i + 2] - h[i])
        dp[i + 2] = min(dp[i + 2], temp + dp[i])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(i) for i in input().split()]
dp = [inf for _ in range(N)]
dp[0] = 0
for i in range(N-1):
    dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1]-h[i]))
    if i+2 < N:
        dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2]-h[i]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(i) for i in input().split()]

def jump(now,h,cost):
    if now == len(h)-2: #ゴール一歩手前
        return cost + abs(h[-1] - h[now])
    elif now == len(h)-1: #ゴールについた時
        return cost

    cost1 = jump(now+1,h,cost)
    cost2 = jump(now+2,h,cost)
    if cost1 <= cost2:
        return cost1 + abs(h[now] - h[now+1])
    else: return cost2 + abs(h[now] - h[now+2])

cost = 0
print(jump(0,h,0))
Problem p03240 (python)

Fixed submission:
n = int(input())

xyh = [list(map(int, input().split())) for i in range(n)]
if xyh[0][2]:
    x,y,h = xyh[0]
if xyh[1][2]:
    x,y,h = xyh[1]
if xyh[-1][2]:
    x,y,h = xyh[-1]
for i in range(101):
    for j in range(101):
        k = h + abs(i - x) + abs(j - y)
        if all(h == max(k - abs(i - x) - abs(j - y), 0) for x, y, h in xyh):
            print(i, j, k)

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

xyh = [list(map(int, input().split())) for i in range(n)]
if xyh[0][2]:
    x,y,h = xyh[0]
if xyh[1][2]:
    x,y,h = xyh[1]
for i in range(101):
    for j in range(101):
        k = h + abs(i - x) + abs(j - y)
        if all(h == max(k - abs(i - x) - abs(j - y), 0) for x, y, h in xyh):
            print(i, j, k)

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

xyh = [list(map(int, input().split())) for i in range(n)]
if xyh[0][2]:
    x,y,h = xyh[0]
for i in range(101):
    for j in range(101):
        k = h + abs(i - x) + abs(j - y)
        if all(h == max(k - abs(i - x) - abs(j - y), 0) for x, y, h in xyh):
            print(i, j, k)
Problem p03281 (python)

Fixed submission:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
cnt = 0

for i in range(1,n+1):
    if len(make_divisors(i)) == 8 and i % 2 == 1:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import sympy
n = int(input())
cnt = 0

for i in range(1,n+1):
    if len(sympy.divisors(i)) == 8 and i % 2 == 1:
        cnt += 1
print(cnt)
Problem p02988 (python)

Fixed submission:
n = int(input())
arr = list(map(int, input().split()))
count = 0
for i in range(1, len(arr)-1):
  if (arr[i+1] - arr[i])* (arr[i] - arr[i-1]) > 0:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = [map(int, input().split())]
print(sum([1 for i in range(len(arr)) if (((arr[i] < arr[i+1]) and (arr[i] > arr[i-1])) or ((arr[i] > arr[i+1]) and (arr[i] < arr[i-1])))]))
Problem p02555 (python)

Fixed submission:
s = int(input())

a = [-1]*(s+10)
mod = 10**9 + 7

a[0] = 1
a[1] = 0
a[2] = 0
a[3] = 1
if s > 3:
    for i in range (4,s+1):
        a[i] = (a[i-1]+a[i-3])%mod

print(a[s])

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

a = [-1]*(s+1)
mod = 10**9 + 7

a[0] = 1
a[1] = 0
a[2] = 0
a[3] = 1
for i in range (4,s+1):
    a[i] = (a[i-1]+a[i-3])%mod

print(a[s])

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

a = [-1]*(s+1)

a[0] = 1
a[1] = 0
a[2] = 0
a[3] = 1
for i in range (4,s+1):
    a[i] = a[i-1]+a[i-3]

print(a[s])
Problem p02576 (python)

Fixed submission:
N, X, T = (int(x) for x in input().split() )

a = int(N/X)

if N % X != 0:
    t = (a + 1)* T
else:
    t = a * T

print(t)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
h,w,m = map(int,input().rstrip().split())
hw = [list(map(int,input().rstrip().split()))for _ in range(m)]

tate = [0]*(h+1)
yoko = [0]*(w+1)
bombpoint = set()

for x,y in hw:
    tate[x] += 1
    yoko[y] += 1
    bombpoint.add((x,y))

ans_x = []
ans_y = []
x_max = max(tate)
y_max = max(yoko)
for i in range(len(tate)):
    if tate[i] == x_max:
        ans_x.append(i)
for i in range(len(yoko)):
    if yoko[i] == y_max:
        ans_y.append(i)

ans = x_max + y_max
for x in ans_x:
    for y in ans_y:
        if (x,y) not in bombpoint:
            print(ans)
            exit()
print(ans - 1)
Problem p02606 (python)

Fixed submission:
def main():
    l, r, d = map(int, input().split())
    res = r // d - (l-1) // d
    print(res)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import sqrt
from collections import defaultdict
def main():
    n = int(input())
    n2 = int(sqrt(n) + 1)
    d1 = defaultdict(int)

    for i1 in range(1, n2):
        for i2 in range(1, n2):
            for i3 in range(1, n2):
                #p = (i1 + i2) ** 2 - (i1 * i2) + i3 * (i1 + i2 + i3)
                p = i1 ** 2 + i2 ** 2 + i3 ** 2 + i1 * i2 + i2 * i3 + i1 * i3
                d1[p] += 1

    for j1 in range(1, n + 1):
        print(d1[j1])

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

Fixed submission:
A, B = map(int, input().split())

print(A*B)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(a*b)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,(input().split())))
 
sum=1
 
if 0 in A:
    print(0)
else:
    for i in range(N):
        sum *= A[i]  
        if sum >= int(1e18):
            break
    print(sum if sum<= int(1e18) else -1)
N = int(input())
A = list(map(int,(input().split())))

sum=1

if 0 in A:
    print(0)
else:
    for i in range(N):
        sum *= A[i]  
        if sum >= int(1e18):
            break
    print(sum if sum<= int(1e18) else -1)