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

Fixed submission:
n = int(input())
memo = [{} for i in range(n+1)]
m = 10**9+7

def ppp(l):
    for i in range(4):
        t = list(l)
        if i >= 1:
            t[i-1],t[i] = t[i],t[i-1]
        if "".join(t).count("AGC") >= 1:
            return False
    return True
def dfs(c,l):
    if l in memo[c]:
        return memo[c][l]
    if c == n:
        return 1
    ret = 0
    for b in "AGCT":
        if ppp(l+b):
            ret = (ret + dfs(c + 1,l[1:] + b)) % m
    memo[c][l] = ret
    return ret
print(dfs(0,"TTT"))

Buggy submission (verdict: Runtime Error):
n = int(input())
memo = [{} for i in range(n+1)]
m = 10**9+7

def ppp(l):
    for i in range(4):
        t = list(l)
        if i >= 1:
            t[i-1],t[i] = t[i],t[i-1]
        if "".join(t).count("AGC") >= 1:
            return False
        return True
def dfs(c,l):
    if l in memo[c]:
        return memo[c][l]
    if c == n:
        return 1
    ret = 0
    for b in "AGCT":
        if ppp(l+b):
            ret = (ret + dfs(c + 1,l[1:] + c)) % m
    memo[c][l] = ret
    return ret
print(dfs(0,"TTT"))

Buggy submission (verdict: Runtime Error):
n = int(input())
memo = [{} for i in range(N+1)]
m = 10**9+7

def ppp(l):
    for i in range(4):
        t = list(l)
        if i >= 1:
            t[i-1],t[i] = t[i],t[i-1]
        if "".join(t).count("AGC") >= 1:
            return False
        return True
def dfs(c,l):
    if l in memo[c]:
        return memo[c][l]
    if c == n:
        return 1
    ret = 0
    for b in "AGCT":
        if ppp(l+b):
            ret = (ret + dfs(c + 1,l[1:] + c)) % m
    memo[c][l] = ret
    return ret
print(dfs(0,"TTT"))
Problem p03109 (python)

Fixed submission:
a = list(input())

b = a[0:4]

c = a[5:7]

d = a[8:10]

su = 0
bb = 0
cc =0
dd = 0
for i in range(4):
	bb = 10*bb + int(b[i])
for i in range(2):
	cc = 10*cc + int(c[i])
for i in range(2):
	dd = 10*dd + int(d[i])


if bb == 2019:
	if cc >= 5:
		print("TBD")
	elif cc == 4:
		if dd == 30:
			print("Heisei")
		else:
			print("Heisei")
	else:
		print("Heisei")
elif bb > 2019:
	print("TBD")
else:
	print("Heisei")

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

ko = [int(input()) for i in range(n)]
INF = 10**9

 def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(a,b,c) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[q],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

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

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

ko = [int(input()) for i in range(n)]
INF = 10**9

def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(w,e,r) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[q],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

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

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

ko = [int(input()) for i in range(n)]
INF = 10**9

 def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(a,b,c) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[ko],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

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

Buggy submission (verdict: Runtime Error):
n,a,b,c = int(input().spilt())

ko = [int(input()) for i in range(n)]
INF = 10**9

 def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(a,b,c) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[ko],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

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

Fixed submission:
a = int(input())

b = []

for i in range(a):
	b.append(int(input()))

c = [[0] * 5 for i in range(a+1)]

for i in range(a):
	c[i+1][0] = c[i][0] + b[i]
	c[i+1][1] = min(c[i][0],c[i][1]) + (b[i] % 2 if b[i] > 0 else 2)
	c[i+1][2] = min(c[i][0],c[i][1],c[i][2]) + ((b[i]+1) % 2)
	c[i+1][3] = min(c[i][0],c[i][1],c[i][2],c[i][3]) + (b[i] % 2 if b[i] > 0 else 2)
	c[i+1][4] = min(c[i][0],c[i][1],c[i][2],c[i][3],c[i][4]) + b[i]

