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

Fixed submission:

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

A = [i for i in map(int, input().split())]
squares=[i for i in range(N+1)]
V=squares[X]
lowest=[]
highest =[]
for i in range(len(A)):
    if A[i]<V:
        lowest.append(A[i])
    else:
        highest.append(A[i])
if len(lowest)>len(highest):
    cost = len(highest)
else:
    cost = len(lowest)

print(cost)

Buggy submission (verdict: Runtime Error):
K = input()
k=K.split('\n')
N,M,X=map(int, k[0].split())
A = [i for i in map(int, k[1].split())]
squares=[i for i in range(N+1)]



V=squares[X]
lowest=[]
highest =[]
for i in range(len(A)):
    if A[i]<V:
        lowest.append(A[i])
    else:
        highest.append(A[i])

if len(lowest)>len(highest):
    cost = len(highest)
else:
    cost = len(lowest)

print(cost)
Problem p03145 (python)

Fixed submission:
print (lambda x:(x[0]*x[1])/2)(map(int,raw_input().split(" ")))

Buggy submission (verdict: Runtime Error):
s=int(raw_input())
f=lambda x:(x/2)*(x%2==0)+(3*x+1)*(x%2==1)
r=[s]
map(lambda x:r.append(f(r[-1])),xrange(1,100000))
for i in xrange(1,100000):
  try:
    s=r[i+1:].index(r[i])
    rs=i+4
    break
  except:
    pass
print rs

Buggy submission (verdict: Runtime Error):
import sys
def main(a,b,c):
  return (a*b)/2

if __name__=="__main__":
  main(sys.argv[1],sys.argv[2],sys.argv[3])
Problem p03145 (python)

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

#X = A * B / 2
# 商の整数値（小数点以下を切り捨て）
X = A * B // 2
print(X)

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

#X = A * B / 2
# 商の整数値（小数点以下を切り捨て）
X = A * B // 2
print(X)

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

X = A * B / 2
print(X)
Problem p03146 (python)

Fixed submission:
def f(n):
    if n%2 == 0:
        return n //2
    return 3*n+1

s = int(input())
ans = 1
used = set()
# 同じものがでるまで処理を繰り返す
while True:
    if s in used:
        break
    used.add(s)
    ans += 1
    s = f(s)
print(ans)

Buggy submission (verdict: Runtime Error):
def f(n):
  if N%2 == 0:
    return n //2
  return 3*n+1

s = int(input())
ans = 1
used = set()
while True:
  if s in used:
    break
  used.add(s)
  ans += 1
  s = f(s)
print(ans)
Problem p03145 (python)

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

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

Fixed submission:
A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())

Buggy submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())

Buggy submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())

Buggy submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn)

Buggy submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'
print(S)

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn)

Buggy submission (verdict: Runtime Error):
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'
print(S)

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1
	print(turn, pop, cnt)
	
	turn = pop

print(turn)
Problem p03145 (python)

Fixed submission:
import numpy as np
ab, bc, ca = list(map(int, input().split()))
ab = np.clip(ab, 1, 100)
bc = np.clip(bc, 1, 100)
ca = np.clip(ca, 1, 100)

area = ab * bc * 0.5
print(int(area))

Buggy submission (verdict: Runtime Error):
s = int(input())
s = max(min(s, 100), 1)

f = lambda x: x * 0.5 if x % 2 == 0 else 3*x + 1
array = [s]
while s != 1:
    s = f(int(s))
    array.append(s)
array.append(4)
freq = len(array)
idx = 0
for n, i in enumerate(array):
    for j in array[n:]:
        if s == j:
            idx = n + 2
            break
print(idx)
Problem p03200 (python)

Fixed submission:
def main():
    txt = input()

    w_cnt = 0
    cnt = 0
    for char in reversed(txt):
        if char == 'W':
            w_cnt += 1
        else:
            cnt += w_cnt
    print(cnt)
    return

main()

Buggy submission (verdict: Runtime Error):
import bisect

