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

Fixed submission:
import sys

x = int(input())
b_p = 0
b_m = 0

def div(n):
    divs = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    divs
    divs += list(map(lambda x: x*(-1), divs))
    return divs

divs = div(x)
while True:  
    for i in divs:
        a_p = i + b_p
        a_m = i + b_m
        if a_p ** 5 == x + b_p ** 5:
            print(a_p, b_p)
            sys.exit()
        if a_m ** 5 == x + b_m ** 5:
            print(a_m, b_m)
            sys.exit()
    b_p += 1
    b_m -= 1

Buggy submission (verdict: Runtime Error):
x = int(input())
b_p = 0
b_m = 0

def div(n):
    divs = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    divs
    divs += list(map(lambda x: x*(-1), divs))
    return divs

divs = div(x)
while True:  
    for i in divs:
        a_p = i + b_p
        a_m = i + b_m
        if a_p ** 5 == x + b_p ** 5:
            print(a_p, b_p)
            exit(1)
        if a_m ** 5 == x + b_m ** 5:
            print(a_m, b_m)
            exit(1)
    b_p += 1
    b_m -= 1
Problem p02692 (python)

Fixed submission:
import sys

n, a, b, c = map(int, input().split())
S = [input() for _ in range(n)]


abc = {"A": a, "B": b, "C": c}
ans = []
for i, s in enumerate(S):
    u, v = s[0], s[1]
    if abc[u] == abc[v] == 0:
        print("No")
        sys.exit()
    elif abc[u] > abc[v]:
        abc[u] -= 1
        abc[v] += 1
        ans.append(v)
    elif abc[u] < abc[v]:
        abc[u] += 1
        abc[v] -= 1
        ans.append(u)
    elif i == n-1:
        ans.append(u)
    else:
        if u in S[i+1]:
            abc[u] += 1
            abc[v] -= 1
            ans.append(u)
        elif v in S[i+1]:
            abc[v] += 1
            abc[u] -= 1
            ans.append(v)
print("Yes")
for ans_ in ans: print(ans_)

Buggy submission (verdict: Runtime Error):
import sys

n, a, b, c = map(int, input().split())
S = [input() for _ in range(n)]


abc = {"A": a, "B": b, "C": c}
ans = []
for i, s in enumerate(S):
    u, v = s[0], s[1]
    if abc[u] == abc[v] == 0:
        print("No")
        sys.exit()
    elif abc[u] > abc[v]:
        abc[u] -= 1
        abc[v] += 1
        ans.append(v)
    elif abc[u] < abc[v]:
        abc[u] += 1
        abc[v] -= 1
        ans.append(u)
    else:
        if u in S[i+1]:
            abc[u] += 1
            abc[v] -= 1
            ans.append(u)
        elif v in S[i+1]:
            abc[v] += 1
            abc[u] -= 1
            ans.append(v)
print("Yes")
for ans_ in ans: print(ans_)
Problem p02696 (python)

Fixed submission:
a, b, n = map(int, input().split())
i = min(b-1, n)
print(int((a*i)/b) -a * int(i/b))

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
max_int = 0
if a != b:
    if n < b:
        max_int = int((a*n)/b) -a * int(n/b)
    else:
        #for i in range(n, n-max(int(b/a), int(a/b), int(a%b), int(b%a))-1, -1):
        for i in range(i, n):
            tmp = int((a*i)/b) -a * int(i/b)

            #print(i)
            #print(tmp)
            if max_int < tmp:
                max_int = tmp

print(max_int)
Problem p02709 (python)

Fixed submission:
def main():
  N = int(input())
  INF = float('inf')
  A = [(i+1, a) for i, a in enumerate(map(int, input().split()))]
  A = sorted(A, key=lambda x: x[1], reverse = True)

  dp = [[-INF] * (N+1) for _ in range(N+1)]
  dp[0][0] = 0

  for s in range(1, N+1):
    for l in range(s+1):
      r = s - l
      dp[l][r] = max(dp[l-1][r] + A[s-1][1] * abs(A[s-1][0]-l), dp[l][r-1] + A[s-1][1] * abs(N-r+1-A[s-1][0]))
    
  ans = 0
  for m in range(N):
    if(dp[m][N-m] > ans):
      ans = dp[m][N-m]
    
  print(ans)

