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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s373380643 | p04047 | u258375111 | 1544232430 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 122 | n=int(input())
x=list(map(int, input().split()))
x.sort()
ans = 0
for i range(n):
ans = ans + x[i*2]
print(ans)
| File "/tmp/tmpt2cgovd4/tmp5vhyb4vn.py", line 8
for i range(n):
^^^^^
SyntaxError: invalid syntax
| |
s712750022 | p04047 | u258375111 | 1544232385 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 120 | n=int(input())
x=list(map(int, input().split()))
x.sort()
ans=0
for i range(n):
ans = ans + x[i*2]
print(ans)
| File "/tmp/tmp7t5j2g7i/tmp1hrawbm0.py", line 8
for i range(n):
^^^^^
SyntaxError: invalid syntax
| |
s739326319 | p04047 | u258375111 | 1544232295 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 116 | n=int(input())
x=list(map(int, input().split()))
x.sort()
ans=0
for i range(n):
ans=ans+x[i*2]
print(ans)
| File "/tmp/tmplhl8ayob/tmpifv36xms.py", line 8
for i range(n):
^^^^^
SyntaxError: invalid syntax
| |
s881546734 | p04047 | u258375111 | 1544232080 | Python | Python (3.4.3) | py | Runtime Error | 20 | 2940 | 115 | n=int(input())
x=list(map(int, input().split()))
x.sort()
ans=0
for i range(n):
ans=ans+x[i*2]
print(ans)
| File "/tmp/tmpfc95ad2u/tmpv3g1659p.py", line 7
for i range(n):
^^^^^
SyntaxError: invalid syntax
| |
s634476725 | p04047 | u258375111 | 1544231888 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 114 | n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=0
for i range(n):
ans=ans+x[i*2]
print(ans)
| File "/tmp/tmpf9axplpk/tmp8pdnl_z3.py", line 7
for i range(n):
^^^^^
SyntaxError: invalid syntax
| |
s333585563 | p04047 | u258375111 | 1544231854 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 111 | n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=0
for i range(n):
ans=+x[i*2]
print(ans)
| File "/tmp/tmpl5p51swk/tmpkoelk746.py", line 7
for i range(n):
^^^^^
SyntaxError: invalid syntax
| |
s529235642 | p04047 | u258375111 | 1544231823 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 111 | n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=0
for i range(n):
ans+=x[i*2]
print(ans)
| File "/tmp/tmp0yuueszz/tmp9ida7por.py", line 7
for i range(n):
^^^^^
SyntaxError: invalid syntax
| |
s028269684 | p04047 | u258375111 | 1544231680 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 152 | n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=0
for i range(n):
if i%2==1:
pass
else:
ans+=min(x[i],x[i+1])
print(ans) | File "/tmp/tmpdb9l59yh/tmpo023wudn.py", line 7
for i range(n):
^^^^^
SyntaxError: invalid syntax
| |
s568274783 | p04047 | u258375111 | 1544230900 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 138 | n=int(input())
a=[]
cou=0
for i in range(n*2):
a[i]=int(input())
a.sort()
for i*2 in range(n):
cou+=min(a[i],a[i+1])
print(cou) | File "/tmp/tmp0y8duhf0/tmpckqnbuz4.py", line 9
for i*2 in range(n):
^^^
SyntaxError: cannot assign to expression
| |
s382251638 | p04047 | u173374079 | 1541225123 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 144 | n = input
l = map(int, input().split())
l = sorted(l)
ans = 0
for i in range(len(n)):
a = l[2*i]
b = l[2*i+1]
ans =+ min(a,b)
print(ans) | Traceback (most recent call last):
File "/tmp/tmp3jmy0uis/tmp7bd088t6.py", line 2, in <module>
l = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s928614242 | p04047 | u845333844 | 1539462793 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 82 | n=int(input())
l=list(map(int,input().split()))
l.sort()
k=l[::2]
print(k.sum()) | Traceback (most recent call last):
File "/tmp/tmpcpo3gixz/tmpnwpj5gqn.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s595342593 | p04047 | u333139319 | 1539110409 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 127 | n = int(input())
l = [int(i) for i in input().split()]
a = 0
for i in len(l):
if i % 2 == 0:
a = a + l[i]
print(a)
| Traceback (most recent call last):
File "/tmp/tmp0goho2v4/tmppj9ds_1w.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s620457516 | p04047 | u361841553 | 1538666213 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 99 | N = int(raw_input())
list_input = sorted(map(int, raw_input().split()))
print(sum(list_input[::2])) | Traceback (most recent call last):
File "/tmp/tmpz6pk0yh4/tmp2nnivwxp.py", line 1, in <module>
N = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s272670636 | p04047 | u361841553 | 1538666105 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 202 | N = int(raw_input())
list_input = map(int, raw_input().split())
list_input = sorted(list_input)
sums = 0
for i in range(0,2*N,2):
print(i)
sums += min(list_input[i],list_input[i+1])
print(sums) | Traceback (most recent call last):
File "/tmp/tmp6f4kdyqq/tmplcstgw9j.py", line 1, in <module>
N = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s974009912 | p04047 | u361841553 | 1538665624 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 191 | N = int(raw_input())
list_input = map(int, raw_input().split())
list_input = sorted(list_input)
sums = 0
for i in range(0,2*N,2):
sums += min(list_input[i],list_input[i+1])
print(sums)
| Traceback (most recent call last):
File "/tmp/tmpmc7q3c8a/tmp7opy6h0t.py", line 1, in <module>
N = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s122802468 | p04047 | u361841553 | 1538665369 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 187 | N = int(input())
list_input = map(int, raw_input().split())
list_input = sorted(list_input)
sums = 0
for i in range(0,2*N,2):
sums += min(list_input[i],list_input[i+1])
print(sums)
| Traceback (most recent call last):
File "/tmp/tmpnitnen9o/tmpbku0h4ky.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s373040472 | p04047 | u361841553 | 1538665249 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 181 | N = input()
list_input = map(int, raw_input().split())
list_input = sorted(list_input)
sums = 0
for i in range(0,2*N,2):
sums += min(list_input[i],list_input[i+1])
print(sums) | Traceback (most recent call last):
File "/tmp/tmpugw6zgq7/tmp05klyomq.py", line 1, in <module>
N = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s565058803 | p04047 | u361841553 | 1538665079 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 158 | N = input()
list_input = map(int, raw_input().split())
list_input = sorted(list_input)
sums = 0
for i in range(N,2*N):
sums += list_input[i]
print(sums) | Traceback (most recent call last):
File "/tmp/tmpibspc35f/tmpj6tz1cqg.py", line 1, in <module>
N = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s868836591 | p04047 | u111421568 | 1537405488 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 763 | n, k = map(int, input().split())
import sys
sys.setrecursionlimit(20000)
l = [[] for i in range(n)]
for i in range(n-1):
a, b = map(int, input().split())
l[a-1].append(b-1)
l[b-1].append(a-1)
def first_search(first, depth):
record = 0
for i in l[first]:
temp = search(first, i, depth-1)
if record < temp:
record = temp
return record + 1
def search(before, now, depth):
if depth <= 0:
return 1
else:
ans = 1
for i in l[now]:
if before != i:
ans += search(now, i, depth-1)
return ans
ret = 0
for i in range(n):
temp = first_search(i, k)
if temp > ret:
ret = temp
if ret > n:
print(0)
else:
print(n-ret) | Traceback (most recent call last):
File "/tmp/tmpdrg_1tfq/tmp70n5y9lo.py", line 1, in <module>
n, k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s331366516 | p04047 | u807772568 | 1534258525 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 109 | a = int(input())
b = list(map(int,input().split()))
b.sorted()
su = 0
for i in range(a-1):
su += b[2*i] | Traceback (most recent call last):
File "/tmp/tmpm224zh66/tmpyb_8s67m.py", line 1, in <module>
a = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s571583433 | p04047 | u807772568 | 1534258465 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 107 | a = int(input())
b = list(map(int,input().split()))
b.sorted()
su = 0
for i in range(a):
su += b[2*i] | Traceback (most recent call last):
File "/tmp/tmpzt6k_i5o/tmpo6p7589n.py", line 1, in <module>
a = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s590942362 | p04047 | u224119305 | 1533123595 | Python | Python (3.4.3) | py | Runtime Error | 149 | 12508 | 721 | import numpy as np
N, K = map(int, input().split())
E = np.zeros((N, N), dtype=int)
exit(0)
Elist = []
for e in range(N-1):
i, o = map(int, input().split())
Elist.append((i-1, o-1))
E[i-1][o-1] = 1
E[o-1][i-1] = 1
# print("N, K=", N, K)
# for e in Elist:
# print(e[0], e[1])
I = np.eye(N, dtype=int)
# print("I=", I)
ie = I
for k in range(K):
ie = ie + np.matmul(I, E)
# print("I + IE =", ie)
# withinK = np.count_nonzero(ie, axis=0)
withinK = np.zeros(N, dtype=int)
for i in range(N):
for j in range(N):
if ie[i][j] > 0:
withinK[i] += 1
# print("withinK=", withinK)
maxBall = np.amax(withinK)
# print("maxBall=", maxBall)
solution = N - maxBall
print(solution) | Traceback (most recent call last):
File "/tmp/tmp_iq4baj5/tmpqdcamms4.py", line 2, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s439685767 | p04047 | u075012704 | 1531432460 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3316 | 1010 | from collections import deque
N, K = map(int, input().split())
T = [[] for i in range(N)]
E = []
for i in range(N-1):
a, b = map(int, input().split())
a, b = a-1, b-1
T[a].append(b)
T[b].append(a)
E.append((a, b))
def bfs(n):
visited = [False] * N
dist = [0] * N
queue = deque([n])
while queue:
node = queue.pop()
if visited[node]:
continue
visited[node] = True
for n in T[node]:
if not visited[n]:
dist[n] = dist[node] + 1
queue.appendleft(n)
return dist
dist = []
for i in range(N):
dist.append(bfs(i))
ans = float('inf')
if K % 2 == 0:
# 全ての頂点について全探索
for i in range(N):
ans = min(ans, len([d for d in dist[i] if d > K / 2]))
else:
# 全ての辺について全探索
for a, b in E:
adist = [(1 if min(d1, d2) > (K-1) / 2 else 0) for d1, d2 in zip(dist[a], dist[b])]
ans = min(ans, sum(adist))
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpirtjjp8z/tmpcoixlpmb.py", line 3, in <module>
N, K = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s036529572 | p04047 | u272266919 | 1529603853 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 112 | N = input()
Li = map(int, input().split(" "))
Li.sort()
total = 0
for i in Li[0::2]
total += i
print(total)
| File "/tmp/tmpljpc4ynz/tmp3ixou9cl.py", line 5
for i in Li[0::2]
^
SyntaxError: expected ':'
| |
s408828323 | p04047 | u828847847 | 1526493488 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 226 | n = int(input())
arr = [map(int,raw_input().split()) for i in range(n)]
count = 0
for i in range(n-1):
for j in range(i+1,n):
s = sum(arr[i]) + sum(arr[j])
comb = s*(s-1)/2
count += comb
print count%(1000000000+7) | File "/tmp/tmpjrzhn040/tmptumpuovh.py", line 12
print count%(1000000000+7)
^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s830242700 | p04047 | u671395265 | 1519893017 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 59 | n = int(input())
print(sum(sorted(map(int, input()))[::2])) | Traceback (most recent call last):
File "/tmp/tmp5u5lu5sz/tmpan8a8w7c.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s617678939 | p04047 | u433184056 | 1508626074 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 166 | N, X = map(int, intpu().split())
if X <= N / 3:
result = 3 * (N - X)
if N / 3 < X and X < N /2:
result = 6 * X
if N / 2 <= X:
result = 3 * X
print(result) | Traceback (most recent call last):
File "/tmp/tmp1rbm_erj/tmporvi1zo1.py", line 1, in <module>
N, X = map(int, intpu().split())
^^^^^
NameError: name 'intpu' is not defined. Did you mean: 'input'?
| |
s742049259 | p04047 | u269390702 | 1508390658 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 124 | n=int(input())
l=list(map(int,input().split()))
l.sort()
sum=0
for x in range(0,n*2+1,2):
sum+=min(l[x:x+2])
print(sum)
| Traceback (most recent call last):
File "/tmp/tmp3rfqddrg/tmpgn0nxq4r.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s853478988 | p04047 | u375536288 | 1499653060 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 195 | def gcd(a,b):
if b == 0:
return a
return gcd(b,a%b)
N,k = map(int,raw_input().split())
#k = int(raw_input())
#A = map(int, raw_input().split())
ans = gcd(N,k)
print 3*(N - ans) | File "/tmp/tmp9v2jvnka/tmpj99i7lsx.py", line 12
print 3*(N - ans)
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s866647203 | p04047 | u375536288 | 1499651248 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 96 | N = int(raw_input())
A = map(int, raw_input().split())
sum = 0
A.sort()
A = A[::2]
print sum(A)
| File "/tmp/tmpptg99vgn/tmpg_z0qcf0.py", line 6
print sum(A)
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s786927693 | p04047 | u430478288 | 1487448408 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 94 | N = input()
kushi = sorted(list(map(int, input().split())))
even = kushi[0::2]
print(sum(even) | File "/tmp/tmprdikeey_/tmp5ljsbv_c.py", line 4
print(sum(even)
^
SyntaxError: '(' was never closed
| |
s862646417 | p04047 | u486232694 | 1484412076 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 222 | n = int(input())
L = map(int, input().split(" "))
L_sorted = sorted(L)
pairs = []
for index in range(0, len(L_sorted)/2, 2):
pairs.append(L_sorted[index : index +2])
answer = sum( min(x) for x in pairs)
print(answer) | Traceback (most recent call last):
File "/tmp/tmp9utqawnl/tmpzm273g1k.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s233463928 | p04047 | u132291455 | 1478315732 | Python | PyPy2 (5.6.0) | py | Runtime Error | 41 | 9200 | 586 | ii=lambda:map(int,raw_input().split())
n,k=ii()
T,F=True,False
e=[[] for _ in range(n)]
for _ in range(n-1):
a,b=ii()
e[a-1]+=[b-1];e[b-1]+=[a-1]
cost=[0]*n
ans=10**5
def dfs(x,f):
if f>=0:vis[f]=T
q=[(x,0)]
while len(q):
v,c=q.pop(0)
if c>k/2:break
cost[v]=c;vis[v]=T
for w in e[v]:
if not vis[w]:q+=[(w,c+1)]
return n-vis.count(T)
if k%2:
for i in range(n):
for j in e[i]:
if i<j:vis=[F]*n;dfs(i,j);ans=min(ans,dfs(j,i))
else:
for i in range(n):vis=[F]*n;ans=min(ans,dfs(i,-1))
print ans
| File "/tmp/tmp_a5bz14a/tmptcp8t6h5.py", line 26
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s524941267 | p04047 | u464852639 | 1473802239 | Python | Python (3.4.3) | py | Runtime Error | 40 | 3064 | 114 | N = int(input())
L = map(int, input().split())
sort(L)
sum = 0
for i in range(0,len(L),2):
sum += L[i]
print(sum) | Traceback (most recent call last):
File "/tmp/tmp2kzvbvok/tmpgjy44v3l.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s046243738 | p04047 | u464852639 | 1473802154 | Python | Python (3.4.3) | py | Runtime Error | 41 | 3188 | 112 | N = int(input())
L = map(int, input().split())
sort(L)
sum = 0
for i in range(0,N):
sum += L[i*2]
print(sum) | Traceback (most recent call last):
File "/tmp/tmp28mm4kbv/tmpwn9im7ub.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s203588797 | p04047 | u464852639 | 1473802043 | Python | Python (3.4.3) | py | Runtime Error | 41 | 3188 | 117 | N = int(input())
L = map(int, input().split())
sort(L)
sum = 0
for i in range(0,len(L),2):
sum += L[i]
print(sum) | Traceback (most recent call last):
File "/tmp/tmpbrgd3usm/tmpaguz4ig2.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s546655394 | p04047 | u354504094 | 1473632610 | Python | Python (2.7.6) | py | Runtime Error | 26 | 2568 | 140 | n, x = map(int, raw_input().split())
def cal(n):
return n + 1 + (n - 2)*2
if n % x == 0:
l = cal(n) - cal(x)
else:
l = cal(n)
print l
| File "/tmp/tmpmccmhj4j/tmpdohaq8ps.py", line 11
print l
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s421375316 | p04047 | u670859236 | 1472862466 | Python | Python (2.7.6) | py | Runtime Error | 26 | 2568 | 81 | n = raw_input()
l = raw_input().split()
print(sum(sorted(l, reverse=True)[1::2])) | Traceback (most recent call last):
File "/tmp/tmpn62zkbl9/tmpu3ponp7t.py", line 1, in <module>
n = raw_input()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s457272852 | p04047 | u914627967 | 1472755228 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3064 | 408 | NX = input()
NX = "".join(NX).split(" ")
NX = [int(s) for s in NX]
D = NX[0]-NX[1]
if NX[0] ==0 or NX[1]==0:
print(str(0))
if NX[1]<D:
Mod = D%NX[1]
if Mod!=0:
print(int(2*NX[1]+NX[1]+(D-NX[1]/2)*3))
else:
print(int(NX[1]*4+D))
elif NX[1]==D:
print(int(3*NX[1]))
elif NX[1]>D:
Mod = NX[1]%D
if Mod!=0:
print(int(NX[1]+(Mod*3)+D+(D*2*int(NX[1]/D))))
else:
print(int(NX[1]+int((NX[1]/D))*2*D)) | Traceback (most recent call last):
File "/tmp/tmp7fpimwyt/tmp7fxf7a09.py", line 1, in <module>
NX = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s078375409 | p04047 | u579875569 | 1469306617 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3064 | 296 | #!/usr/bin/python3
import sys
sys.setrecursionlimit(100000)
N, X = list(map(int, input().split()))
def f(a,b):
if a > b:
a,b = b,a
if a==0 or b==0:
return 0
if b%a is 0:
return int(a*(2*(b/a)-1))
return int(2*a*int(b/a) + f(a,b%a))
print(N+f(N-X, X))
| /tmp/tmpa68b4duh/tmplvugz781.py:13: SyntaxWarning: "is" with a literal. Did you mean "=="?
if b%a is 0:
Traceback (most recent call last):
File "/tmp/tmpa68b4duh/tmplvugz781.py", line 6, in <module>
N, X = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s894827450 | p04047 | u579875569 | 1469265423 | Python | Python (2.7.3) | py | Runtime Error | 27 | 2568 | 103 | #!/usr/bin/python3
N = int(input())
L = list(map(int, input().split()))
L.sort()
print(sum(L[0::2]))
| Traceback (most recent call last):
File "/tmp/tmp02sy6vsp/tmpclvn44io.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s259640156 | p04047 | u579875569 | 1469265388 | Python | Python (2.7.3) | py | Runtime Error | 28 | 2688 | 103 | #!/usr/bin/python3
N = int(input())
L = list(map(int, input().split()))
L.sort()
print(sum(L[0::2]))
| Traceback (most recent call last):
File "/tmp/tmp_8evrifh/tmp11o8wdw2.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s170659470 | p04047 | u742897895 | 1468816666 | Python | PyPy3 (2.4.0) | py | Runtime Error | 398 | 43376 | 281 | n, x = map(int,input().split())
if x > n // 2:
x = n - x
xx = x
yy = n - x
ans = n
i = 0
while True:
ans += 2 * (yy // xx) * xx
yy %= xx
if yy == 0:
ans -= xx
break
if yy < xx:
tmp = xx
xx = yy
yy = tmp
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp5kzi7i2o/tmpg91ezizf.py", line 1, in <module>
n, x = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s849507092 | p04047 | u357487020 | 1468776050 | Python | PyPy2 (5.6.0) | py | Runtime Error | 64 | 9072 | 1017 | import sys
sys.setrecursionlimit(10**6)
def dfs1(s,c):
visited[s]=1
for i in v[s]:
if visited[i]==0:
d[c][i]=d[c][s]+1
dfs1(i,c)
return
def dfs2(c1,c2):
visited[c2]=1
dfs1(c1,c1)
dfs1(c2,c2)
return
n,k=map(int,raw_input().split())
d=[[0]*n for _ in xrange(n)]
v=[[] for _ in xrange(n)]
e=[]
for i in xrange(n-1):
a,b=map(int,raw_input().split())
a-=1
b-=1
v[a].append(b)
v[b].append(a)
e.append([a,b])
if k%2==0:
min_del=1000000
for i in xrange(n):
cnt=0
visited=[0]*n
dfs1(i,i)
for j in xrange(n):
if d[i][j]>k/2:
cnt+=1
min_del=min(min_del,cnt)
print(min_del)
else:
min_del=1000000
for i,j in e:
cnt=0
visited=[0]*n
d=[[0]*n for _ in xrange(n)]
dfs2(i,j)
for l in xrange(n):
if d[i][l]>(k-1)/2 or d[j][l]>(k-1)/2:
cnt+=1
min_del=min(min_del,cnt)
print(min_del) | Traceback (most recent call last):
File "/tmp/tmpdzidzbqs/tmpgh3ndqp6.py", line 18, in <module>
n,k=map(int,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s226244380 | p04047 | u352021237 | 1468749474 | Python | PyPy2 (5.6.0) | py | Runtime Error | 61 | 8816 | 135 | def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
n,x=map(int,raw_input().split())
print 3*(n-gcd(n,x)) | File "/tmp/tmp7nus4nns/tmp8f5mn8l4.py", line 9
print 3*(n-gcd(n,x))
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s704341736 | p04047 | u352021237 | 1468749372 | Python | PyPy2 (5.6.0) | py | Runtime Error | 63 | 8816 | 136 | def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
n,x=map(int,raw_input().split())
print 3*(n-gcd(n,x))
| File "/tmp/tmpa30gbvp7/tmpo5c4tk77.py", line 9
print 3*(n-gcd(n,x))
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s006997741 | p04047 | u187945597 | 1468736828 | Python | Python (2.7.6) | py | Runtime Error | 27 | 2568 | 79 | n,x = map(int,raw_input().split())
print '%d' %(n + ((n/x) - 1)*2*x + 3*(n%x))
| File "/tmp/tmpgmwn1_nl/tmpdzpfw51o.py", line 2
print '%d' %(n + ((n/x) - 1)*2*x + 3*(n%x))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s512345524 | p04047 | u187945597 | 1468736260 | Python | Python (2.7.6) | py | Runtime Error | 26 | 2568 | 131 | n,x = map(int,raw_input().split())
if n > 2*x :
print '%d' %(n + (n/x - 1)*2*x + 3*(n-(n/x)*x))
else :
print '%d' %(n + x)
| File "/tmp/tmp0dhftrts/tmp07oivt9i.py", line 3
print '%d' %(n + (n/x - 1)*2*x + 3*(n-(n/x)*x))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s502251886 | p04047 | u821262411 | 1468728322 | Python | PyPy3 (2.4.0) | py | Runtime Error | 380 | 43120 | 357 | import scipy.misc as scm
def combi(p,q):
return scm.comb(p,q,1)
ans=0
n=int(input())
k=[]
for i in range(n):
a,b=map(int,input().split())
k.append([a,b])
for i in range(n-1):
for j in range(i+1,n):
p=k[i][0]+k[i][1]+k[j][0]+k[j][1]
q=k[i][0]+k[j][0]
ans += combi(p,q) % (10**9+7)
ans = ans % (10**9+7)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp43x9p5p_/tmpqicdlnli.py", line 6, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s852666915 | p04047 | u750436322 | 1468725753 | Python | Python (3.4.3) | py | Runtime Error | 38 | 3064 | 176 | def f(a, b):
if b%a==0:
return b//a*2-1
else:
return b//a*a*2+f(b%a,a)
N, X = map(int, input().split())
ans = N + f(min(N-X,X), max(N-X,X))
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpzr2gvwi8/tmp7zar8ezw.py", line 7, in <module>
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s415818222 | p04047 | u163377571 | 1468724046 | Python | Python (3.4.3) | py | Runtime Error | 39 | 3064 | 234 | N = input()
L = input()
i = 0
array = []
anser = 0
while i < len(L):
if L[i] != ' ':
array.append(int(L[i]))
i+=1
i = 1
array.sort(reverse=True)
for i in range(array):
if i // 2 == 0:
anser+=i
print(anser) | Traceback (most recent call last):
File "/tmp/tmp3t_eeos2/tmpajjcp9ep.py", line 1, in <module>
N = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s282052365 | p04047 | u216545111 | 1468723917 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2568 | 195 | import sys;
n,x=map(int,raw_input().split());
if(2*x<n):
print x+(n-x)+x+x+(n-2*x)*(2*x-1);
elif(2*x==n):
print x+(n-x)+x;
else:
print x+(n-x)+x+(n-x)+x+(n-x);
| File "/tmp/tmpbtwkzr4l/tmpm7r9vhat.py", line 4
print x+(n-x)+x+x+(n-2*x)*(2*x-1);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s680582353 | p04047 | u023220201 | 1468722419 | Python | Python (2.7.6) | py | Runtime Error | 29 | 2568 | 126 | # encoding: utf-8
n, x = map(int, raw_input().split())
ac_bc = n - x
s = ac_bc / 3
l = ac_bc - s
print ac_bc + s * 3 + l * 3 | File "/tmp/tmpfevfjy12/tmpp5s2k1_a.py", line 8
print ac_bc + s * 3 + l * 3
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s911514871 | p04047 | u248145581 | 1468722047 | Python | Python (3.4.3) | py | Runtime Error | 38 | 3064 | 437 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
N, X = list(map(int, input().split()))
sum_ = X
prev = X
next = N - X
i = 0
while True:
num = prev // next
if i == 0:
sum_ += 2 * num * next
elif i % 2 == 1:
sum_ += 2 * num * next - next
else:
sum_ += 2 * num * next - next
mod_ = prev % next
if mod_ == 0:
break
sum_ += next
prev = next
next = mod_
i += 1
print(sum_) | Traceback (most recent call last):
File "/tmp/tmp9ak9q8af/tmpkx50c4_h.py", line 3, in <module>
N, X = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s280459736 | p04047 | u900223807 | 1468720667 | Python | Python (2.7.6) | py | Runtime Error | 1565 | 7168 | 130 | N, X = map(int, raw_input().split())
ans = 0
if N%2 ==0:
d = min(X, N-X)
ans = (N-d)*3
else:
ans = (N-1)*3
print(ans) | Traceback (most recent call last):
File "/tmp/tmpg5apd5yw/tmpyiuuexmc.py", line 1, in <module>
N, X = map(int, raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s646624473 | p04047 | u724409710 | 1468720058 | Python | Python (2.7.6) | py | Runtime Error | 31 | 2568 | 65 | N, X = map(int, raw_input().strip().split())
print N + (N-X)*2 -1 | File "/tmp/tmpw22ecd28/tmpf2ixlzet.py", line 2
print N + (N-X)*2 -1
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s529211517 | p04047 | u714578774 | 1468719985 | Python | Python (2.7.6) | py | Runtime Error | 1759 | 7164 | 78 | N, x = map(long, raw_input().split())
print (N - x) + 3 * x + 3 * (N - x - x)
| Traceback (most recent call last):
File "/tmp/tmp48tvp9em/tmpyw_9jmzb.py", line 1, in <module>
N, x = map(long, raw_input().split())
^^^^
NameError: name 'long' is not defined
| |
s948258491 | p04047 | u966695411 | 1468719234 | Python | Python (3.4.3) | py | Runtime Error | 46 | 3064 | 143 | #! /usr/bin/env python3
N, X = map(int, input().split())
if X*2 == N:
print(X*3)
else:
print(X*3*((N-X)//X + (1 if (N-X)%X>0 else 0))) | Traceback (most recent call last):
File "/tmp/tmpzqu69os1/tmp5hs8nybd.py", line 3, in <module>
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s902533382 | p04047 | u342321365 | 1468719005 | Python | Python (3.4.3) | py | Runtime Error | 1621 | 7272 | 230 | def bbq():
n = int(input())
a = input()
tmp = a.split()
l = [int(x) for x in tmp]
l.sort()
n = 0
i = 0
while(i<n:
n += l[i]
i += 2
print (n)
if __name__ == "__main__":
bbq() | File "/tmp/tmpeosfttz8/tmp2v1jtqup.py", line 9
while(i<n:
^
SyntaxError: invalid syntax
| |
s820627721 | p04047 | u667190633 | 1468718271 | Python | Python (2.7.6) | py | Runtime Error | 28 | 2568 | 126 | N=raw_input()
up=raw_input()
up=up.split()
up=map(int,up)
up.sort()
count=0
for i in range(N):
count+=up[i*2]
print count | File "/tmp/tmpjl6_td_7/tmp6z8al4hf.py", line 10
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s777010165 | p04047 | u667190633 | 1468718176 | Python | Python (2.7.6) | py | Runtime Error | 1286 | 3588 | 120 | N=raw_input()
up=raw_input().split()
up=map(int,up)
up.sort()
count=0
for i in range(N):
count+=up[i*2]
print count | File "/tmp/tmpx7jal0qu/tmpjs8c66kq.py", line 9
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s090382957 | p04047 | u667190633 | 1468717830 | Python | Python (2.7.6) | py | Runtime Error | 270 | 2952 | 113 | N=raw_input()
up=raw_input().split()
up=up.sort()
count=0
for i in range(N):
count+=int(up[i*2])
print count | File "/tmp/tmpxq_69i9f/tmpu9usphyl.py", line 8
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s555175969 | p04048 | u468972478 | 1599700295 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9132 | 117 | n = int(input())
a = sorted(map(int, input().split()))
s = 0
for i in range(2*n-1):
s += min(a[i], a[i+1])
print(s) | Traceback (most recent call last):
File "/tmp/tmpsh1s45wx/tmpz3xltuqz.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s313668169 | p04048 | u629540524 | 1599260745 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9080 | 79 | import sympy
n,x = map(int,input().split())
print(n-x+sum(sympy.divisors(x))*3) | Traceback (most recent call last):
File "/tmp/tmp91up0sf7/tmpdxf_hvet.py", line 2, in <module>
n,x = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s297220978 | p04048 | u697658632 | 1598423644 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9116 | 72 | import math
n, x = map(int, input().split())
print(3 * (n - gcd(n, x)))
| Traceback (most recent call last):
File "/tmp/tmpal0v05tc/tmphtfjb7ip.py", line 2, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s361058051 | p04048 | u761154175 | 1596587907 | Python | PyPy3 (7.3.0) | py | Runtime Error | 112 | 76816 | 255 | def milor(a,b):
if a == b:
return a
if a > b:
a,b = b,a
return milor(b-a,a) + 2*a
def solve(n,x):
res = n + milor(x,n-x)
return res
if __name__ == '__main__':
n,x = map(int,input().split())
print(solve(n,x)) | Traceback (most recent call last):
File "/tmp/tmpmr41ex_o/tmp12z425dk.py", line 15, in <module>
n,x = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s311100241 | p04048 | u856671164 | 1592768464 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8880 | 391 | N,X = input().split()
N,X = int(N), int(X)
answer = X+ (N-X)
def rhombus(N,X):
if N<X:
temp = N
N = X
X = temp
if X==1:
return N+1
if X==0:
return 0
if N%X == 0:
return X*(N//X)*2-X
else:
k = N//X
return k*2*X + rhombus(X,N-(k*X))
answer = answer + rhombus(N-X,X)
print(answer) | File "/tmp/tmp9kqkocsm/tmprbqnr39p.py", line 8
temp = N
TabError: inconsistent use of tabs and spaces in indentation
| |
s264994960 | p04048 | u501278784 | 1587997693 | Python | PyPy3 (2.4.0) | py | Runtime Error | 185 | 38640 | 81 | n,x=map(int,input().split())
k=(x/(n-2*x))*(n-2*x)
ans=2*x+n+k
print(int(ans+1)) | Traceback (most recent call last):
File "/tmp/tmppd14r_sw/tmpzqex2mga.py", line 1, in <module>
n,x=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s634847381 | p04048 | u255673886 | 1587146148 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38460 | 886 | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint
def myinput():
return map(int,input().split())
def mylistinput(n):
return [ list(myinput()) for _ in range(n) ]
def mycol(data,col):
return [ row[col] for row in data ]
def mysort(data,col):
data.sort(key=lambda x:x[col],reverse=False)
return data
def mymax(data):
M = -1*float("inf")
for i in range(len(data)):
m = max(data[i])
M = max(M,m)
return M
def mymin(data):
m = float("inf")
for i in range(len(data)):
M = min(data[i])
m = min(m,M)
return m
n,x = myinput()
ans = (n-1)*3
print(ans) | Traceback (most recent call last):
File "/tmp/tmp7tswj_gk/tmpy7xqmr43.py", line 38, in <module>
n,x = myinput()
^^^^^^^^^
File "/tmp/tmp7tswj_gk/tmpy7xqmr43.py", line 12, in myinput
return map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s365925693 | p04048 | u808664337 | 1583795742 | Python | Python (3.4.3) | py | Runtime Error | 75 | 4032 | 279 | def move(mode, N, X, total):
tmp = total
if mode == 0:
tmp += (N-X)
return move(1, N-X, X, tmp)
if mode == 1:
tmp += X
next = 0
if N-X == 0:
return tmp
return move(next, N, N-X, tmp)
N, X = map(int, input().split(" "))
print(move(0, N, X, X)) | Traceback (most recent call last):
File "/tmp/tmpx9vdgyim/tmpc21pi996.py", line 13, in <module>
N, X = map(int, input().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s669053810 | p04048 | u998008108 | 1582333523 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 67 | import math
n,x=map(int,input().split())
print(3*(n-math.gcd(n,x))) | Traceback (most recent call last):
File "/tmp/tmpyuz1k_jl/tmpw_eokx__.py", line 2, in <module>
n,x=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s482047447 | p04048 | u998008108 | 1582333458 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 67 | import math
n,x=map(int,input().split())
print(3*(n-math.gcd(n,x))) | Traceback (most recent call last):
File "/tmp/tmps0n5aan8/tmp0ufgyiqh.py", line 2, in <module>
n,x=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s867439284 | p04048 | u039864635 | 1580449905 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 82 | from math import gcd
n, x = map(int, input().split())
print(3 * (n - gcd(n, x)))
| Traceback (most recent call last):
File "/tmp/tmpgokyg9vg/tmph9towvk4.py", line 3, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s876123929 | p04048 | u301298600 | 1577946957 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 77 | from math import gcd
n, x = map(int, input().split())
print(3*(n-gcd(n, x)))
| Traceback (most recent call last):
File "/tmp/tmpemzz_1on/tmpq9ks592b.py", line 2, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s963740881 | p04048 | u301298600 | 1577946871 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 77 | from math import gcd
n, x = map(int, input().split())
print(3*(n-gcd(n, x)))
| Traceback (most recent call last):
File "/tmp/tmpr8rwwrl0/tmp8p0pkmkq.py", line 2, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s257332778 | p04048 | u580070121 | 1577585399 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 87 | N = int(input())
X = int(input())
Total_Length = 2*X + N + 3*(X//2)
print(Total_Length) | Traceback (most recent call last):
File "/tmp/tmpjggywu9j/tmpofdu4mop.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s298220524 | p04048 | u365375535 | 1577168275 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3056 | 228 | def run():
N, X = map(int, input().split())
y = N-X
ans = y+X
while True:
a = y//X
ans += a*X*2
if y%X == 0:
break
y, X = max(X, a), min(X, a)
print(ans-X)
if __name__ == '__main__':
run() | Traceback (most recent call last):
File "/tmp/tmpxfoxdqw6/tmpn5ln0udr.py", line 15, in <module>
run()
File "/tmp/tmpxfoxdqw6/tmpn5ln0udr.py", line 2, in run
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s438951925 | p04048 | u365375535 | 1577168085 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 212 | def run():
N, X = map(int, input().split())
y = N-X
ans = y+X
while True:
a = y//X
ans += a*X*2
if y%X == 0:
break
y, X = X, a
print(ans-X)
if __name__ == '__main__':
run() | Traceback (most recent call last):
File "/tmp/tmpy36b549x/tmpj3f2er_i.py", line 15, in <module>
run()
File "/tmp/tmpy36b549x/tmpj3f2er_i.py", line 2, in run
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s108536014 | p04048 | u649172849 | 1569569574 | Python | Python (3.4.3) | py | Runtime Error | 75 | 3984 | 230 | import sys
import math
sys.setrecursionlimit(1000)
def f(x, y):
if y < x:
(y, x) = (x, y)
if x == 0:
return y
return x + y + f(x, y - x)
n, x = map(int, input().split())
print(x + f(x, n - x) - math.gcd(n, x)) | Traceback (most recent call last):
File "/tmp/tmpdq1n3or4/tmp24b_drgc.py", line 16, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s821995801 | p04048 | u649172849 | 1569568673 | Python | Python (3.4.3) | py | Runtime Error | 73 | 3964 | 207 | import sys
sys.setrecursionlimit(1000)
def f(x, y):
if y < x:
(y, x) = (x, y)
if x == 0:
return y
return x + y + f(x, y - x)
n, x = map(int, input().split())
print(x + f(x, n - x) - 1)
| Traceback (most recent call last):
File "/tmp/tmpohzgo15k/tmp1ml4c183.py", line 15, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s564518548 | p04048 | u649172849 | 1569568597 | Python | Python (3.4.3) | py | Runtime Error | 75 | 3968 | 164 | def f(x, y):
if y < x:
(y, x) = (x, y)
if x == 0:
return y
return x + y + f(x, y - x)
n, x = map(int, input().split())
print(x + f(x, n - x) - 1) | Traceback (most recent call last):
File "/tmp/tmpc8fjeg3k/tmp3bq_0asj.py", line 11, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s738614827 | p04048 | u649172849 | 1569568387 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 163 | def f(x, y):
if y < x:
y, x = x, y
if y == 0:
return x
return x + y + f(x, y - x)
n, x = map(int, input().split())
print(x + f(x, n - x)) | File "/tmp/tmpo58etd1v/tmp_idv71zv.py", line 4
y, x = x, y
TabError: inconsistent use of tabs and spaces in indentation
| |
s753370104 | p04048 | u649172849 | 1569567786 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 85 | import math
n, x = map(int, input().split())
print(n * x // math.gcd(n, x) + x)
| Traceback (most recent call last):
File "/tmp/tmpq7zqqlbb/tmpskjrs5o8.py", line 3, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s635919951 | p04048 | u649172849 | 1569567708 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 79 | import math
n, x = map(int, input().split())
print(n * x / math.gcd(n, x) + x) | Traceback (most recent call last):
File "/tmp/tmptfiwqmq_/tmptrfu8mui.py", line 3, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s871397787 | p04048 | u588341295 | 1569041493 | Python | Python (3.4.3) | py | Runtime Error | 1842 | 715380 | 825 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
N, X = MAP()
def rec(a, b):
if a == b:
return a
a, b = min(a, b), max(a, b)
return a*2 + rec(a, b-a)
print(N+rec(X, N-X))
| Traceback (most recent call last):
File "/tmp/tmp20nnpsxf/tmp1walx8fr.py", line 21, in <module>
N, X = MAP()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s015771046 | p04048 | u588341295 | 1568956707 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 785 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
N, X = MAP()
if N%2 == 1:
print((N-1)*3)
else:
raise Exception
print(N*3//2+abs(X-N//2)*3)
| Traceback (most recent call last):
File "/tmp/tmpudnqqjhz/tmp0x550v1d.py", line 21, in <module>
N, X = MAP()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s486035428 | p04048 | u787059958 | 1568587516 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 893 | n, x = map(int, input().split())
if (n%2 == 1):
print((n-1)*3)
elif (n==2):
print(3)
else:
k=n/2
if (x<k):
if((n/2)%2==0):
l = []
for i in range(1,k-2):
l.append(((n-1)*3)-3*(x-1))
last = l[0]
l.append(last)
print(l[x-1])
else:
if (x%2==0):
print((n-2)*3)
else:
print((n-1)*3)
elif(x==k):
print(int(k*3))
else:
p = n-x
if (p<k):
if((n/2)%2==0):
l = []
for i in range(1,k-2):
l.append(((n-1)*3)-3*(p-1))
last = l[0]
l.append(last)
print(l[p-1])
else:
if (p%2==0):
print((n-2)*3)
else:
print((n-1)*3)
| Traceback (most recent call last):
File "/tmp/tmp0wawq0bc/tmp96wz5rdc.py", line 1, in <module>
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s163593323 | p04048 | u263830634 | 1563742209 | Python | Python (3.4.3) | py | Runtime Error | 1395 | 715252 | 270 | import sys
sys.setrecursionlimit(10 ** 9)
N, X = map(int, input().split())
def f(a, b):
if a == b:
return a
if a >= b:
a, b = b, a
if b%a != 0:
return 2 * a * (b//a) + f(a, b%a)
return 2 * a + f(a, b - a)
print (N + f(N - X, X)) | Traceback (most recent call last):
File "/tmp/tmp1lygmlg8/tmp3omlmv4j.py", line 3, in <module>
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s970175330 | p04048 | u263830634 | 1563741175 | Python | Python (3.4.3) | py | Runtime Error | 1411 | 715252 | 211 | import sys
sys.setrecursionlimit(10 ** 9)
N, X = map(int, input().split())
def f(a, b):
if a == b:
return a
if a >= b:
a, b = b, a
return 2 * a + f(a, b - a)
print (N + f(N - X, X)) | Traceback (most recent call last):
File "/tmp/tmpcoaui0oj/tmp8wmtt433.py", line 3, in <module>
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s798673727 | p04048 | u263830634 | 1563741118 | Python | Python (3.4.3) | py | Runtime Error | 81 | 3980 | 169 | N, X = map(int, input().split())
def f(a, b):
if a == b:
return a
if a >= b:
a, b = b, a
return 2 * a + f(a, b - a)
print (N + f(N - X, X)) | Traceback (most recent call last):
File "/tmp/tmpmpdrc3u9/tmp4j86kn25.py", line 1, in <module>
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s438101089 | p04048 | u263830634 | 1563739800 | Python | Python (3.4.3) | py | Runtime Error | 183 | 12660 | 2341 | #座標平面に落とし込んで再帰関数で無理やり計算
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5)
N, X = map(int, input().split())
if 2 * X > N: #対称性
X = N - X
#座標の作成
dp = [[-1] * (N+3)]
for i in range(N+1):
tmp = [-1]
for j in range(N+1):
if i <= j:
tmp.append(0) #到達していないマス
else:
tmp.append(-1) #壁(範囲外)
tmp.append(-1)
tmp.reverse()
dp.append(tmp)
dp.append([-1] * (N+3))
# print (np.array(dp))
#m: 0:右へ, 1:左下へ, 2:左上へ
def moving(x, y, total, m):
if x == X and y == 1 and dp[x][y] == 1: #一周回ってもとの座標に戻ってきた時
# print ('D')
return total
if m == 0: #右に動く時
tmp = 0
while dp[x-1][y+1] == 0: #右に進める時
dp[x-1][y+1] = 1 #右進んだマスを到達したことにする
tmp += 1
x -= 1
y += 1
if dp[x-1][y+1] == -1: #右側が壁の時-->左下に進む
# print ('1-B')
return moving(x, y, total + tmp, 1)
if dp[x-1][y+1] == 1: #右側が光の線の時-->左上へ進む
tmp += 1
# print ('1-C')
return moving(x-1, y+1, total + tmp, 2)
if m == 1: #左下へ動く時
tmp = 0
while dp[x+1][y] == 0: #左下に進める時
dp[x+1][y] = 1
tmp += 1
x += 1
if dp[x+1][y] == -1: #左下が壁の時-->左上に進む
# print ('2-C')
return moving(x, y, total + tmp, 2)
if dp[x+1][y] == 1: #左下が光の線の時-->左上に進む
tmp += 1
# print ('2-C')
return moving(x+1, y, total + tmp, 2)
if m == 2: #左上に動く時
tmp = 0
while dp[x][y-1] == 0: #左上に進める時
dp[x][y-1] = 1
tmp += 1
y -= 1
if dp[x][y-1] == -1: #左上が壁の時-->右に進む
# print ('3-A')
return moving(x, y, total + tmp, 0)
if dp[x][y-1] == 1: #左上が光の線の時-->左下に進む
tmp += 1
# print ('3-B')
return moving(x, y-1, total + tmp, 1)
X += 1
print (moving(X, 1, 0, 0))
# print (np.array(dp)) | Traceback (most recent call last):
File "/tmp/tmpy88wpzh8/tmpbkjidr1j.py", line 5, in <module>
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s836050967 | p04048 | u263830634 | 1563739503 | Python | Python (3.4.3) | py | Runtime Error | 248 | 11996 | 2233 | # import numpy as np
# import sys
# sys.setrecursionlimit(100)
N, X = map(int, input().split())
if N > 1000:
exit()
if 2 * X > N:
X = N - X
#座標の作成
dp = [[-1] * (N+3)]
for i in range(N+1):
tmp = [-1]
for j in range(N+1):
if i <= j:
tmp.append(0) #到達していないマス
else:
tmp.append(-1) #壁(範囲外)
tmp.append(-1)
tmp.reverse()
dp.append(tmp)
dp.append([-1] * (N+3))
# print (np.array(dp))
#m: 0:右へ, 1:左下へ, 2:左上へ
def moving(x, y, total, m):
if x == X and y == 1 and dp[x][y] == 1:
# print ('D')
return total
if m == 0: #右に動く時
tmp = 0
while dp[x-1][y+1] == 0: #右に進める時
dp[x-1][y+1] = 1 #右進んだマスを到達したことにする
tmp += 1
x -= 1
y += 1
if dp[x-1][y+1] == -1: #右側が壁の時-->左下に進む
# print ('1-B')
return moving(x, y, total + tmp, 1)
if dp[x-1][y+1] == 1: #右側が光の線の時-->左上へ進む
tmp += 1
# print ('1-C')
return moving(x-1, y+1, total + tmp, 2)
if m == 1: #左下へ動く時
tmp = 0
while dp[x+1][y] == 0: #左下に進める時
dp[x+1][y] = 1
tmp += 1
x += 1
if dp[x+1][y] == -1: #左下が壁の時-->左上に進む
# print ('2-C')
return moving(x, y, total + tmp, 2)
if dp[x+1][y] == 1: #左下が光の線の時-->左上に進む
tmp += 1
# print ('2-C')
return moving(x+1, y, total + tmp, 2)
if m == 2: #左上に動く時
tmp = 0
while dp[x][y-1] == 0: #左上に進める時
dp[x][y-1] = 1
tmp += 1
y -= 1
if dp[x][y-1] == -1: #左上が壁の時-->右に進む
# print ('3-A')
return moving(x, y, total + tmp, 0)
if dp[x][y-1] == 1: #左上が光の線の時-->左下に進む
tmp += 1
# print ('3-B')
return moving(x, y-1, total + tmp, 1)
X += 1
print (moving(X, 1, 0, 0))
# print (np.array(dp)) | Traceback (most recent call last):
File "/tmp/tmpt_qd75ts/tmp4gifs486.py", line 4, in <module>
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s223030371 | p04048 | u305052967 | 1559310443 | Python | Python (3.4.3) | py | Runtime Error | 75 | 3980 | 196 | N,X = map(int, input().split())
def para(a,b):
if a == b:
return a
if a > b:
return 2*b + para(b,a-b)
if a < b:
return 2*a + para(a,b-a)
print(N+para(X,N-X)) | Traceback (most recent call last):
File "/tmp/tmp9ik4ow9h/tmpbbdluwte.py", line 1, in <module>
N,X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s736998737 | p04048 | u305052967 | 1559309905 | Python | Python (3.4.3) | py | Runtime Error | 73 | 3984 | 198 | N,X = map(int, input().split())
def para(a,b):
if b == 0:
return a
if a >= b:
return a+b + para(b,a-b)
if a < b:
return 2*a + para(a,b-a)
print(X+para(X,N-X)) | Traceback (most recent call last):
File "/tmp/tmp1qnesg9l/tmp2xk2y021.py", line 1, in <module>
N,X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s761842807 | p04048 | u305052967 | 1559309063 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3976 | 197 | N,X = map(int, input().split())
def para(a,b):
if a > b:
return a+b + para(b,a-b)
if a < b:
return 2*a + para(a,b-a)
if a == b:
return 3*a
print(X+para(X,N-X)) | Traceback (most recent call last):
File "/tmp/tmpp3mdl1h6/tmppdoe9gjh.py", line 1, in <module>
N,X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s296000499 | p04048 | u305052967 | 1559308855 | Python | Python (3.4.3) | py | Runtime Error | 75 | 3988 | 214 | N,X = map(int, input().split())
print(N)
print(X)
def para(a,b):
if a > b:
return a+b + para(b,a-b)
if a < b:
return 2*a + para(a,b-a)
if a == b:
return 3*a
print(X+para(X,N-X)) | Traceback (most recent call last):
File "/tmp/tmphdlh_byz/tmpeoh4lly3.py", line 1, in <module>
N,X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s248720864 | p04048 | u305052967 | 1559255143 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3980 | 212 | N,X = map(int, input().split())
print(N)
print(X)
def para(a,b):
if a > b:
return 2*b + para(b,a-b)
if a < b:
return 2*a + para(b-a,a)
if a == b:
return a
print(N+para(X,N-X)) | Traceback (most recent call last):
File "/tmp/tmpgmf63nzs/tmpqk187oa1.py", line 1, in <module>
N,X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s663748375 | p04048 | u095426154 | 1556933882 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 489 | n,x=map(int,input().split())
ans=0
if x<n/2:
a=x
b=n-x
ans+=x+n
while True:
if b%a==0:
ans+=a*2*(b/a)
break
else:
ans+=a*2*(b//a)
a,b=b%a,a
elif x=n/2:
ans=3*x
elif x>n/2:
a=n-x
b=x
ans+=x
while True:
if b%a==0:
ans+=a*2*(b/a)
break
else:
ans+=a*2*(b//a)
a,b=b%a,a
print(ans)
| File "/tmp/tmp_ksfo6x1/tmp788udvrv.py", line 14
elif x=n/2:
^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s171165520 | p04048 | u095426154 | 1556933820 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 487 | n,x=map(int,input().split())
ans=0
if x<n/2:
a=x
b=n-x
ans+=x+n
while True:
if b%a=0:
ans+=a*2*(b/a)
break
else:
ans+=a*2*(b//a)
a,b=b%a,a
elif x=n/2:
ans=3*x
elif x>n/2:
a=n-x
b=x
ans+=x
while True:
if b%a=0:
ans+=a*2*(b/a)
break
else:
ans+=a*2*(b//a)
a,b=b%a,a
print(ans)
| File "/tmp/tmp4g203hce/tmp11_w7v16.py", line 8
if b%a=0:
^^^
SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
| |
s824369964 | p04048 | u346194435 | 1556036048 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 231 | N,X = map(int, input().split())
if N/2 == X:
print(X*3)
elif N/2 > X:
# 上側
l = X + N - X
l += ((N-X)//X)*2
n = (N-X)%X
l += (X//n)*2*n
l += n
else:
l = X
n = X-N
l += (N//n)*2*n
print(l) | Traceback (most recent call last):
File "/tmp/tmpfhxj6qww/tmp0rqbx258.py", line 1, in <module>
N,X = map(int, input().split())
^^^^^^^
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.