Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if (a == 7 and b ==5 and c == 5)or(a == 5 and b == 7 and c == 5)
or(a==5 and b==5 and c==7):
  print("YES")
  
else:
  print("NO")

Fixed submission:
  
  # 文節の入力(整数として扱う)
a, b, c = map(int, input().split())
# まず長さが7の文節があるか確認
if a == 7 and b == 5 and c == 5:
	print("YES")
elif a == 5 and b == 7 and c == 5:
	print("YES")
elif a == 5 and b == 5 and c == 7:
	print("YES")
else:
	print("NO")

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
# まず長さが7の文節があるか確認
if (a == 7 and b ==5 and c == 5)or(a == 5 and b == 7 and c == 5)
or(a==5 and b==5 and c==7):
	print("YES")
  
else:
	print("NO")

Fixed submission:
  
  # 文節の入力(整数として扱う)
a, b, c = map(int, input().split())
# まず長さが7の文節があるか確認
if a == 7 and b == 5 and c == 5:
	print("YES")
elif a == 5 and b == 7 and c == 5:
	print("YES")
elif a == 5 and b == 5 and c == 7:
	print("YES")
else:
	print("NO")

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
# まず長さが7の文節があるか確認
if (a == 7  b == 5 c == 5)or(a == 5 b == 7 c == 5)or(a==5 b==5 c==7):
	print("YES")

else:
	print("NO")

Fixed submission:
  
  # 文節の入力(整数として扱う)
a, b, c = map(int, input().split())
# まず長さが7の文節があるか確認
if a == 7 and b == 5 and c == 5:
	print("YES")
elif a == 5 and b == 7 and c == 5:
	print("YES")
elif a == 5 and b == 5 and c == 7:
	print("YES")
else:
	print("NO")

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

if a=5 b=5 c=7 or a=5 b=7 c=5 or a=7 b=5 c=5:
  print("YES")
  
else:
  print("NO")

Fixed submission:
  
  # 文節の入力(整数として扱う)
a, b, c = map(int, input().split())
# まず長さが7の文節があるか確認
if a == 7 and b == 5 and c == 5:
	print("YES")
elif a == 5 and b == 7 and c == 5:
	print("YES")
elif a == 5 and b == 5 and c == 7:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=a*b
print(c)

Fixed submission:
a=input()
a=a.split()
print(int(a[0])*int(a[1]))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(a*b)

Fixed submission:
a=input()
a=a.split()
print(int(a[0])*int(a[1]))

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
c=a*b
print(c)

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

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=a*b
print(c)


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

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

# スペース区切りの整数の入力
N, *d = map(int, open(0).read().split())

if 0 in d:
  print(0)
  return
  
for O in d:
	A = A * O
	#print(O)
	if A > 1000000000000000000:
		A = -1
		break

print(A)

Fixed submission:
N, M = map(int, input().split())

print(N*M)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys

# スペース区切りの整数の入力
N, *d = map(int, open(0).read().split())
A = 1

for O in d:
    A = A*O

if A > 10 ** 18:
    A = -1

print(A)

Fixed submission:
def main():
# スペース区切りの整数の入力
	N, *d = map(int, open(0).read().split())

	if 0 in d:
  		print(0)
  		return

	A = 1
	for O in d:
		A *= O
		#print(O)
		if A > 1000000000000000000:
			print(-1)
			return

	print(A)

main()
Buggy python submission (verdict: Runtime Error):
def main():
  
	n = int(input())
	a = list(map(int,input().split()))
	uppest = pow(10 , 18)

	ans = 1

	if 0 in a:
  		print (0)
  		return

	for s in a:
	  	ans *= s
  		if ans > uppest:
    			print(-1)
    			return
  
	print(ans)

main()

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

print(a*b)

Buggy python submission (verdict: Runtime Error):
A,B = input()
C = A * B
print(C);

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

print(a*b)

