Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 20:53:54 2019

@author: ctiuser
"""

N = int(input())
A = [int(input()) for i in range(N)]

ans = [A[0]]

for i in range(1,N):
    l,r = 0, len(ans)-1
    p = (r-l)//2 + 1
    if A[i] <= ans[r]:
        ans.append(A[i])
    elif A[i] > ans[l]:
        ans[l] = A[i]
    else:
        tmp = p
        while r - l > 1:
            if A[i] > ans[p]:
                tmp = p
                r = p
                p = (r-l)//2
            else:
                l = p
                p = (r-l)//2
        ans[tmp] = A[i]
#    print(i,ans)
print(len(ans))



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 20:53:54 2019

@author: ctiuser
"""

N = int(input())
A = [int(input()) for i in range(N)]

ans = [A[0]]

for i in range(1,N):
    l,r = 0, len(ans)-1
    p = (r-l)//2 + 1
    if A[i] <= ans[r]:
        ans.append(A[i])
    elif A[i] > ans[l]:
        ans[l] = A[i]
    else:
        tmp = r
        while r - l > 1:
            if A[i] > ans[p]:
                tmp = p
                r = p
                p = (r-l)//2 + l
            else:
                l = p
                p = (r-l)//2 + l
        ans[tmp] = A[i]
#    print(i,ans)
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 20:53:54 2019

@author: ctiuser
"""

N = int(input())
A = [int(input()) for i in range(N)]

ans = [A[0]]

for i in range(1,N):
    l,r = 0, len(ans)-1
    p = (r-0)//2 + 1
    if A[i] <= ans[r]:
        ans.append(A[i])
    elif A[i] > ans[l]:
        ans[l] = A[i]
    else:
        tmp = p
        while r - l > 1:
            if A[i] > ans[p]:
                tmp = p
                r = p
                p = (r-l-0)//2 + 0
            else:
                l = p
                p = (r-l-0)//2 + 0
        ans[tmp] = A[i]
        
#    if i == 6:
#        break
    
#    print(i,ans)
print(len(ans))



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 20:53:54 2019

@author: ctiuser
"""

N = int(input())
A = [int(input()) for i in range(N)]

ans = [A[0]]

for i in range(1,N):
    l,r = 0, len(ans)-1
    p = (r-l)//2 + 1
    if A[i] <= ans[r]:
        ans.append(A[i])
    elif A[i] > ans[l]:
        ans[l] = A[i]
    else:
        tmp = r
        while r - l > 1:
            if A[i] > ans[p]:
                tmp = p
                r = p
                p = (r-l)//2 + l
            else:
                l = p
                p = (r-l)//2 + l
        ans[tmp] = A[i]
#    print(i,ans)
print(len(ans))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Mon Jul  1 11:43:19 2019

@author: Yamazaki Kenichi
"""
from collections import deque

N, M = map(int,input().split())
uv = [list(map(int,input().split())) for i in range(M)]
S, T = map(int,input().split())

Ta = [[] for i in range(3*N+1)]
for c in uv:
    Ta[c[0]].append(c[1]+N)
    Ta[c[0]+N].append(c[1]+2*N)
    Ta[c[0]+2*N].append(c[1])
del c

check = [0 for i in range(3*N+1)]

q = deque([S])
check[S] = 1
counta = 0
while len(q) > 0:
    for i in range(len(q)):
        nexts = Ta[q.popleft()]
        for next_ in nexts:
            if check[next_] != 1:
                q.append(next_)
                check[next_] = 1
    counta += 1
    if check[T] == 1:
        break

print(counta//3)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Jul  1 11:43:19 2019

@author: Yamazaki Kenichi
"""
from collections import deque

N, M = map(int,input().split())
uv = [list(map(int,input().split())) for i in range(M)]
S, T = map(int,input().split())

Ta = [[] for i in range(3*N+1)]
for c in uv:
    Ta[c[0]].append(c[1]+N)
    Ta[c[0]+N].append(c[1]+2*N)
    Ta[c[0]+2*N].append(c[1])

check = [0 for i in range(3*N+1)]