print(min(c[-1]))

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

b = []

for i in range(a):
	b.append(int(input()))

c = [[0] * 5 for i in range(a+1)]

for i in range(a):
	c[i+1][0] = c[i][0] + b[i]
	c[i+1][1] = min(c[i][0],c[i][1]) + (b[i] % 2 if b[i] > 0 else 2)
	c[i+1][2] = min(c[i][0][,c[i][1],c[i][2]]) + ((b[i]+1) % 2)
	c[i+1][3] = min(c[i][0][,c[i][1],c[i][2]],c[i][3]) + (b[i] % 2 if b[i] > 0 else 2)
	c[i+1][4] = min(c[i][0][,c[i][1],c[i][2]],c[i][3],c[i][4]) + b[i]

print(min(c[-1]))
Problem p03138 (python)

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

fm = 0
for i in range(40,0,-1):
    x = 2**(i-1)
    p = 0
    q = 0
    for j in a:
        b = x & j
        p += x ^ b
        q += b
    if q >= p:
        fm += q
    else:
        if m >= x:
            fm += p
            m -= x
        else:
            fm += q
print(fm)

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

n = list(map(int,input().split()))
nnn = [pow(2,i) for i in range(45)]
n.sort()
n.reverse()
kkk = len(str(bin(n[0]))) - 2
k = [[0,0] for i in range(kkk)]
nn = 1
co = 0
su = 0
for i in range(kkk):
	for j in range(a):
		if n[j] & nn > 0:
			k[i][1] += 1
		else:
			k[i][0] += 1
	nn *= 2
if nn != 1:
	nn //= 2
for i in range(kkk):
	if k[kkk-1-i][0] => k[kkk-1-i][1]:
		if su + pow(2,kkk-1-i) <= b:
			su += pow(2,kkk-1-i)
if su < b:
	nn *= 2
	while True:
		if su + nn > b:
			break
		else:
			co += nn*a
			nn *= 2
for i in range(a):
	co += su ^ n[i]
print(co)

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

n = list(map(int,input().split()))
nnn = [pow(2,i) for i in range(45)]
n.sort()
n.reverse()
kkk = len(str(bin(n[0]))) - 2
k = [[0,0] for i in range(kkk)]
nn = 1
co = 0
su = 0
for i in range(kkk):
	for j in range(a):
		if n[j] & nn > 0:
			k[i][1] += 1
		else:
			k[i][0] += 1
	nn *= 2
if nn != 1:
	nn //= 2
for i in range(kkk):
	if k[kkk-1-i][0] => k[kkk-1-i][1]:
		if su + pow(2,kkk-1-i) <= b:
			su += pow(2,kkk-1-i)
if su <= b:
	nn *= 2
	while True:
		if su + nn > b:
			break
		else:
			co += nn*a
			nn *= 2
for i in range(a):
	co += su ^ n[i]
print(co)

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

n = list(map(int,input().split()))
nnn = [pow(2,i) for i in range(45)]
n.sort()
n.reverse()
kkk = len(str(bin(n[0]))) - 2
k = [[0,0] for i in range(kkk)]
nn = 1
co = 0
su = 0
for i in range(kkk):
	for j in range(a):
		if n[j] & nn > 0:
			k[i][0] += 1
		else:
			k[i][1] += 1
	nn *= 2
if nn != 1:
	nn //= 2
for i in range(kkk):
	if k[44-i][1] > k[44-i][0]:
		if su + pow(2,44-i) <= b:
			su += pow(2,44-i)

for i in range(a):
	co += su ^ n[i]
print(co)
Problem p03139 (python)

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

aa = min(b,c)

bb = b+c - a

if bb >= 0:
	print(aa,bb)
else:
	print(aa,0)

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

aa = []
for i in range(n):
	k,l = map(int,input().split())
	aa.append([k,l])