def main():
    _ = int(input())
    nums = list(map(int, input().split()))
    n = len(nums)
    nums.sort()
    used = [False] * n
    
    cnt = 0
    #print(num_bin_digits)

    for cur in reversed(range(n)):
        continue
        if used[cur]:
            continue
        num = nums[cur]
        power_of_2 = 1 << len("{:b}".format(num))

        pair = power_of_2 - num

        idx = bisect.bisect_left(nums, pair)
        if idx >= cur or nums[idx] != pair:
            #print('continue',pair, idx)
            continue

        while used[idx]:
            idx += 1

        if nums[idx] == pair:
            used[idx] = True
            cnt += 1

        #print(idx, num, power_of_2, pair)
        #print(cnt, nums, used)

    print(cnt)

    return

main()
Problem p03241 (python)

Fixed submission:
import math
N, M = map(int, input().split())
 
def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1 ):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)
    return sorted(divisors, reverse=reverse)
 
 
divisors = enum_divisors(M, reverse=True)
divisors = filter(lambda x: x <= M//N, divisors)
 
for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()

Buggy submission (verdict: Runtime Error):
def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) ):
        if n % i == 0:
            divisors.append(i)
            if i != 1 and i * i != n:
                divisors.append(n//i)
    return sorted(divisors, reverse=reverse)

divisors = enum_divisors(M, reverse=True)
divisors = filter(lambda x: x <= M//N, divisors)

for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()
Problem p03385 (python)

Fixed submission:
s = input()
 
if s.count("a") and s.count("b"):
  if s.count("c") and len(s) == 3:
    print("Yes")
  else:
    print("No")
else:
  print("No")

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

A = data[0]
B = data[1]
K = data[2]

ans = []
for i in range(K):
    a = A+i
    b = B-i
    
    if a <= b:
        ans.append(a)
    if a >= b:
        break
    
    ans.append(b)
    
ans.sort()

for i in ans:
    print(i)
Problem p03149 (python)

Fixed submission:
import sys
#
# num = input()
#
# num1 = num[0]
# num2 = num[1]
# num3 = num[2]
# num4 = num[3]

num1, num2, num3, num4 = (int(i) for i in input().split())

num1 = str(num1)
num2 = str(num2)
num3 = str(num3)
num4 = str(num4)


strTarget = "1974"
isCheck1 = False
isCheck2 = False
isCheck3 = False
isCheck4 = False

isValidation1 = num1 in strTarget
if isValidation1 :
    strTarget = strTarget.replace(num1,"")
    isCheck1 = True

isValidation2 = num2 in strTarget
if isValidation2 :
    strTarget = strTarget.replace(num2,"")
    isCheck2 = True

isValidation3 = num3 in strTarget
if isValidation3 :
    strTarget = strTarget.replace(num3,"")
    isCheck3 = True

isValidation4 = num4 in strTarget
if isValidation4 :
    strTarget = strTarget.replace(num4,"")
    isCheck4 = True

if isCheck1 and isCheck2 and isCheck3 and isCheck4:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import sys

num1 = input()
num2 = input()
num3 = input()
num4 = input()

strTarget = "1974"

isValidation1 = num1 in strTarget

if isValidation1 :
    strTarget.replace(num1,"")
else:
    print("NO")
    sys.exit()

isValidation2 = num2 in strTarget
if isValidation2 :
    strTarget.replace(num2,"")
else:
    print("NO")
    sys.exit()

isValidation3 = num3 in strTarget
if isValidation3 :
    strTarget.replace(num3,"")
else:
    print("NO")
    sys.exit()

isValidation4 = num4 in strTarget
if isValidation4 :
    strTarget.replace(num4,"")
else:
    print("NO")
    sys.exit()

print("YES")
Problem p03323 (python)

Fixed submission:
a, b = map(int, input().split())
if 8 < a or 8 < b:
  print(":(")
else:
  print("Yay!")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
if 8 < a or 8 < b:
  print(":(")
else:
  print("Yay!")
Problem p03455 (python)

Fixed submission:
a, b = map(int, raw_input().split())
if a * b % 2:
    print('Odd')
else:
    print('Even')

Buggy submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
axb = a * b
if axb % 2:
    print('Odd')
else:
    print('Even')
Problem p03505 (python)

Fixed submission:
import math

k, a, b = map(int, input().split())
inc = a - b
if k <= a:
    print(1)
elif inc < 0:
    if k <= a:
        print(1)
    else:
        print(-1)
elif inc == 0:
    print(-1)
else:
    from decimal import *
    getcontext().prec = 500
    print(math.ceil(Decimal(k-a) / Decimal(inc))*2+1)

Buggy submission (verdict: Runtime Error):
import math
from decimal import *

k, a, b = map(int, input().split())
inc = a - b
if inc < 0:
    if k <= a:
        print(1)
    else:
        print(-1)
    exit()

getcontext().prec = 500
print(math.ceil(Decimal(k-a) / Decimal(inc))*2+1)

Buggy submission (verdict: Runtime Error):
import math

k, a, b = map(int, input().split())
p = 0
inc = a - b

if inc < 0:
    if k >= a:
        print(1)
    else:
        print(-1)
    exit()
print(math.ceil((k-a) / inc)*2+1)
Problem p03647 (python)

Fixed submission:
n, m = map(int, raw_input().split())

f = dict()
for i in range(m):
    a, b = map(int, raw_input().split())
    if a in f:
        f[a].append(b)
    else:
        f[a] = [b]
if m < 2:
    print("IMPOSSIBLE")
    exit()

for k, v in f.iteritems():
    if k == 1:
        for vv in v:
            if vv not in f:
                continue
            if n in f[vv]:
                print("POSSIBLE")
                exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n, m = map(int, raw_input().split())

f = dict()
for i in range(m):
    a, b = map(int, raw_input().split())
    if a in f:
        f[a].append(b)
    else:
        f[a] = [b]
if m < 2:
    print("IMPOSSIBLE")
    exit()

for k, v in f.iteritems():
    if k == 1:
        for vv in v:
            if n in f[vv]:
                print("POSSIBLE")
                exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n, m = map(int, raw_input().split())

f = dict()
for i in range(m):
    a, b = map(int, raw_input().split())
    f[a] = b

if m == 1:
    print("IMPOSSIBLE")
    exit()

for k, v in f.iteritems():
    if k == 1:
        if f[v] == n:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")
Problem p03657 (python)

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


if a % 3 == 0 or b % 3 == 0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")

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


if a % 3 == 0 or b % 3 == 0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")
Problem p03853 (python)

Fixed submission:
h, w = map(int, raw_input().split())
for i in range(h):
    row = raw_input()
    print(row)
    print(row)

Buggy submission (verdict: Runtime Error):
h, w = map(int, raw_input().split())
for i in range(h):
    row = raw_input()
    print(row)
    print(row)
Problem p03150 (python)

Fixed submission:
num_list = input()
key = 'keyence'
i = 0
l = len(num_list)

n = 0

while num_list[i]==key[i]:
    i+=1
    n +=1
    if n==7:
        print('YES')
        exit()

i = -1
while num_list[i]==key[i]:
    n += 1
    i -= 1
    if n==7:
        print('YES')
        exit()
print('NO')

Buggy submission (verdict: Runtime Error):


num_list = input()
key = 'keyence'

i = 0
ans =False
while num_list[i]==key[i]:
    i+=1
n = i
if n >= 6:
    print('YES')



i = -1
while num_list[i]==key[i]:
    i -= 1
    n += 1

if n >= 6:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
num_list = input()
key = 'keyence'

i = 0
ans =False
while num_list[i]==key[i]:
    i+=1
n = i
if n >= 6:
    print('YES')
else:
    print('NO')


i = -1
while num_list[i]==key[i]:
    i -= 1
    n += 1

if n >= 6:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):


num_list = input()
key = 'keyence'

i = 0
ans =False
while num_list[i]==key[i] and i<100:
    i+=1
n = i

i = -1
while num_list[i]==key[i] and i>-100:
    i -= 1
    n += 1

if n >= 6:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):