q = deque([S])
check[S] = 1
counta = 0
flg = False
while len(q) > 0:
    for i in range(len(q)):
        nexts = Ta[q.popleft()]
        for next_ in nexts:
            if check[next_] != 1:
                q.append(next_)
                check[next_] = 1
    counta += 1
    if check[T] == 1:
        flg = True
        break
if flg:
    print(counta//3)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 20:53:20 2019

@author: Yamazaki Kenichi
"""
from collections import deque
import sys

N, M = map(int,input().split())
uv = [list(map(int,input().split())) for i in range(N)]
S, T = map(int,input().split())

Ta = [[] for i in range(N+1)]
for c in uv:
    Ta[c[0]].append(c[1])

counta = 0
rout = [[] for i in range(N+1)]
while len(rout[S]) < 3:
    next_ = deque([S])
    for i in range(3):
        for j in range(len(next_)):
            tmp = next_.popleft()
            for k in Ta[tmp]:
                next_.append(k)
            rout[tmp].append(i)
        
        if rout[T].count(2) >= 1:
            print(counta)
            sys.exit()
        counta += 1
print(-1)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Jul  1 11:43:19 2019

@author: Yamazaki Kenichi
"""
from collections import deque

N, M = map(int,input().split())
uv = [list(map(int,input().split())) for i in range(M)]
S, T = map(int,input().split())

Ta = [[] for i in range(3*N+1)]
for c in uv:
    Ta[c[0]].append(c[1]+N)
    Ta[c[0]+N].append(c[1]+2*N)
    Ta[c[0]+2*N].append(c[1])

check = [0 for i in range(3*N+1)]

q = deque([S])
check[S] = 1
counta = 0
flg = False
while len(q) > 0:
    for i in range(len(q)):
        nexts = Ta[q.popleft()]
        for next_ in nexts:
            if check[next_] != 1:
                q.append(next_)
                check[next_] = 1
    counta += 1
    if check[T] == 1:
        flg = True
        break
if flg:
    print(counta//3)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 22:14:02 2019

@author: Yamazaki Kenichi
"""

N, K = map(int,input().split())
mod = 10**9+7

r = int(pow(N,1/2))

const = []
if N // r == r:
    s = r - 1
else:
    s = r

for i in range(1,r+1):
    const.append(N//i - N//(i+1))
#if r == int(pow(N,1/2)) :
#    const += [1]
const.reverse()
const = [1 for i in range(s)] + const

dp = [[]]
for c in const:
    try:
        dp[0].append(dp[0][-1] +c)
    except:
        dp[0].append(c)
dp += [[0 for i in range(len(const))] for k in range(K-1)]

for k in range(1,K):
    for i in range(len(const)):
        dp[k][i] = (dp[k][i-1] + dp[k-1][len(const)-i-1]%mod
                      * const[i])%mod
print(dp[-1][-1]%mod)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 29 22:14:02 2019

@author: Yamazaki Kenichi
"""

N, K = map(int,input().split())
mod = 10**9+7

r = int(pow(N,1/2))

const = []
if N // r == r:
    s = r - 1
else:
    s = r

for i in range(1,r+1):
    const.append(N//i - N//(i+1))
#if r == int(pow(N,1/2)) :
#    const += [1]
const.reverse()
const = [1 for i in range(s)] + const

dp = [[]]
for c in const:
    try:
        dp[0].append(dp[0][-1] +c)
    except:
        dp[0].append(c)
dp += [[0 for i in range(len(const))] for k in range(K-1)]

for k in range(1,K):
    for i in range(len(const)):
        dp[k][i] = (dp[k][i-1] + dp[k-1][len(const)-i-1]%mod
                      * const[i])%mod
print(dp[-1][-1]%mod)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 16 20:56:46 2019

@author: Yamazaki Kenichi
"""

N, M = map(int,input().split())
S = list(map(int,input().split()))
T = list(map(int,input().split()))
mod = 10**9 + 7

A = [[1 for j in range(M+1)]]
A += [[0 for j in range(M+1)] for i in range(N)]
A += [[1 for j in range(M+1)]]
for i in range(N):
#    print(i,j)
    for j in range(M):
#        print(i,j)
        if T[j] == S[i]:
            A[i+1][j] = A[-1][j-1] % mod
        else:
            A[i+1][j] = A[i+1][j-1] % mod
        A[-1][j] += A[i+1][j]
        A[-1][j] %= mod
#        print(A)
ans = A[-1][-2]
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 16 22:15:18 2019

@author: Yamazaki Kenichi
"""

N, M = map(int,input().split())
S = list(map(int,input().split()))
T = list(map(int,input().split()))
mod = 10**9 + 7

A = [[1 for j in range(M+1)]]
A += [[0 for j in range(M+1)]]
#A += [[0 for j in range(M+1)] for i in range(N)]
A += [[1 for j in range(M+1)]]
for i in range(N):
#    print(i,j)
    tmp2 = 0
    for j in range(M):
#        print(i,j)
        if T[j] == S[i]:
            tmp = A[-1][j-1] % mod
#            A[i+1][j] = A[-1][j-1] % mod
        else:
            tmp = tmp2 % mod
#            A[i+1][j] = A[i+1][j-1] % mod
        tmp2 = tmp
        A[-1][j] += tmp
#        A[-1][j] += A[i+1][j]
        A[-1][j] %= mod
#        print(A)
ans = A[-1][-2] % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Mon May 27 22:13:19 2019

@author: Yamazaki Kenichi
"""

N, M = map(int,input().split())
ks = [list(map(int,input().split())) for i in range(M)]
p = list(map(int,input().split()))

S = [0 for i in range(M)]
for i in range(M):
    for j in range(1,ks[i][0]+1):
        S[i] += 2**(ks[i][j]-1)

ans = 0
for bit in range(1<<N):
    now = [0 for i in range(M)]
    for i in range(N):
        if bit & 1<<i:
            for j in range(M):
                now[j] += S[j]//(1<<i)
    flg = True
    for j in range(M):
        if now[j]%2 != p[j]:
            flg = False
    ans += flg
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:56:05 2019

@author: Yamazaki Kenichi
"""
import heapq

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

def a(K):
    if K > N:
        return N
    else:
        return K

ans = 0
for i in range(K):
    for j in range(a(K-i)+1):
        tmp = 0
        minus = [0]
        for k in range(a(K-i)):
            tmp += V[k-j]
            heapq.heappush(minus,V[k-j])
#            print(tmp,minus)
        for k2 in range(i):
            if minus[0] < 0:
                tmp += (-heapq.heappop(minus))
            else:
                break
#        print(ans,tmp,i,j,k)
        ans = max(ans,tmp)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:56:05 2019

@author: Yamazaki Kenichi
"""
import heapq

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

ans = 0
for i in range(K):
    for j in range(K-i+1):
        tmp = 0
        minus = [0]
        for k in range(K-i):
            tmp += V[k-j]
            heapq.heappush(minus,V[k-j])
#            print(tmp,minus)
        tmp += (-sum(minus[:i]))
#        print(ans,tmp,i,j,k)
        ans = max(ans,tmp)
    
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:56:05 2019

@author: Yamazaki Kenichi
"""
import heapq

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

def a(K):
    if K > N:
        return N
    else:
        return K

ans = 0
for i in range(K):
    for j in range(a(K-i)+1):
        tmp = 0
        minus = [0]
        for k in range(a(K-i)):
            tmp += V[k-j]
            heapq.heappush(minus,V[k-j])
#            print(tmp,minus)
        for k2 in range(i):
            if minus[0] < 0:
                tmp += (-heapq.heappop(minus))
            else:
                break
#        print(ans,tmp,i,j,k)
        ans = max(ans,tmp)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 16 20:36:58 2019

@author: Yamazaki Kenichi
"""

N = int(input())
C = [int(input()) for i in range(N)]
mod = 10**9+7
T = [[0] for i in range(N+1)]
ans = [1 for i in range(N+1)]
for i in range(N): 
    if i == 0 or C[i] != C[i-1]:
        T[C[i]][0] += 1
        T[C[i]].append(i)
        if T[C[i]][0] >=2:
            ans[i] = (ans[i-1] + ans[T[C[i]][-2]])%mod
        else:
            ans[i] = ans[i-1]%mod
    else:
        ans[i] = ans[i-1]%mod
        
print(ans[N-1]%mod)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 16 20:36:58 2019

@author: Yamazaki Kenichi
"""

N = int(input())
C = [int(input()) for i in range(N)]
mod = 10**9+7
T = [[0] for i in range(2*10**5+1)]
ans = [1 for i in range(N+1)]
for i in range(N): 
    if i == 0 or C[i] != C[i-1]:
        T[C[i]][0] += 1
        T[C[i]].append(i)
        if T[C[i]][0] >=2:
            ans[i] = (ans[i-1] + ans[T[C[i]][-2]])%mod
        else:
            ans[i] = ans[i-1]%mod
    else:
        ans[i] = ans[i-1]%mod
        
print(ans[N-1]%mod)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Mar  3 19:52:44 2019

@author: Yamazaki Kenichi
"""

A,B,K = map(int,input().split())

counta = 0
for i in range(1,K):
    if len(str(A/i)) < 10**10 and len(str(B%i)) < 10**10:
        counta += 1
    if counta == K:
        ans = i
        break
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Mar  3 19:52:44 2019

@author: Yamazaki Kenichi
"""

A,B,K = map(int,input().split())

counta = 0
ans = []
for i in range(1,101):
    if A%i == 0 and B%i == 0:
        ans.append(i)
print(ans[-K])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Feb  3 21:07:35 2019

@author: Yamazaki Kenichi
"""

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

X.sort()
A = []

for i in range(M-1):
    A.append(X[i+1]-X[i])
A.sort()

ans = X[M-1]-X[0]
if M !=1:
    for i in range(M-2,M-2-(N-1),-1):
        ans = ans - A[i] 
print(ans)

Fixed submission:
    # -*- coding: utf-8 -*-
"""
Created on Sun Feb  3 21:07:35 2019

@author: Yamazaki Kenichi
"""

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

if N >= M:
    ans = 0

else:
    X.sort()
    A = []
    for i in range(M-1):
        A.append(X[i+1]-X[i])
    A.sort()
    ans = X[M-1]-X[0]

    for i in range(M-2,M-2-(N-1),-1):
        ans = ans - A[i] 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
H = list(map(int,input().split()))

ans = [10**10 for i in range(N+1)]
ans[0],ans[1] = 0,0
for i in range(1,N+1):
    for k in range(1,K+1):
        if i-k > 0:
            ans[i] = min(ans[i-k]+abs(H[i-1]-H[i-k-1]),ans[i])
print(ans[-1])
    

Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
 
ans = [10**10 for i in range(N+1)]
ans[0],ans[1] = 0,0
for i in range(1,N+1):
    for k in range(1,K+1):
        if i-k > 0:
            ans[i] = min(ans[i-k]+abs(H[i-1]-H[i-k-1]),ans[i])
print(ans[-1])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 23 21:51:02 2019

@author: Yamazaki Kenichi
"""

N,W = map(int,input().split())
A = [list(map(int,input().split())) for i in range(N)]

ans = [[-1 for i in range(N+1)]]
ans[0][N] = 0
for i in range(1,W+1):
    tmp = -1
    maxv = ans[-1][N]
#    print('aa',maxv)
    for j in range(N):
#        print(i,j,A[j][0],maxv,ans[i -A[j][0]][j])
#        print(i,j,A[j],i -A[j][0],ans[-1])
        if i-A[j][0] >= 0 and ans[i-A[j][0]][j] == -1 and ans[i-A[j][0]][N] + A[j][1] > maxv:
            maxv = ans[i-A[j][0]][N] + A[j][1]
            tmp = j
#            print('maxv',maxv,'tmp',tmp)
    if tmp != -1:
        ans.append(ans[-A[tmp][0]][:])
        ans[i][tmp] = 1
    else:
        ans.append(ans[-1][:])
    ans[i][N] = maxv
#    print(ans[i][N])
#    print(ans[i])
print(ans[W][N])

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 23 21:51:02 2019

@author: Yamazaki Kenichi
"""

N,W = map(int,input().split())
A = [list(map(int,input().split())) for i in range(N)]

ans = [[-1 for i in range(N+1)]]
ans[0][N] = 0
for i in range(1,W+1):
    tmp = -1
    maxv = ans[-1][N]
#    print('aa',maxv)
    for j in range(N):
#        print(i,j,A[j][0],maxv,ans[i -A[j][0]][j])
#        print(i,j,A[j],i -A[j][0],ans[-1])
        if i-A[j][0] >= 0 and ans[i-A[j][0]][j] == -1 and ans[i-A[j][0]][N] + A[j][1] > maxv:
            maxv = ans[i-A[j][0]][N] + A[j][1]
            tmp = j
#            print('maxv',maxv,'tmp',tmp)
    if tmp != -1:
        ans.append(ans[-A[tmp][0]][:])
        ans[i][tmp] = 1
    else:
        ans.append(ans[-1][:])
    ans[i][N] = maxv
#    print(ans[i][N])
#    print(ans[i])
print(ans[W][N])
Buggy python submission (verdict: Time Limit Exceeded):

import sys
import numpy as np

sys.setrecursionlimit(10 ** 9)

s = input()
t = input()
N, M = len(s), len(t)

dp = [['' for _ in range(M+1)] for _ in range(N+1)]

for i in range(1,N+1):
    for j in range(1,M+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1]+ s[i-1]
        elif len(dp[i-1][j]) > len(dp[i][j-1]):
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = dp[i][j-1]

ans = ''
for j in range(M+1):
    if len(dp[-1][j]) > len(ans):
        ans = dp[-1][j]
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 22:34:56 2020

@author: ctiuser
"""

import numpy as np

s = np.array(list(input()), dtype='U1')
t = np.array(list(input()), dtype='U1')

ls, lt = len(s), len(t)

eq = s[:, None] == t[None,:]
dp = [np.zeros(lt+1, int)]

for i in range(ls):
    prev = dp[-1].copy()
    np.maximum(prev[1:], prev[:-1] + eq[i], out = prev[1:])
#    print(prev)
    np.maximum.accumulate(prev, out = prev)
#    print(prev)
    dp.append(prev)

i, j = ls, lt
ans = ''
while i > 0 and j > 0:
    if eq[i-1][j-1]:
        ans += s[i-1]
        i -= 1
        j -= 1
        
    if dp[i][j] == dp[i][j-1]:
        j -= 1
        continue
    elif dp[i][j] == dp[i-1][j]:
        i -= 1
        continue
        
ans = ans[::-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 18:20:35 2020
"""

import sys
import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

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

dp = [i <= K for i in range(K + A[-1]+1)]
for i in range(K, -1, -1):
    for a in A:
        if dp[a+i]:
            dp[i] = False
            break

#    print(i, dp[i],A+i,dp[A+i])
#print(dp)

if dp[0]:
    ans = 'Second'
else:
    ans = 'First'
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 18:20:35 2020
"""

import sys
import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

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

dp = np.arange(K + A[-1]+1) >= 0
for i in range(K, -1, -1):
    if np.all(dp[A+i]):
        dp[i] = False
#    print(i, dp[i],A+i,dp[A+i])
#print(dp)

if dp[0]:
    ans = 'First'
else:
    ans = 'Second'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1+1)

if N == 1:
    ans = P
else:
    ans = 1
    for i in range(2,limit+1):
        if P % pow(i,N) == 0:
            ans = i

print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1)

if N == 1:
    ans = P
elif limit == 1:
    ans = 1
else:
    ans = 1
    for i in range(2,limit+2):
        if P % pow(i,N) == 0:
            ans = i
            
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1+1)

if N == 1:
    ans = P
else:
    ans = 1
    for i in range(1,limit+1):
        if P % pow(i,N) == 0:
            ans = i

print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1)