aa.sort(key = lambda x:x[1])
aa.reverse()
co = 0
ma = 0
kkk = 0
for i in range(n):
	if i % 2 == 0:
		ma = max(aa,key = lambda x:x[0])[0]
		for j in range(len(aa)):
			if ma == aa[j][0]:
				co += aa.pop(j)[0]
				break
	else:
		co -= aa.pop(0)[1]

print(co)
Problem p03141 (python)

Fixed submission:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = onem()

po = []
su = 0
for i in range(n):
    a,b = m()
    po.append([a+b,a])
po.sort(reverse = True)

for i in range(n):
    if i % 2 == 0:
        su += po[i][1]
    else:
        su -= po[i][0] - po[i][1]
print(su)

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

a = []
b = []
aa = []
for i in range(n):
	k,l = map(int,input().split())
	a.append(k)
	b.append(l)
	aa.append([k,l])
dp = [[0,0] for i in range(n+1)]
aa.sort(key = lambda x:x[1])
co = 0
for i in range(n):
	for j in range(n):
		if i % 2 == 0:		
			dp[i+1] = max(dp[i]+aa[j][i%2],dp[i+1])
		else:
			dp[i+1] = max(dp[i]-aa[j][i%2],dp[i+1])

print(dp[n+1])
Problem p03148 (python)

Fixed submission:
n,m = map(int,input().split())
a = []
for i in range(n):
    r,t = map(int,input().split())
    a.append((t,r))
a.sort(reverse = True)
d = {}
cd = []
dp = 0
x = 0

for i in range(m):
    z,c = a[i]
    dp += z
    if c in d:
        cd.append(z)
    else:
        d[c] = z
        x += 1
cd.sort(reverse = True)
ans = dp + x**2
c = ans

for i in range(m,n):
    if len(cd) == 0:
        break
    z,v = a[i]
    if v in d:
        continue
    d[v] = z
    x += 1
    c = c - cd.pop()+z+2*x-1
    if c > ans:
        ans = c
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq as hp
n,m = map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort(reverse = True)
d = {}
cd = {}
dp = 0
x = 0

for i in range(m):
    z,c = a[i]
    dp += z
    if c in d:
        hp.heappush(cd,z)
    else:
        d[c] = z
        x += 1
ans = dp + x**2
c = ans

for i in range(m,n):
    if len(cd) == 0:
        break
    z,v = a[i]
    if v in d:
        continue
    d[v] = z
    x += 1
    c = c - hp.heappop(cd)+d+2*x-1
    if c > ans:
        ans = c
print(ans)
Problem p03150 (python)

Fixed submission:
a = "keyence"

b = input()
o = 0
k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
al = 0
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if j == 7:
			al = 1
			print("YES")
			break
		if b[i] == a[j] and jj == 0:
			j += 1
		else:
			jj = 1
			o = j
		if jj == 1 and o == 0:
			if b[-7:] == a:
				print("YES")
				break
			else:
				print("NO")
				break
		elif jj == 1:
			if b[-(7-o):] == a[o:]:
				print("YES")
				break
			else:
				print("NO")
				break
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a = "keyence"

b = input()

k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if j == -1:
			print("NO")
			break
		if b[i] == a[j]:
			j += 1
			if jj == 1:
				jj = 2
		elif jj == 0:
			jj = 1
		elif jj == 2:
			jj = 3
		if j == 7 and (jj == 0 or jj == 1 or jj == 2):
			j = -1
		if j == -1 and i == k-1:
			print("YES")
			break
	if j != -1:
		print("NO")

else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a = "keyence"

b = input()

k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if b[i] == a[j]:
			j += 1
			if jj == 1:
				jj = 2
		elif jj == 0:
			jj = 1
		elif jj == 2:
			jj = 3
	if j == 7 and (jj == 0 or jj == 1 or jj == 2):
		j = -1
	if j == -1:
		print("YES")
	else:
		print("NO")

else:
	print("NO")
Problem p03162 (python)

Fixed submission:
a = int(input())

b = []
m = 0
for i in range(a):
	b.append(list(map(int,input().split())))

