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

Fixed submission:
import sys
sys.setrecursionlimit(200000)
s = input()
t = input()
dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]

def backtrack(dp, s, t, i, j):
    if i == 0 or j == 0:
        return ''
    if s[i-1] == t[j-1]:
        return backtrack(dp, s, t, i-1, j-1) + s[i-1]
    if dp[i][j-1] > dp[i-1][j]:
        return backtrack(dp, s, t, i, j-1)
    return backtrack(dp, s, t, i-1, j)

for i in range(1, len(s)+1):
    for j in range(1, len(t)+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1)
        else:
            dp[i][j] = max(dp[i][j-1], dp[i-1][j])
print(backtrack(dp, s, t, len(s), len(t)))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]

def backtrack(dp, s, t, i, j):
    if i == 0 or j == 0:
        return ''
    if s[i-1] == t[j-1]:
        return backtrack(dp, s, t, i-1, j-1) + s[i-1]
    if dp[i][j-1] > dp[i-1][j]:
        return backtrack(dp, s, t, i, j-1)
    return backtrack(dp, s, t, i-1, j)

for i in range(1, len(s)+1):
    for j in range(1, len(t)+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1)
        else:
            dp[i][j] = max(dp[i][j-1], dp[i-1][j])
print(backtrack(dp, s, t, len(s), len(t)))
Problem p02995 (python)

Fixed submission:
from fractions import gcd
a, b, c, d = map(int, input().split())

cnt = 0
s = b - a + 1
cd = (c*d) // gcd(c,d)