Buggy python submission (verdict: Runtime Error):
A,B = input()
C = A * B
print(A*B);

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

print(a*b)

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()

print(A * B)

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

print(a*b)
Buggy python submission (verdict: Runtime Error):
s , w = int(input())

if s > w:
  print("safe")
else:
  print("unsafe")

Fixed submission:
s , w = map(int, input().split())

if s > w:
  print("safe")
else:
  print("unsafe")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
P    = list(map(int, input().split()))

q = sum(P[:K])
m = q

for k in range(K):
    if k > 0:
        q = q - P[k-1] + P[K-1+k]
    if m < q:
        m = q

print((m+K)/2)


Fixed submission:
N, K = map(int, input().split())
P    = list(map(int, input().split()))

q = sum(P[:K])
m = q

for k in range(N-K+1):
    if k > 0:
        q = q - P[k-1] + P[K-1+k]
    if m < q:
        m = q

print((m+K)/2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if not 1 in A:
    res = -1
else:
    res = 0
    for n in range(1, N+1):
        for i, a in enumerate(A):
            if a == n:
                break
            else:
                res += 1
        A = A[i+1:]
print(res)


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

if not 1 in A:
    res = -1
else:
    b = 1
    B = []
    for a in A:
        if a == b:
            B.append(b)
            b += 1
    res = N - len(B)

print(res)
Buggy python submission (verdict: Runtime Error):
import math

from collections import Counter


N = int(input())

S = [''.join(sorted(list(input()))) for i in range(N)]

print(sum([math.factorial(i) // math.factorial(i-2) // 2 for i in Counter(S).values()]))


Fixed submission:
import math

from collections import Counter


def func(i):
    if i >= 1:
        return math.factorial(i)
    else:
        return 1


N = int(input())

S = [''.join(sorted(list(input()))) for i in range(N)]

print(sum([func(i) // func(i-2) // 2 for i in Counter(S).values()]))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())

F    = [None] * (N+1)
F[0] = 1

for i in range(1, N+1):
    F[i] = F[i-1] * i

S = [''.join(sorted(list(input()))) for i in range(N)]

print(sum([F[i] // F[i-2] // 2 for i in Counter(S).values()]))


Fixed submission:
import math

from collections import Counter


def func(i):
    if i >= 1:
        return math.factorial(i)
    else:
        return 1


N = int(input())

S = [''.join(sorted(list(input()))) for i in range(N)]

print(sum([func(i) // func(i-2) // 2 for i in Counter(S).values()]))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())

F    = [None] * (N+1)
F[0] = 1

for i in range(1, N+1):
    F[i] = F[i-1] * i

S = [None] * N

for i in range(N):
    S[i] = ''.join(sorted(list(input())))

print(sum([F[i] // F[i-2] // 2 for i in Counter(S).values()]))


Fixed submission:
import math

from collections import Counter


def func(i):
    if i >= 1:
        return math.factorial(i)
    else:
        return 1


N = int(input())

S = [''.join(sorted(list(input()))) for i in range(N)]

print(sum([func(i) // func(i-2) // 2 for i in Counter(S).values()]))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
A = [0] * N

for i in range(N):
    if S[i] == 'R':
        step = S[i:].find('L')
        if step % 2 == 0:
            A[i+step]   += 1
        else:
            A[i+step-1] += 1
    else:
        step = S[:i+1][::-1].find('R')
        if step % 2 == 0:
            A[i-step]   += 1
        else:
            A[i-step+1] += 1

print(' '.join([str(a) for a in A]))


Fixed submission:
S = input()
N = len(S)
A = [0] * N

step_R  = [0] * N
count_R = 1
step_L  = [0] * N
count_L = 1

for i in range(1, N):
    if S[i-1] == 'R':
        if S[i] == 'L':
            for j in range(count_R):
                step_R[i-1-j] = j+1
            count_R  = 1
        else:
            count_R += 1

for i in range(1, N)[::-1]:
    if S[i] == 'L':
        if S[i-1] == 'R':
            for j in range(count_L):
                step_L[i+j] = j+1
            count_L  = 1
        else:
            count_L += 1

steps = [max(step_R[i], step_L[i]) for i in range(N)]

for i in range(N):
    step = steps[i]
    if S[i] == 'R':
        if step % 2 == 0:
            A[i+step]   += 1
        else:
            A[i+step-1] += 1
    else:
        if step % 2 == 0:
            A[i-step]   += 1
        else:
            A[i-step+1] += 1

print(' '.join([str(a) for a in A]))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

G = [set([n]) for n in range(N)]

for m in range(M):
    X, Y, Z = map(int, input().split())
    X   -= 1
    Y   -= 1
    Gx   = G[X]
    Gy   = G[Y]
    Gxy  = Gx | Gy
    for idx in Gxy:
        G[idx] = Gxy

print(len(set([tuple(g) for g in G])))


Fixed submission:
class UnionFind:
    def __init__(self, n):
        self.depth  = [0] * n
        self.parent = list(range(n))

    def find(self, x):
        if x == self.parent[x]:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self.depth[x] < self.depth[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.depth[x] == self.depth[y]:
                self.depth[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return self.depth[self.ind(x)]


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

T = UnionFind(N)

for m in range(M):
    X, Y, Z  = map(int, input().split())
    T.unite(X-1, Y-1)

print(sum([1 for i in range(N) if T.find(i) == i]))
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd


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

G = []

for x in range(N):
    B = A[:x] + A[x+1:]
    g = B[0]
    for i in range(1, len(B)):
        g = gcd(g, B[i])
    G.append(g)

print(max(G))


Fixed submission:
from fractions import gcd


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

G_FW    = [None] * N
G_FW[0] = A[0]

for i in range(1, N):
    G_FW[i] = gcd(G_FW[i-1], A[i])

G_RV     = [None] * N
G_RV[-1] = A[-1]

for i in reversed(range(0, N-1)):
    G_RV[i] = gcd(G_RV[i+1], A[i])

G     = [None] * N
G[ 0] = G_RV[1]
G[-1] = G_FW[-2]

for i in range(1, N-1):
    G[i] = gcd(G_FW[i-1], G_RV[i+1])

print(max(G))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S    = input()

L = S.replace('01', '0,1')
L = L.replace('10', '1,0')
L = L.split(',')
L = [len(l) for l in L]

if S[0] == '0':
    L = [0] + L

R = [sum(L[2*i:2*(i+K)+1]) for i in range(max(1, len(L) // 2 + 1 - K))]

print(max(R))


Fixed submission:
N, K = map(int, input().split())
S    = input()

L = S.replace('01', '0,1')
L = L.replace('10', '1,0')
L = L.split(',')
L = [len(l) for l in L]

if S[0] == '0':
    L = [0] + L

R = []
for i in range(max(1, len(L) // 2 + 1 - K)):
    if i == 0:
        R.append(sum(L[2*i:2*(i+K)+1]))
    else:
        R.append(R[-1] - sum(L[2*(i-1):2*(i-1)+2]) + sum(L[2*(i+K)-1:2*(i+K)+1]))

print(max(R))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S    = input()

L = []
t = S[0]
l = 1

for s in S[1:]:
    if t == s:
        l += 1
    else:
        L.append(l)
        t = s
        l = 1

L.append(l)

if S[0] == '0':
    L = [0] + L

R = []
for i in range(max(1, len(L) // 2 + 1 - K)):
    R.append(sum(L[2*i:2*(i+K)+1]))

print(max(R))


Fixed submission:
N, K = map(int, input().split())
S    = input()

L = S.replace('01', '0,1')
L = L.replace('10', '1,0')
L = L.split(',')
L = [len(l) for l in L]

if S[0] == '0':
    L = [0] + L

R = []
for i in range(max(1, len(L) // 2 + 1 - K)):
    if i == 0:
        R.append(sum(L[2*i:2*(i+K)+1]))
    else:
        R.append(R[-1] - sum(L[2*(i-1):2*(i-1)+2]) + sum(L[2*(i+K)-1:2*(i+K)+1]))

print(max(R))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S    = input()

L = S.replace('01', '0,1')
L = L.replace('10', '1,0')
L = L.split(',')
L = [len(l) for l in L]

if S[0] == '0':
    L = [0] + L

R = []
for i in range(max(1, len(L) // 2 + 1 - K)):
    R.append(sum(L[2*i:2*(i+K)+1]))

print(max(R))


Fixed submission:
N, K = map(int, input().split())
S    = input()

L = S.replace('01', '0,1')
L = L.replace('10', '1,0')
L = L.split(',')
L = [len(l) for l in L]

if S[0] == '0':
    L = [0] + L

R = []
for i in range(max(1, len(L) // 2 + 1 - K)):
    if i == 0:
        R.append(sum(L[2*i:2*(i+K)+1]))
    else:
        R.append(R[-1] - sum(L[2*(i-1):2*(i-1)+2]) + sum(L[2*(i+K)-1:2*(i+K)+1]))

print(max(R))
Buggy python submission (verdict: Time Limit Exceeded):
import re


S = input()
L = len(S)

is_break = False

while len(S) > 1:
    S = re.sub('(01)+', '', S)
    S = re.sub('(10)+', '', S)
    try:
        S.find('01')
        S.find('10')
    except:
        is_break = True
    if is_break:
        break

print(L - len(S))


Fixed submission:
S = input()

print(min(S.count('0'), S.count('1')) * 2)

Buggy python submission (verdict: Time Limit Exceeded):
import re


S = input()
L = len(S)

is_break = False

while len(S) > 1:
    S = re.sub('(01)+', '', S)
    S = re.sub('(10)+', '', S)
    try:
        S.find('01')
        S.find('10')
    except:
        is_break = True
    if is_break:
        break

print(L - len(S))


Fixed submission:
S = input()

print(min(S.count('0'), S.count('1')) * 2)

Buggy python submission (verdict: Time Limit Exceeded):
import re


S = input()
L = len(S)

while True:
    T = S[:]
    S = re.sub('(10)+', '', S)
    S = re.sub('(01)+', '', S)
    if S == T:
        break

print(L - len(S))


Fixed submission:
S = input()

print(min(S.count('0'), S.count('1')) * 2)

Buggy python submission (verdict: Time Limit Exceeded):
import re


S = input()
L = len(S)

while True:
    T = S[:]
    S = re.sub('10', '', S)
    S = re.sub('01', '', S)
    if S == T:
        break

print(L - len(S))


Fixed submission:
S = input()

print(min(S.count('0'), S.count('1')) * 2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
L = len(S)

while True:
    T = S[:]
    S = S.replace('10', '')
    S = S.replace('01', '')
    if S == T:
        break

print(L - len(S))


Fixed submission:
S = input()

print(min(S.count('0'), S.count('1')) * 2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A.sort()

R = A[0]

while True:
    C = A.copy()
    B = [A[0]] + [A[i+1] - A[i] for i in range(len(A)-1) if A[i+1] > A[i]]
    B = list(set(B))
    B.sort()
    R = min(R, B[0])
    if C == B:
        break
    elif R == 1:
        break
    else:
        A = B

print(R)


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

A.sort()

R = A[0]

while True:
    C = A.copy()
    B = [A[0]] + [a for a in [A[i+1] % A[i] for i in range(len(A)-1)] if a > 0]
    B = list(set(B))
    B.sort()
    R = min(R, B[0])
    if C == B:
        break
    elif R == 1:
        break
    else:
        A = B

print(R)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A = [None] * N
B = [None] * N
L = list(range(N))
F = [False] * N

for n in range(N):
    a, b = map(int, input().split())
    A[n] = a
    B[n] = b

P = 0
Q = 0

T = True

C    = zip(A, B, L)
C    = sorted(C, key=lambda x: [x[0], x[1]], reverse=True)
D    = zip(B, A, L)
D    = sorted(D, key=lambda x: [x[0], x[1]], reverse=True)

C_A, C_B, C_L = map(list, zip(*C))
D_B, D_A, D_L = map(list, zip(*D))

for _ in range(N):
    if T:
        for i in range(len(C_L)):
            if F[C_L[i]] == False:
                P        += C_A[i]
                F[C_L[i]] = True
                T         = False
                del C_A[i]
                del C_L[i]
                break
    else:
        for i in range(len(D_L)):
            if F[D_L[i]] == False:
                Q        += D_B[i]
                F[D_L[i]] = True
                T         = True
                del D_B[i]
                del D_L[i]
                break

print(P-Q)


Fixed submission:
N = int(input())

A = [None] * N
B = [None] * N
C = [None] * N

for n in range(N):
    a, b = map(int, input().split())
    A[n] = a
    B[n] = b
    C[n] = a + b

Z = zip(A, B, C)
Z = sorted(Z, key=lambda x: [x[2]], reverse=True)

A, B, C = map(list, zip(*Z))

T = True
R = 0

for i in range(N):
    if T:
        R += A[i]
        T  = False
    else:
        R -= B[i]
        T  = True

print(R)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


N = int(input())

A = [None] * N
B = [None] * N

for n in range(N):
    a, b = map(int, input().split())
    A[n] = a
    B[n] = b

P = 0
Q = 0

F = True

for i in range(N):
    if F:
        C    = zip(A, B)
        C    = sorted(C, key=lambda x: [x[0], x[1]], reverse=True)
        A, B = map(list, zip(*C))
        P   += A[0]
        A.pop(0)
        B.pop(0)
        F = False
    else:
        D    = zip(B, A)
        D    = sorted(D, key=lambda x: [x[0], x[1]], reverse=True)
        B, A = map(list, zip(*D))
        Q   += B[0]
        A.pop(0)
        B.pop(0)
        F = True

print(P-Q)


Fixed submission:
N = int(input())

A = [None] * N
B = [None] * N
C = [None] * N

for n in range(N):
    a, b = map(int, input().split())
    A[n] = a
    B[n] = b
    C[n] = a + b

Z = zip(A, B, C)
Z = sorted(Z, key=lambda x: [x[2]], reverse=True)

A, B, C = map(list, zip(*Z))

T = True
R = 0

for i in range(N):
    if T:
        R += A[i]
        T  = False
    else:
        R -= B[i]
        T  = True

print(R)
Buggy python submission (verdict: Time Limit Exceeded):
def func(L):
    return sum([L[i+1] - L[i] for i in range(len(L)-1)])


N, K = map(int, input().split())

H = []

for n in range(N):
    H.append(int(input()))

H.sort()

R = [func(H[i:i+K]) for i in range(N+1-K)]

print(min(R))


Fixed submission:
N, K = map(int, input().split())

H = [int(input()) for n in range(N)]

H.sort()

R = [H[i+K-1] - H[i] for i in range(N+1-K)]

print(min(R))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

H = []

def func(L):
    result = 0
    for i in range(len(L)-1):
        result += L[i+1] - L[i]
    return result


for n in range(N):
    H.append(int(input()))

H.sort()

R = [func(H[i:i+K]) for i in range(N+1-K)]

print(min(R))


Fixed submission:
N, K = map(int, input().split())

H = [int(input()) for n in range(N)]

H.sort()

R = [H[i+K-1] - H[i] for i in range(N+1-K)]

print(min(R))

Buggy python submission (verdict: Runtime Error):
import multiprocessing as mp


N, K = map(int, input().split())

H = []

for n in range(N):
    H.append(int(input()))

H.sort()

R = [H[i:i+K] for i in range(N+1-K)]


def mp_func(L):
    result = 0
    for i in range(len(L)-1):
        result += L[i+1] - L[i]
    return result

P = mp.Pool(mp.cpu_count())
R = P.map(mp_func, R)

print(min(R))


Fixed submission:
N, K = map(int, input().split())

H = [int(input()) for n in range(N)]

H.sort()

R = [H[i+K-1] - H[i] for i in range(N+1-K)]

print(min(R))
Buggy python submission (verdict: Runtime Error):
import math


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

D = math.inf
R = 0

for i, h in enumerate(H):
    d = A - (T - h * 0.006)
    if D > d:
        D = d
        R = i + 1

print(R)


Fixed submission:
N    = int(input())
T, A = map(int, input().split())
H    = list(map(int, input().split()))

D = 99999999
R = 0

for i, h in enumerate(H):
    d = abs(A - (T - h * 0.006))
    if D > d:
        D = d
        R = i + 1

print(R)
Buggy python submission (verdict: Runtime Error):
import math


N, T = map(int, input().split())

R = math.inf

for n in range(N):
    c, t = map(int, input().split())
    if t <= T and c < R:
        R = c

if R != math.inf:
    print(R)
else:
    print('TLE')


Fixed submission:
N, T = map(int, input().split())

R = 9999

for n in range(N):
    c, t = map(int, input().split())
    if t <= T and c < R:
        R = c

if R != 9999:
    print(R)
else:
    print('TLE')
Buggy python submission (verdict: Runtime Error):
N = int(input())

X = [None] * N
Y = [None] * N
H = [None] * N

R = []

for n in range(N):
    X[n], Y[n], H[n] = map(int, input().split())

for cx in range(0, 101):
    for cy in range(0, 101):
        flag = True
        for n in range(N):
            if n == 0:
                ch = H[n] + abs(X[n] - cx) + abs(Y[n] - cy)
            if max(ch - abs(X[n] - cx) - abs(Y[n] - cy), 0) != H[n]:
                flag = False
                break
        if flag == True:
            R.append([cx, cy, ch])

print(R[0][0], R[0][1], R[0][2])


Fixed submission:
N = int(input())

X = [None] * N
Y = [None] * N
H = [None] * N

x_max = 0
y_max = 0
h_max = 0
R = []

for n in range(N):
    X[n], Y[n], H[n] = map(int, input().split())
    if h_max <= H[n]:
        x_max, y_max, h_max = X[n], Y[n], H[n]

for cx in range(0, 101):
    for cy in range(0, 101):
        flag = True
        for n in range(N):
            if H[n] != 0:
                ch = H[n] + abs(X[n] - cx) + abs(Y[n] - cy)
        for n in range(N):
            if max(ch - abs(X[n] - cx) - abs(Y[n] - cy), 0) != H[n]:
                flag = False
                break
        if flag == True:
            R.append([cx, cy, ch])

print(R[0][0], R[0][1], R[0][2])
Buggy python submission (verdict: Runtime Error):
# Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759

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


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def divisorize(fct):
    b, e = fct.pop()
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


fct = factorize(M)
L   = []
for div in divisorize(fct):
    L.append(num(div))

L.sort()
L.reverse()

for l in L:
    if l * N <= M and M % l == 0:
        print(l)
        break


Fixed submission:
# Thanks for http://nihaoshijie.hatenadiary.jp/entry/2018/02/03/115759

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


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def divisorize(fct):
    b, e = fct.pop()
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


try:
    fct = factorize(M)
    L   = []
    for div in divisorize(fct):
        L.append(num(div))
except:
    L = [1, M]

L.sort()
L.reverse()

for l in L:
    if l * N <= M and M % l == 0:
        print(l)
        break