ZhenlongDai/ACPR huggingface dataset:
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, P = map(int,input().split())
 
output=1
 
for num in range(2,round(P**(1/(2*N)))+1):
  for i in range(10000):
    if P%(num**N) == 0:
      P = P/(num**N)
      output = num*output
    else:
      break
 
print(output)
 

Failing test case input:
1 86751842326

Expected output:
86751842326


Actual output:
2


Fixed submission (verdict: Accepted):
N, P = map(int,input().split())
 
output=1
 
if P==1:
  output=1
elif N==1:
  output=P
else:
  for num in range(2,round(P**(1/N))+1):
    if P%(num**N) == 0:
      output = num
 
print(output)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math

def primeFact(P):
    s = math.floor(math.sqrt(P))
    result = {}

    for i in range(2, s):
        if P % i == 0:
            r = 0
            while P % i == 0:
                r += 1
                P = P / i
            result[i] = r

    if P > s:
        result[P] = 1
    return result

def gcd(N, fact):
    gcd = 1
    for key in fact.keys():
        if fact[key] >= N:
            gcd *= key * (int(fact[key] / N))
    return gcd

if __name__ == "__main__":
    N, P = map(int, input().split())
    fact = primeFact(P)
    print(gcd(N, fact))

Failing test case input:
1 29821761596

Expected output:
29821761596


Actual output:
29821761596.0


Fixed submission (verdict: Accepted):

import math

def primeFact(P):
    s = math.floor(math.sqrt(P))
    result = {}

    for i in range(2, s + 1):
        if P % i == 0:
            r = 0
            while P % i == 0:
                r += 1
                P = P 
            result[i] = r

    if P > s:
        result[P] = 1
    return result