m1 = int((a-1) // c)
m2 = int(b // c)
cnt += (m2-m1)
#print(cnt)

m1 = int((a-1) // d)
m2 = int(b // d)
cnt += (m2-m1)
#print(cnt)

m1 = int((a-1) // cd)
m2 = int(b // cd)
cnt -= (m2-m1)
#print(cnt)

#print(cnt)
print(s - cnt)

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())

cnt = 0
s = b - a + 1
cd = (c*d) // math.gcd(c,d)

m1 = int((a-1) / c)
m2 = int((b+1) / c)
cnt += (m2-m1)

m1 = int((a-1) / d)
m2 = int((b+1) / d)
cnt += (m2-m1)

m1 = int((a-1) / cd)
m2 = int((b+1) / cd)
cnt -= (m2-m1)

#print(cnt)
print(s - cnt)
Problem p03061 (python)

Fixed submission:
import fractions

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

gcdl = [0]
gcdr = [0]

for i in range(n-1) :
    gcdl.append(fractions.gcd(gcdl[i], a[i]))
    gcdr.append(fractions.gcd(gcdr[i], a[-(i+1)]))
gcdr = gcdr[::-1]

ans = []
for i in range(n) :
    ans.append(fractions.gcd(gcdl[i], gcdr[i]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import math, itertools

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

gcdl = []
coml = list(itertools.combinations(a,2))

for x in range(len(coml)) :
    gcdl.append(math.gcd(coml[x][0], coml[x][1])) 

gcdl.sort()
min = gcdl[0]
for x in range(1, len(coml)) :
    if min != gcdl[x] :
        break

print(gcdl[x])

Buggy submission (verdict: Runtime Error):
import math, itertools

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

gcdl = []
coml = list(itertools.combinations(a,2))

for x in range(len(coml)) :
    gcdl.append(math.gcd(coml[x][0], coml[x][1])) 

gcdl.sort()
min = gcdl[0]
for x in range(1, len(coml)) :
    if min != gcdl[x] :
        break

print(gcdl[x])
Problem p02691 (python)

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

mp = [0] * n

ans = 0

for i in range(n):
    if i-a[i] >= 0:
        ans += mp[i-a[i]]
    if n > a[i]+i:
        mp[a[i]+i] += 1

print(ans)

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

mp = [0] * n
#right = [0] * n

ans = 0

for i in range(n):
    ans += mp[i-a[i]]
    if n > a[i]+i:
        mp[a[i]+i] += 1

print(ans)
Problem p02830 (python)

Fixed submission:
n=int(input())
s,t=input().split()
for i in range(n):
    print(s[i],end="")
    print(t[i],end="")
print()

Buggy submission (verdict: Runtime Error):
n=int(input())
s,t=input().split()
for i in range(n):
    print(f"{s[i]}{t[i]}",end="")
print()
Problem p02953 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
v = -1
for h in H:
    if v > h:
        if v != h+1:
            print("No")
            exit()
        else:
            v = h+1
    else:
        v = h
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
j=0
cnt=0
if n==1:
    sys.exit("Yes")
for i in range(1,n):
    if 0<=a[i]-a[j]:
        j=i
    else:
        a[j]=a[j-1]
        cnt+=1
        j=i
        if cnt==2:
            break
        else:
            continue
        
if cnt<=1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
j=0
cnt=0
if n<=2:
    sys.exit("Yes")
for i in range(1,n):
    if 0<=a[i]-a[j]:
        #print(i,j)
        j=i
        continue
    else:
        #print(i,j,"else")
        cnt+=1
        j=i
        if cnt==2:
            break
        else:
            continue
        
if cnt<=1:
    print("Yes")
else:
    print("No")
Problem p02993 (python)

Fixed submission:
a=input()
b=False
for i in range(3):
 if a[i+1]==a[i]:
  b=True

if b:
 print("Bad")
else:
 print("Good")

Buggy submission (verdict: Runtime Error):
a=input()
b=False
for i in range(3):
 if a[i+1]==a[i]:
  b=True

if b:
 print(“Bad”)
else:
 print(“Good”)

Buggy submission (verdict: Runtime Error):
a=input()
b=False
for i in range(3):
 if a[i+1]==a[i]:
  b=True

if b:
print(“Bad”)
else:
print(“Good”)
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())
m=w*h/2
if x==0 or y==0:
    print(m,0)
    exit()
if x==w or y==h:
    print(m,0)
    exit()


if w%x==0 and h%y==0:
    print(m,1)
else:
    print(m,0)

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
m=w*h/2
if w%x==0 and h%y==0:
    print(m,1)
else:
    print(m,0)
Problem p03105 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input.split())
print(min(b//a,c))
Problem p03145 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(min(a,b)*min(max(a,b),c)//2)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(min(a,b)*min(max(a,b),c))//2)
Problem p03147 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cnt=0
ch=True
#print(cnt,a)
while True:
    my_bool=True
    for i in range(n):
        if my_bool:
            if a[i]!=0:
                my_bool=False
                ch2=True
                a[i]-=1
        else:
            if a[i]!=0:
                a[i]-=1
                ch=True
                ch2=True
            else:
                if ch2:
                    cnt+=1
                ch=False
                ch2=False
    if ch:
        if my_bool:
            pass
        else:
            #print("ch",cnt,a)
            cnt+=1
    #print(cnt,a)
    if my_bool:
        break
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
cnt=0
#print(cnt,a)
while True:
    my_bool=True
    for i in range(n):
        if my_bool:
            if a[i]!=0:
                my_bool=False
                ch2=True
                a[i]-=1
        else:
            if a[i]!=0:
                a[i]-=1
                ch=True
                ch2=True
            else:
                if ch2:
                    cnt+=1
                ch=False
                ch2=False
    if ch:
        if my_bool:
            pass
        else:
            #print("ch",cnt,a)
            cnt+=1
    #print(cnt,a)
    if my_bool:
        break
print(cnt)
Problem p02683 (python)

Fixed submission:
import numpy as np

n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(1,2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):
            buy_list.append(understand_list[j])
            money += understand_list[j][0]

    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list[1:]]):
        money_list.append(buy_list[0])

if money_list == []:
    print(-1)
else:
    print(min(money_list))

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

n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):
            buy_list.append(understand_list[j])
            money += understand_list[j][0]

    if buy_list == []:
        continue
    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list]):
        money_list.append(buy_list[0])

if money_list == []:
    print(-1)
else:
    print(min(money_list))

Buggy submission (verdict: Runtime Error):
import numpy as np
n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):

            buy_list.append(understand_list[j])
            money += understand_list[j][0]
    if buy_list == []:
        continue
    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list]):
        money_list.append(buy_list[0])
