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

Fixed submission:
n = input()

def abc(s):
  t = all(('3' in s, '5' in s, '7' in s))
  if len(s) < len(n):
    return abc(s+'3') + abc(s+'5') + abc(s+'7') + t
  elif s <= n:
    return t
  else:
    return 0

print(abc(''))

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

def abc(s):
  t = all('3' in s, '5' in s, '7' in s)
  if len(s) < len(n):
    return abc(s+'3') + abc(s+'5') + abc(s+'7') + t
  elif s <= n:
    return t
  else:
    return 0
print(abc(''))
Problem p03219 (python)

Fixed submission:
x, y = map(int, input().split())
print(x + (y//2))

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

Fixed submission:
a, b, k = map(int, input().split())
if a != b:
  if k == 0:
    print(a, b, sep='\n')
    exit()
else:
  print(a)
  exit()
for i in range(a, min(b,a+k)):
  print(i)
for j in range(max(i,b-k)+1,b+1):
  print(j)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
for i in range(a, min(b,a+k)):
  print(i)
for j in range(max(i,b-k)+1, b+1):
  print(j)
Problem p02928 (python)

Fixed submission:
import numpy as np
N,K = map(int,input().split())
A = list(map(int,input().split()))


diff = []
npA = np.array(A)
lenA = len(A)
for a in A:
    temp = list(np.array([a for i in range(lenA)]) - npA)
    diff.append(temp)

D = np.array(diff)

upD = np.triu(D,k=1)

upC = np.count_nonzero(upD>0)
dwC = np.count_nonzero(upD<0)

ans = (K*(K+1)//2)*upC + ((K-1)*K//2)*dwC
print(ans%(1000000007))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int,input().split())
A = list(map(int,input().split()))


diff = []
npA = np.array(A)
lenA = len(A)
for a in A:
    temp = list(np.array([a for i in range(lenA)]) - npA)
    diff.append(temp)

D = np.array(diff)

upD = np.triu(D,k=1)

upC = np.count_nonzero(upD>0)

ans = int(K*(2*upC) - dwC)
print(ans%(1000000007))
Problem p02898 (python)

Fixed submission:
n, k = [int(x) for x in input().split(' ')]
frei = [int(x) for x in input().split(' ')]

ans = 0
for x in frei:
    if x >= k:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = [int(x) for x in input().split(' ')]
frei = [int(x) for x in input().split(' ')]

ans = 0
for x int frie:
  if x >= k:
    ans += 1
print(ans)
Problem p03061 (python)

Fixed submission:
import math

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

gcd_list = [0 for _ in range(N)]

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

for i in range(1, N):
    gcd_list[i] = gcd(gcd_list[i-1], A[i-1])
last_gcd = 0
for i in range(N-2, -1, -1):
    last_gcd = gcd(last_gcd, A[i+1])
    gcd_list[i] = gcd(last_gcd, gcd_list[i])

print(max(gcd_list))

Buggy submission (verdict: Runtime Error):
import math

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

not_replaced_max = A[0]

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

# def divisor(n):
#     limit = int(math.sqrt(n))
#     for i in range(2, limit):
#         if n % i == 0:
#             result.append(i)
#     return result

# def merge(A, B):

# divisor_list = divisor(A[1])
# for i in range(1, N):
#     not_replaced_max = gcd(not_replaced_max, A[i])
# print(replaced_max)
#
A.sort()

def func(n):
    limit = int(math.sqrt(n))
    divisor = []
    for i in range(1, limit):
        if n % i == 0:
            divisor.append(i)
    return divisor

def merge(A, B):
    divisor_list = [a for a in A]
    for b in B:
        if b not in A:
            divisor_list.append(b)
    return divisor_list

divisor_list = merge(func(A[0], A[1]))
divisor_list.sort(reverse=True)
is_end = False
for d in divisor_list:
    count = 0
    for a in A:
        if a % d != 0:
            count += 1
            if count > 1:
                break
    if count == 0 or is_end:
        print(d)
    else:
        is_end = True
Problem p03068 (python)

Fixed submission:
N = int(input())
S = list(input())
K = int(input())

target = S[K-1]
ans = ""
for s in S:
    ans += s if s == target else "*"
print(ans)

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

target = S[K]
ans = ""
for s in S:
    ans += s if s == target else "*"
print(ans)
Problem p03103 (python)

Fixed submission:
def get_input_row():
  return [int(i) for i in input().split(" ")]
     
inp = get_input_row()
N = inp[0]
M = inp[1]
item_dict = {}
num = 0
for i in range(N):
  a, b = get_input_row()
  if a in item_dict:
    item_dict[a] += b
  else:
    item_dict[a] = b

sorted_list = [k for k in item_dict.keys()]
sorted_list.sort()
money = 0
for price in sorted_list:
  if M > item_dict[price]:
    M -= item_dict[price]
    money += price * item_dict[price]
  else:
    money += price * M
    break
print(money)

Buggy submission (verdict: Runtime Error):
    def get_input_row():
      return [int(i) for i in input().split(" ")]
     
    inp = get_input_row()
    N = inp[0]
    M = inp[1]
    item_dict = {}
    num = 0
    for i in range(N):
      a, b = get_input_row()
      if a in item_dict:
        item_dict[a] += b
      else:
      	item_dict[a] = b
    sorted_list = [k for k in item_dict.keys()]
    sorted_list.sort()
    money = 0
    for price in sorted_list:
      if M > item_dict[price]:
        M -= item_dict[price]
        money += price * item_dict[price]
      else:
        money += price * M
        break
    print(money)
Problem p03110 (python)

Fixed submission:
N = int(input())

money = 0
for _ in range(N):
    x, u = input().split()
    if u == "JPY":
        money += float(x)
    else:
        money += float(x) * 380000
print(money)

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

money = 0
for _ in range(N):
    x, u = map(int, input().split())
    if u == "JPY":
        money += x
    else:
        money += x * 380000
print(money)
Problem p03125 (python)

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

if B % A == 0:
    print(A+B)
else:
    print(B-A)

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

need_matches = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-1] * (N+1)
dp[0] = 0
for i in range(1, N+1):
    max_scale = -1
    for num in useful_num_list:
        if need_matches[num] <= i:
            scale = dp[i-need_matches[num]] + 1
            if max_scale < scale:
                max_scale = scale
    dp[i] = max_scale

useful_num_list.sort(reverse=True)
ans =""
n = N
while n > 0:
    ans_scale = ""
    for num in useful_num_list:
        if dp[n] - 1 == dp[n - need_matches[num]]:
            ans_scale = str(num)
            n -= need_matches[num]
            break
    ans += ans_scale
print(ans)
Problem p03126 (python)

Fixed submission:
N, M = map(int, input().split())
loved_by_everyone = [0] * M
for _ in range(N):
    like_list = list(map(int, input().split()))
    for like in like_list[1:]:
        loved_by_everyone[like-1] += 1

kinds = 0
for food in loved_by_everyone:
    kinds += 1 if food == N else 0
print(kinds)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
loved_by_everyone = [0] * M
for _ in range(N):
    like_list = list(map(int, input().split()))
    for like in like_list[1:]:
        loved_by_everyone[like] += 1

kinds = 0
for food in loved_by_everyone:
    kinds += 1 if food == N else 0
print(kinds)
Problem p03263 (python)

Fixed submission:
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]