def gcd(N, fact):
    gcd = 1
    for key in fact.keys():
        if fact[key] >= N:
            gcd *= key ** (fact[key] 
    return int(gcd)

if __name__ == "__main__":
    N, P = map(int, input().split())
    fact = primeFact(P)
    print(gcd(N, fact))
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,P = map(int, input().split())
 
if P == 1 or N == 2:
    print(1)
elif N == 1:
    print(P)
else:
    import math
 
    sq_P = math.floor(math.sqrt(P))
    prim = []
    P_tmp=P
 
    for i in range(2,sq_P+1):
        r=0
        if P_tmp%i == 0:
            r+=1
            P_tmp=P/i
            while P_tmp%i==0:
                r+=1
                P_tmp=P_tmp/i
            prim.append([i,r])
 
    ans = 1
    for i in range(len(prim)):
        if prim[i][1]>=N:
            ans = ans * prim[i][0]
 
    print(ans)

Failing test case input:
2 57494079221

Expected output:
59


Actual output:
1


Fixed submission (verdict: Accepted):
N,P = map(int, input().split())

if P == 1 :
    print(1)
elif N == 1:
    print(P)
else:
    import math

    sq_P = math.floor(math.sqrt(P))
    prim = []
    P_tmp=P

    for i in range(2,sq_P):
        r=0
        if P_tmp%i == 0:
            r+=1
            P_tmp=P_tmp/i
            while P_tmp%i==0:
                r+=1
                P_tmp=P_tmp/i
            prim.append([i,r])

    ans = 1
    for i in range(len(prim)):
        if prim[i][1]>=N:
            ans = ans * prim[i][0]**math.floor(prim[i][1]/N)

    print(ans)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import collections
import math

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

insuList=[]
warukazu = 2
while (warukazu <= math.sqrt(P) +1):
  if P % warukazu == 0:
    P = P / warukazu
    insuList.append(warukazu)
  else:
    warukazu+=1
insuList.append(P)

ans=1
c=collections.Counter(insuList)
for key in c.keys():
  while c[key] >= N:
    ans=ans*key
    c[key] -= N

print(ans)

Failing test case input:
1 223203549657

Expected output:
223203549657


Actual output:
223203549657.0


Fixed submission (verdict: Accepted):

import collections
import math

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

insuList=[]
warukazu = 2
while (warukazu <= math.sqrt(P) +1):
  if P % warukazu == 0:
    P = P / warukazu
    insuList.append(warukazu)
  else:
    warukazu+=1
insuList.append(P)

ans=1
c=collections.Counter(insuList)
for key in c.keys():
  while c[key] >= N:
    ans=ans*key
    c[key] -= N

print(int(ans))

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
N, P = map(int, input().split())

y=[i+1 for i in range(int(P**(1/2))) if P%(i+1)==0]
x=copy.copy(y)
for i in range(len(y)):
    if P%y[i]==0:
        x.append(int(P/y[i]))
x.sort()

for i in range(len(x)):
    tmp=x[i]**(1/N)
    if tmp%int(tmp)==0:
            break

print(int(tmp))

Failing test case input:
1 2791175743

Expected output:
2791175743


Actual output:
1


Fixed submission (verdict: Accepted):
import copy
N, P = map(int, input().split())

x=[i+1 for i in range(int(P**(1/2))) if P%(i+1)==0]
for i in range(len(x)):
    if P%x[i]==0:
        x.append(int(P/x[i]))
x.sort(reverse=True)

for i in range(len(x)):
    tmp=round(x[i]**(1/N),10)
    if tmp%int(tmp)==0:
            break

print(int(tmp))
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, p = list(map(int, input().split()))

if n == 1 :
    print(p)
elif p == 1 :
    print(1)
elif n >= 40:
    print(1)
else:
    ans = 1
    count = 2
    while (count**n) < p:
        if(p % count**n == 0):
            ans *= count
            p /= count**n
        count += 1
    print(ans)


Failing test case input:
2 243501193440

Expected output:
12


Actual output:
6


Fixed submission (verdict: Accepted):
n, p = list(map(int, input().split()))

if n == 1 :
    print(p)
elif p == 1 :
    print(1)
elif n >= 40:
    print(1)
else:
    ans = 1
    count = 2
    tmp = count**n
    while (tmp) <= p:
        if(p % tmp == 0):
            ans *= count
            p = int(p/tmp)
            count -= 1
        count += 1
        tmp = count**n
    print(ans)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p = map(int,input().split())
a = []
i = 2
while (p>1) and (i < int(p**0.5) + 4):
    c = 0
    while p%i == 0:
        p = p/i
        c += 1
    a.append([i,c])
    i += 1
 
c = 1
for i in range(len(a)):
  if a[i][1] >= n:
  	c = c* a[i][0] * int(a[i][1]/n)

print(c)

Failing test case input:
1 161738783295

Expected output:
161738783295


Actual output:
2985


Fixed submission (verdict: Accepted):
n,p = map(int,input().split())
a = []
i = 2
k = p

if n == 1:
  c = p
else:
  while (p>1) and (i < int(k**0.5) + 4):
      c = 0
      while p%i == 0:
          p = p/i
          c += 1
      a.append([i,c])
      i += 1
  if p>1:
      a.append([p,1])
  c = 1

  for i in range(len(a)):
    if a[i][1] >= n:
      k = a[i][0] ** int(a[i][1]/n)
      c = c* k

print(c)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt
from collections import defaultdict
n,p = (int(i) for i in input().split())
d,ans = defaultdict(int),1
while 1:
	f = p
	for i in range(2,int(sqrt(p))+1):
		if p%i==0:
			d[i]+=1
			p
			break
	if f==p:
		d[p]+=1
		break
for i,j in d.items():
	if n<=j: ans*=i
print(ans)

Failing test case input:
1 444809071812

Expected output:
444809071812


Actual output:
889618143624


Fixed submission (verdict: Accepted):
from math import sqrt
from collections import defaultdict
n,p = (int(i) for i in input().split())
d,ans = defaultdict(int),1
while 1:
	f = p
	for i in range(2,int(sqrt(p))+1):
		if p%i==0:
			d[i]+=1
			p
			break
	if f==p:
		d[p]+=1
		break
for i,j in d.items(): ans*=i**(j
print(ans)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int,input().split())
l=[]
for i in range(1001,0,-1):
  x=i**n
  if p%x==0:
    print(i)
    break

Failing test case input:
1 90680099897

Expected output:
90680099897


Actual output:
23


Fixed submission (verdict: Accepted):
n,p=map(int,input().split())
l=[]
if n>41:
  print(1)
else:
  x=int(p**(1/n))
  for i in range(x+1,0,-1):
    if p%(i**n)==0:
      print(i)
      break
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
N, P = map(int, input().split())

y=[int(P/(i+1)) for i in range(int(P**(1/2))) if P%(i+1)==0]
x=copy.copy(y)
for i in range(len(y)):
    if P%y[i]==0:
        x.append(P/y[i])

for i in range(len(x)):
    tmp=x[i]**(1/N)
    if tmp%int(tmp)==0:
            break

print(int(tmp))

Failing test case input:
2 243501193440

Expected output:
12


Actual output:
1


Fixed submission (verdict: Accepted):
import copy
N, P = map(int, input().split())

x=[i+1 for i in range(int(P**(1/2))) if P%(i+1)==0]
for i in range(len(x)):
    if P%x[i]==0:
        x.append(int(P/x[i]))
x.sort(reverse=True)

for i in range(len(x)):
    tmp=round(x[i]**(1/N),10)
    if tmp%int(tmp)==0:
            break

print(int(tmp))

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

N, P = [int(a) for a in input().strip().split()]

facs = prime_decomposition(P)
facc = Counter(facs)

common = 1
for fac in facc.keys():
    if facc[fac] >= N:
        common = common * fac

print(int(common))



Failing test case input:
1 438625

Expected output:
438625


Actual output:
1595


Fixed submission (verdict: Accepted):
from collections import Counter

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(int(n))
    return table

N, P = [int(a) for a in input().strip().split()]

facs = prime_decomposition(P)
facc = Counter(facs)

common = 1
for fac in facc.keys():
    count = facc[fac]
    while count >= N:
        common = common*fac
        count -= N

print(int(common))

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p = map(int,input().split())
a = []
i = 2


if n == 1:
  c = p
else:
  while (p>1) and (i < int(p**0.5) + 4):
      c = 0
      while p%i == 0:
          p = p/i
          c += 1
      a.append([i,c])
      i += 1

  c = 1
  for i in range(len(a)):
    if a[-i][1] >= n:
      c = c* a[-i][0] * int(a[i][1]/n)

print(a)
print(c)


Failing test case input:
1 86266567854

Expected output:
86266567854


Actual output:
[]
86266567854


Fixed submission (verdict: Accepted):
n,p = map(int,input().split())
a = []
i = 2
k = p

if n == 1:
  c = p
else:
  while (p>1) and (i < int(k**0.5) + 4):
      c = 0
      while p%i == 0:
          p = p/i
          c += 1
      a.append([i,c])
      i += 1
  if p>1:
      a.append([p,1])
  c = 1

  for i in range(len(a)):
    if a[i][1] >= n:
      k = a[i][0] ** int(a[i][1]/n)
      c = c* k

print(c)
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int,input().split())

i=1
gcd=1
if(n==1):
    print(p)
else:
    while((i**n)<=p):
        if(p%(i**n)==0):
            gcd*=i
            p/=i**n
        i+=1
        
    print(gcd)

Failing test case input:
2 243501193440

Expected output:
12


Actual output:
6


Fixed submission (verdict: Accepted):
n,p=map(int,input().split())

i=2
gcd=1
if(n>40):
    print(1)
elif(n==1):
    print(p)
else:
    while((i**n)<=p):
        if(p%(i**n)==0):
            
            gcd*=i
            p/=(i**n)
            i-=1
        i+=1
        
    print(gcd)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int,input().split())
array=[]
root=int(p**(1/2))
for i in range(1,root+1):
        if(p%(i**n)==0):
                array.append(i)
print((array[-1]))    

Failing test case input:
1 89483951595

Expected output:
89483951595


Actual output:
15


Fixed submission (verdict: Accepted):
n,p=map(int,input().split())
root=round(p**(1/n))
for i in range(root,0,-1):
        if(p%(i**n)==0):
                print(i)
                break

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,sys