if money_list == []:
    print(-1)
else:
    print(min(money_list))
Problem p02684 (python)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))
r = [0]*N
p = 0
q = 1 #現在地
for i in range(K):
    if i == K-1:
        print(A[q-1])
        exit()
    q = A[q-1] #次の町
    if r[q-1] == 0:
        p += 1
        r[q-1] += p       
    else:
        p += 1
        y = r[q-1]
        break
z = (K-y) % (p-y)
for i in range(N):
    if r[i] == y+z:
        print(i+1)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))
r = [0]*N
p = 0
q = 1 #現在地
for i in range(K):
    q = A[q-1] #次の町
    if r[q-1] == 0:
        p += 1
        r[q-1] += p       
    else:
        p += 1
        y = r[q-1]
        break
z = (K-y) % (p-y)
for i in range(N):
    if r[i] == y+z:
        print(i+1)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))
r = [0]*N
p = 0
q = 1 #現在地
for i in range(min(K,N)):
    q = A[q-1] #次の町
    if r[q-1] == 0:
        p += 1
        r[q-1] += p       
    else:
        p += 1
        y = r[q-1]
        break
z = (K-y) % (p-y)
for i in range(N):
    if r[i] == y+z:
        print(i+1)
Problem p02696 (python)

Fixed submission:
A,B,N = map(int,input().split())
if N >= B:
    x = B-1
else:
    x = N%B