c = [[0,0,0] for i in range(a+1)]

for i in range(a):
	for j in range(3):
		for k in range(3):
			if j == k:
				continue
			else:
				c[i+1][k] = max(c[i+1][k],c[i][j] + b[i][k])

print(max(c[-1]))

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

b = []
m = 0
for i in range(a):
	b.append(list(map(int,input().split())))

c = [[0,0,0] in i for range(a+1)]

for i in range(a):
	for j in range(3):
		for k in range(3):
			if j == k:
				continue
			else:
				c[i+1][k] = max(c[i+1][k],c[i][k] + b[i][j])

print(max(c[-1]))
Problem p03165 (python)

Fixed submission:
a = input()
b = input()

aa = len(a)

bb = len(b)

dp = [[0]*(bb+1) for i in range(aa+1)]

for i in range(aa):
	for j in range(bb):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[aa-1] == b[bb-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[aa-1][bb]:
		bb -= 1
	else:
		aa -= 1
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
a = list(input())

b = list(input())

aa = len(a)

bb = len(b)

dp = [[]*(m+1) for i in range(n+1)]

for i in range(n):
	for j in range(m):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j])

ans = ""

while aa > 0 and bb > 0:
	if a[n-1] == b[m-1]:
		aa -= 1
		bb -= 1
		ans += a[aa]
	elif dp[aa][bb-1] > dp[a-1][b]:
		aa -= 1
	else:
		bb -= 1
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
a = list(input())
b = list(input())

k = max(len(a),len(b))

dp = [[0]*(len(b)+1) for i in range(len(a)+1)]

for i in range(len(a)):
	for j in range(len(b)):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])

ans = ''
def rec(m,n):
	if m == 0 or n == 0:
		return ans
	if a[m-1] == b[n-1]:
		global ans
		ans += a[m-1]
		rec(m-1,n-1)
	elif dp[m-1][n] > dp[m][n-1]:
		rec(m-1,n)
	else:
		rec(m,n-1) 

rec(len(a),len(b))
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
a = list(input())
b = list(input())

k = max(len(a),len(b))

dp = [[0]*(len(b)+1) for i in range(len(a)+1)]

for i in range(len(a)):
	for j in range(len(b)):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])

ans = ""

def rec(m,n):
	if m == 0 and n == 0:
		return ans
	if a[m-1] == b[n-1]:
		global ans
		ans += a[m-1]
		rec(m-1,n-1)
	elif dp[m-1][n] > dp[m][n-1]:
		rec(m-1,n)
	else:
		rec(m,n-1) 

rec(len(a),len(b))
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
a = list(map(input()))
b = list(map(input()))

k = max(len(a),len(b))

dp = [['']*(len(b)+1) for i in range(len(a))]

for i in range(len(a)):
	for j in range(len(b)):
		if a[i] == b[j]:
			dp[i+1][j+1] = dp[i][j] + 1
		else:
			dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])

global ans = ""

def rec(m,n):
	if m == 0 and n == 0:
		return ans
	if a[m-1] == b[n-1]:
		ans += a[m]
		rec(m-1.n-1)
	elif dp[m-1][n] > dp[m][n-1]:
		rec(m-1,n)
	else:
		rec(m,n-1) 

rec(len(a),len(b))
print(ans)
Problem p03213 (python)

Fixed submission:
k = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 8, 8, 11, 11, 11, 11, 14, 14, 32, 32, 35, 35, 35, 35, 42, 42, 42, 42, 49, 49, 49, 49, 49, 49, 75, 75, 86, 86, 86, 86, 86, 86, 123, 123, 131, 131, 131, 131, 148, 148, 153, 153, 170, 170, 170, 170, 170, 170, 227, 227, 227, 227, 227, 227, 250, 250, 323, 323, 324, 324, 324, 324, 354, 354, 354, 354, 384, 384, 384, 384, 384, 391, 491, 491, 529, 529, 529, 529, 529, 529, 543]
a = int(input())
print(k[a])