n,p=map(int,sys.stdin.readline().split())
limit = int(round(p ** (1/n), 5))
if limit==1:
    print(1)
elif n==1:
    print(p)
else:
    i = 3
    cnt,ans=0,1

    while True:
        if limit % 2 == 0:
            limit /= 2
            ans *= 2
        else:
            break
    while i <= limit:
        if limit % i == 0:
            ans *= i
            limit /= i
        else:
            i = i + 2
    print(ans)

Failing test case input:
4 972439611840

Expected output:
206

Actual output:
993


Fixed submission (verdict: Accepted):
import math,sys

n,p=map(int,sys.stdin.readline().split())
limit = int(p ** (1/n))+1
if limit==1:
    print(1)
elif n==1:
    print(p)
else:
    cnt,ans=0,1

    while p % 2 == 0:
        p /= 2
        cnt += 1
    ans *= pow(2, cnt
    
    for div in range(3, limit, 2):
        cnt = 0
        while p % div == 0:
            cnt += 1
            p /= div
        if cnt >= n:
            ans *= pow(div, cnt 
    print(ans)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N, P = map(int, input().split())
max_value = math.floor(math.sqrt(P))
ans = 1

if N != 1:
    for i in range(2, max_value):
        if P % 2 == 0:
            if P % ((ans*i)**N) == 0:
                ans *= i

print(ans)


Failing test case input:
1 12990722462

Expected output:
12990722462


Actual output:
1


Fixed submission (verdict: Accepted):
import math

N, P = map(int, input().split())
max_value = round(pow(P, 1/N)) + 1 
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value):
        mod = i ** N
        if P % mod == 0:
            ans = i

print(ans)
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, p = map(int, input().split())
import math


def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 

    
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

PS = primes(100000)
def factorint(x):
  d = {}
  for k in PS:
    if(x % k== 0):
      m = 1
      while(x % (k**m) == 0):
        m += 1
      d[k] = m - 1
      x = x / (k ** (m - 1))
      if x == 1:
        break
  return d

fac = factorint(p)
result = 1
for i,j in fac.items():
  result *= i **math.floor(j/n)
print(result)

Failing test case input:
1 839883532662

Expected output:
839883532662


Actual output:
8262


Fixed submission (verdict: Accepted):
n, p = map(int, input().split())
import math


def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 

    
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

PS = primes(1000000)
def factorint(x):
  d = {}
  for k in PS:
    if(x % k== 0):
      m = 1
      while(x % (k**m) == 0):
        m += 1
      d[k] = m - 1
      x = x / (k ** (m - 1))
      if x == 1:
        break
  return d

fac = factorint(p)
result = 1
for i,j in fac.items():
  result *= i **math.floor(j/n)
if n == 1:
  result = p
print(result)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N, P = map(int, input().split())
max_value = math.floor(math.sqrt(P))
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value):
        mod = i ** N
        if P % mod == 0:
            ans *= i
            P 
        if i > math.floor(math.sqrt(P)):
            break

print(ans)


Failing test case input:
2 243501193440

Expected output:
12


Actual output:
1728


Fixed submission (verdict: Accepted):
import math

N, P = map(int, input().split())
max_value = round(pow(P, 1/N)) + 1 
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value):
        mod = i ** N
        if P % mod == 0:
            ans = i

print(ans)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,P = map(int,input().split())
i = int(P**(1/N))
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  for i in range(i,0,-1):
    if P%i**N==0:
      print(i)

Failing test case input:
2 243501193440

Expected output:
12


Actual output:
12
6
4
3
2
1


Fixed submission (verdict: Accepted):
N,P = map(int,input().split())
i = round(P**(1/N))
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  for i in range(i,0,-1):
    if P%i**N==0:
      print(i)
      break
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, P = map(int, input().split())

a = 1
b = 1

if N == 1 :
	print(P)
else:
	while P >= a**N:
		if P % a**N == 0:
			P /= a**N
			b *= a
		a += 1
	print(b)


Failing test case input:
2 243501193440

Expected output:
12


Actual output:
6


Fixed submission (verdict: Accepted):
N, P = map(int, input().split())
import math

a = 2
b = 1

if N == 1 :
	print(P)
else:
	while math.log(P) >= N * math.log(a):
		if P % a**N == 0:
			P /= a**N
			b *= a
			a = 1
		a += 1
	print(b)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def e(n,p):
  i = 2
  table = []
  ans = 1
  while i * i <= n:
    b = 0
    while n % i == 0:
      n /= i
      b += 1
      if b >= p:
        ans *= i
        break
    i += 1
  return ans
  
n,p = map(int, input().split())

a = e(p,n)
print(a)

Failing test case input:
1 10724791658

Expected output:
10724791658


Actual output:
15022


Fixed submission (verdict: Accepted):
def e(n,p):
  i = 2
  ans = 1
  if p == 1:
    return n
  else:
    while i * i <= n:
      b = 0
      while n % i == 0:
        n /= i
        b += 1
      else:
        ans *= i**(b
      i += 1
    return ans
  
n,p = map(int, input().split())

a = e(p,n)
print(a)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int,input().split())

i=2
gcd=1
p=1024*1024*1024
if(n>40):
    print(1)
elif(n==1):
    print(p)
else:
    while((i**n)<=p):
        if(p%(i**n)==0):
            
            gcd*=i
            p/=(i**n)
            i-=1
        i+=1
        
    print(gcd)

Failing test case input:
1 433627158286

Expected output:
433627158286


Actual output:
1073741824


Fixed submission (verdict: Accepted):
n,p=map(int,input().split())

i=2
gcd=1
if(n>40):
    print(1)
elif(n==1):
    print(p)
else:
    while((i**n)<=p):
        if(p%(i**n)==0):
            
            gcd*=i
            p/=(i**n)
            i-=1
        i+=1
        
    print(gcd)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

N, P = [int(a) for a in input().strip().split()]

facs = prime_decomposition(P)
facc = Counter(facs)

common = 1
for fac in facc:
    if facc[fac] >= N:
        common = common * fac