main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
N = int(input())
A = list(map(int, input().split()))
acts = [(x, i) for i, x in enumerate(A)]
acts.sort()
dp = [[-1]*N for _ in range(N)]
 
def rec(l, r):
    if r < l:
        return 0
    if dp[l][r] >= 0:
        return dp[l][r]
    k = r - l
    act, init_pos = acts[k]
    gain_l = act * abs(l - init_pos)
    gain_r = act * abs(r - init_pos)
    res = dp[l][r] = max(gain_l + rec(l+1, r), gain_r + rec(l, r-1))
    return res
 
print(solve(0, N-1))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [(A, i) for i, A in enumerate(map(int, input().split()))]

a.sort()
dp = [[-1]*n for _ in range(n)]

def recursive(l, r):
    if l > r:
        return 0
    if dp[l][r] >= 0:
        return dp[l][r]
    k = r - l
    energy, pos = a[k]
    from_l = energy * abs(l - pos)
    from_r = energy * abs(r - pos)
    ans = dp[l][r] = max(from_l + recursive(l+1, r), from_r + recursive(l, r-1))
    return ans

print(recursive(0, n-1))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [(A, i) for i, A in enumerate(map(int, input().split()))]

a.sort()
dp = [[-1]*n for _ in range(n)]

def recursive(l, r):
    if l > r:
        return 0
    if dp[l][r] >= 0:
        return dp[l][r]
    k = r - l
    energy, pos = a[k]
    from_l = energy * abs(l - pos)
    from_r = energy * abs(r - pos)
    dp[l][r] = max(from_l + recursive(l+1, r), from_r + recursive(l, r-1))
    return dp[l][r]

print(recursive(0, n-1))
Problem p02720 (python)

Fixed submission:
from collections import deque

k = int(input())
a = deque(range(1, 10))

for i in range(k):
    x = a.popleft()
    mod = x % 10
    if mod != 0:
        a.append(x*10 + mod -1)
    a.append(x * 10 + mod)
    if mod != 9:
        a.append(x*10 + mod + 1)

print(x)

Buggy submission (verdict: Runtime Error):
from collections import deque

k = int(input())
a = deque(range(1, 10))
cnt = 0

for i in range(k):
    x = a.popleft()
    mod = x % 10
    if mod != 0:
        a.append(x*10 + mod -1)
    a.append(x * 10 + mod)
    if mod != 9:
        a.append(x*10 + mod + 1)
    print(a)

print(x)
Problem p03244 (python)

Fixed submission:
import collections
n = int(input())
v = list(map(int,input().split()))
odd = collections.Counter(v[0::2]).most_common()
even = collections.Counter(v[1::2]).most_common()
odd.append((0, 0))
even.append((0, 0))
if odd[0][0] != even[0][0]:
    print(n - odd[0][1] - even[0][1])
else:
    print(n - max(odd[0][1] + even[1][1], odd[1][1] + even[0][1]))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int,input().split()))
odd = collections.Counter(v[0::2]).most_common()
even = collections.Counter(v[1::2]).most_common()
if odd[0][0] != even[0][0]:
    print(n - odd[0][1] - even[0][1])
elif len(odd) == 1:
    print(n - even[1][1])
elif len(even) == 1:
    print(n - odd[1][1])
else:
    print(n - max(odd[0][1] + even[1][1], odd[1][1] + even[0][1]))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int,input().split()))
odd = collections.Counter(v[0::2]).most_common()
even= collections.Counter(v[1::2]).most_common()
if odd[0][0] != even[0][0]:
    print(n - odd[0][1] - even[0][1])
else:
    print(n - max(odd[0][1] + even[1][1], odd[1][1] + even[0][1]))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int,input().split()))
odd = collections.Counter(v[0::2]).most_common()
even= collections.Counter(v[1::2]).most_common()
if odd[0][0] != even[0][0]:
    print(n - odd[0][1] - even[0][1])