Buggy submission (verdict: Runtime Error):
from scipy.special import perm, comb

a = int(input())

b = [0 for i in range(15)]
j = 0
c = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
d = [0 for i in range(101)]
p = 0
pp = 0
co = 0
for i in range(1,101):
  k = i
  while True:
    if k % c[j] == 0 and k >= c[j]:
      b[j] += 1
      k //= c[j]
    else:
      j += 1
      if j == 15:
        j = 0
        break
  for k in range(15):
    if b[k] >= 4:
      p += 1
    elif b[k] >= 2:
      pp += 1
  if i >= 10:
    d[i] = comb(p, 2,exact=True)*comb(pp, 1,exact=True) + comb(p, 3,exact=True)
  p = 0
  pp = 0
print(d[a])
Problem p03215 (python)

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

c = list(map(int,input().split()))

aa = []
aa.append(0)
aa.append(c[0])

l = []
for i in range(1,a):
	aa.append(aa[i]+c[i])
d = 0
p = len(aa)
for i in range(p):
	for j in range(i+1,p):
		l.append(aa[j]-aa[i])
co = 0
la = 0
for i in range(40,-1,-1):
	for j in range(len(l)):
		if l[j] & (la + 2 ** i) == (la + 2 ** i):
			co += 1
	if co >= b:
		la += (2 ** i)
	co = 0

print(la)

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

c = [int(_) for i in input().split()]

l = []
for i in range(a):
    l += [c[i]]
    for j in range(i+1,a):
        l += [l[-1] + c[j]]
print(l)
co = 0
la = 0
for i in range(40,-1,-1):
	for j in range(len(l)):
		if l[j] & (la + 2 ** i) == (la + 2 ** i):
			co += 1
	if co >= b:
		la += (2 ** i)
	co = 0

print(la)

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

c = list(map(int,input().split()))

aa = []
aa.append(0)
aa.append(c[0])

l = []
for i in range(1,a):
	aa.append(aa[i]+c[i])
d = 0
p = len(aa)
for i in range(p):
	for j in range(i+1,p):
		l.append(aa[j]-aa[i])

l.sort()
l.reverse()
l = list(map(bin,l))
pp = []
for i in range(len(l)-b):
	k = l[i]
	for j in range(1,b):
		k = l[i+b] & k
		if k <= min(pp):
			break
	pp.append(int(k))

pp.sort()
pp.reverse()
print(pp[0])
Problem p03219 (python)

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