print(common)



Failing test case input:
1 53473371889

Expected output:
53473371889


Actual output:
53473371889.0


Fixed submission (verdict: Accepted):
from collections import Counter

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(int(n))
    return table

N, P = [int(a) for a in input().strip().split()]

facs = prime_decomposition(P)
facc = Counter(facs)

common = 1
for fac in facc.keys():
    count = facc[fac]
    while count >= N:
        common = common*fac
        count -= N

print(int(common))
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p = map(int,input().split())
s = 0 
a = int(p)
b = {}

if p == 1:
    print(1)
elif n == 1:
    print(p)
else:
    while s == 0:
        for i in range(2,a+1):
            if p % i == 0:
                p = p / i
                if p == 1:
                    s = 1
                
                if i not in b:
                    b[i] = 1
                else:
                    b[i] += 1
                
                break

    ans = 1
    for k,v in b.items():
        if v >= n:
            ans *= k
    print(ans)

Failing test case input:
2 243501193440

Expected output:
12


Actual output:
6


Fixed submission (verdict: Accepted):
n,p = map(int,input().split())
s = 0 
a = int(p)
b = {}

def calc(x):
    c = []
    b, e = 2, 0
    while b * b <= x:
        while x % b == 0:
            x = x 
            e = e + 1
        if e > 0:
            c.append((b, e))
        b, e = b + 1, 0
    if x > 1:
        c.append((x, 1))
    return c
    
    
if p == 1:
    print(1)
else:
    d = calc(p)
    ans = 1
    for i in range(len(d)):
        if d[i][1] >= n:
            ans *= d[i][0] ** (d[i][1] 
    print(ans)

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int,input().split())
l=[]
for i in range(1001,0,-1):
  x=pow(i,n)
  if p%x==0:
    print(i)
    break

Failing test case input:
1 408403472338

Expected output:
408403472338


Actual output:
626


Fixed submission (verdict: Accepted):
n,p=map(int,input().split())
l=[]
if n>41:
  print(1)
else:
  x=int(p**(1/n))
  for i in range(x+1,0,-1):
    if p%(i**n)==0:
      print(i)
      break

Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, p = map(int, input().split())

pp = p

count_2 = 0
while True:
    if pp % 2 == 0:
        pp = pp / 2
        count_2 += 1
    else:
        break

if count_2 >= n:
    result = 2
else:
    result = 1

p = p / (2 ** count_2)

num2 = int(p ** (1/n)) + 1

for i in range(num2, 0, -1):
    if p % (i ** n) == 0:
        print(result * i)
        break


Failing test case input:
1 4295973496

Expected output:
4295973496


Actual output:
1073993374


Fixed submission (verdict: Accepted):
n, p = map(int, input().split())

pp = p

count_2 = 0
while True:
    if pp % 2 == 0:
        pp = pp / 2
        count_2 += 1
    else:
        break