else:
    print(n - max(odd[0][0] + even[1][0], odd[1][0] + even[0][0]))
Problem p03030 (python)

Fixed submission:
def main():
    N = int(input())
    A = []
    for i in range(N):
        S, P = input().split()
        A.append((S,int(P),i+1))
 
    sort_A = sorted(A, key=lambda x:(x[0], -x[1])) 
    for i in range(N):
        print(sort_A[i][2])
 
main()

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<algorithm>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<pair<pair<string,int>,int>> rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first >> rest[i].first.second;
        rest[i].first.second *= -1;
        rest[i].second = i+1;
    }
 
    sort(rest.begin(),rest.end());
 
    for(int i = 0;i < n;i++){
        cout << rest[i].second << endl;
    }
 
    return 0;
}
Problem p03131 (python)

Fixed submission:
# coding:utf-8

K, A, B = [int(i) for i in input().split()]

def cal(K, A, B):
    BNUM = 1
    TRANS_GET = B - A
    # 操作開始
    counter = 0
    while counter < K:
        nokori = K - counter
        if BNUM >= A:
        # 交換可能
            if nokori >= 2:
                syou = int(nokori / 2)
                BNUM += TRANS_GET * syou
                counter += syou * 2
            else:
                # 叩く
                BNUM += 1
                counter += 1
        else:
        # 交換不可
            atonanko = A - BNUM
            if atonanko <= nokori-2:
                BNUM += atonanko
                counter += atonanko
            else:
                BNUM += nokori
                break
    return BNUM


if B - A <= 2:
    max_b = 1 + K
else:
    max_b = cal(K, A, B)

print(max_b)

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

K, A, B = [int(i) for i in input().split()]

def cal(K, A, B):
    BNUM = 1
    TRANS_GET = B - A
    # 操作開始
    counter = 0
    while counter < K:
        nokori = K - counter
        if BNUM >= A:
        # 交換可能
            if nokori >= 2:
                syou = int(nokori / 2)
                amari = nokori % 2
                BNUM += TRANS_GET * syou + amari
                break
            else:
                BNUM += nokori
                break
        else:
        # 交換不可
            atonanko = A - BNUM
            if atonanko < nokori-2:
                BNUM += atonanko
                counter += atonanko
            else:
                BNUM += nikori
                break
    return BNUM


if A < B:
    if B - A > 2:
        max_b = cal(K, A, B)
    else:
        max_b = 1 + K
else:
    max_b = 1 + K

print(max_b)

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

K, A, B = [int(i) for i in input().split()]
print(K, A, B)

def cal(K, A, B):
    BNUM = 1
    TRANS_GET = B - A
    # 操作開始
    counter = 0
    while counter < K:
        nokori = K - counter
        if BNUM >= A:
        # 交換可能
            if nokori >= 2:
                BNUM += TRANS_GET
                counter += 2
            else:
                BNUM += nokori
                break
        else:
        # 交換不可
            atonanko = A - BNUM
            if atonanko < nokori-2:
                BNUM += atonanko
                counter += atonanko
            else:
                BNUM += nikori
                break
    return BNUM


if A < B:
    if B - A > 2:
        max_b = cal(K, A, B)
    else:
        max_b = 1 + K
else:
    max_b = 1 + K

print(max_b)
Problem p03147 (python)

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
h += [0]
add = False
ans = 0
for n in range(100):
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                ans += 1
            add = False
print(ans)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
# C - Grand Garden

N = int(input())
h = list(map(int,input().split()))
h += [0]
ans = 0

for n in range(100):
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                ans += 1
            add = False

print(ans)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
# C - Grand Garden

N = int(input())
h = list(map(int,input().split()))
h += [0]
ans = 0

for _ in range(100):
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                ans += 1
            add = False

print(ans)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
# C - Grand Garden

N = int(input())
h = list(map(int,input().split()))
h += [0]
ans = 0

for _ in range(100):
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                mini_ans += 1
            add = False

print(ans)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
# C - Grand Garden

