s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s952005740 | p03646 | u579754454 | 1502346620 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 300 | K=int(input())
a=[]
N=0
if K<=50:
N=K
a=[i for i in range(1,K+1)]
a=map(str,a)
else:
N=50
index=0
a=[i for i in range(0,50)]
for i in range(K):
index=a.index(min(a))
a[index]+=N+1
a=map(lambda x:x-1,a)
a=map(str,a)
print(N)
print(" ".join(a))
|
s771791187 | p03646 | u579754454 | 1502345324 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 237 | K=int(input())
a=[]
N=0
if K<=50:
N=K
a=[i for i in range(1,K+1)]
a=map(str,a)
else:
N=50
x=K%50
a=[i for i in range(1,52)]
a=map(str,a)
b=a[0:50-x]
c=a[51-x:51]
a=c+b
print(N)
print(" ".join(a))
|
s933474595 | p03646 | u579754454 | 1502345196 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 234 | K=int(input())
a=[]
N=0
if K<=50:
N=K
a=[i for i in range(1,K+1)]
a=(map,a)
else:
N=50
x=K%50
a=[i for i in range(1,52)]
a=map(str,a)
b=a[0:50-x]
c=a[51-x:51]
a=c+b
print(N)
print(" ".join(a))
|
s359489898 | p03646 | u579754454 | 1502345103 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 247 | K=int(input())
a=[]
N=0
if K<=50:
N=K
a=[i for i in range(1,K+1)]
a=(map,a)
else:
N=50
x=K%50
a=[i for i in range(1,52)]
a=map(str,a)
b=a[0:50-x]
c=a[51-x:51]
a=c+b
print(a)
print(N)
print(" ".join(a))
|
s398897572 | p03646 | u205584541 | 1501997920 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 156 | K = int(raw_input())
res = range(51)
k = K/50
mod = K%50
for i in res:
res[i] = i+k
res.pop(51-mod)
print 50
for i in range(len(res)):print res[i], |
s752593009 | p03646 | u650245944 | 1501589418 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 145 | #!/usr/bin
# -*- coding="utf-8" -*-
K = int(input())
N = K + 1
n = [0] * N
n[0] = K**2 + K*2
n = ' '.join(list(map(str, n)))
print(N)
print(n)
|
s254991888 | p03646 | u150117535 | 1501473211 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 264 | K= int(input())
if K==0:
print("2")
print("1 1")
elif K<10**16+10000:
print("2")
print("1",1+K)
else:
p=K//49
l=p//50
r=p-50*l
ans=[49*(l+1)]*50
for i in range(r):
ans[i]+=ans[i]+49
print(50)
print(" ".join(ans)) |
s877248827 | p03646 | u150117535 | 1501473155 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 264 | K= int(input())
if K=0:
print("2")
print("1 1")
elif K<10**16+10000:
print("2")
print("1",1+K)
else:
p=K//49
l=p//50
r=p-50*l
ans=[49*(l+1)]*50
for i in range(r):
ans[i]=+=ans[i]+49
print(50)
print(" ".join(ans)) |
s659421201 | p03646 | u451017206 | 1501387127 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 269 | K=int(input())
N=min(50,K)
a = list(range(N))
m = int(K / len(a))
b = K%len(a)
a=list(map(lambda x: x + m, a))
for i in range(b):
a[i] += N
for j in range(N):
if j == i:
continue
a[j] -= 1
print(N)
print(' '.join(list(map(str,a))))
|
s145279442 | p03646 | u462626125 | 1501384680 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 512 | def decrease(A,N):
t = 0
while(1):
if max(A) <= N -1: break
else:
for i in range(N): A[i] = A[i] + 1
i = A.index(max(A))
A[i] = A[i] - N - 1
t += 1
return t
if __name__ == '__main__':
K = int(input())
p,q = K // 50, K % 50
A = [i ... |
s465226418 | p03646 | u941268675 | 1501382861 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 276 | K = int(input())
f1 = 1
for n in range(2, 51):
if K % n == 0:
f1 = n
f2 = K // f1
a = f1 + f2 - 1
ans = [a - i for i in range(f1)]
print (f1)
print (" ".join([str(v) for v in ans]) if K != 1 else [1, 0, 3]) |
s565955483 | p03646 | u254456372 | 1501382558 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 930 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import re
import math
import collections
import itertools
import functools
DEBUG = True
DEBUG = False
def dbg(*args):
if DEBUG:
print("DBG: ", file=sys.stderr, end="")
print(*args, file=sys.stderr)
def solve_small(K):
if K == 0:
... |
s517994575 | p03646 | u404459933 | 1501382397 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 367 | K=int(input())
if K==0:
print(1)
print(0)
elif K==1:
print(2)
print(2,2)
else:
print(50)
times=(K-1)//50
A=[99]*50
for i in range(len(A)):
A[i]+=times
rem=(K-1)%50
for i in range(rem):
for j in range(len(A)):
if j==0:
A[j]+=N
... |
s650142741 | p03646 | u245448626 | 1501381278 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 53 | K=int(input())
print(K+1)
print((str(K+1)+' ')*K+'0') |
s566879751 | p03646 | u245448626 | 1501381122 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 44 | K=int(input())
print((str(K+1)+' ')*(K)+'0') |
s542263497 | p03646 | u245448626 | 1501380813 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3056 | 32 | K=int(input())
print('0 '*(K+1)) |
s588066146 | p03647 | u034128150 | 1595096526 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9104 | 570 | N = int(input())
list_of_a = list(map(int, input().split()))
ng = max(0, sum(list_of_a)-(N-1)*N) - 1
ok = max(0, (max(list_of_a) - (N-1)) * N)
while ok - ng > 1:
mid = (ok + ng) // 2
count = 0
for a in list_of_a:
count += (a + mid + 1) // (N+1)
if count <= mid:
ok = mid
else:
... |
s301747373 | p03647 | u034128150 | 1595096334 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9012 | 570 | N = int(input())
list_of_a = list(map(int, input().split()))
ng = max(0, sum(list_of_a)-(N-1)*N) - 1
ok = max(0, (max(list_of_a) - (N-1)) * N)
while ok - ng > 1:
mid = (ok + ng) // 2
count = 0
for a in list_of_a:
count += (a + mid + 1) // (N+1)
if count <= mid:
ok = mid
else:
... |
s118672372 | p03647 | u816631826 | 1573597152 | Python | Python (3.4.3) | py | Runtime Error | 1231 | 78772 | 606 | n, m = list(map(int, input().split()))
connections = dict()
answer = {
'true': 'POSSIBLE',
'false': 'IMPOSSIBLE'
}
def add_to_set(a, b):
if a in connections:
connections[a].add(b)
else:
connections[a] = set([b])
if b in connections:
connections[b].add(a)
else:
... |
s131879068 | p03647 | u863370423 | 1573564838 | Python | Python (3.4.3) | py | Runtime Error | 1213 | 78680 | 544 | n, m = list(map(int, input().split()))
connections = {}
answer = {
'true': 'POSSIBLE',
'false': 'IMPOSSIBLE'
}
def add_to_set(a, b):
if a in connections:
connections[a].add(b)
else:
connections[a] = {b}
if b in connections:
connections[b].add(a)
else:
connect... |
s567118913 | p03647 | u816631826 | 1573564464 | Python | Python (3.4.3) | py | Runtime Error | 928 | 85840 | 526 | n, m = input().split()
m = int(m)
connections = {}
answer = {
'true': 'POSSIBLE',
'false': 'IMPOSSIBLE'
}
def add_to_set(a, b):
if a in connections:
connections[a].add(b)
else:
connections[a] = {b}
if b in connections:
connections[b].add(a)
else:
connections... |
s161551511 | p03647 | u089230684 | 1573532416 | Python | Python (3.4.3) | py | Runtime Error | 922 | 34676 | 816 | n, m = map(int, input().split())
ends = []
starts = []
possible = False
for i in range(m):
a, b = map(int, input().split())
if a == 1:
starts.append([a, b])
elif b == n:
ends.append([a, b])
starts.sort(key=lambda x: x[1])
ends.sort(key=lambda x: x[0])
i = 0
j = 0
to = starts[i][1]
fr = en... |
s867594444 | p03647 | u353919145 | 1573532369 | Python | Python (3.4.3) | py | Runtime Error | 941 | 34676 | 782 | n, m = map(int, input().split())
ends = []
starts = []
possible = False
for i in range(m):
a, b = map(int, input().split())
if a == 1:
starts.append([a, b])
elif b == n:
ends.append([a, b])
starts.sort(key=lambda x: x[1])
ends.sort(key=lambda x: x[0])
i = 0
j = 0
while i != len(starts) an... |
s394342433 | p03647 | u170765582 | 1564020707 | Python | Python (3.4.3) | py | Runtime Error | 663 | 53268 | 161 | a,b=map(int,input().split())
c=[list(map(int,input().split()))for i in[0]*b]
print(({i[1]for i in c if c[0]==1}&{i[0]for i in c if c[1]==a}=={})*'IM'+'POSSIBLE') |
s540793053 | p03647 | u676059589 | 1564014037 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1042 | 122576 | 1295 | from copy import *
from sys import *
from math import *
import queue
from collections import defaultdict,Counter,deque
setrecursionlimit(1000000)
def main():
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
b = {}
for i in ab:
try:
b[i[0]].append(i[1])
except:
b[i[0... |
s622530278 | p03647 | u450339194 | 1554918744 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 329 | N, M = map(int, input().split())
import sys
teiki = defaultdict(set)
for i in range(M):
a, b = map(int, input().split())
teiki[a].add(b)
if 1 not in teiki:
print('IMPOSSIBLE')
sys.exit()
for i in teiki[1]:
if i in teiki and N in teiki[i]:
print('POSSIBLE')
sys.exit()
print('IMP... |
s188086429 | p03647 | u669696235 | 1550354250 | Python | Python (3.4.3) | py | Runtime Error | 1034 | 7792 | 609 | class UnionFind():
def __init__(self,size):
self.table = [-1 for i in range(size)]
def find(self,x):
if(self.table[x]<0):
return x
else :
self.table[x]=self.find(self.table[x])
return self.table[x]
def union(self,x,y):
s1 = self.find(x) ... |
s538395355 | p03647 | u375616706 | 1548796044 | Python | Python (3.4.3) | py | Runtime Error | 475 | 11080 | 667 | import heapq
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
cand_1 = []
cand_2 = []
for _ in range(M):
a, b = map(int, input().split())
if a == 1:
cand_1.append(b)
elif b == N:
cand_2.append(a)
ans = "IMPOSSIBLE"
heapq.heapify(cand_1)
heapq.heapify(cand_2)
l1 = len... |
s431876020 | p03647 | u397531548 | 1544581553 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 279 | N,M=map(int,input().split())
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(M):
a,b=map(int,input().split())
if a==1:
x[b]=1
if b==N:
y[a]=1
for i in range(N+1):
if x[i]==1 and y[i]==1:
print("POSSIBLE")
break
else:
print("IMPOSSIBLE") |
s259806041 | p03647 | u816631826 | 1538583108 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 39244 | 449 | n,m=map(int, input().split())
main_list=list()
list2=list()
for i in range(m):
a,b=map(int, input().split())
list2.append(a)
list2.append(b)
main_list.append(list2)
list2=[]
for i in range(m):
if main_list[i][0]==1:
for j in range(m):
if (main_list[i][1]==main_list[j][0])and(... |
s251234879 | p03647 | u345076485 | 1530219234 | Python | Python (3.4.3) | py | Runtime Error | 711 | 23276 | 465 | N,M=map(int,input().split())
a=[]
b=[]
for i in range(0,M):
c,d=map(int,input().split())
a.append(c)
b.append(d)
pos=0
i=0
g=[0 for i in range(0,M)]
print(g)
e=[]
f=[]
k=0
l=0
while i < M and pos == 0:
if a[i] == 1:
g[b[i]] = 1
if b[i] == 1:
g[a[i]] = 1
i=i+1
i=0
print(g)
while i < M and pos == 0:
if a[i] =... |
s322378685 | p03647 | u363299657 | 1507246185 | Python | Python (2.7.6) | py | Runtime Error | 699 | 35128 | 388 | n, m = map(int, raw_input().split())
f = dict()
for i in range(m):
a, b = map(int, raw_input().split())
if a in f:
f[a].append(b)
else:
f[a] = [b]
if m < 2:
print("IMPOSSIBLE")
exit()
for k, v in f.iteritems():
if k == 1:
for vv in v:
if n in f[vv]:
... |
s176633097 | p03647 | u243370518 | 1507246168 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 143 | k = int(input())
n = 50
m = (n - 1) * (k + 1) + 1
series = str(m)
for i in range(n):
series = series + " 0"
print(str(n))
print(series)
|
s695838647 | p03647 | u498631675 | 1507245328 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 346 | # -*- coding: utf-8 -*-
N, M = map(int, raw_input().split())
a = []
for i in xrange(M):
a.append(map(int, raw_input().split()))
s1=set()
s2=set()
for i in xrange(M):
if a[i][0]==1:
s1.add(a[i][1])
if a[i][1]==N:
s2.add(a[i][0])
if s1 & s2:
print 'POSSIBLE'
else:
print 'IMPOSSIBLE'
... |
s459227679 | p03647 | u363299657 | 1507245011 | Python | Python (2.7.6) | py | Runtime Error | 559 | 22332 | 302 | n, m = map(int, raw_input().split())
f = dict()
for i in range(m):
a, b = map(int, raw_input().split())
f[a] = b
if m == 1:
print("IMPOSSIBLE")
exit()
for k, v in f.iteritems():
if k == 1:
if f[v] == n:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
s927882359 | p03647 | u243370518 | 1507244154 | Python | Python (3.4.3) | py | Runtime Error | 374 | 3064 | 357 | x = input().split(" ")
n = int(x[0])
m = int(x[1])
probInit = set([])
probEnd = set([])
for i in range(m):
edge = input().split(" ")
if edge[0] == 0:
probInit.add(edge[1])
if edge[1] == n - 1:
probEnd.add(edge[0])
sec = probEnd.intercection(probInit)
if (len(sec) == 0):
print("IMPOS... |
s732297844 | p03647 | u677320550 | 1505285639 | Python | Python (3.4.3) | py | Runtime Error | 147 | 3060 | 271 | n, m = [int(x) for x in input().split()]
for i in range(m):
a, b = [int(x) for x in input().split()]
if a == 1:
s[b] = 1
if d[b] == 1:
print('POSSIBLE')
break
elif b == n:
d[a] = 1
if s[a] == 1:
print('POSSIBLE')
break
else:
print('IMPOSSIBLE') |
s122977084 | p03647 | u191557685 | 1504471463 | Python | Python (3.4.3) | py | Runtime Error | 397 | 45976 | 688 | import sys;
lines = sys.stdin.readlines();
n = {};
can = "";
max = 1;
for i, line in enumerate(lines):
start,goal = line.split();
start = int (start);
goal = int (goal);
if not start in n :
n[start] = [];
if (max < start):
max = start;
if (max < goal):
max = goal;
n[... |
s543776603 | p03647 | u191557685 | 1504471406 | Python | Python (3.4.3) | py | Runtime Error | 409 | 45912 | 689 | import sys;
lines = sys.stdin.readlines();
n = {};
can = "";
max = 1;
for i, line in enumerate(lines):
start,goal = line.split();
start = int (start);
goal = int (goal);
if not start in n :
n[start] = [];
if (max < start):
max = start;
if (max < goal):
max = goal;
n[... |
s240964883 | p03647 | u696449926 | 1502139538 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 352 | K = int(input())
a = 0
b = 0
for i in range(1, 51):
if (K - K % i) / i + i - 1 >= 1000 + 10**16:
break
b = int(K % i)
a = int((K - b) / i)
N = i
list = [0] * N
j = 0
while (j <= N - b - 1) :
list[j] = N + a - b - 1
j += 1
while (j > N - b - 1 and j <= N - 1):
list[j] = 2 * N - b
j += 1
list = map(... |
s035180246 | p03647 | u341087021 | 1502011562 | Python | Python (3.4.3) | py | Runtime Error | 586 | 6132 | 288 | n, m = [int(x) for x in input().split()]
s = [0]*(n+1)
d = [0]*(n+1)
for i in range(m):
a, b = [int(x) for x in input().split()]
if a == 1:
s[b] = 1
elif b == n:
d[a] = 1
for i in range(1,m+1):
if s[i] == 1 and d[i] == 1:
print('POSSIBLE')
break
else:
print('IMPOSSIBLE')
|
s133677862 | p03647 | u226155577 | 1501817192 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 151 | n,m,*T=map(int,open(0).read().split());*S,=zip(T[::2],T[1::2]);s=lambda e:{*sum([s for s in S if e in s],())};print("IM"*(len(s(1)&s(n))<1)+"POSSIBLE") |
s073836981 | p03647 | u607437307 | 1501498266 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 14656 | 1080 | #coding:utf-8
import sys
teikibin = {}
ans = False
n, m = sys.stdin.readline().strip().split(" ")
n = int(n)
m = int(m)
for i in range(m):
a, b = sys.stdin.readline().strip().split(" ")
a = int(a)
b = int(b)
if a in teikibin:
teikibin[a].append(b)
else:
teikibin[a] = [b]
... |
s845779955 | p03647 | u607437307 | 1501498178 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 13632 | 1080 | #coding:utf-8
import sys
teikibin = {}
ans = False
n, m = sys.stdin.readline().strip().split(" ")
n = int(n)
m = int(m)
for i in range(m):
a, b = sys.stdin.readline().strip().split(" ")
a = int(a)
b = int(b)
if a in teikibin:
teikibin[a].append(b)
else:
teikibin[a] = [b]
... |
s353616509 | p03647 | u552668967 | 1501436330 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2692 | 293 | from sys import stdin
n,m = map(int,stdin.readline().split())
ans = 'IMPOSSIBLE'
di = set()
for i in xrange(m):
x,y = map(int,stdin.readline().split())
di.add((min(x,y),max(x,y))
for i in xrange(2,n):
fir = (1,i)
sec = (i,n)
if fir in di and sec in di:
ans = 'POSSIBLE'; break
print ans |
s488191133 | p03647 | u674569298 | 1501389106 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 71 | n = int(input())
ans = list(map(str,range(1,n+1)))
print(' '.join(ans)) |
s487610651 | p03647 | u777923818 | 1501384399 | Python | Python (3.4.3) | py | Runtime Error | 147 | 12500 | 365 | # -*- coding: utf-8 -*-
import numpy as np
K = int(input())
K = K
# astypeを入れないとおかしくなっちゃう
a = np.ones(50).astype(np.int64)*(49) + (K)//50
if K%50 != 0:
a[:K%50] += 51 - (K%50)
a[K%50:] -= (K%50)
else:
pass
result = "50\n{}".format(a[0])
for a_ in a[1:]:
result += (" {}".format(int(a_))... |
s661510138 | p03647 | u894844146 | 1501383172 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 502 | def f():
n,m = map(int,input().split(" "))
s = []
w = [[] for i in range(n+2)]
for i in range(m):
a,b = map(int,input().split(" "))
if a==1:
s.append(b)
if b==1:
s.append(a)
w[a].append(b)
... |
s452071527 | p03647 | u280269055 | 1501382343 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 204 | N = int(input())
A = list(map(int, input().split()))
s = sum(A) - N*(N-1)
m = sum(list(map(lambda x: (x+s)//N, A)))
while m > s:
s = m
m = sum(list(map(lambda x: (x+s)//N, A)))
else:
print(m) |
s820284947 | p03647 | u280269055 | 1501382296 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 194 | N = int(input())
A = list(map(int, input().split()))
s = sum(A) - N*(N-1)
m = list(map(lambda x: (x+s)//N, A))
while m > s:
s = m
m = list(map(lambda x: (x+s)//N, A))
else:
print(m) |
s926485284 | p03647 | u783675879 | 1501381312 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 109 | n=int(raw_input())
if n%2==0:
print 2
print n/2+1,n/2+1
else:
print 2
print (n-1)/2,(n-1)/2+3 |
s326835476 | p03647 | u272028993 | 1501379956 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 437 | def show1(n, ans):
for i in xrange(n):
print ans[i],
print
def show2(n, m, l, ans):
for i in xrange(l):
print ans[i] + m + 1,
for i in xrange(l, n):
print ans[i] + m ,
print
k = int(raw_input())
n = 50
ans = [0] * n
print n
if k <= n:
for i in xrange(k):
ans[i] ... |
s554277001 | p03647 | u781758937 | 1501378619 | Python | Python (3.4.3) | py | Runtime Error | 623 | 18944 | 306 | N, M = map(int, input().split())
A = set({})
B = set({})
for j in range(N-1):
tmp = []
tmp = [int(i) for i in input().split()]
if tmp[0] == 1:
A.add(tmp[1])
elif tmp[1] == N:
B.add(tmp[0])
if len(A.intersection(B)) > 0:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
|
s590684846 | p03647 | u346308892 | 1501377204 | Python | Python (3.4.3) | py | Runtime Error | 27 | 4848 | 3770 | class Edge:
def __init__(self,edge,cost=1):
self.node_from=edge[0]
self.node_to=edge[1]
self.cost=cost
def add_node(self,node):
self.nodes.append(node)
class myGraph:
def __init__(self):
self.adj={}
self.nodes={}
def add_edge(self,edge,cost):
i... |
s859033328 | p03648 | u313043608 | 1587419050 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 660 | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
int MOD=1000000007;
void calc(vector<int>& a... |
s422811093 | p03648 | u779455925 | 1580061510 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38528 | 266 | # input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
K=int(input())
if K%2==0:
A0=K//2+1
A1=K//2+1
else:
A0=(K+1)//2-2
A1=(K+1)//2+1
print(N)
print(A0,A1)
|
s407069842 | p03648 | u644778646 | 1568702401 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38588 | 290 | def main():
k = int(input())
a = min(k, 50)
b = k % a
ans = [i + k//a for i in range(a)]
for i in range(b):
ans.sort()
for j in range(1, a):
ans[j] -= 1
ans[0] += a
print(a)
print(*ans)
if __name__ == '__main__':
main() |
s491211703 | p03648 | u393512980 | 1566348283 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3316 | 414 | import sys
sys.setrecursionlimit(10000000)
def input():
return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
def arc079():
K = int(input())
k = K//50
a = [i+k*50 for i in range(50)]
for i in range(K-k):
... |
s687029102 | p03648 | u054106284 | 1549322234 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 134 | K = int(input())
ans = [K//50 + i for i in range(50)]
if K%50:
for i in range(K%50):
ans[i] += 50
print(50)
print(" ".join(ans)) |
s321595745 | p03648 | u054106284 | 1549322185 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 133 | K = int(input())
ans = [K//50 + i for i in range(50)]
if K%50:
for i in range(K%50):
ans[i] += N
print(50)
print(" ".join(ans)) |
s351133686 | p03648 | u048945791 | 1541373325 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 238 | N = 50
big = 10 ** 16
K = int(input())
if K <= 50 * 50:
a = [49] * 50
a[0] += K * 50
else:
a = [0] * 50
index = 0
for i in range(K // big):
a[i] = big
a[i] = K % big
print(N)
print(" ".join(map(str, a))) |
s493463194 | p03648 | u976162616 | 1507245718 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 359 | if __name__ == "__main__":
K = int(input())
if (K == 0):
print (2)
print (0, 0)
exit()
if (K == 1):
print (2)
print (2, 0)
if (K <= 50):
print (K)
res = []
for x in range(K):
res.append(x + 1)
print (" ".join(map(str, r... |
s105398565 | p03648 | u976162616 | 1507245631 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 381 | if __name__ == "__main__":
K = int(input())
if (K == 0):
print (1)
print (0)
exit()
if (K <= 50):
print (K)
res = []
for x in range(K):
res.append(x + 1)
print (" ".join(map(str, res)))
exit()
if (K <= 10 ** 16 + 1000):
... |
s500281790 | p03648 | u696449926 | 1502142661 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 256 | K = int(input())
b = int(K % 50)
a = int((K - b) / 50)
list = [0] * 50
j = print(' '.join(list))0
while (j <= 49 - b) :
list[j] = 49 + a - b
j += 1
while (j >49 - b and j <= 49):
list[j] = 2 * 50 + a - b
j += 1
list = map(str, list)
print('50')
|
s842006088 | p03648 | u696449926 | 1502139557 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 368 | K = int(input())
a = 0
b = 0
for i in range(1, 51):
if (K - K % i) / i + i - 1 >= 1000 + 10**16:
break
b = int(K % i)
a = int((K - b) / i)
N = i
list = [0] * N
j = 0
print(a, b, N)
while (j <= N - b - 1) :
list[j] = N + a - b - 1
j += 1
while (j > N - b - 1 and j <= N - 1):
list[j] = 2 * N - b
j +=... |
s019079178 | p03648 | u419645731 | 1501381009 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 251 | x = int(input())
if x == 0:
print(4)
print(3, 3, 3, 3)
1/0
x-= 1
phase = x//50
subphase = x%50
pstart = phase*50
left = 99+phase-(x-pstart)
right = 48+phase-(x-pstart)
ans = [left]*(1+subphase)+[right]*(49-subphase)
print(50)
print(*ans) |
s493567235 | p03648 | u509661905 | 1501380908 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38640 | 488 | MIN_N = 2
MAX_N = 50
MAX_A0 = 10 ** 16 + 1000
def solve(k):
n = 1
a0 = -MAX_A0
for n_cand in range(MIN_N, MAX_N + 1):
a0_cand = n_cand * (k + 1) - 1
if a0 < 0 or a0 < a0_cand <= MAX_A0:
n = n_cand
a0 = a0_cand
res = [0] * n
res[0] = a0
assert all(0 <= x ... |
s714491293 | p03648 | u272028993 | 1501378934 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 434 | def show1(n, ans):
for i in xrange(n):
print ans[i],
print
def show2(n, m, l, ans):
for i in xrange(l):
print ans[i] * m + 1,
for i in xrange(l, n):
print ans[i] * m,
print
k = int(raw_input())
n = 50
ans = [0] * n
print n
if k <= n:
for i in xrange(k):
ans[i] =... |
s304339144 | p03649 | u844789719 | 1596920934 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9100 | 215 | N, *A = [int(_) for _ in open(0).read().split()]
sumB = max(0, sum(A) - N * (N - 1))
while True:
B = [0 - (-(a + x + 1 - N)) // (N + 1) for a in A]
if sumB == sum(B):
break
sumB += 1
print(sumB)
|
s531164600 | p03649 | u430937688 | 1580083709 | Python | Python (3.4.3) | py | Runtime Error | 98 | 8908 | 1203 | #!/usr/bin/env python3
import sys
def count_linear_process(lis):
length = len(lis)
return [l // length for l in lis]
def linear_process(lis):
length = len(lis)
return [l % length for l in lis]
def check_end(lis):
return max(lis) < len(lis)
def add_processed(lis, counts):
sum_cnt = sum(co... |
s339868393 | p03649 | u606045429 | 1574213046 | Python | Python (3.4.3) | py | Runtime Error | 151 | 12496 | 186 | from numpy import int64, divmod
N, A = open(0)
N, A = int(N), int64(A.split())
ans = 0
S = -1
while S:
B, A = A % N, A // N
S = B.sum()
ans += S
A += S - B
print(ans)
|
s701943458 | p03649 | u606045429 | 1574212903 | Python | Python (3.4.3) | py | Runtime Error | 150 | 12496 | 185 | from numpy import int64, divmod
N, A = open(0)
N, A = int(N), int64(A.split())
ans = 0
S = -1
while S:
B, A = divmod(A, N)
S = B.sum()
ans += S
A += S - B
print(ans)
|
s869237071 | p03649 | u280667879 | 1501398923 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 198 | from heapq import*
n=int(input())
a=[-int(e)for e in input().split()]
r=0
heapify(a)
while 1:
x=heappop(a)
if x>-n:break
c=-x//n
x+=c*n
for _ in range(n-1):a[i]-=c
heappush(a,x)
r+=c
print(r) |
s569909321 | p03649 | u280667879 | 1501398915 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38384 | 198 | from heapq import*
n=int(input())
a=[-int(e)for e in input().split()]
r=0
heapify(a)
while 1:
x=heappop(a)
if x>-n:break
c=-x//n
x+=c*n
for _ in range(n-1):a[i]-=c
heappush(a,x)
r+=c
print(r) |
s923622533 | p03649 | u582577761 | 1501380777 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 2139 | #include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 20110... |
s810331659 | p03649 | u582577761 | 1501380758 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38384 | 2139 | #include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 20110... |
s025866287 | p03650 | u488401358 | 1595688871 | Python | PyPy3 (7.3.0) | py | Runtime Error | 266 | 136256 | 2095 | from collections import deque
N=int(input())
IN=[[] for i in range(N)]
OUT=[-1 for i in range(N)]
p=list(map(int,input().split()))
for i in range(N):
IN[p[i]-1].append(i)
OUT[i]=p[i]-1
deg=[len(IN[i]) for i in range(N)]
deq=deque([v for v in range(N) if deg[v]==0])
res=[]
while deq:
v=deq.popleft()
r... |
s570854567 | p03650 | u488401358 | 1595688804 | Python | PyPy3 (7.3.0) | py | Runtime Error | 273 | 136600 | 2248 | from collections import deque
N=int(input())
IN=[[] for i in range(N)]
OUT=[-1 for i in range(N)]
p=list(map(int,input().split()))
for i in range(N):
IN[p[i]-1].append(i)
OUT[i]=p[i]-1
deg=[len(IN[i]) for i in range(N)]
deq=deque([v for v in range(N) if deg[v]==0])
res=[]
while deq:
v=deq.popleft()
r... |
s760628914 | p03650 | u488401358 | 1595688716 | Python | PyPy3 (7.3.0) | py | Runtime Error | 265 | 136048 | 2233 | from collections import deque
N=int(input())
IN=[[] for i in range(N)]
OUT=[-1 for i in range(N)]
p=list(map(int,input().split()))
for i in range(N):
IN[p[i]-1].append(i)
OUT[i]=p[i]-1
deg=[len(IN[i]) for i in range(N)]
deq=deque([v for v in range(N) if deg[v]==0])
res=[]
while deq:
v=deq.popleft()
r... |
s173054674 | p03650 | u488401358 | 1595688060 | Python | PyPy3 (7.3.0) | py | Runtime Error | 256 | 136316 | 2225 | from collections import deque
N=int(input())
IN=[[] for i in range(N)]
OUT=[-1 for i in range(N)]
p=list(map(int,input().split()))
for i in range(N):
IN[p[i]-1].append(i)
OUT[i]=p[i]-1
deg=[len(IN[i]) for i in range(N)]
deq=deque([v for v in range(N) if deg[v]==0])
res=[]
while deq:
v=deq.popleft()
r... |
s599319024 | p03650 | u488401358 | 1595648015 | Python | PyPy3 (7.3.0) | py | Runtime Error | 274 | 129612 | 2076 | from collections import deque
N=int(input())
IN=[[] for i in range(N)]
OUT=[-1 for i in range(N)]
p=list(map(int,input().split()))
for i in range(N):
IN[p[i]-1].append(i)
OUT[i]=p[i]-1
deg=[len(IN[i]) for i in range(N)]
deq=deque([v for v in range(N) if deg[v]==0])
res=[]
while deq:
v=deq.popleft()
r... |
s852626283 | p03650 | u488401358 | 1595646928 | Python | PyPy3 (7.3.0) | py | Runtime Error | 403 | 129740 | 2083 | from collections import deque
N=int(input())
IN=[[] for i in range(N)]
OUT=[-1 for i in range(N)]
p=list(map(int,input().split()))
for i in range(N):
IN[p[i]-1].append(i)
OUT[i]=p[i]-1
deg=[len(IN[i]) for i in range(N)]
deq=deque([v for v in range(N) if deg[v]==0])
res=[]
while deq:
v=deq.popleft()
r... |
s372324179 | p03650 | u997521090 | 1538708675 | Python | PyPy2 (5.6.0) | py | Runtime Error | 2150 | 761460 | 1919 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(1000000)
INF = 10 ** 18
N = input()
p = map(int, raw_input().split())
E = [[] for i in range(N + 1)]
for i in range(N):
E[p[i]].append(i + 1)
flag = [True] * (N + 2)
def func(pos, pre, start... |
s166586633 | p03650 | u466826467 | 1503461849 | Python | Python (3.4.3) | py | Runtime Error | 1827 | 152124 | 1988 | from collections import defaultdict
import heapq as hq
def helper(n):
q = child_L[n]
del child_L[n]
hq.heapify(q)
i = 0
while q:
t = hq.heappop(q)
if i < t:
break
else:
i += (i == t)
j = i + 1
while q:
t = hq.heappop(q)
if j... |
s298413564 | p03650 | u243492642 | 1501453308 | Python | Python (3.4.3) | py | Runtime Error | 2114 | 161040 | 1848 | # coding: utf-8
from collections import defaultdict
def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def read():
N = II()
p = ILI()
return N, p
def solve(N, p):
ans = None
edges = defaultdict(list)
for i in range(N):
edges[p[i]].append(i + 1)
nod... |
s852135237 | p03651 | u785573018 | 1600559115 | Python | Python (3.8.2) | py | Runtime Error | 95 | 25428 | 308 | from math import gcd
n, k = map(int, input().split())
a = list(set(map(int, input().split())))
a.sort(); b = a[0]
for i in range(1, n): b = gcd(b, a[i])
if len(a) == 1:
print("POSSIBLE") if k == a[0] else print("IMPOSSIBLE")
else:
print("POSSIBLE") if k <= a[-1] and k%b == 0 else print("IMPOSSIBLE") |
s967963197 | p03651 | u375695365 | 1599089196 | Python | PyPy3 (7.3.0) | py | Runtime Error | 110 | 93100 | 396 | n, k = map(int, input().split())
a = list(map(int, input().split()))
a1 = []
if max(a) < k:
print("IMPOSSIBLE")
exit()
for i in range(1, n):
a1.append(abs(a[i-1]-a[i]))
a1 = sorted(a1)
for i in range(1, n-1):
if a1[i] % a1[0] != 0:
print("POSSIBLE")
break
else:
if k % a1[0] == 0 or... |
s146483464 | p03651 | u188745744 | 1598894694 | Python | Python (3.8.2) | py | Runtime Error | 66 | 20008 | 275 | N,K=list(map(int,input().split()))
l=list(map(int,input().split()))
import math
A=math.gcd(l[0],l[1])
if K<=max(l):
for i in range(max(0,N-2)):
A=math.gcd(A,l[i+2])
if K%A==0:
print("POSSIBLE")
else:
print("IMPOSSIBLE")
else:
print("IMPOSSIBLE") |
s295590421 | p03651 | u603958124 | 1596567910 | Python | Python (3.8.2) | py | Runtime Error | 81 | 21708 | 946 | from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator ... |
s635061281 | p03651 | u603958124 | 1596567844 | Python | Python (3.8.2) | py | Runtime Error | 76 | 21952 | 929 | from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator ... |
s889159588 | p03651 | u029000441 | 1596415299 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2226 | 704484 | 1405 | #float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, h... |
s218746354 | p03651 | u029000441 | 1596415175 | Python | PyPy3 (7.3.0) | py | Runtime Error | 110 | 92444 | 1394 | #float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, h... |
s655747815 | p03651 | u029000441 | 1596414946 | Python | PyPy3 (7.3.0) | py | Runtime Error | 111 | 92284 | 1382 | #float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, h... |
s243620625 | p03651 | u885634168 | 1595823897 | Python | PyPy3 (7.3.0) | py | Runtime Error | 114 | 103104 | 939 | def gcd_(a, b):
if a < b: a, b = b, a
if b == 0: return a
return gcd_(b, a % b)
def gcd_bl(A):
left = [0 for _ in range(N + 1)]
right = [0 for _ in range(N + 1)]
ans = [0 for _ in range(N)]
left[1] = A[0]
for i in range(1, N):
left[i + 1] = gcd_(left[i], A[i])
right[-1 -... |
s107389738 | p03651 | u885634168 | 1595822878 | Python | PyPy3 (7.3.0) | py | Runtime Error | 107 | 103296 | 1027 | def cin():
in_ = list(map(int,input().split()))
if len(in_) == 1: return in_[0]
else: return in_
def gcd_(a, b):
if a < b: a, b = b, a
if b == 0: return a
return gcd_(b, a % b)
def gcd(l):
ans = l[0]
for i in l: ans = gcd_(ans, i)
return ans
def gcd_bl(A):
left = [0 ... |
s836208974 | p03651 | u266014018 | 1595798678 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8920 | 456 | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
def gcd(x,y):
r = x%y
if r==0:
return y
return gcd(y, r)
n, k =map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
c = a[0]
for i in range(n):
c = gcd(a[... |
s232213918 | p03651 | u871841829 | 1594354302 | Python | Python (3.8.2) | py | Runtime Error | 74 | 20100 | 331 | N, K = map(int, input().split())
A = list(map(int, input().split()))
P = "POSSIBLE"
IP = "IMPOSSIBLE"
M = max(A)
def gcd(a, b):
if a == 0:
return b
else:
return gcd(b%a, a)
t = gcd(A[1], A[0])
if N >= 2:
for a in A[2:]:
t = gcd(t, a)
if K%t == 0 and K <= M:
print(P)
else:
... |
s153051210 | p03651 | u871841829 | 1594354266 | Python | Python (3.8.2) | py | Runtime Error | 68 | 19924 | 331 | N, K = map(int, input().split())
A = list(map(int, input().split()))
P = "POSSIBLE"
IP = "IMPOSSIBLE"
M = max(A)
def gcd(a, b):
if a == 0:
return b
else:
return gcd(b%a, a)
t = gcd(A[1], A[0])
if N >= 2:
for a in A[2:]:
t = gcd(t, a)
if K%t == 0 and K <= M:
print(P)
else:
... |
s063157321 | p03651 | u871841829 | 1594354240 | Python | Python (3.8.2) | py | Runtime Error | 72 | 19760 | 331 | N, K = map(int, input().split())
A = list(map(int, input().split()))
P = "POSSIBLE"
IP = "IMPOSSIBLE"
M = max(A)
def gcd(a, b):
if a == 0:
return b
else:
return gcd(b%a, a)
t = gcd(A[1], A[0])
if N >= 2:
for a in A[2:]:
t = gcd(t, a)
if K%t == 0 and K <= M:
print(P)
else:
... |
s583946934 | p03651 | u871841829 | 1594353339 | Python | Python (3.8.2) | py | Runtime Error | 60 | 19896 | 322 | N, K = map(int, input().split())
A = list(map(int, input().split()))
P = "POSSIBLE"
IP = "IMPOSSIBLE"
A.sort()
def gcd(a, b):
if a == 0:
return b
else:
gcd(b, b%a)
t = gcd(A[1], A[0])
if N <= 2:
for a in A[2:]:
t = gcd(t, a)
if K%t == 0 and K <= M:
print(P)
else:
print(I... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.