result = 2 ** (count_2 

p = p / (2 ** count_2)

kisu = True if p / 2 != 0 else False

num2 = int(p ** (1/n)) + 1
if kisu:
    num2 = num2 - 1 if num2 % 2 == 0 else num2
else:
    num2 = num2 - 1 if num2 % 2 != 0 else num2


for i in range(num2, 1, -2):
    if p % (i ** n) == 0:
        print(result * i)
        break

else:
    print(result * 1)
Problem: p03194
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p = map(int,input().split())
a = []
i = 2
while (p>1) and (i < int(p**0.5) + 4):
    c = 0
    while p%i == 0:
        p = p/i
        c += 1
    a.append([i,c])
    i += 1
 
c = 1
for i in range(len(a)):
  if a[i][1] >= n:
  	c = c* a[i][0] * int(a[i][1]/n)

if n == 1:
  c = p
    
print(c)

Failing test case input:
1 29821761596

Expected output:
29821761596


Actual output:
677767309.0


Fixed submission (verdict: Accepted):
n,p = map(int,input().split())
a = []
i = 2
k = p

if n == 1:
  c = p
else:
  while (p>1) and (i < int(k**0.5) + 4):
      c = 0
      while p%i == 0:
          p = p/i
          c += 1
      a.append([i,c])
      i += 1
  if p>1:
      a.append([p,1])
  c = 1

  for i in range(len(a)):
    if a[i][1] >= n:
      k = a[i][0] ** int(a[i][1]/n)
      c = c* k

print(c)
Problem: p03032
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, k = map(int, input().split())
v = list(map(int, input().split()))
ret = 0
for l in range(k + 1):
    for r in range(k - l + 1):
        d = k - l - r
        g = sorted(v[:l] + v[n - r:])
        for i in range(min(d, len(g))):
            g[i] = max(0, g[i])
        ret = max(ret, sum(g))
print(ret)

Failing test case input:
6 9
-1 -11 37 -1 0 -3

Expected output:
37


Actual output:
72


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
v = list(map(int, input().split()))
ret = 0
for l in range(min(n, k) + 1):
    for r in range(min(n, k) - l + 1):
        d = k - l - r
        g = sorted(v[:l] + v[n - r:])
        for i in range(min(d, len(g))):
            g[i] = max(0, g[i])
        ret = max(ret, sum(g))
print(ret)

Problem: p03032
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n,k=map(int,input().split())
v=list(map(int,input().split()))
c=min(n,k)
ans=0

for a in range(c+1):
    for b in range(c-a+1):
        t=v[:a]+v[n-b:]
        t.sort()
        for i in range(k-(a+b)):
            if len(t) and t[0]<0:
                t.pop(0)
            ans=max(ans,sum(t))
print(ans)


Failing test case input:
6 4
-10 3 2 0 2 12

Expected output:
16


Actual output:
15


Fixed submission (verdict: Accepted):

n,k=map(int,input().split())
v=list(map(int,input().split()))
c=min(n,k)
ans=0

for a in range(c+1):
    for b in range(c-a+1):
        t=v[:a]+v[n-b:]
        t.sort()
        for i in range(k-(a+b)):
            if len(t) and t[0]<0:
                t.pop(0)
        ans=max(ans,sum(t))
print(ans)

Problem: p03032
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,k = map(int,input().split())
v = list(map(int,input().split()))

ans=0
minnk = min(n,k)
for r in range(minnk+1):
    for l in range(minnk+1-r):
        sute = k-(r+l)
        
        temoti = sorted(v[:l] +v[n-r:])
        score = sum(temoti[sute:])
        
        if ans<score:
            ans=score
print(ans)   

Failing test case input:
6 44
-2 -30 27 1 1 -2

Expected output:
29


Actual output:
0


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
v = list(map(int,input().split()))
import bisect

ans=0
minnk = min(n,k)
for r in range(minnk+1):
    for l in range(minnk+1-r):
        sute = k-(r+l)
        
        temoti = sorted(v[:l] +v[n-r:])
        n_nega = bisect.bisect(temoti,0)
        score = sum(temoti[min(n_nega,sute):])

        if ans<score:
            ans=score
print(ans)
Problem: p03032
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=list(map(int,input().split()))
l=list(map(int,input().split()))
ans=0
for i in range(M+1):
   for j in range(M-i+1):
      mem=l[0:i]+l[N-j:]
      for k in range(min((M-i-j),len(mem))):
         if min(mem)<0:
            mem.remove(min(mem))
      ans=max(ans,sum(mem))
print(ans)

Failing test case input:
6 11
-4 -139 119 1 0 -7

Expected output:
120


Actual output:
240


Fixed submission (verdict: Accepted):
N,M=list(map(int,input().split()))
l=list(map(int,input().split()))
S=min(M,N)
ans=0
for i in range(S+1):
   for j in range(S-i+1):
      mem=l[0:i]+l[N-j:]
      for k in range(min((M-i-j),len(mem))):
         if min(mem)<0:
            mem.remove(min(mem))
      ans=max(ans,sum(mem))
print(ans)

Problem: p03032
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0
for left in range(n + 1):
    for right in range(n + 1 - left):
        if left > n - right or left + right > k:
            continue
        li = v[:left] + v[n - right:]
        rem = k - left - right
        ans = max(ans, sum(sorted(li)[rem:]))
print(ans)


Failing test case input:
6 14
2 -100 31 1 -2 -3

Expected output:
34


Actual output:
0


Fixed submission (verdict: Accepted):

from bisect import bisect
n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0
for left in range(n + 1):
    for right in range(n + 1 - left):
        if left > n - right or left + right > k:
            continue
        li = sorted(v[:left] + v[n - right:])
        rem = min(bisect(li, 0), k - left - right)
        ans = max(ans, sum(li[rem:]))
print(ans)

Problem: p03032
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, k = map(int, input().split())
v = list(map(int, input().split()))
ret = 0
for l in range(k + 1):
    for r in range(k - l):
        d = k - l - r
        g = sorted(v[:l] + v[n - r:])
        for i in range(min(d, len(g))):
            g[i] = max(0, g[i])
        ret = max(ret, sum(g))
print(ret)


Failing test case input:
6 2
0 9 0 -1 3 2

Expected output:
9


Actual output:
2


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
v = list(map(int, input().split()))
ret = 0
for l in range(min(n, k) + 1):
    for r in range(min(n, k) - l + 1):
        d = k - l - r
        g = sorted(v[:l] + v[n - r:])
        for i in range(min(d, len(g))):
            g[i] = max(0, g[i])
        ret = max(ret, sum(g))
print(ret)
Problem: p03032
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
v = list(map(int,input().split()))
ma = 0

for a in range(n+1):
    for b in range(n-a+1):
        li = v[:a]+v[n-b:]
        if a+b > k:
            continue
        if a+b > n:
            continue
        push = k-a-b
        li.sort()
        li = li[push:]
        ma = max(ma,sum(li))
print(ma)

Failing test case input:
6 11
-4 -139 119 1 0 -7

Expected output:
120


Actual output:
119


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
v = list(map(int,input().split()))
ma = 0
kaisu = min(n,k)
for a in range(kaisu+1):
    for b in range(kaisu-a+1):
        push = k-(a+b)
        li = v[:a]+v[n-b:]
        li.sort(reverse=True)
        for c in range(push):
            if li:
                if li[-1] < 0:
                    li.pop()
        ma = max(ma,sum(li))
print(ma)

Problem: p03032
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
N,K = map(int,input().split())
V = list(map(int,input().split()))






sumval = 0
for sute in range(K):
    for i in range(K-sute):
        
        sV = sorted(V[:K-sute-i]+ V[N-i:])
        
        sumval = max(sum(sV[sute:]),sumval)

print(sumval)

Failing test case input:
6 2
-10 3 6 0 2 6

Expected output:
8


Actual output:
0


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
V = list(map(int,input().split()))

sumval = 0
for l in range(min(K+1,N+1)):
    for r in range(min(K+1-l,N-l+1)):
        sV = sorted(V[:l]+ V[N-r:])
        
        
        
        
        
        for sute in range(min(K-r-l+1,len(sV))):
            c = sum(sV[sute:])
            sumval = max(c,sumval)

print(sumval)

Problem: p03032
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
for i in range(1,K+1):
    for j in range(i+1):
        rec = V[:i-j]+V[N-j:]
        rec.sort(reverse=True)
        away = min(i, K-i)
        for l in range(away+1):
            recsum = sum(rec[:i-l])
            if recsum > ans:
                ans=recsum
print(ans)

Failing test case input:
6 14
2 -100 31 1 -2 -3

Expected output:
34


Actual output:
68


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
KN = min(K,N)
for i in range(1,KN+1):
    for j in range(i+1):
        rec = V[:i-j]+V[N-j:]
        rec.sort(reverse=True)
        away = max(min(i, K-i),0)
        for l in range(away+1):
            recsum = sum(rec[:i-l])
            if recsum > ans:
                ans=recsum
print(ans)
Problem: p03032
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
Vs = list(map(int, input().split()))
max_v = 0
for k in range(0, K+1):
  for i in range(0, k+1):
    for j in range(0, K-k+1):
      inh = sorted(Vs[:i] + Vs[i+N-k:])
      max_v = max(max_v, sum(inh[K-k:]))

print(max_v)


Failing test case input:
6 9
-1 -11 54 0 0 -3

Expected output:
54


Actual output:
107


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
Vs = list(map(int, input().split()))
max_v = 0
R = min(N, K)
for r in range(R+1):
  for a in range(r+1):
    b = r - a
    inh = sorted(Vs[:a] + Vs[N-b:])
    for d in range(min(r, K-r)+1):
      max_v = max(max_v, sum(inh[d:]))

print(max_v)

Problem: p03032
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
V = list(map(int, input().split()))

l = []
ans = 0
for a in range(K + 1):
  for b in range(K + 1 - a):
    l = V[0:a] + V[N - b:N]
    l.sort()
    for i in range(K - a - b + 1):
      ans = max(ans, sum(l[i:]))
print(max(ans, 0))

Failing test case input:
6 7
-1 -23 72 0 1 -3

Expected output:
73


Actual output:
118


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
V = list(map(int, input().split()))

R = min(N, K)
l = []
ans = 0
for a in range(R + 1):
  for b in range(R + 1 - a):
    l = V[:a] + V[N - b:]
    l.sort()
    for i in range(K - a - b + 1):
      ans = max(ans, sum(l[i:]))
print(max(ans, 0))

Problem: p03032
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
V = list(map(int, input().split()))

s = 0
for i in range(K): 
    for j in range(K - i): 
        if i + j > N:
            continue
        
        a = V[:i] + V[N-j:]
        r = K - i - j 

        a.sort()
        for k in range(min(len(a), r+1)):
            s = max(s, sum(a[k:]))

print(s)

Failing test case input:
6 2
0 9 0 -1 3 2

Expected output:
9


Actual output:
2


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
V = list(map(int, input().split()))

s = 0
for i in range(K + 1): 
    for j in range(K + 1 - i): 
        if i + j > N:
            continue
        
        a = V[:i] + V[N-j:]
        r = K - i - j 

        a.sort()
        for k in range(min(len(a)+1, r+1)):
            s = max(s, sum(a[k:]))

print(s)
Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X, Y= map(int, input().split(' '))
 
node = []
for k in range(1, N+1):
    for v in range(k, N+1):
       node.append(min([abs(k-v), abs(X-k)+abs(v-Y)+1, abs(Y-k)+abs(X-v)+1]))

for i in range(1, N+1):
    print(node.count(i))
   

Failing test case input:
11 1 7

Expected output:
11
12
13
7
6
4
2
0
0
0


Actual output:
11
12
13
7
6
4
2
0
0
0
0


Fixed submission (verdict: Accepted):
N, X, Y= map(int, input().split(' '))
 
array=[None]*N
for i in range(N):
    array[i]=0
    
for k in range(1, N+1):
    for v in range(k, N+1):
       array[min([abs(k-v), abs(X-k)+abs(v-Y)+1, abs(Y-k)+abs(X-v)+1])] += 1 

for i in range(1, N):
    print(array[i])

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
array = list(map(int, input().split()))
miniDis = []
for i in range(1,array[0]):
  for j in range(i+1,array[0]+1):
    miniDis.append(min(j-i,abs(array[1]-i)+1+abs(array[2]-j)))
                     
for i in range(1,array[0]-1):
  print(miniDis.count(i))


Failing test case input:
8 1 4

Expected output:
8
7
5
4
3
1
0


Actual output:
8
7
5
4
3
1


Fixed submission (verdict: Accepted):
array = list(map(int, input().split()))
miniDis = [0]*(array[0] -1)
for i in range(1,array[0]):
  for j in range(i+1,array[0]+1):
    miniDis[min(j-i,abs(array[1]-i)+1+abs(array[2]-j))-1] += 1
    
                   
                   
                   
                   
for i in range(array[0] -1):
  print(miniDis[i])

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X,Y = map(int,input().split())

ans = [0]*N

for i in range(1,N):
    for j in range(i+1,N+1):
        if i <= X and Y <= j:
            road = min(j-i,(X-i)+(j-Y)+1)
            ans[road] += 1
        else:
            road = j-i
            ans[road] += 1

for i in range(1,N):
    print(ans[i])

Failing test case input:
7 3 7

Expected output:
7
8
4
2
0
0

Actual output:
7
6
5
2
1
0


Fixed submission (verdict: Accepted):
N,X,Y = map(int,input().split())

ans = [0]*N

for i in range(1,N):
    for j in range(i+1,N+1):
        road = min(abs(j-i),abs(X-i)+abs(j-Y)+1,abs(Y-i)+abs(j-X)+1)
        ans[road] += 1

for i in range(1,N):
    print(ans[i])

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x,y = map(int, input().split())

l = [0] * n


for i in range(n):
    for j in range(i+1,n):
        if i <= x and j >= y:
            a = j-i-y+x+1
            l[a-1] += 1
        else:
            a = j-i
            l[a-1] += 1

for i in range(0,n-1):
    print(l[i])

Failing test case input:
19 4 8

Expected output:
19
21
19
18
16
13
12
11
10
9
8
7
5
2
1
0
0
0


Actual output:
19
19
19
18
17
15
13
11
10
9
8
6
4
2
1
0
0
0


Fixed submission (verdict: Accepted):
n,x,y = map(int, input().split())

l = [0] * n


for i in range(1,n):
    for j in range(i+1,n+1):
        if j < x or i > y:
            a = j-i
            l[a] += 1
        else:
            p = j-i
            q = abs(j-y)+abs(i-x)+1
            a = min(p,q)
            l[a] +=1

for i in range(1,n):
    print(l[i])
Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x, y = map(int, input().split())
x -= 1 
y -= 1 
ans = [0]*n

for i in range(n):
  for j in range(i+1, n):
    a = min(j-i, abs(x-i) + abs(y-j) + 1)
     
    ans[a-1] += 1 
for p in ans:
  print(p)

Failing test case input:
10 4 9

Expected output:
10
12
11
7
4
1
0
0
0


Actual output:
10
12
11
7
4
1
0
0
0
0


Fixed submission (verdict: Accepted):
n, x, y = map(int, input().split())
x -= 1 
y -= 1 
ans = [0]*(n-1)

for i in range(n):
  for j in range(i+1, n):
    a = min(j-i, abs(x-i) + abs(y-j) + 1)
     
    ans[a-1] += 1 
for p in ans:
  print(p)

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x, y = map(int, input().split())

ans = [0]*(n+1)
for i in range(1,n+1):
  for j in range(i+1, n+1):
    d = min(abs(i-j), abs(y-j)+abs(x-i)+1, abs(y-i)+abs(x-j)+1)
    ans[d] += 1

for a in ans[1:]:
  print(a)

Failing test case input:
7 4 7

Expected output:
7
6
4
3
1
0


Actual output:
7
6
4
3
1
0
0


Fixed submission (verdict: Accepted):
n, x, y = map(int, input().split())

ans = [0]*(n+1)
for i in range(1,n+1):
  for j in range(i+1, n+1):
    d = min(abs(i-j), abs(y-j)+abs(x-i)+1, abs(y-i)+abs(x-j)+1)
    ans[d] += 1

for a in ans[1:-1]:
  print(a)

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

from itertools import combinations

n,x,y=map(int,readline().split())
dis=[0]*n
lst=list(range(1,n+1))
for a,b in combinations(lst,2):
  dist=min(b-a, abs(x-a)+abs(y-b)+1,abs(y-a)+abs(x-b)+1)
  dis[dist]+=1
print(dis)

Failing test case input:
25 3 4

Expected output:
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1


Actual output:
[0, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]


Fixed submission (verdict: Accepted):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

from itertools import combinations

n,x,y=map(int,readline().split())
dis=[0]*n
lst=list(range(1,n+1))
for a,b in combinations(lst,2):
  if b<=x or a>=y:
    dist=b-a
  else:
    dist=min(b-a, abs(x-a)+abs(y-b)+1)
  dis[dist]+=1
print(*dis[1:],sep='\n')

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X, Y = map(int, input().split())
dist_list = [0]*N

for i in range(N-1):
    for j in range(i+1, N):
        a = j - i
        b = abs(i+1 - X) + abs(j+1 -Y) + 1
        dist_list[min(a,b)] += 1

for k in range(N-1):
    print(dist_list.count(k+1))



Failing test case input:
28 2 6

Expected output:
28
30
27
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
3
0
0
0


Actual output:
0
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1


Fixed submission (verdict: Accepted):
N, X, Y = map(int, input().split())
dist_list = [0]*N

for i in range(N-1):
    for j in range(i+1, N):
        a = j - i
        b = abs(i+1 - X) + abs(j+1 -Y) + 1
        dist_list[min(a,b)] += 1

for k in range(N-1):
    print(dist_list[k+1])
Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, X, Y = list(map(int,input().split()))

Num = [0] * N
for j in range(1, N):
  for i in range(1, j):
    D = min(j - i, abs(j - Y) + 1 + abs(i - X))
    Num[D] += 1
for k in range(1, N):
  print(Num[k])


Failing test case input:
7 3 7

Expected output:
7
8
4
2
0
0

Actual output:
5
5
3
2
0
0


Fixed submission (verdict: Accepted):
N, X, Y = list(map(int,input().split()))
 
Num = [0] * N
for j in range(1, N + 1):
  for i in range(1, j):
    D = min(j - i, abs(j - Y) + 1 + abs(i - X))
    Num[D] += 1
for k in range(1, N):
  print(Num[k])

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,x,y = map(int, input().split())

k = [0]*(n+1)
for i in range(1,n):
    for j in range(i+1,n+1):
        length = min(j-i, abs(x-i)+abs(j-y)+1, abs(y-i)+abs(j-x)+1)
        k[length] = k[length]+1

for i in range(1,n+1):
    print(k[i])

Failing test case input:
37 1 7

Expected output:
37
38
39
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
4
2
0
0
0


Actual output:
37
38
39
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
4
2
0
0
0
0


Fixed submission (verdict: Accepted):
n,x,y = map(int, input().split())

k = [0]*(n+1)
for i in range(1,n):
    for j in range(i+1,n+1):
        length = min(j-i, abs(x-i)+abs(j-y)+1, abs(y-i)+abs(j-x)+1)
        k[length] = k[length]+1

for i in range(1,n):
    print(k[i])

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x, y = map(int,input().split())

ans = [0] * (n+10)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        distance = min(abs(j-i), abs(x-i) + 1 + abs(y-j), abs(y-i) + 1 + abs(x-i))
        ans[distance] += 1
        
for i in range(1, n):
    print(ans[i])

Failing test case input:
11 2 5

Expected output:
11
11
9
7
6
5
4
2
0
0


Actual output:
11
11
9
19
2
3
0
0
0
0


Fixed submission (verdict: Accepted):
n, x, y = map(int,input().split())

ans = [0] * (n+10)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        distance = min(abs(j-i), abs(x-i) + 1 + abs(y-j), abs(y-i) + 1 + abs(x-j))
        ans[distance] += 1
        
for i in range(1, n):
    print(ans[i])

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x, y = map(int, input().split())
ans = [0] * (n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        d = min(j-1, abs(x-i)+abs(j-y)+1)
        ans[d-1] += 1
print(*ans, sep='/n')

Failing test case input:
5 1 3

Expected output:
5
3
2
0


Actual output:
2/n2/n3/n3


Fixed submission (verdict: Accepted):
n, x, y = map(int, input().split())
ans = [0] * (n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        d = min(j-i, abs(x-i)+abs(j-y)+1)
        ans[d-1] += 1
print(*ans, sep='\n')
Problem: p02726
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter
N, X, Y = map(int, input().split())
ans = []

for i in range(N):
    for j in range(i+1, N):
        ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))

c = Counter(ans)
for i in range(1,N):
    print(c[i])


Failing test case input:
5 1 3

Expected output:
5
3
2
0


Actual output:
5
4
1
0


Fixed submission (verdict: Accepted):
from collections import Counter
N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = []

for i in range(N):
    for j in range(i+1, N):
        ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))