N = int(input())
h = list(map(int,input().split()))
h += [0]
ans = 0

for _ in range(1000):
    mini_ans = 0
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                mini_ans += 1
            add = False
    
    if mini_ans == 0:
        break
    else:
        ans += mini_ans

print(ans)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
# C - Grand Garden

N = int(input())
h =  [int(i) for i in input().split()]
h += [0]
ans = 0

for _ in range(1000000):
    mini_ans = 0
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                mini_ans += 1
            add = False
    
    if mini_ans == 0:
        break
    else:
        ans += mini_ans

print(ans)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
# C - Grand Garden

N = int(input())
h =  [int(i) for i in input().split()]
h += [0]
ans = 0

while True:
    mini_ans = 0
    for i in range(N+1):
        if h[i] != 0:
            h[i] -= 1
            add = True
        else:
            if add:
                mini_ans += 1
            add = False
    if mini_ans == 0:
        break
    else:
        ans += mini_ans

print(ans)
Problem p03160 (python)

Fixed submission:
# coding:utf-8

N = int(input())
H = [int(hi) for hi in input().split()]
dp = [0]*N
dp[1] = abs(H[0]-H[1])

for i in range(2, N):
    dp[i] = min(abs(H[i]-H[i-2])+dp[i-2],abs(H[i]-H[i-1])+dp[i-1])
    
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
# coding:utf-8
 
N = int(input())
H = [int(hi) for hi in input().split()]
 
# 地点iへの最小コストを計算する関数
def dp(i):
    if i == 0:
        return 0
    elif i == 1:
        return abs(H[0]-H[1])
    else:
        return min(dp(i-2)+abs(H[i-2]-H[i]), dp(i-1)+abs(H[i-1]-H[i]))
 
min_cost = dp(N-1)
print(min_cost)

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

N = int(input())
H = [int(hi) for hi in input().split()]

# 地点iへの最小コストを計算する関数
def dp(i):
    if i == 1:
        return 0
    elif i == 0:
        return 0
    elif i == 2:
        return abs(H[0]-H[1])
    else:
        dp_i_1 = dp(i-1)+abs(H[i-2]-H[i-1])
        dp_i_2 = dp(i-2)+abs(H[i-3]-H[i-1])
        return min(dp_i_1, dp_i_2)

cost = dp(N)
print(cost)

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

N = int(input())
H = [int(hi) for hi in input().split()]

# 地点iへの最小コストを計算する関数
def dp(i):
    if i == 1:
        return 0
    elif i == 2:
        return abs(H[0]-H[1])
    else:
        dp_i_1 = dp(i-1)+abs(H[i-2]-H[i-1])
        dp_i_2 = dp(i-2)+abs(H[i-3]-H[i-1])
        return min(dp_i_1, dp_i_2)

cost = dp(N)
print(cost)

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

N = int(input())
H = [int(hi) for hi in input().split()]

cost1, cost2 = 0, 0

def jump(_k: int, k: int, cost: int) -> int:
    global H, N
    cost += abs(H[_k] - H[k])
    if k == N-1:
        return cost
    if k+1 <= N-1:
        cost1 = jump(k, k+1, cost)
    if k+2 <= N-1:
        cost2 = jump(k, k+2, cost)
    else:
        cost2 = cost1
    if cost1 <= cost2:
        return cost1
    else:
        return cost2

if N == 2:
    cost1 = jump(0, 1, 0)
    print(cost1)
else:
    cost1 = jump(0, 1, 0)
    cost2 = jump(0, 2, 0)
    if cost1 > cost2:
        print(cost2)
    else:
        print(cost1)

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

N = int(input())
H = [int(hi) for hi in input().split()]

def jump(_k: int, k: int, cost: int) -> int:
    global H, N
    cost += abs(H[_k] - H[k])
    if k == N-1:
        return cost
    if k+1 <= N-1:
        cost1 = jump(k, k+1, cost)
    if k+2 <= N-1:
        cost2 = jump(k, k+2, cost)
    else:
        cost2 = cost1
    if cost1 <= cost2:
        return cost1
    else:
        return cost2