odd_cells = []
for y in range(H):
    for x in range(W):
        x = x if y % 2 == 0 else W-x-1
        if A[y][x] % 2 == 1:
            odd_cells.append([x+1, y+1])

ans_operation = []
for i in range(0, len(odd_cells)-1, 2):
    source = odd_cells[i]
    dist = odd_cells[i+1]
    while not (source[0] == dist[0] and source[1] == dist[1]):
        if (source[0] == W and source[1] % 2 == 1) or\
                (source[0] == 1 and source[1] % 2 == 0):
            ans_operation.append(source+[source[0], source[1]+1])
            source[1] += 1
        else:
            direction = 1 if source[1] % 2 == 1 else -1
            ans_operation.append(source+[source[0]+direction, source[1]])
            source[0] += direction

print(len(ans_operation))
for ans in ans_operation:
    # x と y が逆
    print(ans[1], ans[0], ans[3], ans[2])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]

odd_cells = []
for y in range(H):
    for x in range(W):
        x = x if y % 2 == 0 else W-x-1
        if A[y][x] % 2 == 1:
            odd_cells.append([x+1, y+1])

ans_operation = []
for i in range(0, len(odd_cells), 2):
    source = odd_cells[i]
    dist = odd_cells[i+1]
    while not (source[0] == dist[0] and source[1] == dist[1]):
        if dist[1] - source[1] > 1:
            ans_operation.append(source+[source[0], source[1]+1])
            source[1] += 1
        else:
            if (source[0] == W and source[1] % 2 == 1) or\
                    (source[0] == 0 and source[1] % 2 == 0):
                ans_operation.append(source+[source[0], source[1]+1])
                source[1] += 1
            else:
                direction = 1 if source[1] % 2 == 1 else -1
                ans_operation.append(source+[source[0]+direction, source[1]])
                source[0] += direction