c = Counter(ans)
for i in range(1,N):
    print(c[i])

Problem: p02726
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, X, Y = map(int, input().split())

d = {}

for i in range(1, N):
    for j in range(i + 1, N + 1):
        if j >= Y and i <= X:
            d[(i, j)] = min(j - i - (Y - X) + 1, j - i)    
        else:
            d[(i, j)] = j - i

ans = [0] *(N - 1)

for k, v in d.items():
    ans[v - 1] += 1

for v in ans:
    print(v)

Failing test case input:
19 1 13

Expected output:
19
20
21
22
23
24
12
10
8
6
4
2
0
0
0
0
0
0


Actual output:
19
18
17
16
15
14
13
11
10
9
8
6
5
4
3
2
1
0


Fixed submission (verdict: Accepted):
N, X, Y = map(int, input().split())

d = {}

for i in range(1, N):
    for j in range(i + 1, N + 1):
        if j >= Y and i <= X:
            d[(i, j)] = min(j - i - (Y - X) + 1, j - i)    
        elif i <= X:
            d[(i, j)] = min(j - i, X - i + 1 + Y - j)    
        elif j >= Y:
            d[(i, j)] = min(j - i, i - X + 1 + j - Y)    
        else:
            d[(i, j)] = min(j - i, i - X + 1 + Y - j)