if N == 1:
    ans = P
elif limit == 1:
    ans = 1
else:
    ans = 1
    for i in range(2,limit+2):
        if P % pow(i,N) == 0:
            ans = i
            
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1+1)

if N == 1:
    ans = P
else:
    ans = 1
    for i in range(1,limit+1):
        if P % pow(i,N) == 0:
            ans = i
    
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1)

if N == 1:
    ans = P
elif limit == 1:
    ans = 1
else:
    ans = 1
    for i in range(2,limit+2):
        if P % pow(i,N) == 0:
            ans = i
            
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1+1)

if N == 1:
    ans = P
else:
    ans = 1
    for i in range(1,limit+1):
        if P % pow(i,N) == 0:
            ans = i
    
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1)

if N == 1:
    ans = P
elif limit == 1:
    ans = 1
else:
    ans = 1
    for i in range(2,limit+2):
        if P % pow(i,N) == 0:
            ans = i
            
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 21:30:42 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

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

n = N
eat = X

def dfs(x):
    x

ans = 0
#print(ans,eat,n)
while eat > 0:
    if eat == (pow(2,n+2) - 3 + 1) //2:
        ans += pow(2,n) - 1 + 1
        eat = 0
        n -= 1
    elif eat > (pow(2,n+2) - 3 + 1) //2:
        ans += pow(2,n) - 1 + 1
        eat -= (pow(2,n+2) - 2) //2
        n -= 1
    else:
        eat -= 1
        n -= 1
