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

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
*a, = map(int, input().split())

from fractions import gcd
from functools import reduce
import numpy as np

new_gcd = np.frompyfunc(gcd, 2, 1)

a = np.array(a)
left = new_gcd.accumulate(a, dtype=np.object).astype(np.int)
right = new_gcd.accumulate(a[::-1], dtype=np.object).astype(np.int)[::-1]
left = np.append([0], left[:-1])
right = np.append(right[1:], 0)

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n = int(input())
*a, = map(int, input().split())

import fractions
from functools import reduce
import numpy as np

def gcd_list(a):
    return reduce(fractions.gcd, a)

left = [0]*n
right = [0]*n

for i in range(1, n):
    left[i] = np.gcd.reduce(a[:i])

for i in range(n-2, -1, -1):
    right[i] = np.gcd.reduce(a[i+1:])

ans = 0
for i in range(n):
    ans = max(ans, gcd_list([left[i], right[i]]))
print(ans)
Problem p03062 (python)

Fixed submission:
n = int(input())
*a, = map(int, input().split())
*a_abs, = map(abs, a)
if len([i for i in a if i<0])%2==0:
    print(sum(a_abs))
else:
    print(sum(a_abs)-2*min(a_abs))

Buggy submission (verdict: Runtime Error):
from numpy import *

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

if len(A[A<0])%2 == 0:
    print(sum(abs(A)))
else:
    A = abs(A).sort()
    print(sum(A[1:]) - A[0])

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

N = int(input())
A = np.array(map(int, input().split()))
if len(A[A<0])%2 == 0:
    ans = sum(abs(A))
else:
    A = sorted(abs(A))
    ans = sum(A[1:])-A[0]
print(ans)

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

N = int(input())
A = np.array(map(int, input().split()))
if len(A[A<0])%2 == 0:
    ans = sum(abs(A))
else:
    A = sorted(abs(A))
    ans = sum(A[1:] - A[0])
print(ans)
Problem p03074 (python)

Fixed submission:
import sys
input =  sys.stdin.readline

n, k = map(int, input().split())
s = input()+'-1'

cnt = 0
cnt_list = []
for i in range(n):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        cnt_list.append(cnt+1)
        cnt = 0

# print(cnt_list)


l = 0
r = 2*k
ma = 0
su = 0
if s[0] == '0':
    r = 2*k
else:
    r = 2*k+1
su = sum(cnt_list[l:r])
while l < r:
    if ma < su:
        ma = su
    if l == 0 and r == 2*k:
        l += 1
        su -= cnt_list[l-1]
    else:
        l += 2
        su -= sum(cnt_list[l-2:l])
    r += 2
    su += sum(cnt_list[r-2:r])
    if r >= len(cnt_list):
        r = len(cnt_list)
    
print(ma)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
s_split_0 = s.split("1")
s_split_1 = s.split("0")

s_split_1= [len(i) for i in s_split_1 if i!=""]
s_split_0= [len(i) for i in s_split_0 if i!=""]

if s[0]=="1":
    print(max([sum(s_split_0[i:i+k])+sum(s_split_1[i:i+k+1]) for i in range(len(s_split_0)-k+1)]))