print(A*x//B)

Buggy submission (verdict: Runtime Error):
import math
A,B,N = map(int,input().split())
if N%A != 0:
    n = N%A
    ans = 0
    for i in range(1,n+1):
        ans = max(ans,math.floor(A*i/B)-A*math.floor(i/B))
else:
    for i in range(1,A):
        ans = max(ans,math.floor(A*i/B)-A*math.floor(i/B))
print(ans)
Problem p02765 (python)

Fixed submission:
N,R = map(int,input().split())
if N >= 10:
  print(R)
else:
  print(R+100*(10-N))

Buggy submission (verdict: Runtime Error):
import math
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2, N + 1):
    g1.append( (g1[-1]*i) % mod)
    inverse.append( (-inverse[mod % i] * (mod//i)) % mod)
    g2.append( (g2[-1]*inverse[-1]) % mod)
ans = ans-(cmb(n,a,mod)+cmb(n,b,mod))-1
print(ans)
Problem p02768 (python)

Fixed submission:
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)
def cmb(n,r,mod):
  if n == r:
    return 1
  p,q = 1,1
  r = min(r,n-r)
  for i in range(r):
    p = p*(n - i)%mod
    q = q*(i + 1)%mod
    Y = pow(q,10**9+5,mod)
  return p*Y%mod
ans = ans - cmb(n,a,mod) - cmb(n,b,mod) - 1
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)
def cmb(n,r,mod):
  p,q = 1,1
  r = min(r,n-r)
  for i in range(r):
    p = p*(n - i)%mod
    q = q*(i + 1)%mod
    Y = pow(q,10**9+5,mod)
  return p*Y%mod
ans = ans - cmb(n,a,mod) - cmb(n,b,mod) - 1
print(ans%mod)

Buggy submission (verdict: Runtime Error):
import math
n,a,b = map(int,input().split())
mod = 10**9+7
ans = pow(2,n,mod)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2, N + 1):
    g1.append( (g1[-1]*i) % mod)
    inverse.append( (-inverse[mod % i] * (mod//i)) % mod)
    g2.append( (g2[-1]*inverse[-1]) % mod)
ans = ans-(cmb(n,a,mod)+cmb(n,b,mod))-1
print(ans)
Problem p02811 (python)

Fixed submission:
K,X = map(int,input().split())
if K*500>=X:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
K , X = int(input.split)
if K*500 == X:
  print(Yes)
elif:
  print(No)
Problem p03160 (python)

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
h = [0] + h
dp = [0]*(N+1)
dp[2] = abs(h[2]-h[1])
for i in range(3,N+1):
  dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[N])

Buggy submission (verdict: Runtime Error):
n,w = map(int,input().split())
v = [list(map(int,input().split())) for _ in range(n)]
dp = [[0]*(w+1) for _ in range(n+1)]
for i in range(1,n+1):
  for j in range(w+1):
    if j < v[i-1][0]:
      dp[i][j] = dp[i-1][j]
    else:
      dp[i][j] = max(dp[i-1][j],dp[i-1][j-v[i-1][0]]+v[i-1][1])
print(dp[n][w])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)
N,W = map(int,input().split())
w = []
v = []
for i in range(N):
  w_,v_ = map(int,input().split())
  w.append(w_)
  v.append(v_)

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

def memo(i,j):
  if dp[i][j]:
    return dp[i][j]
  if i == N:
    dp[i][j] = 0
  elif w[i] > j:
    dp[i][j] = memo(i+1,j)
  else:
    dp[i][j] = max(memo(i+1,j),memo(i+1,j-w[i])+v[i])
  return dp[i][j] 
print(memo(0,W))

Buggy submission (verdict: Runtime Error):
N,W = map(int,input().split())
w = []
v = []
for i in range(N):
  w_,v_ = map(int,input().split())
  w.append(w_)
  v.append(v_)

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

def memo(i,j):
  if dp[i][j]:
    return dp[i][j]
  if i == N:
    dp[i][j] = 0
  elif w[i] > j:
    dp[i][j] = memo(i+1,j)
  else:
    dp[i][j] = max(memo(i+1,j),memo(i+1,j-w[i])+v[i])
  return dp[i][j] 
print(memo(0,W))
Problem p03624 (python)

Fixed submission:
abc='abcdefghijklmnopqrstuvwxyz'
s=raw_input().strip()
isi=set()
for l in s:
    if l not in isi:
        isi.add(l)
for l in abc:
    if l not in isi:
        print l
        break
else:
    print 'None'

Buggy submission (verdict: Runtime Error):
abc='abcdefghijklmnopqrstuvwxyz'
s=raw_input().strip()
isi=dict()
for l in s:
Problem p02687 (python)

Fixed submission:
S = raw_input()
if S == 'ABC':
	print 'ARC'
else:
	print 'ABC'

Buggy submission (verdict: Runtime Error):
S = raw_input()
if S = 'ABC':
	print 'ARC'
else:
	print 'ABC'
Problem p02691 (python)

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

x_occurance = {}
minus = []
for i in range(N):
	p = A[i] + i
	m = i - A[i]
	x_occurance[p] = x_occurance.get(p, 0) + 1
	minus.append(m)

count = 0
for i in range(N):
	count += x_occurance.get(minus[i], 0) 

print count

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

count = 0
for i in range(N):
	h = A[i]
	for j in range(i+h+1, N):
		if j - i == h + A[j]:
			count += 1
print(count)
Problem p02885 (python)

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

print(max(0, a-2*b))

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

print(max(0, a-2*b)
Problem p02727 (python)

Fixed submission:
x, y, a, b, c = map(int, input().split())

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

A = sorted(A)
B = sorted(B)
C = sorted(C)

t = 0
s = 0

A = A[-x:]
B = B[-y:]

C.extend(A)
C.extend(B)
C = sorted(C)

print(sum(C[-x-y:]))

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

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

A = sorted(A)
B = sorted(B)
C = sorted(C)

t = 0
s = 0
A = A[-x:]
B = B[-y:]

for i in range(c):
    if A[t] < B[s] and A[t] < C[i]:
        A[t] = C[i]
        t += 1
    elif B[s] < A[t] and B[s] < C[i]:
        B[s] = C[i]
        s += 1

print(sum(A[-x:]) + sum(B[-y:]))
Problem p02677 (python)

Fixed submission:
import math
a,b,h,m=map(int,input().split())
q=h*30+m*0.5
w=m*6
cosa=math.cos(math.radians(q-w))
print((a**2+b**2-2*a*b*cosa)**0.5)

Buggy submission (verdict: Runtime Error):
import math
a,b,h,m=map(int,input().split())
q=h*30+m*0.5
w=m*6
cosa=math.cos(math.radians(q-w))
print((a**2+b**2-2*a*b*cos)**0.5)
Problem p02700 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
while True:
    C-=B
    if C<=0:
        print("Yes")
        break
    A-=D
    if A<=0:
        print("No")
        break

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
while True:
    C-=B
    if c<=0:
        print("Yes")
        break
    A-=D
    if a<=0:
        print("No")
        break
Problem p03059 (python)

Fixed submission:
A,B,T = map(int, raw_input().split())
print((T/A)*B)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
N = input()
A = map(int, raw_input().split())
B = []
for i in range(N):
	t = 0
	for j in range(N):
		if(i == j):
			continue
		else:
			if(t == 0):
				t = A[j]
			else:
				t = gcd(t,A[j])
		if(t == 1):
			break
	B.append(t)
print(max(B))
Problem p03063 (python)

Fixed submission:
N = input()
S = raw_input()
flag1 = 0
a = 0
count = [0,0]
count2 = []
count3 = []
for c in S:
	if(c == "#"):
		if(flag1 == 1):
			flag1 = 0
			count2.append(count[0])
			count3.append(count[1])
		count[0] += 1
	else:
		count[1] += 1
		flag1 = 1
countf = []
for i in range(len(count2)):
	countf.append(count2[i] + count[1] - count3[i])
countf.append(N - count[0])
countf.append(N - count[1])
print(min(countf))

Buggy submission (verdict: Runtime Error):
DIV = 998244353

N = input()
a = []
for i in range(N):
    a.append(input())
a.sort()
suma = sum(a)
dp = [[0] * (suma+1) for i in range(N)]
dp[0][0] = 2
dp[0][a[0]] = 1
allc = 3
for i in range(1,N):
	allc = allc*3
	k = a[i]
	for j in range(sum(a[:i+1])+1):
		if(j < k):
			dp[i][j] = dp[i-1][j]*2
		else:
			dp[i][j] = dp[i-1][j]*2+dp[i-1][j-k]
allc = allc - sum(dp[N-1][suma-suma/2:])*3
if(suma%2 == 0):
	dp2 = [[0] * (suma+1) for i in range(N)]
	dp2[0][0] = 1
	dp2[0][a[0]] = 1 
	for i in range(1,N):
		k = a[i]
		for j in range(sum(a[:i+1])+1):
			if(j < k):
				dp2[i][j] = dp2[i-1][j]
			else:
				dp2[i][j] = dp2[i-1][j]+dp2[i-1][j-k]
	allc += dp2[N-1][suma/2]*3
print(allc%DIV)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input()) - 1
i = 0
while i < k and s[i] == '1':
    i += 1
print(s[i])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
i = 0
while i < k and s[i] == '1':
    i += 1
print(s[i])
Problem p03338 (python)

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

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

Fixed submission:
# coding: utf-8

a, b, c = map(int, input().split())
# print(a, b, c)

if 0 < c - a - b and 4 * a * b < (c - a - b)**2:
    print('Yes')
else:
    print('No')

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

a, b, c = map(int, input().split())
# print(a, b, c)

if sympy.sqrt(a) + sympy.sqrt(b) < sympy.sqrt(c):
    print('Yes')
else:
    print('No')
Problem p02748 (python)

Fixed submission:
# coding: utf-8
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = sorted(a)
b1 = sorted(b)
z = [list(map(int, input().split())) for _ in range(M)]

num1 = a1[0] + b1[0]
# print("num1:", num1)
for i in range(M):
    x, y, c = z[i]
    num = a[x - 1] + b[y - 1] - c
    if num < num1:
        num1 = num
print(num1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = sorted(a)
b1 = sorted(b)
z = [list(map(int, input().split())) for _ in range(M)]

num1 = a1[0] + b1[0]
# print("num1:", num1)        
num1 = min(num1)
# print("num1:", num1)
for i in range(M):
    x, y, c = z[i]
    num = a[x - 1] + b[y - 1] - c
    if num < num1:
        num1 = num
print(num1)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
z = [list(map(int, input().split())) for _ in range(M)]

num1 = [a[i] + b[i] for i in range(max(A, B))]

for i in range(M):
    x, y, c = z[i]
    num = a[x - 1] + b[y - 1] - c
    num1.append(num)
# print(num1)
print(min(num1))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
A, B, M = map(int, input().split())
# print("A:", A, "B:", B, "M:", M)
a = list(map(int, input().split()))
# print("a:", a)
b = list(map(int, input().split()))
# print("b:", b)
z = [list(map(int, input().split())) for _ in range(M)]
# print("z:", z)
min_ = [a[i] + b[i] for i in range(max(A, B))]
# print("min:", min_)
for i in range(M):
    x, y, c = z[i]
    # print("x:", x, "y:", y, "c:", c)
    num = a[x - 1] + b[y - 1] - c
    # print("num:", num)
    min_.append(num)
# print(min_)
print(min(min_))
Problem p02760 (python)

Fixed submission:
def cal(lst1, lst2):
    lst3 = [0, 0, 0]
    for i in range(3):
        if lst1[i] in lst2:
            lst3[i] = 1
    return lst3

def judge(a, b, c):
    if (a == 1) and (a == b == c):
        return True
    else:
        return False

A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))
N = int(input())
b = [int(input()) for _ in range(N)]

