s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s522065197 | p04014 | u915647268 | 1587822118 | Python | Python (3.4.3) | py | Runtime Error | 527 | 3316 | 392 | n = int(input())
s = int(input())
sq = n**.5
ans = '-1'
for b in range(2, int(sq)+1):
sum = 0
tmp = n
while tmp//b != 0:
sum += tmp%b
tmp //= b
sum += tmp
if sum == s:
ans = b
break
if ans == '-1':
if sq.is_integer():
sq -= 1
for p in range(int(sq), 0, -1):
b = (n-s+p)/p
if b.is_integer():
b ... | Traceback (most recent call last):
File "/tmp/tmpipimz7d7/tmpgfofht6h.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s769105797 | p04014 | u915647268 | 1587822010 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3064 | 461 | n = int(input())
s = int(input())
sq = n**.5
ans = '-1'
for b in range(2, int(sq)+1):
sum = 0
tmp = n
while tmp//b != 0:
sum += tmp%b
tmp //= b
sum += tmp
if sum == s:
ans = b
break
if ans == '-1':
if sq.is_integer():
sq -= 1
for p in range(int(sq), 0, -1):
b = (n-s+p)/p
if b.is_integer():
su... | Traceback (most recent call last):
File "/tmp/tmpopfgsx5p/tmpwisnc013.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s357764175 | p04014 | u915647268 | 1587821392 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3064 | 431 | n = int(input())
s = int(input())
sq = n**.5
ans = '-1'
for b in range(2, int(sq)+1):
sum = 0
tmp = n
while tmp//b != 0:
sum += tmp%b
tmp //= b
sum += tmp
if sum == s:
ans = b
break
if ans == '-1':
if sq.is_integer():
sq -= 1
for p in range(int(sq), 0, -1):
b = int((n-s+p)/p)
sum = 0
tmp = n
... | Traceback (most recent call last):
File "/tmp/tmph0sph0ky/tmpx3rg369d.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s269254208 | p04014 | u559200744 | 1587282078 | Python | PyPy3 (2.4.0) | py | Runtime Error | 569 | 206492 | 461 | N = int(input())
S = int(input())
def f(b, n):
if n < b:
return n
else:
return f(b, int(n/b)) + (n % b)
def solve(N, S):
if N == S:
return N+1
else:
for b in range(2, int(N**(1/2))+1):
if f(b, N) == S:
return b
for p in range(1, int(N... | Traceback (most recent call last):
File "/tmp/tmpt6_9xfyr/tmp2ckgd2sd.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s559302314 | p04014 | u679154596 | 1586483999 | Python | Python (3.4.3) | py | Runtime Error | 416 | 3064 | 608 | import math
n = int(input())
s = int(input())
b = -1
def keisan(k, w):
l = []
while k >= w:
l.append(k % w)
k = k // w
else:
l.append(k)
return (sum(l))
if n == s:
b = n + 1
print(b)
exit()
if n < s:
b = -1
print(b)
exit()
n_r = math.floor(math.sqrt(n))
for i in range(2, n_r+1):... | Traceback (most recent call last):
File "/tmp/tmpsgyb2psp/tmp6epvlhs2.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s239476095 | p04014 | u939198091 | 1586402381 | Python | Python (3.4.3) | py | Runtime Error | 318 | 3948 | 462 | import math
def func(b,n):
if b > n:
return n
else:
return func(b, math.floor(n/b)) + (n % b)
def solve(n,s):
for b in range(2,math.floor(math.sqrt(n))+1):
if func(b,n) == s:
return b
for p in range(1,math.floor(math.sqrt(n))+1):
if (n-s) % p == 0:
b = int((n-s)/p)+1
if func... | Traceback (most recent call last):
File "/tmp/tmprd6rdox3/tmpg3qoq1d2.py", line 23, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s062807455 | p04014 | u939198091 | 1586402303 | Python | PyPy3 (2.4.0) | py | Runtime Error | 549 | 133724 | 462 | import math
def func(b,n):
if b > n:
return n
else:
return func(b, math.floor(n/b)) + (n % b)
def solve(n,s):
for b in range(2,math.floor(math.sqrt(n))+1):
if func(b,n) == s:
return b
for p in range(1,math.floor(math.sqrt(n))+1):
if (n-s) % p == 0:
b = int((n-s)/p)+1
if func... | Traceback (most recent call last):
File "/tmp/tmpbn_ef5ga/tmpo1l3ykr1.py", line 23, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s834202075 | p04014 | u547167033 | 1586391108 | Python | PyPy3 (2.4.0) | py | Runtime Error | 296 | 41692 | 351 | n=int(input())
s=int(input())
if s==n:
print(n+1)
exit()
def f(x):
m=n
t=[]
while m>0:
y=m%x
t.append(y)
m-=m%x
m//=x
return sum(t)
for b in range(2,int(n**0.5)+1):
if f(b)==s:
print(b)
exit()
for p in range(1,int(n**0.5)+1):
if (n-s)%p==0:
b=(n-s)//p+1
if f(b)==s:
... | Traceback (most recent call last):
File "/tmp/tmpwmz1sbwg/tmpxqmncnio.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s314470476 | p04014 | u968846084 | 1585796395 | Python | Python (3.4.3) | py | Runtime Error | 73 | 3188 | 290 | def D(n,d):
r=0
while n>0:
r=r+n%d
n=n//d
return r
n=int(input())
s=int(input())
if n-s==0:
print(n+1)
exit()
A=[]
for i in range(1,int((n-s)**(1/2))+1):
if (n-s)%i==0:
A.append(i)
for i in range(len(A)):
if D(n,A[i]+1)==s:
print(A[i]+1)
exit()
print(-1) | Traceback (most recent call last):
File "/tmp/tmp00d5icqq/tmplu5fntdi.py", line 8, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s647262625 | p04014 | u968846084 | 1585796038 | Python | Python (3.4.3) | py | Runtime Error | 72 | 3316 | 288 | def D(n,d):
r=0
while n>0:
r=r+n%d
n=n//d
return r
n=int(input())
s=int(input())
if n-s==-1:
print(n)
exit()
A=[]
for i in range(1,int((n-s)**(1/2))+3):
if (n-s)%i==0:
A.append(i)
for i in range(len(A)):
if D(n,A[i]+1)==s:
print(A[i]+1)
exit()
print(-1) | Traceback (most recent call last):
File "/tmp/tmpg1g3ye9_/tmpnbmr8qx8.py", line 8, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s815214084 | p04014 | u968846084 | 1585795793 | Python | Python (3.4.3) | py | Runtime Error | 72 | 3572 | 256 | def D(n,d):
r=0
while n>0:
r=r+n%d
n=n//d
return r
n=int(input())
s=int(input())
A=[]
for i in range(1,int((n-s)**(1/2))+3):
if (n-s)%i==0:
A.append(i)
for i in range(len(A)):
if D(n,A[i]+1)==s:
print(A[i]+1)
exit()
print(-1) | Traceback (most recent call last):
File "/tmp/tmp45ouzyet/tmpjkdguu_h.py", line 8, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s064948198 | p04014 | u893063840 | 1584018434 | Python | Python (3.4.3) | py | Runtime Error | 400 | 3936 | 472 | from math import floor, sqrt, ceil
def f(b, n):
if n < b:
return n
return f(b, floor(n / b)) + n % b
n = int(input())
s = int(input())
if n == s:
print(n + 1)
exit()
for b in range(2, floor(sqrt(n)) + 1):
if f(b, n) == s:
print(b)
exit()
for p in range(1, ceil(sqrt(n)... | Traceback (most recent call last):
File "/tmp/tmp306ncvb9/tmpep78wmei.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s729322023 | p04014 | u021916304 | 1583994651 | Python | Python (3.4.3) | py | Runtime Error | 293 | 3064 | 638 | import math
import sys
sys.setrecursionlimit(10000000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num < base:
return num
else:
return num%base + colsum(num//base,base)
#s >= n
if s == n:
print(n+1)
exit()
elif s > n:
print(-1)
exit()
#sqrt... | Traceback (most recent call last):
File "/tmp/tmpcep3t3mg/tmpth0cuwa5.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s724008870 | p04014 | u021916304 | 1583994410 | Python | Python (3.4.3) | py | Runtime Error | 1521 | 689896 | 601 | import math
import sys
sys.setrecursionlimit(10000000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num <= base:
return num
else:
return num%base + colsum(num//base,base)
#s >= n
if s == n:
print(n+1)
exit()
elif s > n:
print(-1)
exit()
#sqr... | Traceback (most recent call last):
File "/tmp/tmp429e31e1/tmpykvro_w4.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s334935543 | p04014 | u021916304 | 1583994185 | Python | Python (3.4.3) | py | Runtime Error | 1520 | 689896 | 610 | import math
import sys
sys.setrecursionlimit(10000000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num < base:
return num
else:
return num%base + colsum(num//base,base)
#s = n(n<b)
if s == n:
print(n+1)
exit()
#s > n
if s > n:
print(-1)
exit... | Traceback (most recent call last):
File "/tmp/tmpivgydwuk/tmpoxyqpkjg.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s330195988 | p04014 | u021916304 | 1583994157 | Python | Python (3.4.3) | py | Runtime Error | 1507 | 689896 | 611 | import math
import sys
sys.setrecursionlimit(10000000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num < base:
return num
else:
return num%base + colsum(num//base,base)
#s = n(n<b)
if s == n:
print(n+1)
exit()
#s > n
if s == n:
print(-1)
exi... | Traceback (most recent call last):
File "/tmp/tmpgckiq5g6/tmp3t3oxy9f.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s043086601 | p04014 | u021916304 | 1583994042 | Python | Python (3.4.3) | py | Runtime Error | 1525 | 689896 | 567 | import math
import sys
sys.setrecursionlimit(10000000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num < base:
return num
else:
return num%base + colsum(num//base,base)
#s = n(n<b)
if s == n:
print(n+1)
exit()
#sqrt(n)まで探索
for i in range(2,int(up)+... | Traceback (most recent call last):
File "/tmp/tmp2dnol7m4/tmpkr9q4ljc.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s896417956 | p04014 | u021916304 | 1583993938 | Python | Python (3.4.3) | py | Runtime Error | 1367 | 702580 | 599 | import math
import sys
sys.setrecursionlimit(10000000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num < base:
return num
else:
return num%base + colsum(num//base,base)
#s = n(n<b)
if s == n:
print(n+1)
exit()
#sqrt(n)まで探索
for i in range(2,int(up)+... | Traceback (most recent call last):
File "/tmp/tmpbs893o35/tmpuxrvlww3.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s902313146 | p04014 | u021916304 | 1583993688 | Python | Python (3.4.3) | py | Runtime Error | 481 | 95372 | 599 | import math
import sys
sys.setrecursionlimit(100000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num < base:
return num
else:
return num%base + colsum(num//base,base)
#s = n(n<b)
if s == n:
print(n+1)
exit()
#sqrt(n)まで探索
for i in range(2,int(up)+1)... | Traceback (most recent call last):
File "/tmp/tmpujjvohlg/tmpncq0g4qh.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s145141647 | p04014 | u021916304 | 1583993461 | Python | Python (3.4.3) | py | Runtime Error | 285 | 96956 | 599 | import math
import sys
sys.setrecursionlimit(100000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num < base:
return num
else:
return num%base + colsum(num//base,base)
#s = n(n<b)
if s == n:
print(n+1)
exit()
#sqrt(n)まで探索
for i in range(2,int(up)+1)... | Traceback (most recent call last):
File "/tmp/tmpgc8ui1s8/tmplvltb882.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s042131133 | p04014 | u021916304 | 1583993103 | Python | Python (3.4.3) | py | Runtime Error | 377 | 92192 | 593 | import math
import sys
sys.setrecursionlimit(100000)
n = int(input())
s = int(input())
up = math.sqrt(n)
def colsum(num, base):
if num < base:
return num
else:
return colsum(math.floor(num/base),base)+num%base
#s = n
if s == n:
print(n+1)
exit()
#sqrt(n)まで探索
for i in range(2,int(up... | Traceback (most recent call last):
File "/tmp/tmpcltlwcv3/tmp764zofyu.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s726598110 | p04014 | u237316771 | 1582396201 | Python | Python (3.4.3) | py | Runtime Error | 324 | 3912 | 862 | #!/usr/bin/env python3
import sys
def f(b: int, n: int) -> int:
if n < b:
return n
return f(b, n // b) + n % b
def solve(n: int, s: int):
for b in range(2, int(n ** 0.5) + 1):
if f(b, n) == s:
print(b)
return
for p in reversed(range(int(n ** 0.5))):
q ... | Traceback (most recent call last):
File "/tmp/tmp_hjbul9z/tmp7uxflf1j.py", line 42, in <module>
main()
File "/tmp/tmp_hjbul9z/tmp7uxflf1j.py", line 36, in main
n = int(next(tokens)) # type: int
^^^^^^^^^^^^
StopIteration
| |
s538372789 | p04014 | u237316771 | 1582396025 | Python | Python (3.4.3) | py | Runtime Error | 323 | 3940 | 844 | #!/usr/bin/env python3
import sys
def f(b: int, n: int) -> int:
if n < b:
return n
return f(b, n // b) + n % b
def solve(n: int, s: int):
for b in range(2, int(n ** 0.5) + 1):
if f(b, n) == s:
print(b)
return
for p in reversed(range(int(n ** 0.5))):
q ... | Traceback (most recent call last):
File "/tmp/tmpsb3hwnyd/tmp0n0hjxtx.py", line 42, in <module>
main()
File "/tmp/tmpsb3hwnyd/tmp0n0hjxtx.py", line 36, in main
n = int(next(tokens)) # type: int
^^^^^^^^^^^^
StopIteration
| |
s404702083 | p04014 | u627600101 | 1582154150 | Python | Python (3.4.3) | py | Runtime Error | 649 | 3188 | 717 | n=int(input())
s=int(input())
No=0
if n==s:
print(n+1)
No =1
else:
for b in range(2,int(n**0.5)+2):
m=0
N=n
while N!=0:
m+=N%b
N=N//b
if m>s:
break
if m==s:
print(b)
No=1
exit()
f... | Traceback (most recent call last):
File "/tmp/tmpfxkb7j7e/tmp3cayho3t.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s934811110 | p04014 | u627600101 | 1582153743 | Python | Python (3.4.3) | py | Runtime Error | 632 | 3188 | 717 | n=int(input())
s=int(input())
No=0
if n==s:
print(n+1)
No =1
else:
for b in range(2,int(n**0.5)+1):
m=0
N=n
while N!=0:
m+=N%b
N=N//b
if m>s:
break
if m==s:
print(b)
No=1
exit()
f... | Traceback (most recent call last):
File "/tmp/tmphemg_upn/tmpudgbxf4n.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s028099006 | p04014 | u628976407 | 1580943817 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3056 | 152 | def Base_10_to_n(X, n):
if (int(X/n)):
return Base_10_to_n(int(X/n), n)+str(X%n)
return str(X%n)
print(Base_10_to_n(input(),input())) | Traceback (most recent call last):
File "/tmp/tmpnho360t8/tmpxgb1j5nb.py", line 6, in <module>
print(Base_10_to_n(input(),input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s529363230 | p04014 | u788137651 | 1580351443 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 66136 | 1861 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,default... | Traceback (most recent call last):
File "/tmp/tmpxcvvtfy0/tmp6dx8iaj7.py", line 21, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
| |
s585992966 | p04014 | u788137651 | 1580349618 | Python | PyPy3 (2.4.0) | py | Runtime Error | 376 | 66064 | 2072 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,default... | Traceback (most recent call last):
File "/tmp/tmp1qkqevrg/tmp5qktawa2.py", line 21, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
| |
s550892449 | p04014 | u788137651 | 1580349588 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2108 | 67552 | 2052 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,default... | Traceback (most recent call last):
File "/tmp/tmpr9t8pydo/tmpeu2o7p6f.py", line 21, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
| |
s983161477 | p04014 | u892538842 | 1577414896 | Python | Python (3.4.3) | py | Runtime Error | 510 | 3960 | 460 | import math
def f(b, n):
if n < b:
return n
else:
return f(b, n // b) + n % b
n = int(input())
s = int(input())
def find_b(n, s):
if n == s:
return -1
p = int(math.sqrt(n))
i = 2
while i < (n-s)/p + 1:
if f(i, n) == s:
return i
i += 1
... | Traceback (most recent call last):
File "/tmp/tmpcxpa9zmk/tmpp6h9gjd_.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s989968993 | p04014 | u892538842 | 1577414714 | Python | Python (3.4.3) | py | Runtime Error | 528 | 3964 | 427 | import math
def f(b, n):
if n < b:
return n
else:
return f(b, n // b) + n % b
n = int(input())
s = int(input())
def find_b(n, s):
p = int(math.sqrt(n))
i = 2
while i < (n-s)/p + 1:
if f(i, n) == s:
return i
i += 1
while p >= 1:
b = int((n... | Traceback (most recent call last):
File "/tmp/tmpvcke5tkj/tmp9omyvksg.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s787759852 | p04014 | u906428167 | 1577397718 | Python | PyPy3 (2.4.0) | py | Runtime Error | 324 | 42140 | 500 | n = int(input())
s = int(input())
ans = float('inf')
for b in range(2, 10**6):
res = n
tmp = 0
while res > 0:
tmp += res % b
res = (res-res % b)//b
if tmp == s:
ans = min(ans, b)
if n < 10**6:
print(ans if ans != float('inf') else -1)
exit()
for p in range(1, 10**6):
... | Traceback (most recent call last):
File "/tmp/tmpthxbcyu6/tmpx7gjryfh.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s033708855 | p04014 | u905582793 | 1577204998 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 62 | n,s=int(input())
if n*2<=s+1:
print(s-n+1)
else:
print(-1) | Traceback (most recent call last):
File "/tmp/tmpqvzkcuyg/tmpk8f2tzgz.py", line 1, in <module>
n,s=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s734665465 | p04014 | u141786930 | 1576385515 | Python | Python (3.4.3) | py | Runtime Error | 599 | 4056 | 458 | import math
n = int(input())
s = int(input())
ans = -1
def func(b, n):
if n < b:
return n
else:
return func(b, n//b) + n%b
if n < s:
ans = -1
elif n == s:
ans = n+1
else:
for b in range(2,int(math.sqrt(n))):
if func(b, n) == s:
ans = b
break
if ans =... | Traceback (most recent call last):
File "/tmp/tmpjzg411li/tmpm1ae27f0.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s109418030 | p04014 | u141786930 | 1576385345 | Python | Python (3.4.3) | py | Runtime Error | 220 | 3944 | 458 | import math
n = int(input())
s = int(input())
ans = -1
def func(b, n):
if n < b:
return n
else:
return func(b, n//b) + n%b
if n > s:
ans = -1
elif n == s:
ans = n+1
else:
for b in range(2,int(math.sqrt(n))):
if func(b, n) == s:
ans = b
break
if ans =... | Traceback (most recent call last):
File "/tmp/tmpbhr37iwj/tmpe5xa8x2c.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s435239683 | p04014 | u440566786 | 1575120738 | Python | PyPy3 (2.4.0) | py | Runtime Error | 211 | 41456 | 654 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def f(b,n):
if(n<b): return n
return f(b,n//b)+n%b
def resolve():
n=int(input())
s=int(input())
if(s>n):
print(-1)
return
if(s==n):
print(n+1)
... | Traceback (most recent call last):
File "/tmp/tmpc96bymy5/tmp425ajy2y.py", line 38, in <module>
resolve()
File "/tmp/tmpc96bymy5/tmp425ajy2y.py", line 12, in resolve
n=int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s895197228 | p04014 | u912115033 | 1574025212 | Python | Python (3.4.3) | py | Runtime Error | 289 | 3952 | 581 | def f(p, q):
if q < p:
return q
else:
return f(p, q//p) + q%p
n = int(input())
s = int(input())
flag = 0
if n < s:
print(-1)
flag = 1
if flag == 0 and n == s:
print(n+1)
flag = 0
if flag == 0:
for i in range(2, int(n**0.5)+2):
if f(i, n) == s:
print(i)
... | Traceback (most recent call last):
File "/tmp/tmp0nfhyyg9/tmpov9z7btc.py", line 7, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s007057864 | p04014 | u912115033 | 1574024700 | Python | Python (3.4.3) | py | Runtime Error | 280 | 3956 | 529 | def f(p, q):
if q < p:
return q
else:
return f(p, q//p) + q%p
n = int(input())
s = int(input())
flag = 0
if n < s:
print(-1)
flag = 1
if flag == 0:
for i in range(2, int(n**0.5)+2):
if f(i, n) == s:
print(i)
flag = 1
break
if flag == 0:
... | Traceback (most recent call last):
File "/tmp/tmpanexfeqz/tmptqlycj37.py", line 7, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s407969608 | p04014 | u912115033 | 1574024348 | Python | Python (3.4.3) | py | Runtime Error | 283 | 3948 | 562 | def f(p, q):
if q < p:
return q
else:
return f(p, q//p) + q%p
n = int(input())
s = int(input())
flag = 0
if s == 1:
print(n)
flag=1
if n == 1:
print(-1)
flag=1
if flag == 0:
for i in range(2, int(n**0.5)+2):
if f(i, n) == s:
print(i)
flag = 1
... | Traceback (most recent call last):
File "/tmp/tmplypex2rw/tmpjwfbwpsa.py", line 7, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s460886565 | p04014 | u912115033 | 1574023890 | Python | Python (3.4.3) | py | Runtime Error | 289 | 4068 | 528 | def f(p, q):
if q < p:
return q
else:
return f(p, q//p) + q%p
n = int(input())
s = int(input())
flag = 0
if s == 1:
print(n)
flag=1
if n == 1:
print(-1)
flag=1
for i in range(2, int(n**0.5)+2):
if f(i, n) == s:
print(i)
flag = 1
break
if flag == 0:
... | Traceback (most recent call last):
File "/tmp/tmpdjdga_bl/tmpwphr5ptr.py", line 7, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s784972379 | p04014 | u606878291 | 1573413699 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 766 | import math
def digit_sum(b, n):
if b > n:
return n
else:
return digit_sum(b=b, n=n // b) + n % b
def main(n, s):
if s > n:
return -1
elif n == s:
return n + 1
else:
sqrt_n = int(math.sqrt(n))
for b in range(2, sqrt_n + 1):
if digit_sum... | File "/tmp/tmptdeefe4r/tmpg1u53674.py", line 21
b_min = 1L << 55
^
SyntaxError: invalid decimal literal
| |
s552194483 | p04014 | u606878291 | 1573411759 | Python | Python (3.4.3) | py | Runtime Error | 426 | 3064 | 639 | import math
def digit_sum(b, n):
if b > n:
return n
else:
return digit_sum(b=b, n=n // b) + n % b
def main(n, s):
if n == s:
return n + 1
elif s == 1:
return n
elif s > n:
return -1
else:
sqrt_n = int(math.sqrt(n))
for b in range(2, sqr... | Traceback (most recent call last):
File "/tmp/tmpb5okfuhi/tmpl234trdm.py", line 31, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s111596999 | p04014 | u638795007 | 1573282952 | Python | PyPy3 (2.4.0) | py | Runtime Error | 218 | 40300 | 816 | def examD():
n = I(); s = I()
ans = -1
if s==n:
ans = n+1
else:
loop = int(n**(0.5))
for b in range(2,loop+1):
cur = n
ansC = 0
while cur>0:
ansC += cur%b
cur = cur//b
if ansC==s:
ans ... | Traceback (most recent call last):
File "/tmp/tmp13zjooqq/tmpmpfhxm24.py", line 34, in <module>
examD()
File "/tmp/tmp13zjooqq/tmpmpfhxm24.py", line 2, in examD
n = I(); s = I()
^^^
File "/tmp/tmp13zjooqq/tmpmpfhxm24.py", line 27, in I
def I(): return int(sys.stdin.readline())
... | |
s089935146 | p04014 | u638795007 | 1573282556 | Python | PyPy3 (2.4.0) | py | Runtime Error | 254 | 41308 | 814 | def examD():
n = I(); s = I()
ans = -1
if s==n:
ans = n+1
else:
loop = int(n**(0.5))
for i in range(2,loop+1):
cur = n
ansC = 0
while cur>0:
ansC += cur%i
cur = cur//i
if ansC==s:
ans ... | Traceback (most recent call last):
File "/tmp/tmppf0xbhu0/tmpjet5ho11.py", line 34, in <module>
examD()
File "/tmp/tmppf0xbhu0/tmpjet5ho11.py", line 2, in examD
n = I(); s = I()
^^^
File "/tmp/tmppf0xbhu0/tmpjet5ho11.py", line 27, in I
def I(): return int(sys.stdin.readline())
... | |
s504244994 | p04014 | u638795007 | 1573281910 | Python | PyPy3 (2.4.0) | py | Runtime Error | 254 | 41180 | 818 | def examD():
n = I(); s = I()
ans = -1
if s==n:
ans = n+1
else:
loop = int(n**(0.5))
for i in range(2,loop+1):
cur = n
ansC = int(0)
while cur>0:
ansC += cur%i
cur = cur//i
if ansC==s:
... | Traceback (most recent call last):
File "/tmp/tmpcrrozlqm/tmp_pvwu_fx.py", line 34, in <module>
examD()
File "/tmp/tmpcrrozlqm/tmp_pvwu_fx.py", line 2, in examD
n = I(); s = I()
^^^
File "/tmp/tmpcrrozlqm/tmp_pvwu_fx.py", line 27, in I
def I(): return int(sys.stdin.readline())
... | |
s363652002 | p04014 | u143278390 | 1572745194 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4028 | 864 | import math
import sys
import math
n=int(input())
s=int(input())
def f(b,n):
if(n<b):
return n
else:
return f(b,math.floor(n/b))+ n%b
if(s==n):
print(n+1)
sys.exit()
for b in range(2,int(math.sqrt(n))):
if(f(b,n)==s):
print(b)
sys.exit()
for b in range(int(mat... | Traceback (most recent call last):
File "/tmp/tmp67657l7k/tmptqe83sd0.py", line 5, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s137055222 | p04014 | u143278390 | 1572744494 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3964 | 402 | import math
import sys
import math
n=int(input())
s=int(input())
def f(b,n):
if(n<b):
return n
else:
return f(b,math.floor(n/b))+ n%b
if(s==n):
print(n+1)
sys.exit()
for b in range(2,int(math.sqrt(n))):
if(f(b,n)==s):
print(b)
sys.exit()
for b in range(int(mat... | Traceback (most recent call last):
File "/tmp/tmpohuixz0h/tmp9x5cdpzy.py", line 5, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s877399483 | p04014 | u190086340 | 1572635782 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2111 | 531408 | 684 | import math
def f(n, base):
X_dumy = base
lis = []
while X_dumy > 0:
lis.append(X_dumy % n)
X_dumy = X_dumy // n
return sum(lis)
def solve():
N, S = int(input()), int(input())
# print(N, S)
if N == S:
return N + 1
for b in range(2, int(math.sqrt(N)) + 1... | Traceback (most recent call last):
File "/tmp/tmpoq3fpbe2/tmp3x1uxoro.py", line 38, in <module>
res = solve()
^^^^^^^
File "/tmp/tmpoq3fpbe2/tmp3x1uxoro.py", line 14, in solve
N, S = int(input()), int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s646662521 | p04014 | u190086340 | 1572635536 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 592660 | 679 | import math
def f(n, base):
X_dumy = base
lis = []
while X_dumy > 0:
lis.append(X_dumy % n)
X_dumy = int(X_dumy / n)
return sum(lis)
def solve():
N, S = int(input()), int(input())
# print(N, S)
if N == S:
return N + 1
for b in range(2, int(math.sqrt(N)) + 1)... | Traceback (most recent call last):
File "/tmp/tmp8dlub1vs/tmpdjzmwf3a.py", line 38, in <module>
res = solve()
^^^^^^^
File "/tmp/tmp8dlub1vs/tmpdjzmwf3a.py", line 14, in solve
N, S = int(input()), int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s664112753 | p04014 | u190086340 | 1572634456 | Python | PyPy3 (2.4.0) | py | Runtime Error | 299 | 44892 | 852 | import math
def f(base, n):
# 10進数 n を, base 進数に変換して各桁を足し合わせる
lis = []
while n > 0:
# print('除', n // base, 'あまり', n % base)
lis.append(n % base)
n = n // base
return sum(lis)
def solve():
N, S = int(input()), int(input())
# print(N, S)
if N == S:
return... | Traceback (most recent call last):
File "/tmp/tmpbnepfl59/tmp6kxkcqb9.py", line 41, in <module>
res = solve()
^^^^^^^
File "/tmp/tmpbnepfl59/tmp6kxkcqb9.py", line 15, in solve
N, S = int(input()), int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s093246538 | p04014 | u190086340 | 1572633744 | Python | PyPy3 (2.4.0) | py | Runtime Error | 284 | 43740 | 850 | import math
def f(base, n):
# 10進数 n を, base 進数に変換して各桁を足し合わせる
lis = []
while n > 0:
# print('除', n // base, 'あまり', n % base)
lis.append(n % base)
n = n // base
return sum(lis)
def solve():
N, S = int(input()), int(input())
# print(N, S)
if N == S:
return ... | Traceback (most recent call last):
File "/tmp/tmpw279edik/tmp222x_qa9.py", line 40, in <module>
res = solve()
^^^^^^^
File "/tmp/tmpw279edik/tmp222x_qa9.py", line 14, in solve
N, S = int(input()), int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s075604327 | p04014 | u190086340 | 1572633298 | Python | PyPy3 (2.4.0) | py | Runtime Error | 281 | 43228 | 838 | import math
def f(base, n):
# 10進数 n を, base 進数に変換して各桁を足し合わせる
lis = []
while n > 0:
# print('除', n // base, 'あまり', n % base)
lis.append(n % base)
n = n // base
return sum(lis)
def solve():
N, S = int(input()), int(input())
# print(N, S)
if N == S:
return ... | Traceback (most recent call last):
File "/tmp/tmpuhcxffud/tmp_b1q4i36.py", line 41, in <module>
res = solve()
^^^^^^^
File "/tmp/tmpuhcxffud/tmp_b1q4i36.py", line 15, in solve
N, S = int(input()), int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s683508850 | p04014 | u190086340 | 1572464822 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 385 | import math
def solve():
N, S = int(input()), int(input())
# print(N, S)
floor = math.floor
def f(b, n):
if n < b:
return n
if n >= b:
return f(b, floor(n / b)) + (n % b)
for b in range(2, N):
if f(b, N) == S:
return b
return -... | Traceback (most recent call last):
File "/tmp/tmpkz5b0tld/tmpe8plz40g.py", line 23, in <module>
res = oracle()
^^^^^^
NameError: name 'oracle' is not defined
| |
s016716029 | p04014 | u474423089 | 1570676359 | Python | Python (3.4.3) | py | Runtime Error | 406 | 3964 | 513 | import math
def f(b,n):
if n<b:
return n
return f(b,n//b)+n%b
def main():
n=int(input())
s=int(input())
if n==s:
return n+1
elif n <s:
return -1
else:
for b in range(2,int(math.sqrt(n))+2):
if f(b,n)==s:
print(b)
ex... | Traceback (most recent call last):
File "/tmp/tmp4co_uvjq/tmpcbzvn7xj.py", line 26, in <module>
print(main())
^^^^^^
File "/tmp/tmp4co_uvjq/tmpcbzvn7xj.py", line 8, in main
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s198008203 | p04014 | u474423089 | 1570676153 | Python | Python (3.4.3) | py | Runtime Error | 435 | 3960 | 562 | import math
def f(b,n):
if n<b:
return n
return f(b,n//b)+n%b
def main():
n=int(input())
s=int(input())
if n==s:
print(n+1)
exit()
elif n <s:
print(-1)
exit()
else:
for b in range(2,int(math.sqrt(n))+2):
if f(b,n)==s:
... | Traceback (most recent call last):
File "/tmp/tmpixsbjbq0/tmpby9ki0io.py", line 29, in <module>
main()
File "/tmp/tmpixsbjbq0/tmpby9ki0io.py", line 8, in main
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s504223492 | p04014 | u474423089 | 1570676059 | Python | Python (3.4.3) | py | Runtime Error | 430 | 3964 | 564 | import math
def f(b,n):
if n<b:
return n
return f(b,n//b)+n%b
def main():
n=int(input())
s=int(input())
if n==s:
print(n+1)
exit()
elif n <s:
print(-1)
exit()
else:
for b in range(2,int(math.sqrt(n))+2):
if f(b,n)==s:
... | Traceback (most recent call last):
File "/tmp/tmp_xjid4q1/tmpsvd88i34.py", line 29, in <module>
main()
File "/tmp/tmp_xjid4q1/tmpsvd88i34.py", line 8, in main
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s162531902 | p04014 | u701199820 | 1569781929 | Python | PyPy3 (2.4.0) | py | Runtime Error | 331 | 52720 | 417 | import math
n = int(input())
s = int(input())
ans = -1
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n%b
if n == s: ans = n+1
for i in range(2, int(math.sqrt(n))+1):
if f(i, n) == s:
ans = i
break
if ans == -1:
for i in range(int(math.sqrt(n)), 0, -1):
... | Traceback (most recent call last):
File "/tmp/tmp1dpszk6j/tmpok61vj08.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s070495676 | p04014 | u404794295 | 1569327357 | Python | Python (3.4.3) | py | Runtime Error | 759 | 4036 | 353 | n=int(input())
s=int(input())
a="-1"
def f(b,n):
if n<b:
return n
else:
return f(b,n//b)+n%b
if n==s:
a=n+1
i=2
while 0<=i<=n**(1/2):
if f(i,n)==s:
a=i
break
i+=1
if a=="-1":
for p in range(1,int(n**(1/2))):
b=(n-s)/p+1
if f(b,n)==s:
a=... | Traceback (most recent call last):
File "/tmp/tmpa21imsd9/tmph91lm02_.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s092541786 | p04014 | u141610915 | 1568874696 | Python | Python (3.4.3) | py | Runtime Error | 485 | 3912 | 741 | import math
#平方オーダーなら収まるので平方根とって方針を分ける
n = int(input())
s = int(input())
if n == s:
print(n + 1)
exit(0)
def sqrt(k):
return int(math.sqrt(k))
def digitsum(b, m):
if m < b:
return m
return digitsum(b, m // b) + m % b
#√nより小さいなら
#全探索余裕 桁は多くて40程度なので
for b in range(2, sqrt(n) + 1):
if digitsum(b, n) == s:
... | Traceback (most recent call last):
File "/tmp/tmply2v1l52/tmpfpdduhwd.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s883597439 | p04014 | u141610915 | 1568874548 | Python | Python (3.4.3) | py | Runtime Error | 286 | 3912 | 806 | import math
#平方オーダーなら収まるので平方根とって方針を分ける
n = int(input())
s = int(input())
if s == 1:
print(n)
exit(0)
if n == s:
print(n + 1)
exit(0)
def sqrt(k):
return int(math.sqrt(k))
def digitsum(b, m):
if m < b:
return m
return digitsum(b, m // b) + m % b
#√nより小さいなら
#全探索余裕 桁は多くて40程度なので
for b in range(2, sqrt(n) ... | Traceback (most recent call last):
File "/tmp/tmpk7y8zjga/tmph689phup.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s874584943 | p04014 | u141610915 | 1568874220 | Python | Python (3.4.3) | py | Runtime Error | 285 | 3948 | 746 | import math
#平方オーダーなら収まるので平方根とって方針を分ける
n = int(input())
s = int(input())
if s == 1:
print(n)
exit(0)
def sqrt(k):
return int(math.sqrt(k))
def digitsum(b, m):
if m < b:
return m
return digitsum(b, m // b) + m % b
#√nより小さいなら
#全探索余裕 桁は多くて40程度なので
for b in range(2, sqrt(n) + 1):
if digitsum(b, n) == s:
... | Traceback (most recent call last):
File "/tmp/tmpgmbuvg95/tmp8kskfysp.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s631845851 | p04014 | u993161647 | 1568082573 | Python | Python (3.4.3) | py | Runtime Error | 526 | 3964 | 515 | import sys, math
n = int(input())
s = int(input())
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n % b
if s == n:
print(n + 1)
sys.exit()
elif s > n:
print('-1')
sys.exit()
sqrt_n = math.floor(math.sqrt(n))
for b in range(2, sqrt_n + 1):
if f(b, n) == s:
... | Traceback (most recent call last):
File "/tmp/tmpg6mq29se/tmp8_h_7vuh.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s859679089 | p04014 | u993161647 | 1568082209 | Python | Python (3.4.3) | py | Runtime Error | 831 | 3960 | 538 | import sys, math
n = int(input())
s = int(input())
def f(b, n):
if n < b:
return n
else:
return f(b, math.floor(n/b)) + n % b
if s == n:
print(n + 1)
sys.exit()
elif s > n:
print('-1')
sys.exit()
for b in range(2, math.floor(math.sqrt(n))+1):
if f(b, n) == s:
prin... | Traceback (most recent call last):
File "/tmp/tmp4vcnd_mg/tmpn90y0ohe.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s407184943 | p04014 | u792670114 | 1567738655 | Python | Python (3.4.3) | py | Runtime Error | 365 | 3064 | 452 | n = int(input())
s = int(input())
def sub(n, b):
r = 0
while n > 0:
r += n%b
n = n//b
return r
if s == n:
b = n+1
print(b)
exit()
for b in range(2, n+1):
if b*b > n:
break
s2 = sub(n, b)
if s2 == s:
print(b)
exit()
bs = []
for p in range(1, n+1):
if p*p > n:
break
if (n-s)%... | Traceback (most recent call last):
File "/tmp/tmpibku6_0u/tmpg3cabldm.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s570000607 | p04014 | u792670114 | 1567738505 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 16364 | 429 | n = int(input())
s = int(input())
def sub(n, b):
r = 0
while n > 0:
r += n%b
n = n//b
return r
if s == n:
b = n+1
print(b)
exit()
for b in range(2, n+1):
if b*b > n:
break
s2 = sub(n, b)
if s2 == s:
print(b)
exit()
bs = []
for p in range(1, n+1):
if p*p > n:
break
b = (n-s)... | Traceback (most recent call last):
File "/tmp/tmp58gwpw6l/tmpw2mxhi8k.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s288002977 | p04014 | u594956556 | 1566872723 | Python | Python (3.4.3) | py | Runtime Error | 430 | 3188 | 309 | n=int(input())
s=int(input())
if n==s:
print(n+1)
exit()
for b in range(2,int(n**(1/2)+1)):
m=n
wa=0
while m>0:
wa+=m%b
m=m//b
if wa==s:
print(b)
exit()
for p in range(int(n**(1/2)),0,-1):
if (n-s)%p==0:
b=(n-s)//p+1
if p+n%b==s:
print(b)
exit()
print('-1')
| Traceback (most recent call last):
File "/tmp/tmp9i4lvb3y/tmpho3ctiyi.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s217376341 | p04014 | u594956556 | 1566872176 | Python | Python (3.4.3) | py | Runtime Error | 406 | 3188 | 309 | n=int(input())
s=int(input())
if n==s:
print(n+1)
exit()
for b in range(2,int(n**(1/2))+1):
m=n
wa=0
while m>0:
wa+=m%b
m=m//b
if wa==s:
print(b)
exit()
for p in range(int(n**(1/2)),0,-1):
if (n-s)%p==0:
b=(n-s)//p+1
if p+n%b==s:
print(b)
exit()
print(-1) | Traceback (most recent call last):
File "/tmp/tmp3qd6vnav/tmpuq3qjjy6.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s249243122 | p04014 | u842689614 | 1566167254 | Python | Python (3.4.3) | py | Runtime Error | 765 | 3188 | 345 | n=int(input())
s=int(input())
b_ans=1
for b in range(2,int(n**0.5)+1):
nn=n
st=[]
while(nn>0):
st.append(nn%b)
nn=(nn-st[-1])/b
if sum(st)==s:
b_ans=b
break
if b_ans==1:
for p in range(int(n**0.5)):
b=int(n/p)
q=n-p*b
if s==p+q:
b_ans=b
break
if b_ans!=1:
print... | Traceback (most recent call last):
File "/tmp/tmpwo8ybylk/tmp9cbw9aed.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s947339825 | p04014 | u392319141 | 1566149717 | Python | PyPy3 (2.4.0) | py | Runtime Error | 584 | 205724 | 540 | def sol():
N = int(input())
S = int(input())
if N == S:
print(N + 1)
return
def digitSum(n, b):
if b < 0:
return -1
if n < b:
return n
return digitSum(n // b, b) + n % b
for b in range(2, int(N**0.5 + 10)):
if digitSum(N, b) ... | Traceback (most recent call last):
File "/tmp/tmpx2_fsia_/tmpauj_yjhu.py", line 27, in <module>
sol()
File "/tmp/tmpx2_fsia_/tmpauj_yjhu.py", line 2, in sol
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s649925220 | p04014 | u423585790 | 1565209467 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2202 | 1467292 | 3028 | #!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): re... | Traceback (most recent call last):
File "/tmp/tmpm4wwcgfx/tmp43c7e0co.py", line 118, in <module>
D()
File "/tmp/tmpm4wwcgfx/tmp43c7e0co.py", line 99, in D
n, s = IR(2)
^^^^^
File "/tmp/tmpm4wwcgfx/tmp43c7e0co.py", line 21, in IR
def IR(n): return [II() for _ in range(n)]
... | |
s332776176 | p04014 | u584174687 | 1564844490 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2106 | 41980 | 627 |
import sys
def check(num, s, b):
sum_keta = 0
while num > 0:
sum_keta += num % b
num //= b
if sum_keta == s:
return 1
else:
return 0
def main():
num = int(input())
s = int(input())
if num == s:
print(num + 1)
sys.exit()
for b in rang... | Traceback (most recent call last):
File "/tmp/tmpwdapreex/tmpduh1mgfw.py", line 43, in <module>
main()
File "/tmp/tmpwdapreex/tmpduh1mgfw.py", line 17, in main
num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s309158611 | p04014 | u263830634 | 1561496303 | Python | Python (3.4.3) | py | Runtime Error | 464 | 95384 | 565 | import math
import sys
sys.setrecursionlimit(10**5)
n = int(input())
s = int(input())
if n < s:
print (-1)
exit()
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n%b
if s == n:
print (n+1)
exit()
if n == 1:
print (-1)
exit()
for i in range(2, int(math.sqrt(... | Traceback (most recent call last):
File "/tmp/tmp69c7n3z9/tmpg552nv9c.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s140317142 | p04014 | u263830634 | 1561494208 | Python | Python (3.4.3) | py | Runtime Error | 459 | 95392 | 508 | import math
import sys
sys.setrecursionlimit(10**5)
n = int(input())
s = int(input())
if n < s:
print (-1)
exit()
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n%b
if s == n:
print (n+1)
exit()
if n == 1:
print (-1)
exit()
for i in range(2, int(math.sqrt(... | Traceback (most recent call last):
File "/tmp/tmpow04vm1a/tmpuzauezry.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s985992796 | p04014 | u263830634 | 1561494066 | Python | Python (3.4.3) | py | Runtime Error | 454 | 4084 | 468 | import math
n = int(input())
s = int(input())
if n < s:
print (-1)
exit()
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n%b
if s == n:
print (n+1)
exit()
if n == 1:
print (-1)
exit()
for i in range(2, int(math.sqrt(n))+2):
if f(i, n) == s:
pri... | Traceback (most recent call last):
File "/tmp/tmp_fbfbuts/tmpl39e6zyf.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s381351015 | p04014 | u263830634 | 1561493788 | Python | Python (3.4.3) | py | Runtime Error | 459 | 3964 | 431 | import math
n = int(input())
s = int(input())
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n%b
if s == n:
print (n+1)
exit()
if n == 1:
print (-1)
exit()
for i in range(2, int(math.sqrt(n))+2):
if f(i, n) == s:
print (i)
exit()
for p in range... | Traceback (most recent call last):
File "/tmp/tmpfzy2oxhx/tmpde7qmhka.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s461586942 | p04014 | u163320134 | 1561247599 | Python | Python (3.4.3) | py | Runtime Error | 451 | 3956 | 434 | def f(b,n):
if b>n:
return n
else:
return f(b,n//b)+n%b
n=int(input())
s=int(input())
if s>n:
print(-1)
elif s==n:
print(n+1)
else:
ans=0
for i in range(2,int(n**0.5)+1):
if f(i,n)==s:
ans=i
break
if ans!=0:
print(ans)
else:
for i in range(1,int(n**0.5)+1):
tb=(n-s... | Traceback (most recent call last):
File "/tmp/tmpo_ubkcd4/tmphg_3b0l2.py", line 7, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s416486502 | p04014 | u163320134 | 1561247243 | Python | Python (3.4.3) | py | Runtime Error | 454 | 3952 | 412 | def f(b,n):
if b>n:
return n
else:
return f(b,n//b)+n%b
n=int(input())
s=int(input())
if s==n:
print(n+1)
else:
ans=0
for i in range(2,int(n**0.5)+1):
if f(i,n)==s:
ans=i
break
if ans!=0:
print(ans)
else:
for i in range(1,int(n**0.5)+1):
tb=(n-s)//i+1
if f(tb,n... | Traceback (most recent call last):
File "/tmp/tmporv63qgb/tmp0wv4j41v.py", line 7, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s887889770 | p04014 | u155024797 | 1557974191 | Python | PyPy3 (2.4.0) | py | Runtime Error | 531 | 207004 | 662 | import math
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n % b
def main():
n = int(input())
s = int(input())
if s == 1:
print(n)
return
elif s == n:
print(n+1)
return
elif s > n:
print(-1)
return
sqrt = int(... | Traceback (most recent call last):
File "/tmp/tmp04pin31s/tmpfl8l5iui.py", line 40, in <module>
main()
File "/tmp/tmp04pin31s/tmpfl8l5iui.py", line 12, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s265804490 | p04014 | u155024797 | 1557614067 | Python | PyPy3 (2.4.0) | py | Runtime Error | 340 | 52976 | 664 | import math
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n % b
def main():
n = int(input())
s = int(input())
if s == 1:
print(n)
return
elif s == n:
print(n+1)
return
elif s > n:
print(-1)
return
sqrt = -int... | Traceback (most recent call last):
File "/tmp/tmphykpmtke/tmpsgn2xav5.py", line 40, in <module>
main()
File "/tmp/tmphykpmtke/tmpsgn2xav5.py", line 12, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s649515857 | p04014 | u155024797 | 1557613934 | Python | PyPy3 (2.4.0) | py | Runtime Error | 342 | 52976 | 664 | import math
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n % b
def main():
n = int(input())
s = int(input())
if s == 1:
print(n)
return
elif s == n:
print(n+1)
return
elif s > n:
print(-1)
return
sqrt = -int... | Traceback (most recent call last):
File "/tmp/tmpqritamuu/tmpsusg3ykf.py", line 40, in <module>
main()
File "/tmp/tmpqritamuu/tmpsusg3ykf.py", line 12, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s126984816 | p04014 | u619458041 | 1556074739 | Python | Python (3.4.3) | py | Runtime Error | 433 | 3948 | 467 | import sys
def f(b, n):
if b > n:
return n
return f(b, n//b) + n % b
def main():
input = sys.stdin.readline
n = int(input())
s = int(input())
if s == n:
return n+1
for i in range(2, int(n**0.5)):
if f(i, n) == s:
return i
for p in range(1, int(... | Traceback (most recent call last):
File "/tmp/tmpf423ewti/tmpyfxgzqii.py", line 32, in <module>
print(main())
^^^^^^
File "/tmp/tmpf423ewti/tmpyfxgzqii.py", line 12, in main
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s397455249 | p04014 | u619458041 | 1556074624 | Python | Python (3.4.3) | py | Runtime Error | 231 | 3064 | 431 | import sys
def f(b, n):
if b > n:
return n
return f(b, n//b) + n % b
def main():
input = sys.stdin.readline
n = int(input())
s = int(input())
if s == n:
return n+1
for i in range(2, int(n**0.5)):
if f(i, n) == s:
return i
b = (n - s) // p + 1
... | Traceback (most recent call last):
File "/tmp/tmpza0tu2ch/tmpafodnxas.py", line 30, in <module>
print(main())
^^^^^^
File "/tmp/tmpza0tu2ch/tmpafodnxas.py", line 12, in main
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s260792398 | p04014 | u155024797 | 1554958809 | Python | PyPy3 (2.4.0) | py | Runtime Error | 553 | 209052 | 561 | def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n % b
def main():
n = int(input())
s = int(input())
if s == 1:
print(n)
return
elif s > n:
print(-1)
return
b = 2
while b * b <= n:
if f(b, n) == s:
print(b)
... | Traceback (most recent call last):
File "/tmp/tmpkw_nb4on/tmpk2spgdw4.py", line 35, in <module>
main()
File "/tmp/tmpkw_nb4on/tmpk2spgdw4.py", line 9, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s580855953 | p04014 | u425287928 | 1553954872 | Python | Python (3.4.3) | py | Runtime Error | 460 | 3948 | 333 | n=int(input())
s=int(input())
def f(b,n):
if n < b:
return n
else:
return f(b,n//b)+n%b
ans=-1
if s>n:
pass
elif s==n:
ans=n+1
else:
for _b in range(2,int(n**0.5)+1):
if f(_b,n)==s:
ans=_b
break
if ans==-1:
for _p in range(1,int(n**0.5)+1):
_b = (n-s)//_p+1
if f(_b,n)==s:
ans=_b
bre... | Traceback (most recent call last):
File "/tmp/tmp13f_i_gu/tmpkxxkaynn.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s589537272 | p04014 | u585482323 | 1551650411 | Python | PyPy3 (2.4.0) | py | Runtime Error | 279 | 40940 | 1721 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): ... | Traceback (most recent call last):
File "/tmp/tmpm31aqtoa/tmpypcuhwts.py", line 64, in <module>
n,s = IR(2)
^^^^^
File "/tmp/tmpm31aqtoa/tmpypcuhwts.py", line 14, in IR
for i in range(n):l[i] = I()
^^^
File "/tmp/tmpm31aqtoa/tmpypcuhwts.py", line 9, in I
def I():... | |
s799085696 | p04014 | u585482323 | 1551650286 | Python | PyPy3 (2.4.0) | py | Runtime Error | 247 | 40940 | 1685 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): ... | Traceback (most recent call last):
File "/tmp/tmpcq9xeqf4/tmpfglimnj4.py", line 64, in <module>
n,s = IR(2)
^^^^^
File "/tmp/tmpcq9xeqf4/tmpfglimnj4.py", line 14, in IR
for i in range(n):l[i] = I()
^^^
File "/tmp/tmpcq9xeqf4/tmpfglimnj4.py", line 9, in I
def I():... | |
s166727121 | p04014 | u585482323 | 1551650199 | Python | PyPy3 (2.4.0) | py | Runtime Error | 262 | 40940 | 1695 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): ... | Traceback (most recent call last):
File "/tmp/tmpkqysdpeb/tmp3x7od1g_.py", line 65, in <module>
n,s = IR(2)
^^^^^
File "/tmp/tmpkqysdpeb/tmp3x7od1g_.py", line 14, in IR
for i in range(n):l[i] = I()
^^^
File "/tmp/tmpkqysdpeb/tmp3x7od1g_.py", line 9, in I
def I():... | |
s882525845 | p04014 | u585482323 | 1551649809 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2132 | 449648 | 1695 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): ... | Traceback (most recent call last):
File "/tmp/tmpdjbxqn46/tmpd37kx9v0.py", line 63, in <module>
n,s = IR(2)
^^^^^
File "/tmp/tmpdjbxqn46/tmpd37kx9v0.py", line 14, in IR
for i in range(n):l[i] = I()
^^^
File "/tmp/tmpdjbxqn46/tmpd37kx9v0.py", line 9, in I
def I():... | |
s812911327 | p04014 | u585482323 | 1551649627 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2131 | 449648 | 1687 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): ... | Traceback (most recent call last):
File "/tmp/tmp90_ibncy/tmpfes5vvw0.py", line 63, in <module>
n,s = IR(2)
^^^^^
File "/tmp/tmp90_ibncy/tmpfes5vvw0.py", line 14, in IR
for i in range(n):l[i] = I()
^^^
File "/tmp/tmp90_ibncy/tmpfes5vvw0.py", line 9, in I
def I():... | |
s397294894 | p04014 | u585482323 | 1551649499 | Python | PyPy3 (2.4.0) | py | Runtime Error | 311 | 49008 | 1654 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): ... | Traceback (most recent call last):
File "/tmp/tmp810o3spy/tmpl66auw21.py", line 62, in <module>
n,s = IR(2)
^^^^^
File "/tmp/tmp810o3spy/tmpl66auw21.py", line 14, in IR
for i in range(n):l[i] = I()
^^^
File "/tmp/tmp810o3spy/tmpl66auw21.py", line 9, in I
def I():... | |
s251748966 | p04014 | u706695185 | 1551182860 | Python | Python (3.4.3) | py | Runtime Error | 2139 | 520344 | 417 | n = int(input())
s = int(input())
memo = [[False for _ in range(n)] for _ in range(n)]
def f(x,y):
print(memo[x][y])
if memo[x][y]:
return memo[x][y]
elif y < x:
memo[x][y] = y
return y
else:
memo[x][y] = f(x, y//x)+(y%x)
return memo[x][y]
# f()
for i in revers... | Traceback (most recent call last):
File "/tmp/tmpbu658r3p/tmppij0o_to.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s680875096 | p04014 | u171366497 | 1550989593 | Python | Python (3.4.3) | py | Runtime Error | 409 | 3948 | 414 | #ABC044D
def fun(b,n):
if n<b:return n
return (n%b)+fun(b,n//b)
n=int(input())
s=int(input())
n_root=n**0.5
def main(n,n_root,s):
if s==n:return n+1
if s>n:return -1
for b in range(2,1+int(n_root)):
if fun(b,n)==s:
return b
for i in range(int(n_root),0,-1):
b=1+(n-s)... | Traceback (most recent call last):
File "/tmp/tmp7p31_kuo/tmpd2tuznp0.py", line 5, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s839396636 | p04014 | u171366497 | 1550988585 | Python | Python (3.4.3) | py | Runtime Error | 417 | 3948 | 434 | #ABC044D
def fun(b,n):
if n<b:return n
return (n%b)+fun(b,n//b)
n=int(input())
s=int(input())
n_root=n**0.5
def main(n,n_root,s):
if s==n:return n+1
if s>n:return -1
if s==1:return n
for b in range(2,1+int(n_root)):
if fun(b,n)==s:
return b
for i in range(int(n_root),0,-... | Traceback (most recent call last):
File "/tmp/tmpaldh0pi1/tmpwbpkb1kq.py", line 5, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s461442612 | p04014 | u171366497 | 1550988473 | Python | Python (3.4.3) | py | Runtime Error | 421 | 3952 | 520 | #ABC044D
def fun(b,n):
if n<b:return n
return (n%b)+fun(b,n//b)
n=int(input())
s=int(input())
n_root=n**0.5
def main(n,n_root,s):
if s==n:return n+1
if s>n:return -1
if s==1:return n
for b in range(2,1+int(n_root//1)):
if fun(b,n)==s:
return b
for i in range(1+int(n_root... | Traceback (most recent call last):
File "/tmp/tmpeggpm4aq/tmp9ow724ai.py", line 5, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s585561753 | p04014 | u983918956 | 1550452473 | Python | PyPy3 (2.4.0) | py | Runtime Error | 185 | 38384 | 674 | N,A = map(int,input().split())
X = [int(e) for e in input().split()]
# dp[i][k][s]: i番目まで見てk個選んで総和sとなる場合の数
# 初期条件: dp[0][0][0] = 1
# 遷移: dp[i][k][s] += dp[i-1][k-1][s-X[i]] + dp[i-1][k][s]
# 答え: sum(dp[N][k][k*A] 1 <= k <= N)
s_max = 2500
dp = [[[0]*(s_max+1) for k in range(N+1)] for i in range(N+1)]
dp[0][0][0] = 1
fo... | Traceback (most recent call last):
File "/tmp/tmpwflo6jy9/tmp9wrgdmfy.py", line 1, in <module>
N,A = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s334441775 | p04014 | u483645888 | 1550090401 | Python | Python (3.4.3) | py | Runtime Error | 573 | 3948 | 460 | n = int(input())
s = int(input())
flag = False
if s > n:
print(-1)
exit()
if s == n:
print(n+1)
exit()
def chk(b, n):
if n//b == 0:
return n
else:
return chk(b,n//b) + n%b
for b in range(2, int(n**0.5)+1):
if chk(b, n) == s:
print(b)
flag = True
exit()
for i in range(int(n**0.5)... | Traceback (most recent call last):
File "/tmp/tmpets8ngqa/tmp4gfjq7mc.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s213404904 | p04014 | u483645888 | 1550090183 | Python | Python (3.4.3) | py | Runtime Error | 585 | 3956 | 440 | n = int(input())
s = int(input())
flag = False
if s > n:
print(-1)
exit()
if s == n:
print(n+1)
exit()
def chk(b, n):
if n//b == 0:
return n
else:
return chk(b,n//b) + n%b
for b in range(2, int(n**0.5)+1):
if chk(b, n) == s:
print(b)
flag = True
exit()
for i in range(int(n**0.5)... | Traceback (most recent call last):
File "/tmp/tmpwtvwiydm/tmpea6gbe9h.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s711296881 | p04014 | u483645888 | 1550089933 | Python | Python (3.4.3) | py | Runtime Error | 578 | 3952 | 438 | n = int(input())
s = int(input())
flag = False
if s > n:
print(-1)
exit()
if s == n:
print(n+1)
exit()
def chk(b, n):
if n//b == 0:
return n
else:
return chk(b,n//b) + n%b
for b in range(2, int(n**0.5)+1):
if chk(b, n) == s:
print(b)
flag = True
exit()
for i in range(int(n**0.5), ... | Traceback (most recent call last):
File "/tmp/tmp6sgjoegi/tmpjmpf97m2.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s014128628 | p04014 | u483645888 | 1550089429 | Python | Python (3.4.3) | py | Runtime Error | 582 | 3944 | 407 | n = int(input())
s = int(input())
flag = False
if s == n:
print(n+1)
exit()
def chk(b, n):
if n//b == 0:
return n
else:
return chk(b,n//b) + n%b
for b in range(2, int(n**0.5)+1):
if chk(b, n) == s:
print(b)
flag = True
exit()
for i in range(int(n**0.5), 0, -1):
b = (n-s)//i + 1
if... | Traceback (most recent call last):
File "/tmp/tmpadr1dv2x/tmpnm696msv.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s264807207 | p04014 | u483645888 | 1550089217 | Python | Python (3.4.3) | py | Runtime Error | 571 | 3944 | 406 | n = int(input())
s = int(input())
flag = False
if s == n:
print(n+1)
exit()
def chk(b, n):
if n//b == 0:
return n
else:
return chk(b,n//b) + n%b
for b in range(2, int(n**0.5)+1):
if chk(b, n) == s:
print(b)
flag = True
exit()
for i in range(int(n**0.5), 0, -1):
b = (n-s)//i + 1
if... | Traceback (most recent call last):
File "/tmp/tmp6ygh598v/tmptptnrs6j.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.