print(len(ans_operation))
for ans in ans_operation:
    # x と y が逆
    print(ans[1], ans[0], ans[3], ans[2])
Problem p03274 (python)

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

distance = float('inf')
for i in range(N-K+1):
    tmp_distance = abs(X[i]) + abs(X[i+K-1]-X[i])
    distance = min(distance, tmp_distance)
    tmp_distance = abs(X[i+K-1]) + abs(X[i+K-1]-X[i])
    distance = min(distance, tmp_distance)
print(distance)

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

distance = max([X[-1] - X[0], -X[i], X[-1]])
for i in range(N-K+1):
    if X[i+K-1] < 0:
        distance = min(distance, -X[i])
    elif X[i] > 0:
        distance = min(distance, X[i+K-1])
    else:
        tmp_distance = X[i+K-1]-X[i]
        tmp_distance += min(X[i+K-1], -X[i])
        distance = min(distance, tmp_distance)
print(distance)
Problem p03309 (python)

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

ans = 0
for i in range(N):
    A[i] -= i+1

b_index = N // 2
A.sort()

def regret(A, b):
    result = 0
    for a in A:
        result += abs(a-b)
    return result

ans = regret(A, A[b_index])
if b_index + 1 < N:
    ans = min(ans, regret(A, A[b_index+1]))
print(ans)

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

ans = 0
for i in range(N):
    A[i] -= i+1

b_index = N // 2

def regret(A, b):
    result = 0
    for a in A:
        result += abs(a-b)
    return result

print(min(regret(A, A[b_index]), regret(A, A[b_index+1])))
Problem p03354 (python)

Fixed submission:
N, M = map(int, input().split())
P = list(map(int, input().split()))

class UnionFind():
    def __init__(self, N):
        self.nodes = [i for i in range(N)]

    def root(self, x):
        if self.nodes[x] != x:
            self.nodes[x] = self.root(self.nodes[x])
        return self.nodes[x]

    def is_same(self, x, y):
        return self.root(x) == self.root(y)

    def union(self, x, y):
        self.nodes[self.root(x)] = self.root(y)

tree = UnionFind(N)
for _ in range(M):
    x, y = map(int, input().split())
    tree.union(x-1, y-1)

ans = 0
for idx, p in enumerate(P):
    if tree.is_same(idx, p-1):
        ans += 1
print(ans)

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

class UnionFind():
    def __init__(self, N):
        self.nodes = [i for i in range(N)]

    def root(self, x):
        if self.nodes[x] == x:
            return x
        else:
            root = self.root(self.nodes[x])
            return root

    def is_same(self, x, y):
        return self.root(x) == self.root(y)

    def union(self, x, y):
        self.nodes[self.root(x)] = self.root(y)