#    print(ans,eat,n)

print(ans)
    


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun May 19 16:57:17 2019

@author: Yamazaki Kenichi
"""

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

dp = [[1,1] for i in range(N+1)]
for i in range(1,N+1):
    dp[i][0] = dp[i-1][0]*2 + 1
    dp[i][1] = dp[i-1][1]*2 + 3

ans = 0
for i in range(2,N+2):
    if X - (dp[-i][1] + 2) >= 0:
        ans += dp[-i][0] + 1
        X -= (dp[-i][1] + 2)
#        print(ans,X,dp[-i])
    else:
        X -= 1
#        print(ans,X,dp[-i])
    if i == N+1 and X >= 1:
        ans += 1
#        print(ans,X,dp[-i])
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Thu Jan  3 10:20:42 2019

@author: Yamazaki Kenichi
"""
from scipy.special import perm, comb

N = int(input())

prime = [2]
for j in range(3,100):
    if all(j % i != 0 for i in prime) :
        prime.append(j)

def a(x):
    for i in range(N):
        if prime.count((N-i)//x)>0:
            return prime.index((N-i) // x )
    return -1
        
a02 = a(2)+1
a04 = a(4)+2 if (N>=9 and N<12) else a(4)+1 
a14 = a(14)+1
if N < 26:
    a24 = 0
elif N < 54:
    a24 = 1
elif N < 100:
    a24 = 2
else:
    a24 = 3

b74 = 1 if N > 78 else 0
b24 =a24*(a02-1)
b14 =a14*(a04-1)
b04 =int(comb(a04,2))*(a02-2)
    
if N < 10:
    ans = 0
else:
    ans = b74 + b24 + b14 + b04

print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Thu Jan  3 10:20:42 2019

@author: Yamazaki Kenichi
"""

N = int(input())

prime = [2]
for j in range(3,100):
    if all(j % i != 0 for i in prime) :
        prime.append(j)

N1 = 1
for i in range(1,N+1):
    N1 *= i 

prime1 = []
a02,a04,a14,a24,a74 =0,0,0,0,0
for j in prime:
    temp = 0
    while N1 % pow(j,temp) ==0:
        temp += 1
    a02 += 1 if temp > 2 else 0
    a04 += 1 if temp > 4 else 0
    a14 += 1 if temp > 14 else 0
    a24 += 1 if temp > 24 else 0
    a74 += 1 if temp > 74 else 0    
    prime1.append(temp)

ans = a74 +a24*(a02-1) +a14*(a04-1) +a04*(a04-1)//2*(a02-2)



print(ans)