num_list = input()
key = 'keyence'

i = 0
ans =False
while num_list[i]==key[i]:
    i+=1
n = i

i = -1
while num_list[i]==key[i]:
    i -= 1
    n += 1

if n >= 6:
    print('YES')
else:
    print('NO')
Problem p03380 (python)

Fixed submission:
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    # n = 5
    # a = [6, 9, 4, 2, 11]

    max_a = max(a)
    max_half = max_a / 2

    best_a_j = a[0] if a[0] != max_a else a[1]
    min_d = max_half
    for a_j in a:
        if a_j == max_a:
            continue

        d = abs(a_j - max_half)
        if d < min_d:
            best_a_j = a_j
            min_d = d

    print(max_a, best_a_j)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000)

max_comb = None
max_value = 0


def memorize(c, value, memo, a):
    global max_comb
    global max_value

    memo[c] = value

    # for answer
    if c[0] != c[1] and \
            c[0] in a and \
            c[1] in a and \
            max_value < memo[c]:
        max_value = memo[c]
        max_comb = c


def comb(a_i, a_j, memo, a):
    c = (a_i, a_j)
    # print(a_i, a_j)

    if c in memo:
        return memo[c]

    if a_j == 1:
        memorize(c, a_i, memo, a)
        return a_i

    if a_i == a_j or a_j == 0:
        memorize(c, 1, memo, a)
        return 1

    value = comb(a_i - 1, a_j, memo, a) + comb(a_i - 1, a_j - 1, memo, a)
    memorize(c, value, memo, a)
    return memo[c]


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    # n = 5
    # a = [6, 9, 4, 2, 11]

    # find 1st, 2nd
    # max_a, second_max_a = -1, -2
    # for a_i in a:
    #     if max_a < a_i:
    #         second_max_a = max_a
    #         max_a = a_i
    #     elif second_max_a < a_i:
    #         second_max_a = a_i

    max_a = max(a)
    memo = dict()

    for a_i in a:
        if max_a != a_i:
            comb(max_a, a_i, memo, a)
            # comb(max_a, second_max_a, memo, a)
    #
    # for i in range(n - 1):
    #     for j in range(i + 1, n):
    #         comb(a_sorted[i], a_sorted[j], memo, a)
    #
    #         # print("comb:", a_sorted[i], a_sorted[j])

    print(max_comb[0], max_comb[1])

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(100000 + 2)