tree = UnionFind(N+1)
for _ in range(M):
    x, y = map(int, input().split())
    tree.union(x, y)

ans = 0
for idx, p in enumerate(P):
    if tree.is_same(idx+1, p):
        ans += 1
print(ans)
Problem p03409 (python)

Fixed submission:
N = int(input())
Red = [list(map(int, input().split())) for _ in range(N)]
Blue = [list(map(int, input().split())) for _ in range(N)]

Red.sort(key=lambda x: x[1], reverse=True)
Blue.sort(key=lambda x: x[0])

ans = 0
for blue in Blue:
    for red in Red:
        if red[0] < blue[0] and red[1] < blue[1]:
            ans += 1
            Red.remove(red)
            break

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
Red = [list(map(int, input().split())) for _ in range(N)]
Blue = [list(map(int, input().split())) for _ in range(N)]

Red.sort(key=lambda x: x[1], reverse=True)
Blue.sort(key=lambda x: x[0])

ans = 1
for blue in Blue:
    for red in Red:
        if red[0] < b[0] and red[1] < b[1]:
            ans += 1
            Red.remove(red)
            break

print(ans)
Problem p02911 (python)

Fixed submission:
def solve():
    n, k, q = map(int, input().split())
    a = []
    for i in range(n):
        a.append(0)
    for i in range(q):
        aa = int(input()) - 1
        a[aa] = a[aa]+1
    for i in range(n):
        if k - (q-a[i]) > 0:
            print('Yes')
        else:
            print('No')

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    n, k, q = map(int, input().split())
    a = []
    for i in range(q):
        a.append(0)
    for i in range(q):
        aa = int(input()) - 1
        a[aa] = a[aa]+1
    for i in range(n):
        if k - (q-a[i]) > 0:
            print('Yes')
        else:
            print('No')

if __name__ == "__main__":
    solve()
Problem p02900 (python)

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

import math

if A < B:
    A, B = B, A
    
while A % B != 0:
    A, B = B, A%B
    
ans = 1

for i in range(2, int(math.sqrt(B))+1):
    if B % i == 0:
        ans += 1
        
        while B % i == 0:
            B //= i
            
if B > 1:
    ans += 1
    
print(ans)

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

import math

g = math.gcd(A, B)
ans = 1

for i in range(2, int(math.sqrt(g))+1):
    if g % i == 0:
        ans += 1
        
        while True:
            g //= i
            if g % i != 0:
                break
                
if (g != 1):
    ans += 1
    
print(ans)

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

import math

g = math.gcd(A, B)
ans = 1

for i in range(2, int(math.sqrt(g))+1):
    if g % i == 0:
        ans += 1
        
        while True:
            g //= i
            if g % i != 0:
                break
                
if g != 1:
    ans += 1
    
print(ans)

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

lst = []
for i in range(1, min(A, B)+1):
    if A % i == 0 and B % i == 0:
        lst.append(i)
        
from math import gcd

ans = 0
cnt = 1

for j in range(1, len(lst)):
    for k in range(j+1, len(lst)):
        if gcd(lst[j], lst[k]) == 1:
            cnt += 1
        else:
            if cnt > ans:
                ans = cnt
                cnt = 0
            
print(ans+1)
Problem p02922 (python)

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

cnt = 0
tap = 1

while tap < B:
    tap += A-1
    cnt += 1
    
print(cnt)

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

n = (B-A) / (A-1) + 1
print(math.ceil(n))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)


A, B = map(int, input().split())

import math

def func(B, C, D):
    if D >= B:
        print(C)
    else:
        C += 1
        func(B, C, D)
        
if B == 1:
    print(0)

else:
    C = math.ceil(B/A)
    D = (A-1)*(C-1) + A
    func(B, C, D)

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

import math

def func(B, C, D):
    if D >= B:
        print(C)
    else:
        C += 1
        func(B, C, D)
        