ans = [0] * (N - 1)

for k, v in d.items():
    ans[v - 1] += 1

for v in ans:
    print(v)

Problem: p02726
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import deque
from collections import Counter
N, X, Y = map(int, input().split())

res = deque()

for x in range(1, N):
    for y in range(x + 1, N+1):
        res.append(min([abs(x-y), 1 + abs(X-x) + abs(Y-y), 1 + abs(Y-x) + abs(X-x)]))
resd = Counter(res)

for i in range(1, N):
    if i in resd.keys():
        print(resd[i])
    else:
        print(0)

Failing test case input:
34 3 5

Expected output:
34
33
32
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
2
1
0


Actual output:
34
33
112
27
75
23
67
19
35
16
29
13
23
10
17
7
11
4
5
1
0
0
0
0
0
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
from collections import deque
from collections import Counter
N, X, Y = map(int, input().split())

res = deque()

for x in range(1, N):
    for y in range(x + 1, N+1):
        res.append(min(abs(x-y), 1 + abs(X-x) + abs(Y-y)))
resd = Counter(res)

for i in range(1, N):
    if i in resd.keys():
        print(resd[i])
    else:
        print(0)
Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, x, y = map(int, input().split())
L = []
for i in range(1, n):
    for j in range(i+1, n+1):
        length = j - i
        if i <= x and j >= y:
            length -= y-x-1
        L.append(length)