else:
    print(max([sum(s_split_0[i:i+k])+sum(s_split_1[i:i+k]) for i in range(len(s_split_1)-k+1)]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
s_split_0 = s.split("1")
s_split_1 = s.split("0")

s_split_1= [len(i) for i in s_split_1 if i!=""]
s_split_0= [len(i) for i in s_split_0 if i!=""]

if s[0]=="1":
    print(max([sum(s_split_0[i:i+k])+sum(s_split_1[i:i+k+1]) for i in range(len(s_split_0)-k+1)]))
else:
    print(max([sum(s_split_0[i:i+k+1])+sum(s_split_1[i:i+k]) for i in range(len(s_split_1)-k+1)]))
Problem p03106 (python)

Fixed submission:

a, b, k = map(int, input().split())
temp = a if a>b else b
list =  [i  for i in range(1,temp+1) if a%i==0 and b%i==0]
list = list[::-1]
print(list[k-1])

Buggy submission (verdict: Runtime Error):

a, b, k = map(int, input().split())
temp = a if a>b else b
list =  [i  for i in range(1,temp+1) if a%i==0 and b%i==0]
list = list[::-1]
print(list[k-1]

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
temp = a if a>b else b
list =  [i  for i in range(1,temp) if a%i==0 and b%i==0]
list = list[::-1]
print(list[k-1])
Problem p03163 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [[0]*(w+1) for _ in range(n)]

for i in range(wv[0][0], w+1):
    dp[0][i] = wv[0][1]

for i in range(1, n):
    for j in range(w+1):
        if j-wv[i][0] < 0:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i][0]]+wv[i][1])
print(dp[n-1][w])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np

N, W = map(int, input().split())
dp = np.zeros(W+1, dtype=int)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])
Problem p03164 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np

N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
wv = np.array(wv)
V = max(wv[:, 1])
dp = np.array([float('inf')]*(N*V+1))

dp[0] = 0
for i in range(N):
    w, v = wv[i]
    dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(max(np.where(dp<=W)[0]))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np

N, W = map(int, input().split())
dp = np.zeros(W+1, dtype=int)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np

N, W = map(int, input().split())
dp = np.zeros(W+1, dtype=int)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])
Problem p02658 (python)

Fixed submission:
n = int(input())
alist = list(map(int, input().split(" ")))

if 0 in alist:
  print("0")
else:
  result = 1
  m = 0
  while result <= 10**18 and m < n:
    result *= alist[m]
    m += 1
  if m < n or result > 10**18:
    print("-1")
  else:
    print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
alist = list(map(int, input().split(" ")))

if 0 in alist:
  print("0")
else:
  result = 1
  m = 0
  while result <= 10**18:
    result *= alist[m]
    m += 1
  if m < n or result > 10**18:
    print("-1")
  else:
    print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
alist = list(map(int, input().split(" ")))

result = 1
m = 0
while result <= 10**18:
  result *= alist[m]
  m += 1

if m < n or result > 10**18:
  print("-1")
else:
  print(result)
Problem p02696 (python)

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