if B == 1:
    print(0)

else:
    C = math.ceil(B/A)
    D = (A-1)*(C-1) + A
    func(B, C, D)
Problem p02937 (python)

Fixed submission:
s = input()
t = input()
s_ = s[:]
cnt = 0
tlen = len(t)
ans = 0
flag = True

while cnt < tlen:
    
    num = s_.find(t[cnt])
    
    if num != -1:
        ans += (num+1)
        s_ = s_[(num+1):]
        cnt += 1
        flag = False
    else:
        if flag:
            print(-1)
            exit(0)
        ans += len(s_)
        s_ = s[:]
        flag = True
        
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
l = 10**5
S = s*l

a = 0
flag = True
for i in range(len(t)):
    if t[i] in S:
        a = S.index(t[i], a)+1
    else:
        flag = False
        break
        
if flag:
    print(a)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
l = 10**5
S = s*l
a = 0
flag = True
for i in range(len(t)):
    if t[i] in S[a:]:
        a += S[a:].index(t[i])+1
    else:
        flag = False
        break
        
if flag:
    print(a)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
l = 10**5
S = s*l

a = 0
flag = True
for i in range(len(t)):
    if t[i] in S[a:]:
        a += S[a:].find(t[i])+1
    else:
        flag = False
        break
        
if flag:
    print(a)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
l = 10**5
S = s*l

a = 0
flag = True
for i in range(len(t)):
    if t[i] in S[a+1:]:
        a += S[a+1:].find(t[i])+1
    else:
        flag = False
        break
        
if flag:
    print(a+1)
else:
    print(-1)
Problem p03408 (python)

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

from collections import Counter

blue = Counter(S)
red = Counter(T)

point = []

for bkey in blue:
    if bkey in red:
        point.append(blue[bkey] - red[bkey])
    else:
        point.append(blue[bkey])
        
print(max(point) if max(point) > 0 else 0)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

pnt = []

for b in blue:
    if b in red:
        pnt.append(blue[b] - red[b])
    else:
        pnt.append(blue[b])
        
print(max(pnt) if max(pnt) > 0 else 0)
Problem p03495 (python)

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

from collections import Counter

ac = Counter(A)

cnt = 0

if len(ac) > K:
    for a in ac.most_common()[K:]:
        cnt += a[1]
    
print(cnt)

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

from collections import Counter

ac = Counter(A)
cnt = 0

if len(c) > K:
    for a in ac.most_common()[K:]:
        cnt += a[1]
        
print(cnt)
Problem p03624 (python)

Fixed submission:
S = input()

import string

S = list(sorted(S))
T = string.ascii_lowercase

for t in T:
    if t not in S:
        print(t)
        break
        
else:
    print("None")

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

import string

S = list(sorted(S))
T = string.ascii_lowercase

flag = False

for t in T:
    if t in S:
        flag = True
        continue
    else:
        flag = False
        print(a)
        break
        
if flag:
    print("None")
Problem p03944 (python)

Fixed submission:
W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]

W_ = [0, W] 
H_ = [0, H]

for l in lst:
    if l[2] == 1 and W_[0] < l[0]:
        W_[0] = l[0]
    elif l[2] == 2 and l[0] < W_[1]:
        W_[1] = l[0]
    elif l[2] == 3 and H_[0] < l[1]:
        H_[0] = l[1]
    elif l[2] == 4 and l[1] < H_[1]:
        H_[1] = l[1]
        
width = W_[1] - W_[0] if W_[1] - W_[0] > 0 else 0
height = H_[1] - H_[0] if H_[1] - H_[0] > 0 else 0

print(width * height)

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]

X = [0, W]
Y = [0, H]

for l in lst:
    if l[2] == 1 and X[0] < l[0]:
        X[0] = l[0]
    elif l[2] == 2 and l[0] < X[1]:
        X[1] = l[0]
    elif l[2] == 3 and Y[0] < l[1]:
        Y[0] = l[1]
    elif lst[2] == 4 and l[1] < Y[1]:
        Y[1] = l[1]