if N == 2:
    cost1 = jump(0, 1, 0)
    cost2 = cost1
else:
    cost1 = jump(0, 1, 0)
    cost2 = jump(0, 2, 0)

if cost1 > cost2:
    print(cost2)
else:
    print(cost1)
Problem p03206 (python)

Fixed submission:
# coding:utf-8

d = int(input())

c_eve = 25 - d

out = "Christmas"

for i in range(c_eve):
    out += " Eve"

print(out)

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

N, X = map(int, input().split())

def eatBan(c, w):
        return c, w+1
def eatPan(c, w):
    return c+1, w+1
def checkWalk(w, X):
    if w == X:
        return True
    else:
        return False

def createNBurger(w, c, n, X):
    if n == 0:
        c, w = eatPan(c, w)
        return c, w
    else:
        # バン食べる
        c, w = eatBan(c, w)
        if checkWalk(w, X):
            c, w, True
        # N-1 バーガー
        c, w = createNBurger(w, c, n-1, X)
        if checkWalk(w, X):
            c, w, True
        # パティ食べる
        c, w = eatPan(c, w)
        if checkWalk(w, X):
            c, w, True
        # N-1 バーガー
        c, w = createNBurger(w, c, n-1, X)
        if checkWalk(w, X):
            return c, w, True
        # バン食べる
        c, w = eatBan(c, w)
        if checkWalk(w, X):
            c, w, True
        return c, w, False

# Nバーガー作成
c = 0
w = 0
c, w , t= createNBurger(w, c, N, X)

# eat_p = 0
# for i, c in enumerate(burger):
#     if c == "P":
#         eat_p += 1
#     if i == X-1:
#         break
print(c)

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

N = int(input())
an = [int(input()) for i in range(N)]

an.sort()
an.reverse()

print(an)

sum = 0
for i, ai in enumerate(an):
    if i == 0:
        sum += ai/2
    else:
        sum += ai

print(int(sum))
Problem p03262 (python)

Fixed submission:
# coding:utf-8

from fractions import gcd 

n, y = map(int, input().split())

dist_list = [abs(x-y) for x in map(int, input().split())]

if n == 1:
    d = dist_list[0]
else:
    d = gcd(dist_list[1], dist_list[0])
    for i in range(n-2):
        d = gcd(d, dist_list[i+1])

print(d)

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

import math

n, y = map(int, input().split())

dist_list = [abs(x-y) for x in map(int, input().split())]

if n == 1:
    d = dist_list[0]
else:
    d = math.gcd(dist_list[1], dist_list[0])
    for i in range(n-2):
        d = math.gcd(d, dist_list[i+1])

print(d)

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

import math

n, y = map(int, input().split())

dist_list = [abs(x-y) for x in map(int, input().split())]

dist_list.sort()

if n == 1:
    d = dist_list[0]
else:
    for i in reversed(range(n)):
        if i == n-1:
            d = math.gcd(dist_list[i], dist_list[i-1])
        else:
            d = math.gcd(dist_list[i-1], d)    

print(d)

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

import math

n, y = map(int, input().split())

dist_list = [abs(x-y) for x in map(int, input().split())].sort()

if n == 1:
    d = dist_list[0]
else:
    for i in reversed(range(n)):
        if i == n-1:
            d = math.gcd(dist_list[i], dist_list[i-1])
        else:
            d = math.gcd(dist_list[i-1], d)    

print(d)

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

import math

n, y = map(int, input().split())

dist_list = [abs(x-y) for x in map(int, input().split())]

if n == 1:
    d = dist_list[0]
else:
    for i in reversed(range(n)):
        if i == n-1:
            d = math.gcd(dist_list[i], dist_list[i-1])
        else:
            d = math.gcd(dist_list[i-1], d)    

print(d)

Buggy submission (verdict: Runtime Error):
import math

n, y = map(int, input().split())

dist_list = [abs(x-y) for x in map(int, input().split())]

if n == 1:
    d = dist_list[0]