C_1 = []
C_2 = []
C_3 = []

C_1 = cal(A_1, b)
C_2 = cal(A_2, b)
C_3 = cal(A_3, b)

a = judge(C_1[0], C_2[0], C_3[0])
b = judge(C_1[1], C_2[1], C_3[1])
c = judge(C_1[2], C_2[2], C_3[2])

d = judge(C_1[0], C_1[1], C_1[2])
e = judge(C_2[0], C_2[1], C_2[2])
f = judge(C_3[0], C_3[1], C_3[2])

g = judge(C_1[0], C_2[1], C_3[2])
h = judge(C_1[2], C_2[1], C_3[0])

lst = [a, b, c, d, e, f, g, h]

if True in lst:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def cal(lst1, lst2, lst3):
    for i in range(3):
        if lst1[i] in lst3:
            lst2[i] = 1

def judge(a, b, c):
    if a == 1 and (a == b == c):
        return True
    else:
        return False

A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))
N = int(input())
b = [int(input()) for _ in range(N)]
C_1 = [0, 0, 0]
C_2 = [0, 0, 0]
C_3 = [0, 0, 0]
cal(A_1, C_1, b)
cal(A_2, C_2, b)
cal(A_3, C_3, b)

a, b, c, d, e, f, g, h = False
# 縦
a = judge(C_1[0], C_2[0], C_3[0])
b = judge(C_1[1], C_2[1], C_3[1])
c = judge(C_1[2], C_2[2], C_3[2])

# 横
d = judge(C_1[0], C_1[1], C_1[2])
e = judge(C_2[0], C_2[1], C_2[2])
f = judge(C_3[0], C_3[1], C_3[2])

g = judge(C_1[0], C_2[1], C_3[2])
h = judge(C_1[2], C_2[1], C_3[0])

lst = [a, b, c, d, e, f, g]

if True in lst:
    print('Yes')
else:
    print('No')