width = X[1] - X[0] if X[1] - X[0] > 0 else 0
height = Y[1] - Y[0] if Y[1] - Y[0] > 0 else 0

print(width * height)

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]

X = [0, W]
Y = [0, H]

for l in lst:
    if l[2] == 1 and X[0] < l[0]:
        X[0] = l[0]
    elif l[2] == 2 and l[0] < X[1]:
        X[1] = l[0]
    elif l[2] == 3 and Y[0] < l[1]:
        Y[0] = l[1]
    elif lst[2] == 4 and l[1] < Y[1]:
        Y[1] = l[1]

width = X[1] - X[0]
height = Y[1] - Y[0]

if width > 0 and height > 0:
    print(width * height)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]

X = [0, W]
Y = [0, H]

for l in lst:
    if l[2] == 1 and X[0] < l[0]:
        X[0] = l[0]
    elif l[2] == 2 and l[0] < X[1]:
        X[1] = l[0]
    elif l[2] == 3 and Y[0] < l[1]:
        Y[0] = l[1]
    elif lst[2] == 4 and l[1] < Y[1]:
        Y[1] = l[1]

width = X[1] - X[0]
height = Y[1] - Y[0]

if width >= 0 and height >= 0:
    print(width * height)
else:
    print(0)
Problem p03059 (python)

Fixed submission:
a, b, c = map(int ,input().split())
print(int((c+0.5)//a * b))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int ,input().split())
	print((a+0.5)//c * a)
Problem p03160 (python)

Fixed submission:
# DP
def frog_dp():
    cost = [0] * N
    for cs in range(1, N):
        if cs == 1:
            cost[cs] = abs(h[cs]-h[cs-1])
        else:
            cost[cs] = min(cost[cs-1] + abs(h[cs]-h[cs-1]), cost[cs-2] + abs(h[cs] - h[cs-2]))
    return cost[-1]


N = int(input())
h = list(map(int, input().split()))
ans = frog_dp()
print(ans)

Buggy submission (verdict: Runtime Error):
#全探索
def jump_all(cs):
    if cs == N:
        return 0
    elif cs == N - 1:
        return jump_all(cs + 1) + (h[cs+1] - h[cs])
    else:
        SINGLE = jump_all(cs + 1) + abs(h[cs+1] - h[cs])
        DOUBLE = jump_all(cs + 2) + abs(h[cs+2] - h[cs])
        return min(SINGLE, DOUBLE)


N = int(input())
h = list(map(int, input().split()))
h.append(h[-1])
ans = jump_all(0)
print(ans)
Problem p03285 (python)

Fixed submission:
n = int(input())
count = 0
for cake in range(0,n+1,4):
    for donatsu in range(0,n+1,7):
        if donatsu + cake == n:
            count += 1
print("Yes") if count >= 1 else print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
for cake in range(0,n+1,4):
    for donatsu in range(0,n+1,7):
        count += 1
print("Yes") if count >= 1 else print("No")
n = int(input())
count = 0
for cake in range(0,n+1,4):
    for donatsu in range(0,n+1,7):
        if donatsu + cake == 0:
            count += 1
print("Yes") if count >= 1 else print("No")
Problem p03605 (python)

Fixed submission:
a = input()
print("Yes") if "9" in a else print("No")

Buggy submission (verdict: Runtime Error):
/Users/isiidaisuke/PycharmProjects/program/venv/bin/python /Users/isiidaisuke/PycharmProjects/program/program.py
89
Yes

Process finished with exit code 0
Problem p03693 (python)

Fixed submission:
num = "".join(input().split())
print("YES") if int(num) % 4 == 0 else print("NO")

Buggy submission (verdict: Runtime Error):
num = "".join(input().split())
print("YES") if num%4 == 0 else print("NO")
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
S = [input() for _ in range(n)]
S.sort()
print("".join(S))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
S = [input() for _ in range(3)]
S.sort()
print("".join(S))