def floor(x):
    return ((a*x/b)//1) - a*((x/b)//1)

ans = floor(min(b-1,n))

print(int(ans))

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

def floor(x):
    return x//1

dp=[0]*(n+1)

for x in range(1,n+1):
    dp[x] = max(dp[x-1],floor(a*x/b)-a*floor(x/b))

print(int(dp[n]))

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

def floor(x):
    return x//1

dp=[0]*(n+1)

for x in range(1,n+1):
    dp[x] = max(dp[x-1],floor(a*x/b)-a*floor(x/b))

print(int(dp[n]))

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

dp=[0]*(n+1)

for x in range(n):
    dp[x+1] = max(dp[x],((a*(x+1)/b)//1)-a*(((x+1)/b)//1))

print(int(dp[n]))
Problem p02702 (python)

Fixed submission:
s = input()[::-1]

dp = [0]*2019
dp[0]=1
total = 0
a = 1

for i in list(s):
  total += int(i)*a
  total %= 2019
  dp[total] += 1
  a *= 10
  a %= 2019
count=0
  
for i in range(2019):
    count += dp[i]*(dp[i]-1)//2
 
print(count)

Buggy submission (verdict: Runtime Error):
s = str(input())
l = len(list(s))

if l<=3:
    print(0)
else:
    n = 0
    for i in range(4,l+1):
        for j in range(0,l-i+1):
            if int(s[j:j+i])%2019 == 0:
                n += 1
            else:
                n += 0

print(n)
Problem p02705 (python)

Fixed submission:
import math
r = int(input())

l=float(math.pi*2*r)

print(round(l,3))

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

result = 0
for i in range(k,n+2):
  numbers = range(0,n+1)
  mins = sum(numbers[0:i])
  maxs = sum(numbers[-i:])
  result += maxs - mins +1


print(result)
Problem p02727 (python)

Fixed submission:
x,y,a,b,c = map(int, input().split(" "))
plist= sorted(list(map(int, input().split(" "))),reverse=True)[0:x]
qlist= sorted(list(map(int, input().split(" "))),reverse=True)[0:y]
rlist= sorted(list(map(int, input().split(" "))),reverse=True)

plist.extend(qlist)
plist.sort()
n = min(x+y,len(rlist))
i = 0

while i < n and rlist[i]>plist[i]:
  i += 1
if i == 0:
  print(sum(plist))
else:
  print(sum(plist[i:x+y])+sum(rlist[0:i]))

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = map(int, input().split(" "))
plist= list(map(int, input().split(" ")))
qlist= list(map(int, input().split(" ")))
rlist= list(map(int, input().split(" ")))

plist.extend(qlist)
plist.sort()

rlist.sort(reverse=True)

n = min(len(plist),len(rlist))
slist = plist[0:x+y-1]
ulist = plist[0:x+y-1]
slist[0] = rlist[0]
i = 1

while i < n and sum(slist)>sum(ulist):
  slist[i]=rlist[i]
  ulist[i-1]=rlist[i-1]
  i += 1

print(sum(slist))
Problem p02755 (python)

Fixed submission:
a,b = map(int, input().split(" "))
p = []
q = []

for i in range(int(((a/8)*100)//1), int((((a+1)/8)*100)//1+1)):
  if i >= (a/8)*100 and i < ((a+1)/8)*100:
    p.append(i)
    
for i in range((b*10), (b+1)*10):
    q.append(i)

pq = list(set(p) & set(q))
if pq == []:
  print("-1")
else:
  print(min(pq))

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split(" "))
p = []
q = []

for i in range(((a/8)*100)//1, (((a+1)/8)*100)//1+1):
  if i >= (a/8)*100 and i < ((a+1)/8)*100:
    p.append(i)
    
for i in range((a*10), (a+1)*10):
    q.append(i)

pq = list(set(p) & set(q))
if pq == []:
  print("-1")
else:
  print(min(pq))
Problem p02801 (python)

Fixed submission:
lis = "abcdefghijklmnopqrstuvwxyz"
 
z = input()
 
for a in range(len(lis)-1):
  if z == lis[a]:
    print(lis[a+1])
    exit()

Buggy submission (verdict: Runtime Error):
lis = "abcdefghijklmnopqrstuvwxyz"

z = input()

for a in range(len(lis)-1):
  if z = lis[a]:
    print(lis[a+1])
    exit()

Buggy submission (verdict: Runtime Error):
lis = "abcdefghijklmnopqrstuvwxyz"
dic = {}

z = imput()

for a in range(len(lis)-1):
  if z = lis[a]:
    print(lis[a+1])
    exit()
Problem p02886 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
res = 0
for i in range(n):
  for j in range(i+1,n):
    res += a[i]*a[j]
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int,input().split())
res = 0
for i in range(n):
  for j in range(i+1,n):
    res += a[i]*a[j]
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int,input().split())
res = 0
for i in range(n):
  if a[i] == 0:
    continue
  for j in range(i+1,n):
    res += a[i]*a[j]
print(res)
Problem p02573 (python)

Fixed submission:
class UnionFind:
    __slots__ = ["data"]
    
    def __init__(self, n=0):
        self.data = [-1]*(n+1)
    
    def root(self, x):
        if self.data[x] < 0:
            return x
        self.data[x] = self.root(self.data[x])
        return self.data[x]
    
    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            if self.data[x] < self.data[y]:
                self.data[x] += self.data[y]
                self.data[y] = x
            else:
                self.data[y] += self.data[x]
                self.data[x] = y
    
    def same(self, x, y):
        return self.root(x) == self.root(y)
    
    def size(self, x):
        return -self.data[self.root(x)]


def main():
    n, m = map(int, input().split())
    uf = UnionFind(n)
    for i in range(m):
        a, b = map(int, input().split())
        uf.unite(a, b)
        
    ans = 0
    
    for i in range(1, n+1):
        ans = max(ans, uf.size(i))
    
    print(ans)
        

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from numba import njit


class UnionFind:
    __slots__ = ["data"]
    
    def __init__(self, n=0):
        self.data = [-1]*(n+1)
    
    def root(self, x):
        if self.data[x] < 0:
            return x
        self.data[x] = self.root(self.data[x])
        return self.data[x]
    
    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            if self.data[x] < self.data[y]:
                self.data[x] += self.data[y]
                self.data[y] = x
            else:
                self.data[y] += self.data[x]
                self.data[x] = y
    
    def same(self, x, y):
        return self.root(x) == self.root(y)
    
    def size(self, x):
        return -self.data[self.root(x)]

@njit
def main():
    n, m = map(int, input().split())
    uf = UnionFind(n)
    for i in range(m):
        a, b = map(int, input().split())
        uf.unite(a, b)
        
    ans = 0
    
    for i in range(1, n+1):
        ans = max(ans, uf.size(i))
        
    print(ans)
        


main()
Problem p02662 (python)

Fixed submission:
def main():
    n, s = map(int, input().split())
    mod = 998244353
    a = list(map(int, input().split()))
    dp = [[0]*(s+1) for _ in range(n+1)]
    dp[0][0] = 1
    dio = dp[0]
    for i in range(1, n+1):
        ai = a[i-1]
        di = dp[i]
        for j in range(min(s+1, ai)):
            di[j] = (di[j]+2*dio[j])%mod
        for j in range(ai, s+1):
            di[j] = (di[j]+2*dio[j]+dio[j-ai])%mod
        dp[i] = di
        dio = di
    print(dp[n][s])
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, s = map(int, input().split())
    mod = 998244353
    a = list(map(int, input().split()))
    dp = [[0]*(s+1) for _ in range(n+1)]
    dp[0][0] = 1
    dio = dp[0]
    for i in range(1, n+1):
        ai = a[i-1]
        di = dp[i]
        for j in range(max(s+1, ai)):
            di[j] += 2*dio[j]
            di[j] %= mod
        for j in range(ai, s+1):
            di[j] += dio[j-ai]
            di[j] %= mod
        dp[i] = di
        dio = di
    print(dp[n][s])
    

if __name__ == "__main__":
    main()
Problem p02698 (python)

Fixed submission:
from bisect import bisect_left
import sys
sys.setrecursionlimit(1000000)



def dfs(p):
    ai = a[p]
    i = bisect_left(dp, ai)
    old = dp[i]
    dp[i] = ai
    ans[p] = bisect_left(dp, INF)-1
    for child in to[p]:
        if ans[child] is None:
            dfs(child)
    dp[i] = old
    
    
        

if __name__ == "__main__":
    n = int(input())
    a = [None] + list(map(int, input().split()))
    to = [[] for _ in range(n+1)]
    for _ in range(n-1):
        u, v = map(int, input().split())
        to[u].append(v)
        to[v].append(u)
    INF = 10**20
    dp = [INF]*(n+1)
    dp[0]= -INF
    ans = [None]*(n+1)
    dfs(1)
    print("\n".join(list(map(str, ans[1:]))))

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
import sys
sys.setrecursionlimit(1000000)



def dfs(p):
    ai = a[p]
    i = bisect_left(dp, ai)
    old = dp[i]
    dp[i] = ai
    ans[p] = bisect_left(dp, INF)-1
    for child in to[p]:
        if ans[child] is None:
            dfs(child)
    dp[i] = old
    
    
        

if __name__ == "__main__":
    n = int(input())
    a = [None] + list(map(int, input().split()))
    to = [[] for _ in range(n+1)]
    for _ in range(n-1):
        u, v = map(int, input().split())
        to[u].append(v)
        to[v].append(u)
    INF = 10**20
    dp = [INF]*(n+1)
    dp[0]= -INF
    q = deque([1])
    ans = [None]*(n+1)
    dfs(1)
    print("\n".join(list(map(str, ans[1:]))))
Problem p02713 (python)

Fixed submission:
def main():
    k = int(input())
    gcds = list(sorted([gcd(i, j) for i in range(1, k+1) for j in range(1, k+1)]))
    j = 0
    s = list(sorted(list(set(gcds))))
    m = k**2-1
    gcdss = [0]*len(s)
    flag = False
    for i, l in enumerate(s):
        while gcds[j] == l:
            gcdss[i] += 1
            if j == m:
                flag = True
                break
            j += 1
        if flag:
            break
    ans = sum([gcd(i, p)*n for i in range(1, k+1) for p, n in zip(s, gcdss)])
    print(ans)
            
    
def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return gcd(b, a%b)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    k = int(input())
    gcds = list(sorted([gcd(i, j) for i in range(1, k+1) for j in range(1, k+1)]))
    j = 0
    s = list(set(gcds))
    m = k**2-1
    gcdss = [0]*len(s)
    for i, l in enumerate(s):
        while gcds[j] == l:
            j += 1
            gcdss[i] += 1
        if j == m:
            break
    ans = sum([gcd(i, j)*n for i in range(1, k+1) for j, n in zip(s, gcdss)])
    print(ans)
            
    
def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return gcd(b, a%b)


if __name__ == "__main__":
    main()
Problem p02716 (python)

Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    dp = [-10**15]*(n+1)
    dp[2] = max(a[0], a[1])
    if n > 2:
        dp[3] = max(a[:3])
        aa = a[0]+a[2]
        for i in range(4, n+1):
            if i%2:
                aa += a[i-1]
                dp[i] = max(dp[i-1], dp[i-2]+a[i-1])
            else:
                dp[i] = max(aa, dp[i-2]+a[i-1])
    print(dp[n])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    if n == 2:
    dp = [-10**15]*(n+1)
    dp[2] = max(a[0], a[1])
    if n > 2:
        dp[3] = max(a[:3])
        aa = a[0]+a[2]
        for i in range(4, n+1):
            if i%2:
                aa += a[i-1]
                dp[i] = max(dp[i-1], dp[i-2]+a[i-1])
            else:
                dp[i] = max(aa, dp[i-2]+a[i-1])
    print(dp[n])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    dp = [-10**15]*(n+1)
    dp[2] = max(a[0], a[1])
    dp[3] = max(a[:3])
    aa = a[0]+a[2]
    for i in range(4, n+1):
        if i%2:
            aa += a[i-1]
            dp[i] = max(dp[i-1], dp[i-2]+a[i-1])
        else:
            dp[i] = max(aa, dp[i-2]+a[i-1])
    print(dp[n])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    dp = [[-10**15]*(3) for i in range(n+1)]
    dp[2][0] = a[0]
    dp[2][1] = a[1]
    dp[2][2] = max(a[0], a[1])
    dp[3][0] = max(a[0]+a[1], a[0]+a[2], a[1]+a[2])
    for i in range(4, n+1):
        if i%2:
            dp[i][0] = max(dp[i-1][2], dp[i-2][0]+a[i-1])
        else:
            dp[i][0] = dp[i-2][0]+a[i-2]
            dp[i][1] = dp[i-2][1]+a[i-1]
            dp[i][2] = max(dp[i][0], dp[i][1])
    if n%2:
        print(dp[n][0])
    else:
        print(dp[n][2])

if __name__ == "__main__":
    main()
Problem p02727 (python)

Fixed submission:
def main():
    x, y, a, b, c = map(int, input().split())
    al = sorted(list(map(int, input().split())), reverse=True)[:x]
    bl = sorted(list(map(int, input().split())), reverse=True)[:y]
    cl = sorted(list(map(int, input().split())), reverse=True)
    ans = 0
    xi, yi = 0, 0
    for i in cl:
        if al:
            ai = al[-1]
        else:
            ai = 10000000000
        if bl:
            bi = bl[-1]
        else:
            bi = 10000000000
        if ai < bi:
            if al:
                m = al.pop()
            else:
                m = 0
        else:
            if bl:
                m = bl.pop()
            else:
                m = 0
                
        if m < i:
            ans += i
        else:
            ans += m
            break
    ans += sum(al)+sum(bl)
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
al = sorted(list(map(int, input().split())), reverse=True)[:x]
bl = sorted(list(map(int, input().split())), reverse=True)[:y]
cl = sorted(list(map(int, input().split())), reverse=True)
ans = 0
xi, yi = 0, 0
for i in cl:
    if al:
        ai = al[-1]
    else:
        ai = 0
    if bl:
        bi = bl[-1]
    else:
        bi = 0
    if ai < bi:
        m = al.pop()
    else:
        m = bl.pop()
    if m < i:
        ans += i
    else:
        ans += m
        break
ans += sum(al)+sum(bl)
print(ans)
Problem p02755 (python)

Fixed submission:
a, b = map(int, input().split())
ass = 1 if ((100/8 * (a+1))-int(100/8 * (a+1))) else 0
asss = 1 if ((100/8 * a)-int(100/8 * a)) else 0
bss = 1 if ((100/10 * (b+1))-int(100/10 * (b+1))) else 0
bsss = 1 if ((100/10 * b)-int(100/10 * b)) else 0
As = set(range(int(100/8 * a)+asss, int(100/8 * (a+1))+ ass))
Bs = set(range(int(100/10 * b)+bsss, int(100/10 * (b+1))+bss))
if As & Bs:
    print(min(As&Bs))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
x_min = max(int(100/8 * a), int(100/10 * b))
x_max = min(int(100/8 * (a+1)), int(100/10 * (b+1)))
if int(100/8 * a) < int(100/10 * (b+1) and int(100/10 * b) < int(100/8 * (a+1)):
    print(x_min)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a < 1 or b < 1:
    print(-1)
else:
    amin = a*100//8 + ((a*100)%8 and 1)
    amax = (a+1)*100//8 + (max((a+1)*100)%8, 1) or 1)
    bmin = b*100//10 + ((b*100)%10 and 1)
    bmax = (b+1)*100//10 + (max(((b+1)*100)%10, 1) or 1)
    A = set(range(amin, amax))
    B = set(range(bmin, bmax))
    if (A & B):
        print(min(A&B))
    else:
        print(-1)
Problem p02760 (python)

Fixed submission:
def main():
    A = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    B = [int(input()) for _ in range(n)]
    ans =  [None]*8
    AT = list(zip(*A))
    ans[0] = set(A[0])
    ans[1] = set(A[1])
    ans[2] = set(A[2])
    ans[3] = set(AT[0])
    ans[4] = set(AT[1])
    ans[5] = set(AT[2])
    ans[6] = set([A[i][i] for i in range(3)])
    ans[7] = set([A[i][2-i] for i in range(3)])

    for b in B:
        for a in ans:
            if b in a:
                a -= {b}
                if not a:
                    print("Yes")
                    return
    print("No")

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
a = [list(map(int, input().split())) for _ in range(3)]
is_bingo = [[False]*3 for _ in range(3)]
n = int(input())
for _ in range(n):
    b = int(input())
    for i, ai in enumerate(a):
        for j, aii in enumerate(ai):
            if aii == b:
                is_bingo[i][j] = True
is_bingo_flat = [j for i in is_bingo for j in i]
for i in range(3):
    if all(is_bingo[i]) or all(list(zip(*is_bingo))[i]):
        print("Yes")
        break
else:
    if all(is_bingo_flat[::3]) or all(is_bingo_flat[2:7::2]):
        print("Yes")
    print("No")