for k in range(1, n):
    print(len([l for l in L if l==k]))

Failing test case input:
10 4 8

Expected output:
10
12
10
8
4
1
0
0
0

Actual output:
10
10
10
8
5
2
0
0
0


Fixed submission (verdict: Accepted):
n, x, y = map(int, input().split())
result = [0]*n
for i in range(1, n):
    for j in range(i+1, n+1):
        a = j - i
        b = abs(i-x) + abs(j-y) + 1
        c = abs(i-y) + abs(j-x) + 1
        result[min(a,b,c)] += 1
for r in result[1:]:
    print(r)

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,X,Y=map(int,input().split())
l=[0]*N
for i in range(1,N):
    for j in range(i):
        l[min(abs(i-j-1),abs(X-j-1)+abs(Y-i-1))]+=1
print(*l,sep="\n")

Failing test case input:
12 1 4

Expected output:
12
11
9
8
7
6
5
4
3
1
0


Actual output:
12
11
9
8
7
6
5
4
3
1
0
0


Fixed submission (verdict: Accepted):
N,X,Y=map(int,input().split())
l=[0]*~-N
for i in range(1,N):
    for j in range(i):
        l[min(abs(i-j-1),abs(X-j-1)+abs(Y-i-1))]+=1
print(*l,sep="\n")

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = list(map(int,input().split()))
N = a[0]
X = a[1]
Y = a[2]
ans = list(range(N+1))
for k in range(1,N+1):
  ans[k] = 0
 
for i in range(1,N):
  for j in range(i+1,N+1):
    k = min(j-i,abs(X-i)+1+abs(j-Y))
    ans[k] = ans[k]+1
 
for dist in ans:
  print(dist)

Failing test case input:
10 4 6

Expected output:
10
9
8
7
5
3
2
1
0


Actual output:
0
10
9
8
7
5
3
2
1
0
0


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
N = a[0]
X = a[1]
Y = a[2]
ans = list(range(N))
for k in range(1,N):
  ans[k] = 0
 
for i in range(1,N):
  for j in range(i+1,N+1):
    k = min(j-i,abs(X-i)+1+abs(j-Y))
    ans[k] = ans[k]+1
 
for t in range(1,N):
  print(ans[t])

Problem: p02726
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N, X, Y = map(int, input().split())
X -= 1
Y -= 1
cnt = [0] * N

for i in range(N):
    for j in range(i+1,N):
         tmp = min(j-i, abs(i-X)+abs(j-Y)+1)
         cnt[tmp] += 1

for k in range(1, N):
    print(cnt[k])

print(cnt)

Failing test case input:
19 4 8

Expected output:
19
21
19
18
16
13
12
11
10
9
8
7
5
2
1
0
0
0


Actual output:
19
21
19
18
16
13
12
11
10
9
8
7
5
2
1
0
0
0
[0, 19, 21, 19, 18, 16, 13, 12, 11, 10, 9, 8, 7, 5, 2, 1, 0, 0, 0]


Fixed submission (verdict: Accepted):


N, X, Y = map(int, input().split())
X -= 1
Y -= 1
cnt = [0] * N

for i in range(N):
    for j in range(i+1,N):
         tmp = min(j-i, abs(i-X)+abs(j-Y)+1)
         cnt[tmp] += 1

for k in range(1, N):
    print(cnt[k])