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

Fixed submission:
import sys
from math import ceil
from fractions import gcd

a, b, c, d = map(int, input().split())
if c == 1:
  print(0)
  sys.exit()
cd_lcm = c*d//gcd(c, d)
c_left, c_right = ceil(a/c), b//c
d_left, d_right = ceil(a/d), b//d
cd_left, cd_right = ceil(a/cd_lcm), b//(cd_lcm)
cv, dv, cdv = c_right - c_left + 1, d_right - d_left + 1, cd_right - cd_left + 1
print((b - a + 1) - (cv + dv - cdv))

Buggy submission (verdict: Runtime Error):
from fractions import gcd

def ceil(a, b):
  return -(-a//b)

a, b, c, d = map(int, input().split())
if c == 1:
  print(0)
  sys.exit()
cd_lcm = c*d//gcd(c, d)
c_left, c_right = ceil(a,c), b//c
d_left, d_right = ceil(a,d), b//d
cd_left, cd_right = ceil(a,cd_lcm), b//(cd_lcm)
cv, dv, cdv = c_right - c_left + 1, d_right - d_left + 1, cd_right - cd_left + 1
print((b - a + 1) - (cv + dv - cdv))
Problem p02683 (python)

Fixed submission:
from itertools import combinations
import numpy as np
n,m,x = map(int,input().split())
a_list = []
price_list = []
for _ in range(n):
    tmp = list(map(int,input().split()))
    price_list.append(tmp.pop(0))
    a_list.append(tmp)
    
all_list = [x for x in range(len(a_list))]
prices = []
for i in range(1,len(a_list)+1):
    for y in combinations(all_list,i):
        tmp = np.zeros(m)
        price = 0
        for ch in y:
            tmp += np.array(a_list[ch])
            price += price_list[ch]
        if np.all(tmp>=x):
            prices.append(price)
if prices != []:
    print(min(prices))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
import numpy as np
n,m,x = map(int,input().split())
a_list = []
price_list = []
for _ in range(n):
    tmp = list(map(int,input().split()))
    price_list.append(tmp.pop(0))
    a_list.append(tmp)
    
all_list = [x for x in range(len(a_list))]
prices = []
for i in range(1,len(a_list)+1):
    for y in combinations(all_list,i):
        tmp = np.zeros(3)
        price = 0
        for ch in y:
            tmp += np.array(a_list[ch])
            price += price_list[ch]
        if np.all(tmp>=x):
            prices.append(price)
if prices != []:
    print(min(prices))
else:
    print(-1)
Problem p02713 (python)

Fixed submission:
from itertools import combinations
import math
n = int(input())
ans = 0
for r in range(1,4): 
    if r>n:
        break
    for x  in combinations([x+1 for x in range(n)],r):
        if len(x)==1:
            ans += x[0]
        elif len(x)==2:
            ans += math.gcd(x[0],x[1])*6
        else:
            tmp = math.gcd(x[0],x[1])
            ans += math.gcd(x[2],tmp)*6
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
import math
n = int(input()
ans = 0
for r in range(1,4): 
    if r>n:
        break
    for x  in combinations([x+1 for x in range(n)],r):
        if len(x)==1:
            ans += x[0]
        elif len(x)==2:
            ans += math.gcd(x[0],x[1])*6
        else:
            tmp = math.gcd(x[0],x[1])
            ans += math.gcd(x[2],tmp)*6
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
import math
n = int(input()
ans = 0
for r in range(1,4): 
    
    if r>n:
        break
    for x  in combinations([x+1 for x in range(n)],r):
        print(x)
        if len(x)==1:
            ans += x[0]
        elif len(x)==2:
            ans += math.gcd(x[0],x[1])*6
        else:
            tmp = math.gcd(x[0],x[1])
            ans += math.gcd(x[2],tmp)*6
print(ans)
Problem p02755 (python)

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

import math 
a = [x for x in range(math.ceil(A*12.5),math.ceil((A+1)*12.5))]
b = [x for x in range(math.ceil(B*10),math.ceil((B+1)*10))]

c = set(a) & set(b)

if c != set():
  print(min(c))
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
a_interval = list(map(int,[a/0.08,(a+1)/0.08]))
b_interval = list(map(int,[b/0.1,(b+1)/0.1]))
a_interval = [x for x in range(a_interval[0],a_interval[1]+1)]
b_interval = [x for x in range(b_inaterval[0],b_interval[1]+1)]
tmp = set(a_interval) & set(b_interval)
if tmp == set():
    print(-1)
else:
    print(min(tmp))

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

import math 
a = [x for x in range(math.ceil(A*12.5),math.ceil((A+1)*12.5))]
b = [x for x in range(math.ceil(B*10),math.ceil((B+1)*10))]

c = set(a) & set(b)

if c != {}:
  print(min(c))
else:
  print(-1)
Problem p02791 (python)

Fixed submission:
n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if min_v>x:
        min_v=x
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if x == 1
    	ans+=1
        break
    if min_v>=x:
        min_v=x
    else:
        ans+=1
print(ans)
Problem p02813 (python)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
import math

ans_p = 0
defa = [_ for _ in range(1,n+1)]
for i,x in enumerate(p):
    index = defa.index(x)
    ans_p += math.factorial(n-i-1)*len(defa[:index])
    defa.remove(x)
    
ans_q = 0
defa = [_ for _ in range(1,n+1)]
for i,x in enumerate(q):
    index = defa.index(x)
    ans_q += math.factorial(n-i-1)*len(defa[:index])
    defa.remove(x)
    
print(abs(ans_p-ans_q))

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
ans_p = 0
defa = [_ for _ in range(1,n+1)]
for i,x in enumerate(p):
    
    index = defa.index(x)
    ans_p += math.factorial(n-i-1)*len(defa[:index])
    defa.remove(x)
    
ans_q = 0
defa = [_ for _ in range(1,n+1)]
for i,x in enumerate(q):
    index = defa.index(x)
    ans_q += math.factorial(n-i-1)*len(defa[:index])
    defa.remove(x)
    
print(abs(ans_p-ans_q))
Problem p02900 (python)

Fixed submission:
a,b = map(int,input().split())
from fractions import gcd
import math
ab_gcd = gcd(a,b)
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return [1,n]
    else:
        factor.append(n)
        return factor
res = trial_division(ab_gcd)
print(len(set(res+[1])))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
from fractions import gcd
import math
ab_gcd = fractions.gcd(a,b)
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return []
    else:
        factor.append(n)
        return factor
res = trial_division(ab_gcd)
print(len(set(res+[1])))
Problem p02923 (python)

Fixed submission:
n = int(input())
h_li = list(map(int,input().split()))
tmp = h_li[0]
move = 0
res = [0]
for i,x in enumerate(h_li[1::]):
    if tmp >= x:
        move += 1
        tmp = x
        if i == len(h_li)-2:
            res.append(move)
    else:
        res.append(move)
        move = 0
        tmp = x
        
print(max(res))

Buggy submission (verdict: Runtime Error):
n = int(input())
h_li = list(map(int,input().split()))
tmp = h_li[0]
move = 0
res = []
for i,x in enumerate(h_li[1::]):
    if tmp >= x:
        move += 1
        tmp = x
        if i == len(h_li)-2:
            res.append(move)
    else:
        res.append(move)
        move = 0
        tmp = x
        
print(max(res))
Problem p02982 (python)

Fixed submission:
n,d = map(int,input().split())
x_list_kai = [list(map(int,input().split())) for x in range(n)]


import itertools,math
dis = []
for x in itertools.combinations(x_list_kai,2):
    distance = 0
    for dim in range(0,d):
        result  = 0
        for y in x:
            if result == 0:
                result = y[dim]
            else:
                result -= y[dim]
            
        result  = result **2
        distance += result
    dis.append(math.sqrt(distance))
    
counter = 0
for i in dis:
    if i.is_integer() == True:
        counter += 1
print(counter)

Buggy submission (verdict: Runtime Error):
n,d = map(int,input().split())
x_list_kai = [list(map(int,input().split())) for x in range(3)]


import itertools,math
dis = []
for x in itertools.combinations(x_list_kai,2):
    distance = 0
    for dim in range(0,d):
        result  = 0
        for y in x:
            if result == 0:
                result = y[dim]
            else:
                result -= y[dim]
            
        result  = result **2
        distance += result
    dis.append(math.sqrt(distance))
    
counter = 0
for i in dis:
    if i.is_integer() == True:
        counter += 1
print(counter)
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
a,b,c,d = map(int,input().split())
import math
lcm = c*d//gcd(c,d)
a_1 = a-1
panish = ((b//c)+(b//d)-(b//lcm))-(((a_1//c)+(a_1//d))-(a_1//lcm))
print(b-a_1-panish)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
import math
lcm = int(c*d/math.gcd(c,d))
a_1 = a-1
panish = (int(b/c)+int(b/d)-int(b/lcm))-((int(a_1/c)+int(a_1/d))-int(a_1/lcm))
print(b-a_1-panish)
Problem p02996 (python)

Fixed submission:
n = int(input())
a_b_list_kai = [list(map(int,input().split())) for x in range(n)]

a_b_list_kai = sorted(a_b_list_kai,key = lambda x:x[1])
limit = 0
result = 0
sum_task = 0
for x in a_b_list_kai:
    sum_task += x[0]
    limit = max(limit,x[1])
    if sum_task > limit:
        result = 1

if result == 1:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
a_b_list = [list(map(int,input().split())) for x in range(n)]
a_b_list_kai = [[int(a_b_list[x]),int(a_b_list[x+1])] for x in range(0,n*2,2)]
sorted(a_b_list_kai,key = lambda x:x[1])
limit = 0
result = 0
sum_task = 0
for x in a_b_list_kai:
    sum_task += x[0]
    limit = max(limit,x[1])
    if sum_task > limit:
        result = 1

if result == 1:
    print('No')
else:
    print('Yes')
Problem p03565 (python)

Fixed submission:
s = input()
t = input()

flg = 0
y = s[::-1]
z = t[::-1]
result = []
for j,x in enumerate(range(0,len(y))):
    result = []
    for i,k in enumerate(y[x:x+len(t)]):
        if (k == z[i])|(k=="?"):
            result.append(True)
    if all(result)&(len(result)==len(t)):
        flg = 1
        break
if flg == 1:
    print((s[:len(s)-j-len(t)]+t+s[len(s)-j:]).replace("?","a"))
else:
    print("UNRESTORABLE")

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

cont = 0
y = s[::-1]
for i,x in enumerate(y):
    print(i,y[i])
    if x == "?":
        cont += 1
        if cont == len(t):
            break
        elif (cont == len(t)-1)&(y[i+1] == t[0]):
            break
    else:
        cont = 0
            
if cont == 0:
    print("UNRESTORABLE")
else:
    print((s[:len(s)-i-1]+t+s[len(s)-i+len(t):]).replace("?","a"))

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

y = s[::-1]
for i,x in enumerate(y):
    print(i,y[i])
    if x == "?":
        cont += 1
        if cont == len(t):
            break
        elif (cont == len(t)-1)&(y[i+1] == t[0]):
            break
    else:
        cont = 0
            
if cont == 0:
    print("UNRESTORABLE")
else:
    print((s[:len(s)-i-1]+t+s[len(s)-i+len(t):]).replace("?","a"))
Problem p02713 (python)

Fixed submission:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義
k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcd(gcd(a,b),c)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=np.gcd(np.gcd(a,b),c)
print(ans)
Problem p02958 (python)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
flag = 0
ans = True
for i in range(0,n):
    if p[i] != i+1 and flag<=2:
        flag+=1
        if p[p[i]-1] == i+1:
            continue
        else:
            ans = False
    elif i+1 != p[i]:
        ans = False
if ans:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split())
cnt = 0
for i in range(0,n):
    if p[i]!=i+1:
        cnt+=1
if cnt>2:
    print("NO")
else:
    print("YES")
Problem p03846 (python)

Fixed submission:
n = int(input())
s = list(map(int, input().split()))
s_set = set(s)
count = 2 ** ((n) // 2)
if (sum(s) == 2 * sum(s_set)):
    print(count % (10 ** 9 + 7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter
mod = 1000000007
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
flag = 1
if n % 2 == 0:
    start = 1
else:
    if c[0] != 1:
        flag = 0
    start = 2
for i in range(start, n, 2):
    if c[i] != 2:
        flag = 0
        break
if flag == 0:
    print(0)
else:
    print(int(math.pow(2, n // 2)) % mod)

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
flag = 1
if n % 2 == 0:
    start = 1
else:
    if c[0] != 1:
        flag = 0
    start = 2
for i in range(start, n, 2):
    if c[i] != 2:
        flag = 0
        break
if flag == 0:
    print(0)
else:
    print(int(math.pow(2, n // 2)))

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
flag = 1
if n % 2 == 0:
    start = 1
else:
    if c[0] < 1:
        flag = 0
    start = 2
for i in range(start, n, 2):
    if c[i] != 2:
        flag = 0
        break
if flag == 0:
    print(0)
    exit()
else:
    print(int(math.pow(2, n // 2)))
Problem p02756 (python)

Fixed submission:
B = input()
order = True
F = ""
for q in range(int(input())):
    T = input().rstrip().split()
    if T[0] == "1":
        order ^= True
    else:
        f,c = T[1],T[2]
        if not((f == "1") ^ order):
            F += c
        else:
            B += c
    #print(F,B)
F = F[::-1]+B
if not order:
    F = F[::-1]
print(F)

Buggy submission (verdict: Runtime Error):
B = input()
order = True
F = ""
for q in range(int(input())):
    T = input().rstrip().split()
    if T[0] == "1":
        order ^= True
    else:
        f,c = T[1],T[2]
        if not((f == "1") ^ order):
            F += c
        else:
            B += c
    print(F,B)
F = F[::-1]+B
if not order:
    F = F[::-1]
print(F)
Problem p02787 (python)

Fixed submission:
from functools import lru_cache
import sys

H,N = [int(i) for i in input().rstrip().split(' ')]
M = [[int(i) for i in input().rstrip().split(' ')] for _ in range(N)]

sys.setrecursionlimit(10**9)
DP = [0]*(H+1)

for x in range(1,H+1):
    DP[x] = min(DP[max(x-a,0)] + b for a,b in M)

print(DP[H])

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

H,N = [int(i) for i in input().rstrip().split(' ')]
M = [[int(i) for i in input().rstrip().split(' ')] for _ in range(N)]
#print(*M, sep='\n') #配列開業表示の仕方

@lru_cache(maxsize=None)
def DP(hp):
    global M
    if hp <= 0:
        return 0
    res = min([DP(hp-a)+b for a,b in M])
    return res

print(DP(H))
Problem p03043 (python)

Fixed submission:
import math as mt
N,K = [int(i) for i in input().rstrip().split()]
R = 0
for n in range(1,N+1):
    l = mt.floor(mt.log2(K/n) - 0.1**9)+1
    if l <= 0:
        R += 1/N*(N-n+1)
        #print(K,n,l,R)
        break
    else:
        R += 1/N*0.5**l
        #print(K,n,l,R)
print(R)

Buggy submission (verdict: Runtime Error):
import math as mt
N,K = [int(i) for i in input().rstrip().split()]
R = 0
for n in range(1,N+1):
    l = mt.floor(mt.log2((K-1)/n))+1
    if l <= 0:
        R += 1/N*(N-n+1)
        #print(K,n,l,R)
        print(R)
        break
    else:
        R += 1/N*0.5**l
        #print(K,n,l,R)
Problem p03111 (python)

Fixed submission:
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

Buggy submission (verdict: Runtime Error):
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
	if cur == N:
		return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
	ret0 = dfs(cur + 1, a, b, c)
 	ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
	ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
	ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
	return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))
Problem p02684 (python)

Fixed submission:
n,k = map(int,input().split())
s = list(map(int,input().split()))
# print(s)
now_city = 1
s_l_city = 1
t = [0] #何回そこを通ったか
f = [0] #何回目にそこを通ったか
a=0
b = 0#サイクルありなし
f_l=0#ループの最初

#【ループ回数】200000
for i in range(n):
    t.append(0)
    f.append(-1)
# print(s)
sycle = 0
#【ループ回数】200000
for i in range(1,n+10):
    now_city = s[now_city-1]

    if t[now_city-1]==1:
        #  print(i,f[j])
         sycle=i-f[now_city-1]
         f_l=f[now_city-1]
        #  f_l=i
        #  a = 1
         b = i
        #  s_l_city=now_city
        #  print("ループの最初の数字",now_city,"最初は"+str(f_l)+"回目","周期は",sycle)
         break
    t[now_city-1]+=1
    f[now_city-1]=i
# print(t)
# print(f_l)
# print(f_l,sycle,s_l_city)

if k>b:
    # now_city=s_l_city
    for _ in range((k-f_l)%sycle):

        now_city = s[now_city-1]
    # print((k-f_l)%sycle)
    print(now_city)
else:
    # print("ループなし")
    now_city=1
    for _ in range(k):
        now_city=s[now_city-1]
    print(now_city)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
A=list(map(int,input().split()))
A=[0]+A
B=[]
C=[0]+[-1]*n
now_city=1
seen=set()

#【ループ回数】200000
for i in range(1,len(A)):
    print("Baah")
if k <= len(B):
    print("Baah")
else:
    k = k- len(B)
    #x = k % len(route)
    if x ==0:
        print("Baah")
    else:
        print("Baah")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
A=list(map(int,input().split()))
A=[0]+A
B=[]
C=[0]+[-1]*n
now_city=1
seen=set()

#【ループ回数】200000
for i in range(1,len(A)):
    now_city=A[now_city]
    #【ループ回数】B 内で now_city があるかを探索
    #if now_city in B:
        #route=B[C[now_city]-1:i-1]
    #    break
    B.append(now_city)
    C[now_city]=i
if k <= len(B):
    print(B[k-1])
else:
    k = k- len(B)
    #x = k % len(route)
    if x ==0:
        #print(route[-1])
    else:
        #print(route[x-1])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
A=list(map(int,input().split()))
A=[0]+A
B=[]
C=[0]+[-1]*n
now_city=1
seen=set()

#【ループ回数】200000
for i in range(1,len(A)):
    now_city=A[now_city]
    #【ループ回数】B 内で now_city があるかを探索
    #if now_city in B:
    #    route=B[C[now_city]-1:i-1]
    #    break
    B.append(now_city)
    C[now_city]=i
if k <= len(B):
    print(B[k-1])
else:
    k = k- len(B)
    x = k % len(route)
    if x ==0:
        print(route[-1])
    else:
        print(route[x-1])
Problem p02742 (python)

Fixed submission:
H, W = map(int, input().split())
result = 0
if H==1 or W==1:
    result = 1
elif W%2==0:
    result = (W/2)*H
else:
    if H%2==0:
        result=W*(H/2)
    else :
        result=W*(H-1)/2+(W+1)/2
print(str(round(result)))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
if H==1 or W==1:
    print("1")
elif W%2==0:
    result = (W/2)*H
else:
    if H%2==0:
        result=W*(H/2)
    else :
        result=W*(H-1)/2+(W+1)/2
print(str(round(result)))
Problem p02743 (python)

Fixed submission:
import math
import numpy
a,b,c = map(int, input().split())
d = c - a - b
if d > 0 and d * d > 4 * a * b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
import numpy
a,b,c = map(int, input().split())
d = c - a - b
if d > 0 and d * D > 4 * a * b:
    print("Yes")
else:
    print("No")
Problem p02755 (python)

Fixed submission:
A,B = list(map(int,input().split()))
found = False
for i in range(1010):
    A_tax = int(i * 0.08)
    B_tax = int(i * 0.10)
    if A == A_tax and B == B_tax:
        print(i)
        found = True
        break
if not found:
    print("-1")

Buggy submission (verdict: Runtime Error):
# AtCoder Beginner Contest 158 - C - Tax Increase
# お送り頂いたコードをもとにした解法（該当する元の金額を二重の for 文で検査する）

A,B = list(map(int,input().split()))
z=0

#【註】手を加えたのは、コメントを付した 2 箇所のみとなります。
# 8% の消費税の場合、この計算では「消費税計算において小数点以下が切り捨てになる」ことを反映できず、
# 計算結果が誤差を生じてしまいます。たとえば 8% 時の消費税額が 1 円の場合は、本来であれば価格が 13 円～24 円のレンジに
# 収まらなければなりませんが、当初の計算では 12 円から 25 円のレンジになってしまいます。

#for x in range(int(25*A/2),int(25*(A+1)/2)):
for x in range(int(((25*A)+1)/2),int((25*(A+1)-1)/2)):
    for y in range(int(10*B),int(10*(B+1))):
        if x==y:
            print(x)
            break
        else:
            z += 1
    if x==y:
        break
#if z==(int(25*(A+1)/2)-int(25*A/2))*(int(10*(B+1))-int(10*B)):    
if z==(int((25*(A+1)-1)/2)-int(((25*A)+1)/2))*(int(10*(B+1))-int(10*B)):    
    print(-1)


A,B = list(map(int,input().split()))
found = False
for i in range(1010):
    A_tax = int(i * 0.08)
    B_tax = int(i * 0.10)
    if A == A_tax and B == B_tax:
        print(i)
        found = True
        break
if not found:
    print("-1")
Problem p02760 (python)

Fixed submission:
#Biginner Contest 157 B-Bingo
#二次元配列を使う(3*3)
bingonum=[[0,0,0],[0,0,0],[0,0,0]]
bingo=[["False","False","False"],["False","False","False"],["False","False","False"]]
for i in range(3):
    bingonum[i][0],bingonum[i][1],bingonum[i][2] = map(int,input().split())

N = int(input())
b=[]
for _ in range(N):
    b.append(int(input()))

for x in range(N):
    for i in range(3):
        for j in range(3):
            if bingonum[i][j]==b[x]:
                bingo[i][j]="True"

IsBingo = "No"
for i in range(3):
    if bingo[i][0] =="True" and bingo[i][1] =="True" and bingo[i][2] =="True":
        IsBingo="Yes"
    if bingo[0][i] =="True" and bingo[1][i] =="True" and bingo[2][i] =="True":
        IsBingo="Yes"
if (bingo[0][0] =="True" and bingo[1][1] =="True" and bingo[2][2] =="True") or (bingo[0][2] =="True" and bingo[1][1] =="True" and bingo[2][0]=="True"):
    IsBingo="Yes"
print(IsBingo)

Buggy submission (verdict: Runtime Error):
bingonum=[[0,0,0],[0,0,0],[0,0,0]]
bingo=[["False","False","False"],["False","False","False"],["False","False","False"]]
for i in range(3):
    bingonum[i][0],bingonum[i][1],bingonum[i][2] = map(int,input().split())

N = int(input())
b=[]
for _ in range(N):
    b.append(int(input())
for x in range(N):
    for i in range(3):
        for j in range(3):
            if bingonum[i][j]==b[x]:
                bingo[i][j]="True"

IsBingo = "No"
for i in range(3):
    if bingo[i][0] =="True" and bingo[i][1] =="True" and bingo[i][2] =="True":
        IsBingo="Yes"
    if bingo[0][i] =="True" and bingo[1][i] =="True" and bingo[2][i] =="True":
        IsBingo="Yes"
if (bingo[0][0] =="True" and bingo[1][1] =="True" and bingo[2][2] =="True") or (bingo[0][2] =="True" and bingo[1][1] =="True" and bingo[2][0]=="True"):
    IsBingo="Yes"
print(IsBingo)