else:
    for i in reversed(range(n-1)):
        if i == n-1:
            d = math.gcd(dist_list[i], dist_list[i-1])
        else:
            d = math.gcd(dist_list[i-1], d)    

print(d)

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

import math

n, y = map(int, input().split())

dist_list = [abs(x-y) for x in map(int, input().split())]

if n == 1:
    d = dist_list[0]
elif n >= 2:
    for i in reversed(range(n-1)):
        if i == n-2:
            d = math.gcd(dist_list[i], dist_list[i-1])
        else:
            d = math.gcd(dist_list[i-1], d)    

print(d)
Problem p02675 (python)

Fixed submission:
numTest = int(input())

value = numTest % 10

if value == 2 or value == 4 or value == 5 or value == 7 or value == 9 :
	print('hon')
elif value == 0 or value == 1 or value == 6 or value == 8 :
	print('pon')
elif value == 3 :
	print('bon')

Buggy submission (verdict: Runtime Error):

numTest = int(input())

value = numTest % 10

if value == 2 or value == 4 or value == 5 or value == 7 or value == 9 :
	print('hon')
elif value == 0 or value == 1 or value == 6 or value == 8 :
	print('pon')
elif value == 3 :
	print(bon)
Problem p02692 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n,A,B,C = map(int,input().split())
s = [[*input()] for _ in range(n)]
a = {"A":A, "B":B, "C":C}
ans = ["Yes"]+[0]*n
def dfs(i):
    if i==n:
        print("\n".join(ans))
        exit()
    for p,m in [s[i],s[i][::-1]]:
        if a[m]:
            a[p]+=1; a[m]-=1; ans[i+1]=p
            dfs(i+1)
            #一つ戻る
            a[p]-=1; a[m]+=1
dfs(0)
print("No")

Buggy submission (verdict: Runtime Error):
n,A,B,C = map(int,input().split())
s = [[*input()] for _ in range(n)]
a = {"A":A, "B":B, "C":C}
ans = ["Yes"]+[0]*n
def dfs(i):
    if i==n:
        print("\n".join(ans))
        exit()
    for p,m in [s[i],s[i][::-1]]:
        if a[m]:
            a[p]+=1; a[m]-=1; ans[i+1]=p
            dfs(i+1)
            #一つ戻る
            a[p]-=1; a[m]+=1
dfs(0)
print("No")
Problem p03059 (python)

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

print(int((T+0.5)//A*B))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))
Asorted = sorted(A)


L=[0]*N
R=[0]*N
L[0]=A[0]
R[0]=A[N-1]

for n in range(1,N):
  L[n]=gcd(A[n],L[n-1])
  R[n]=gcd(A[N-n-1],R[n-1])
  
  ans=max(L[N-2],R[N-2])

for i in range(1,N-1):
  ans=max(ans,gcd(L[i-1],R[N-i-2]))

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))
A = sorted(A)[:: -1]


L=[0]*N
R=[0]*N
L[0]=A[0]
R[0]=A[N-1]

for n in range(1,N):
  L[n]=gcd(A[n],L[n-1])
  R[n]=gcd(A[N-n-1],R[n-1])
  
  ans=max(L[N-2],R[N-2])

for i in range(1,N-1):
  ans=max(ans,gcd(L[i-1],R[N-i-2]))

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))
print(A)

L=[0]*N
R=[0]*N
L[0]=A[0]
R[0]=A[N-1]

for n in range(1,N):
  L[n]=gcd(A[n],L[n-1])
  R[n]=gcd(A[N-n-1],R[n-1])
  
  ans=max(L[N-2],R[N-2])

for i in range(1,N-1):
  ans=max(ans,gcd(L[i-1],R[N-i-2]))

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))
L=[0]*N
R=[0]*N
L[0]=A[0]
R[0]=A[N-1]
ans=0

for n in range(1,N):
  L[n]=gcd(A[n],L[n-1])
  R[n]=gcd(A[N-n-1],R[n-1])
  
  ans=max(L[N-2],R[N-2])

for i in range(1,N-1):
  ans=max(ans,gcd(L[i-1],R[N-i-2]))

print(ans)