max_comb = None
max_value = 0


def memorize(c, value, memo):
    global max_comb
    global max_value

    memo[c] = value
    if max_value < memo[c]:
        max_value = memo[c]
        max_comb = c


def comb(a_i, a_j, memo):
    c = (a_i, a_j)
    # print(a_i, a_j)

    if c in memo:
        return memo[c]

    if a_j == 1:
        memorize(c, a_i, memo)
        return a_i

    if a_i == a_j or a_j == 0:
        memorize(c, 1, memo)
        return 1

    value = comb(a_i - 1, a_j, memo) + comb(a_i - 1, a_j - 1, memo)
    memorize(c, value, memo)
    return memo[c]


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    # n = 5
    # a = [6, 9, 4, 2, 11]
    a_sorted = sorted(a, reverse=True)

    memo = dict()
    for i in range(n - 1):
        for j in range(i + 1, n):
            comb(a_sorted[i], a_sorted[j], memo)

            # print("comb:", a_sorted[i], a_sorted[j])

    print(max_comb[0], max_comb[1])
Problem p03450 (python)

Fixed submission:
import sys

sys.setrecursionlimit(200002)


def dfs(start, edges, nodes):
    for adj_node, distance in edges[start].items():
        # まだ訪れていない隣接ノード
        if nodes[adj_node] is None:
            nodes[adj_node] = nodes[start] + distance
            # adj_nodeを開始位置にしてまだ訪れていないノードを探索する
            # 探索中にノード値とエッジの関係性が一致しなくなればFalse
            if not dfs(adj_node, edges, nodes):
                return False
        # 既に訪れた隣接ノード
        else:
            if nodes[adj_node] - nodes[start] != distance:
                return False

    return True


if __name__ == '__main__':
    N, M = map(int, input().split())
    if M == 0:
        print("Yes")
        exit(0)

    Ls, Rs, Ds = zip(*[list(map(int, input().split())) for _ in range(M)])

    # N, M = 10, 3
    # Ls, Rs, Ds = zip(*[[8, 7, 100],
    #                    [7, 9, 100],
    #                    [9, 8, 100]])

    edges = {i: dict() for i in range(N)}

    for L, R, D in zip(Ls, Rs, Ds):
        edges[L - 1][R - 1] = D
        edges[R - 1][L - 1] = -D

    nodes = [None] * N

    valid_list = []
    for start in range(N):
        if nodes[start] is None:
            nodes[start] = 0
            # ノード値とエッジの関係性が一致しなくなればfalse
            valid_list.append(dfs(start, edges, nodes))

    if all(valid_list):
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
def dfs(start, edges, n_nodes):
    node_values = [0 for _ in range(n_nodes)]
    not_visited = set(range(n_nodes))

    # start node
    not_visited.remove(start)

    # not connected nodes
    not_connected_nodes = set([node for node, connected in edges.items()
                               if len(connected) == 0])
    not_visited -= not_connected_nodes

    if start in not_connected_nodes:
        return True

    next_node_candidates = {start}
    while not_visited:
        curr_node = next_node_candidates.pop()

        connected_nodes = edges[curr_node].keys()
        for c in connected_nodes:
            if c in not_visited:
                next_node_candidates |= {c}
                not_visited.remove(c)
                node_values[c] = node_values[curr_node] + edges[curr_node][c]

    # validate edges
    for e1, e2_and_d in edges.items():
        for e2, d in e2_and_d.items():
            if edges[e1][e2] != node_values[e2] - node_values[e1]:
                return False

    # all edges are valid: return True
    return True