print(a+(b//2))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
aa = []
d = []
for i in range(b):
    k,kk = map(int,input().split())
    d.append([k, kk,i+1])

da = sorted(d)

kkk = da[0][0]
ll = 0
for i in range(b):
    kkkk = da[i][0]
    if kkk == kkkk:
        ll += 1
    else:
        kkk = kkkk
        ll = 1
    aa.append([da[i][2],da[i][0],ll])
aa.sort()

for i in aa:
    m = str(i[1])
    n = str(i[2])
    m = "0"*(6-len(m))+m
    n = "0"*(6-len(n))+n
    print(m+n)
Problem p03238 (python)

Fixed submission:
a = int(input())

if a == 1:
    print("Hello World")
else:
    b = int(input())
    c = int(input())
    print(b+c)

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

if a == 1:
    print("Hello World")
else:
    b = int(input())
    c = int(input())
    print(b+c)
Problem p03241 (python)

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

b = a[1]//a[0]

c = []

for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1] % i == 0 and i <= b:
        if a[1] // i <= b:
            c.append(a[1] // i)
        else:
            c.append(i)
c.sort()
c.reverse()
print(c[0])

Buggy submission (verdict: Runtime Error):
import math;a = list(map(int,input().split()));b = a[1]//a[0];c = [];for i in range(1,int(math.sqrt(a[1]))+1):if a[1]%i==0 and i<=b:if a[1] // i <= b:c.append(a[1]//i);else:c.append(i);c.sort(reverse=True);print(c[0])

Buggy submission (verdict: Runtime Error):
¥import math
a = list(map(int,input().split()))
b = a[1]//a[0]
c = []
for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1]%i==0 and i<=b:
        if a[1] // i <= b:
            c.append(a[1]//i)
        else:
            c.append(i)
c.sort(reverse=True)
print(c[0])
Problem p03262 (python)

Fixed submission:
import functools
import fractions
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = []
d = []
co = 0
for i in range(a[0]):
	c.append(abs(b[i]-a[1]))
	if b[i]-a[1] > 0 and co == 0:
		c.insert(i,0)
		co += 1
if co == 0:
	c.append(0)

for i in range(len(c)-1):
	d.append(abs(c[i+1]-c[i]))
print(functools.reduce(fractions.gcd, d))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = []
d = []
co = 0
for i in range(a[0]):
	c.append(abs(b[i]-a[1]))
	if b[i]-a[1] > 0 and co == 0:
		c.insert(i,0)
		co += 1
if co == 0:
	c.append(0)

for i in range(len(c)-1):
	d.append(abs(c[i+1]-c[i]))
k = min(d)
for i in range(len(d)):
	if d[i] % k != 0:
		d[0] = 1
		break
print(d[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = []
d = []
co = 0
for i in range(a[0]):
	c.append(abs(b[i]-a[1]))
	if b[i]-a[1] > 0 and co == 0:
		c.insert(i,0)
		co += 1

for i in range(len(c)-1):
	d.append(abs(c[i+1]-c[i]))
	if d[-1] == 0:
		d.pop()
d.sort()
for i in range(len(d)-1):
	if d[i] % d[0] != 0:
		d[0] = 1
		break
print(d[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = []
d = []
co = 0
for i in range(a[0]):
	c.append(abs(b[i]-a[1]))
	if b[i]-a[1] > 0 and co == 0:
		c.insert(i,0)
		co += 1

for i in range(len(c)-1):
	d.append(abs(c[i+1]-c[i]))
	if d[-1] == 0:
		d.pop()
d.sort()
for i in range(len(d)-1):
	if d[i] % d[0] != 0:
		d[0] = 1
		break
print(d[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = []
d = []
co = 0
for i in range(a[0]):
	c.append(abs(b[i]-a[1]))
	if b[i]-a[1] > 0 and co == 0:
		c.insert(i,0)
		co += 1

for i in range(len(c)-1):
	d.append(abs(c[i+1]-c[i]))
	if d[-1] == 0:
		d.pop()
d.sort()
for i in range(len(d)-1):
	if d[i] % d[0] != 0:
		d[0] = 1
		break
print(d[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = []
d = []
for i in range(a[0]):
	c.append(abs(b[i]-a[1]))
	if b[i]-a[1] > 0:
		c.insert(i,0)

for i in range(len(c)-1):
	d.append(abs(c[i+1]-c[i]))
	if d[-1] == 0:
		d.pop()
d.sort()
for i in range(len(d)-1):
	if d[i] % d[0] != 0:
		d[0] = 1
		break
print(d[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = []
for i in range(a[0]):
	b[i] = abs(b[i]-a[1])
b.sort()
if a[0] == 1:
	c = b
else:
	for i in range(a[0]-1):
		c.append(b[i+1]-b[i])
c.sort()
if c[0] == 0:
	c.remove(0)
if len(c) == 0:
	c = b[0]
for i in range(len(c)):
	if c[i] % c[0] != 0:
		c[0] = 1
		break
print(c[0])
Problem p03268 (python)

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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//b),3))

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

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//a),3)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = a//b-1
d = a//(b//2)
if b % 2 == 0:
	print(c**3+d**3)
else:
	print(c**3)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = a//b
d = a//(b//2)
if b % 2 == 0:
	print(d**3)
else:
	print(c**3)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = a//b
d = a//(b//2)
if b % 2 == 0:
	print(c**3 + d**3)
else:
	print(c**3)