if __name__ == '__main__':
    N, M = map(int, input().split())
    if M == 0:
        print("Yes")
        exit(0)

    Ls, Rs, Ds = zip(*[list(map(int, input().split())) for _ in range(M)])

    # N, M = 10, 3
    # Ls, Rs, Ds = zip(*[[8, 7, 100],
    #                    [7, 9, 100],
    #                    [9, 8, 100]])

    edges = {i: dict() for i in range(N)}
    # visited = [None] * N
    for L, R, D in zip(Ls, Rs, Ds):
        edges[L - 1][R - 1] = D
        edges[R - 1][L - 1] = -D

    for start in range(N):
        is_valid = dfs(start, edges, N)
        if not is_valid:
            print("No")
            exit(0)

    print("Yes")
Problem p03493 (python)

Fixed submission:
print(sum([int(i) for i in list(input())]))

Buggy submission (verdict: Runtime Error):
print(sum(list(int(input()))))

Buggy submission (verdict: Runtime Error):
print(sum(list(input())))
Problem p03494 (python)

Fixed submission:
i = int(input())
l = [int(n) for n in input().split(' ')]

t = 0
bool = True
while bool:
    t += 1
    for j in range(len(l)):
        if l[j] % 2 == 1:
            bool = False
            break
        else:
            l[j] /= 2
print(t-1)

Buggy submission (verdict: Runtime Error):
i = int(input())
l = [int(n) for n in input().split(' ')]

t = 0
bool = True
while bool:
    t += 1
    for j in l:
        if j % 2 == 1:
            bool = False
            break
        else:
            l /= 2
print(t-1)

Buggy submission (verdict: Runtime Error):
i = int(input())
l = [int(i) for i in list(input())]

j = 0
t = 0
while True:
  k = l[j] % 2
  if k == 1:
    break
  else:
    l[j] /= 2
    
  j = j + 1 % i
  if j == 0:
    t += 1
print(t)
Problem p03238 (python)

Fixed submission:
N = int(input())
if N == 1:
    print('Hello World')
else:
    a = int(input())
    b = int(input())
    print(a + b)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print('Hello World')
else:
    a, b = map(int, input().split())
    print(a + b)
Problem p03239 (python)

Fixed submission:
N, T = map(int, input().split())
a = 9999
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        a = min(a, c)
if a == 9999:
    print('TLE')
else:
    print(a)

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
a = 9999
for _ in N:
    c, t = map(int, input().split())
    if t <= T:
        a = min(a, c)
if a == 9999:
    print('TLE')
else:
    print(a)
Problem p03241 (python)

Fixed submission:
# nの約数を求める
def divisor(n):
    d = []
    for i in range(int(n**(0.5)+1))[1:]:
        if n % i == 0:
            d.append(i)
            if i * i != n:
                d.append(int(n / i))
    return d


N, M = map(int, input().split())
# d はnの約数のベクター
d = divisor(M)
g = int(M / N)
d = [x for x in d if x <= g]
print(max(d))

Buggy submission (verdict: Runtime Error):
# nの約数を求める
def divisor(n):
    d = []
    for i in range(int(n**(0.5)+1)):
        if n % i == 0:
            d.append(i)
            if i * i != n:
                d.append(n / i)
    return d


N, M = map(int, input().split())
# d はnの約数のベクター
d = divisor(M)
g = M / N
d = [x for x in d if x <= g]
print(max(d))

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print('Hello World')
else:
    a, b = map(int, input().split())
    print(a + b)