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
s872147671
p03768
u477320129
1491098068
Python
PyPy3 (2.4.0)
py
Runtime Error
2108
87256
1055
import heapq class Node: def __init__(self): self.color = 0 self.to = [] def bfs(graph, cur, color, visited, dist): q = [(0, cur)] while q: d, c = heapq.heappop(q) if visited[c]: continue graph[c].color = color visited[c] = True if d == dist: continue for n in graph[c].to: if visited[n]: continue heapq.heappush(q, (d+1, n)) def main(): N, M = [int(i) for i in input().split()] graph = [Node() for _ in range(N+1)] for _ in range(M): a, b = [int(i) for i in input().split()] graph[a].to.append(b) graph[b].to.append(a) Q = int(input()) assert 1 <= N <= 2000 assert 1 <= M <= 2000 assert 1 <= Q <= 2000 for _ in range(Q): v, d, c = [int(i) for i in input().split()] visited = [False] * (N + 1) bfs(graph, v, c, visited, d) for i in range(1, N+1): print(graph[i].color) if __name__ == "__main__": main()
s899050334
p03768
u257374434
1491097963
Python
Python (3.4.3)
py
Runtime Error
2104
83552
1005
from collections import defaultdict,deque N,M = list(map(int,input().split())) AB = [list(map(lambda x:int(x)-1,input().split())) for _ in range(M) ] Q= int(input()) vdc = [ list(map(int,input().split())) for _ in range(Q)] for vdc_elements in vdc: vdc_elements[0] = vdc_elements[0]-1 near_dict = defaultdict(set) for a,b in AB: near_dict[a].add(b) near_dict[b].add(a) def get_distance(a,b): used = set() q = deque() q.append((a,0)) while q : #print(used) now,dist=q.pop() if now ==b: return dist for i in near_dict[now]: if i not in used: q.append((i,dist+1)) used.add(i) return 10000000000 def get_color(target_i): for i in reversed(range(Q)): v,d,c = vdc[i] if get_distance(v,target_i) <= d: return c return 0 #print(get_distance(0,6)) #print(get_distance(1,6)) if N+M+Q > 7000: raise for i in range(N): print(get_color(i))
s677420079
p03768
u509661905
1491097885
Python
Python (3.4.3)
py
Runtime Error
2104
4860
973
#!/usr/bin/env python3 import collections def bfs(s, d, adj_matrix): visited = {s} dist = {s: 0} q = collections.deque() q.append(s) while q: t = q.popleft() if dist[t] >= d: break for u in adj_matrix[t]: if u not in visited: q.append(u) visited.add(u) dist[u] = dist[t] + 1 return visited def main(): n, m = (int(x) for x in input().split()) assert n <= 2000 # ! adj_matrix = [set() for _ in range(n)] color = [0 for _ in range(n)] for _ in range(m): a, b = (int(x) - 1 for x in input().split()) adj_matrix[a].add(b) adj_matrix[b].add(a) qu = int(input()) for _ in range(qu): v, d, c = (int(x) for x in input().split()) v -= 1 res = bfs(v, d, adj_matrix) for u in res: color[u] = c print(*color, sep="\n") if __name__ == '__main__': main()
s281416147
p03768
u104282757
1491097654
Python
Python (3.4.3)
py
Runtime Error
18
3064
746
from collections import deque G = dict() N, M = map(int, input().split()) color = [0]*(N+1) for n in range(1, N+1): G[n] = [] for _ in range(M): a, b = map(int, input().split()) G[a].append(b) G[b].append(a) Q = int(input()) for _ in range(Q): v, d, c = map(int, input().split()) # BFS dist = dict() deq = deque([v]) color[v] = c dist[v] = 0 while len(deq) > 0: s = deq.popleft() if dist[s] >= d: break for t in G[s]: if t in dist.keys() pass else: dist[t] = dist[s] + 1 color[t] = c deq.append(t) for n in range(1, N+1): print(color[n])
s957924267
p03768
u477320129
1491097337
Python
PyPy3 (2.4.0)
py
Runtime Error
2106
72864
784
class Node: def __init__(self): self.color = 0 self.to = [] def dfs(graph, cur, color, dist): graph[cur].color = color if dist == 0: return for n in graph[cur].to: dfs(graph, n, color, dist-1) def main(): N, M = [int(i) for i in input().split()] graph = [Node() for _ in range(N+1)] for _ in range(M): a, b = [int(i) for i in input().split()] graph[a].to.append(b) graph[b].to.append(a) Q = int(input()) assert 1 <= N <= 2000 assert 1 <= M <= 2000 assert 1 <= Q <= 2000 for _ in range(Q): v, d, c = [int(i) for i in input().split()] dfs(graph, v, c, d) for i in range(1, N+1): print(graph[i].color) if __name__ == "__main__": main()
s040143895
p03768
u477320129
1491097048
Python
PyPy3 (2.4.0)
py
Runtime Error
1008
69152
915
class Node: def __init__(self): self.color = 0 self.to = [] def dfs(graph, cur, color, visited, dist): visited[cur] = True graph[cur].color = color if dist == 0: return for n in graph[cur].to: if visited[n]: continue dfs(graph, n, color, visited, dist-1) def main(): N, M = [int(i) for i in input().split()] graph = [Node() for _ in range(N+1)] for _ in range(M): a, b = [int(i) for i in input().split()] graph[a].to.append(b) graph[b].to.append(a) Q = int(input()) assert 1 <= N <= 2000 assert 1 <= M <= 2000 assert 1 <= Q <= 2000 for _ in range(Q): v, d, c = [int(i) for i in input().split()] visited = [False] * (N + 1) dfs(graph, v, c, visited, d) for i in range(1, N+1): print(graph[i].color) if __name__ == "__main__": main()
s932476860
p03768
u332385682
1491096878
Python
PyPy3 (2.4.0)
py
Runtime Error
501
55984
1085
from sys import stdin, stderr from collections import deque def solve(): N, M = map(int, input().split()) Adj = [[] for i in range(N)] for i in range(M): a, b = map(int, stdin.readline().split()) a, b = a - 1, b - 1 Adj[a].append(b) Adj[b].append(a) Q = int(stdin.readline()) assert 1 <= N <= 2000 assert 1 <= M <= 2000 assert 1 <= Q <= 2000 v = [0] * Q d = [0] * Q c = [0] * Q for i in range(Q): v[i], d[i], c[i] = map(int, stdin.readline().split()) v[i] -= 1 cols = [0] * N for i in range(Q): bfs(N, Adj, v[i], d[i], c[i], cols) print(*cols, sep='\n') def bfs(N, Adj, v, d, c, cols): visited = [False] * N visited[v] = True nxts = deque([[v, 0]]) while nxts: u, dis = nxts.popleft() if dis > d: continue cols[u] = c for w in Adj[u]: if not visited[w]: visited[w] = True nxts.append([w, dis + 1]) return if __name__ == '__main__': solve()
s198044950
p03769
u340781749
1596953058
Python
Python (3.8.2)
py
Runtime Error
26
9148
255
n = int(input()) ans = [] c = 1 can = (1 << 40) - 1 needs = 41 while n: if n >= can: n -= can ans.extend([c] * needs) c += 1 else: can >>= 1 needs -= 1 assert len(ans) <= 200 print(len(ans)) print(*ans)
s589724212
p03769
u044893624
1571781881
Python
Python (2.7.6)
py
Runtime Error
11
2568
192
def f(x,n): if x == 1: return [n]; if x % 2 == 1: return f(x >> 1,n + 1) + [n] else: return [n] + f(x - 1,n + 1) n = input() p += range(1,len(p) + 1) print ' '.join(list(map(str,p)))
s628443956
p03769
u102461423
1567097554
Python
Python (3.4.3)
py
Runtime Error
21
3316
450
import sys input = sys.stdin.readline from collections import deque N = int(input()) # empty N -= 1 if N == 0: print(1) print(1,1) exit() bit = [i for i in range(60) if N&(1<<i)] n = bit[-1] left = deque(range(n,0,-1)) right = deque() x = n+1 for i in range(n,0,-1): right.append(i) if i-1 in bit: right.append(x) left.appendleft(x) x += 1 S = left + right print(len(S)) print(' '.join(map(str,S)))
s944975911
p03769
u102461423
1567097261
Python
Python (3.4.3)
py
Runtime Error
21
3316
395
import sys input = sys.stdin.readline from collections import deque N = int(input()) bit = [i for i in range(60) if N&(1<<i)] n = bit[-1] left = deque(range(n,0,-1)) right = deque() x = n+1 left,right for i in range(n,0,-1): right.append(i) if i-1 in bit: right.append(x) left.appendleft(x) x += 1 S = left + right print(len(S)) print(' '.join(map(str,S)))
s908499873
p03769
u692632484
1558485192
Python
Python (3.4.3)
py
Runtime Error
53
3064
535
def fact(n): if n<2: return 1 else: return n*fact(n-1) def comb(a,b): return fact(a)//(fact(b)*fact(a-b)) def count_way(n): res=0 for i in range(2,n+1,2): res+=comb(n,i) return res def main(n): res=[] idx=1 while n>0: cnt=2 while count_way(cnt)<=n: cnt+=1 cnt-=1 for i in range(cnt): res.append(idx) n-=count_way(cnt) idx+=1 if len(res)>200: while True: res+=1 print(len(res)) for num in res: print(num,end=' ') print() N=int(input()) main(N)
s637595644
p03769
u864197622
1546457239
Python
Python (3.4.3)
py
Runtime Error
18
3064
270
def calc(n, k): if k>100: print(1/0) # print(n, k) if n<=0: return [] i = 0 while (1<<(i+1)) -1 <= n: i += 1 return [str(k)] * (i+1) + calc(n-((1<<i) - 1), k+1) a=calc(int(input()), 1) if len(a)>200: print(1/0) print(len(a)) print(" ".join(a))
s451442396
p03769
u209551477
1491182248
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38384
383
from collections import deque N = int( input() ) + 1 # empty counts hi = 0 while 1 << hi + 1 <= N: hi += 1 hi -= 1 ans_A = deque() ans_B = deque() ptr = 1 for i in range( hi, -1, -1 ): ans_A.append( ptr ) ans_B.append( ptr ) ptr += 1 if N >> i & 1: ans_A.append( ptr ) ans_B.appendleft( ptr ) ptr += 1 print( len( ans_A ) * 2 ) print( * ( ans_A + ans_B ) )
s992644355
p03769
u209551477
1491181828
Python
PyPy3 (2.4.0)
py
Runtime Error
177
38640
356
from collections import deque N = int( input() ) hi = 0 while 1 << hi + 1 <= N: hi += 1 ans_A = deque() ans_B = deque() ptr = 1 for i in range( hi, -1, -1 ): ans_A.append( ptr ) ans_B.append( ptr ) ptr += 1 if N >> i & 1: ans_A.append( ptr ) ans_B.appendleft( ptr ) ptr += 1 print( len( ans_A ) * 2 ) print( * ( ans_A + ans_B ) )
s567452827
p03769
u315078622
1491098969
Python
Python (3.4.3)
py
Runtime Error
17
3060
313
N = int(input()) now = 1 ans = [] while N > 0: bit = 2 while (1 << bit) - 1 <= N: bit += 1 for _ in range(bit): ans.append(str(now)) now += 1 N -= (1 << (bit - 1)) - 1 assert(N >= 0) # print(format(N, 'b')) assert(len(ans) <= 200) print(len(ans)) print(' '.join(ans))
s494201385
p03770
u905582793
1589947222
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38256
1393
from collections import defaultdict mod = 10**9+7 rng = 200100 fctr = [1] finv = [1] for i in range(1,rng): fctr.append(fctr[-1]*i%mod) for i in range(1,rng): finv.append(pow(fctr[i],mod-2,mod)) def cmb(n,k): if n<0 or k<0: return 0 else: return fctr[n]*finv[n-k]*finv[k]%mod import sys input = sys.stdin.readline n,X,Y = map(int,input().split()) cw = [list(map(int,input().split())) for i in range(n)] cw.sort() mnls = [] graph = [[] for i in range(n)] notmn = set() for i in range(n): if i == 0 or cw[i-1][0] != cw[i][0]: mnls.append((i,*cw[i])) else: if cw[i][1]+mnls[-1][2] <= X: graph[i].append(mnls[-1][0]) graph[mnls[-1][0]].append(i) else: notmn.add(i) mnls.sort(key = lambda x:x[2]) for i,x in enumerate(mnls): if i == 0: continue if x[2]+mnls[0][2] <= Y: graph[x[0]].append(mnls[0][0]) graph[mnls[0][0]].append(x[0]) for i in notmn: if mnls[0][2]+cw[i][1] <= Y: graph[i].append(mnls[0][0]) graph[mnls[0][0]].append(i) vis = [0 for i in range(n)] ans = 1 for i in range(n): if vis[i]: continue vis[i] = 1 stack = [i] color = defaultdict(int) while stack: x = stack.pop() color[cw[x][0]] += 1 for y in graph[x]: if vis[y] == 0: vis[y] = 1 stack.append(y) sm = sum(color.values()) for v in color.values(): ans = ans*cmb(sm,v)%mod sm -= v print(ans)
s169071151
p03770
u631277801
1536861942
Python
Python (3.4.3)
py
Runtime Error
19
3316
1728
import sys stdin = sys.stdin def li(): return [int(x) for x in stdin.readline().split()] def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return [float(x) for x in stdin.readline().split()] def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return list(ns()) def ni(): return int(ns()) def nf(): return float(ns()) from itertools import accumulate n,w = li() wi,vi = li() w0 = wi v_list = [[0] for _ in range(4)] v_list[0].append(vi) for _ in range(n-1): wi,vi = li() v_list[wi-w0].append(vi) for i in range(4): v_list[i].sort(reverse=True) v_list[i] = list(accumulate(v_list[i])) ans = 0 res = w for w1 in range(len(v_list[0])): if w - w0*(w1) < 0: pass else: res1 = w - w0*(w1) ans1 = v_list[0][w1] ans = max(ans, ans1) for w2 in range(len(v_list[1])): if res1 - (w0+1)*(w2) < 0: pass else: res2 = res1 - (w0+1)*(w2) ans2 = ans1 + v_list[1][w2] ans = max(ans, ans2) for w3 in range(len(v_list[2])): if res2 - (w0+2)*(w3) < 0: pass else: res3 = res2 - (w0+2)*(w3) ans3 = ans2 + v_list[2][w3] ans = max(ans, ans3) for w4 in range(len(v_list[3])): if res3 - (w0+3)*(w4) < 0: pass else: res4 = res3 - (w0+3)*(w4) ans4 = ans3 + v_list[3][w4] ans = max(ans, ans4) print(ans)
s786404006
p03771
u054111484
1491101397
Python
Python (2.7.6)
py
Runtime Error
100
20088
1307
n = map(int, raw_input().split()) x = map(int, raw_input().split()) #x.sort(reverse = True) #print x for i in range(0, n[0]): mem = [0]*n[0] v = n[1] V = n[1] mem[i]=1 go(mem,v,i,V) if chk(mem) == 1: print Possible else: print Impossible def go(mem,v,i,V): if (i-1)<0: if x[i+1]-x[i]<=v and mem[i+1]==0: mem[i+1]=1 go(mem,V,i+1,V) elif V>=1: for j in range(0,n[0]): if mem[j]==0: go(mem,V/2,j,V/2) else: return 0 elif (i+1)==n[0]: if x[i]-x[i-1]<=v and mem[i-1]==0: mem[i-1]=1 go(mem,v,i-1,V) elif V>=1: for j in range(0,n[0]): if mem[j]==0: go(mem,V/2,j,V/2) else: return 0 else: if x[i+1]-x[i]<=v and mem[i+1]==0: mem[i+1]=1 go(mem,V,i+1,V) elif x[i]-x[i-1]<=v and mem[i-1]==0: mem[i-1]=1 go(mem,v,i-1,V) elif V>=1: for j in range(0,n[0]): if mem[j]==0: go(mem,V/2,j,V/2) else: return 0 def chk(mem): for t in range(0,n[0]): if mem[t]!=1: return 0 return 1
s936757949
p03773
u313103408
1601185429
Python
PyPy3 (7.3.0)
py
Runtime Error
89
68776
205
import math n = int(input()) s = math.ceil(math.sqrt(n)) h = 10**5 for i in range(1,s+1): if n%i==0: if h > max(len(str(i)),len(str(int(n/i)))): h = max(len(str(i)),len(str(int(n/i)))) print(h)
s856633769
p03773
u425762225
1600825023
Python
Python (3.8.2)
py
Runtime Error
21
9136
37
print((int(input())+int(input()))%24)
s314113003
p03773
u425762225
1600824955
Python
Python (3.8.2)
py
Runtime Error
20
8964
25
print(((read)+(read))%24)
s399797442
p03773
u548464743
1600819629
Python
PyPy3 (7.3.0)
py
Runtime Error
91
74756
298
num = int(input()) def function(a,b): return (max(len(str(a)),len(str(b)))) d = len(str(num)) for i in range(1,num+1): if num % i == 0: b = int(num // i) c = function(i,b) if d >= c: d = c else: print(d) exit() print(d)
s457471392
p03773
u886902015
1599853105
Python
Python (3.8.2)
py
Runtime Error
24
8952
40
a,b=int(input().split()) print((a+b)%24)
s539893221
p03773
u940652437
1598831560
Python
Python (3.8.2)
py
Runtime Error
30
9192
353
n = int(input()) tmp = n ans = n y = tmp **0.5 o = int(y // 1) for i in range(o+1): a=i+1 #print("a:"+str(a)) b=n/(i+1) #print("b:"+str(b)) #print("a*b:"+str(a*b)) if (b.is_integer()==True ): kari = max(len(str(a)),len(str(int(b)))) #print("kari:"+str(kari)) ans = min(ans,kari) print(ans)
s379259471
p03773
u672316981
1598724799
Python
Python (3.8.2)
py
Runtime Error
22
9068
52
a. b = map(int, input().split()) print((a + b) % 24)
s627345335
p03773
u672316981
1598724788
Python
Python (3.8.2)
py
Runtime Error
26
8920
52
a. b = map(int, input().split()) print((a + b) % 23)
s209740199
p03773
u075303794
1598178861
Python
Python (3.8.2)
py
Runtime Error
22
8936
76
A,B=map(int,iput().split()) if A+B>=24: print(A+B-24) else: print(A+B)
s271574047
p03773
u075303794
1598178836
Python
Python (3.8.2)
py
Runtime Error
24
9072
76
A,B=map(int,iput().splilt()) if A+B>=24: print(A+B-24) else: print(A+B)
s876445979
p03773
u869790980
1597809160
Python
PyPy2 (7.3.0)
py
Runtime Error
137
64308
46
a,b = map(int, raw_input()) print (a + b) % 24
s610040219
p03773
u556594202
1597507137
Python
Python (3.8.2)
py
Runtime Error
25
9132
313
import bisect N=int(input()) A = sorted(list(map(int,input().split()))) B = sorted(list(map(int,input().split()))) C = sorted(list(map(int,input().split()))) count=0 for i in range(N): a_cand = bisect.bisect_right(A,B[i]-1) c_cand = N-bisect.bisect_right(C,B[i]) count += a_cand*c_cand print(count)
s622866082
p03773
u835575472
1597334756
Python
Python (3.8.2)
py
Runtime Error
24
9032
50
a, b = map(int, input().split) print((a + b) % 24)
s328766677
p03773
u614381513
1597089367
Python
Python (3.8.2)
py
Runtime Error
23
9136
309
n = int(input()) fab = 0 ans = 1000 n_s = int(n ** (1/2)) for i in range(1, n_s + 2): if n % i == 0: a = len(str(i)) b = len(str(int(n / i))) #print(n/i, i, a, b) if a > b and a < ans: ans = a elif a < b and b < ans: ans = b print(ans)
s806400472
p03773
u226779434
1596972437
Python
Python (3.8.2)
py
Runtime Error
19
8900
51
a,b = map(int,input().splilt()) print((a + b) % 24)
s259362617
p03773
u714104087
1596579953
Python
PyPy3 (7.3.0)
py
Runtime Error
99
74740
47
a, b = map(int, input().split) print((a+b)%24)
s281667392
p03773
u487288850
1595661764
Python
Python (3.8.2)
py
Runtime Error
22
8900
50
a,b=map(int,input().split()) print(max(a+b,a+b-24)
s754744636
p03773
u699522269
1595642495
Python
Python (3.8.2)
py
Runtime Error
24
8896
46
A,B = map(int,input().split()) return A+B % 24
s858452975
p03773
u786020649
1595442077
Python
Python (3.8.2)
py
Runtime Error
25
9048
37
a,b=map(int,input()) print((a+b)%24)
s216200858
p03773
u612635771
1594907088
Python
Python (3.8.2)
py
Runtime Error
25
8840
42
A, B = map(int, input()) print((A+B) % 24)
s547503531
p03773
u623814058
1594571874
Python
Python (3.8.2)
py
Runtime Error
27
9104
168
N = int(input()) ans = 10**18 for i in range(1, int(N**0.5)+1): if N % i == 0: b = N//i ans = min(ans, max( len(str(i)), len(str(b)))) print(ans)
s247044797
p03773
u047931063
1593921996
Python
PyPy3 (7.3.0)
py
Runtime Error
96
74236
88
import itertools A, B = map(int,input().split()) print(itertools.cycle(range(24))[A+B])
s949125777
p03773
u168416324
1593782430
Python
Python (3.8.2)
py
Runtime Error
26
9016
62
x=sum(list(map(int,input.split()))) if x>=24: x-=24 print(x)
s741312932
p03773
u562015767
1593547624
Python
PyPy3 (7.3.0)
py
Runtime Error
168
74508
396
n,m = map(int,input().split()) s,c = [],[] for i in range(n): a = list(map(int,input().split())) s.append(a) for i in range(m): a = list(map(int,input().split())) c.append(a) for i in range(n): tmp = 10**16 ans = 0 for j in range(m): b = (abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1])) if tmp > b: tmp = b ans = j+1 print(ans)
s888178206
p03773
u489247698
1593351890
Python
Python (3.8.2)
py
Runtime Error
23
9084
266
import sys import math # python3にlongの概念はない N = int(input()) M = int(math.sqrt(N)) # N**0.5でも可能 number = 1 ans = 1 for i in range(1, M+1): if N % i == 0: number = i number = math.floor(N/number) ans = len(str(number)) print(ans)
s450357006
p03773
u422272120
1592872057
Python
Python (3.8.2)
py
Runtime Error
24
8956
71
a,b = map(int,input().split()) print (a+b) if a+b >= 24 print (a+b-24)
s519413815
p03773
u961288441
1592745524
Python
Python (3.8.2)
py
Runtime Error
27
9076
204
import math N = int(input()) ans = float("inf") a = 1 b = 1 for i in range(1, math.floor(N**0.5)): a = i b = N/i if N%i==0: ans = min(ans, max(len(str(a)),len(str(int(b))))) print(ans)
s388444540
p03773
u642874916
1592522847
Python
Python (3.8.2)
py
Runtime Error
23
9004
55
A, B = input(int, input().split()) print((A + B) % 24)
s928984402
p03773
u633450100
1591657517
Python
Python (3.4.3)
py
Runtime Error
17
2940
92
A,B = [for(i) for i in input().split()] if A + B > 24: print(A + B -24) else: print(A+B)
s086736359
p03773
u865291932
1591290689
Python
Python (3.4.3)
py
Runtime Error
17
3064
225
N=int(input()) count=0 lis=[] for i in range(1,N+1): if N/i < i: break if N/i==N//i: lis.append(i) llis=[] for x in lis: y = N / x mm=max([x,y]) ketasuu=len(str(int(mm))) llis.append(ketasuu) print(min(llis))
s856607830
p03773
u850582941
1591040740
Python
Python (3.4.3)
py
Runtime Error
17
2940
138
A = int(input()) B = int(input()) ans1 = A + B if ans1 >= 24: ans2 = ans1 - 24 print(ans2) else: print(ans1)
s338185633
p03773
u739798900
1590984918
Python
Python (3.4.3)
py
Runtime Error
18
2940
163
time_input = input() time = time_input.split() A = time[0] B = time[1] if A + B > 24: print(A + B - 24) elif A + B == 24: print(0) else: print(A + B)
s305373285
p03773
u153094838
1590961403
Python
Python (3.4.3)
py
Runtime Error
18
3064
1102
# -*- coding: utf-8 -*- """ Created on Sun May 31 17:19:32 2020 @author: NEC-PCuser """ def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: while temp%i==0: temp //= i arr.append(i) if temp!=1: arr.append(temp) if arr==[]: arr.append(n) return arr def multiplication(n): ans = len(str(n)) for i in range(2, int(-(-n**0.5//1))+1): if (n % i == 0): ans = max([len(str(i)), len(str(n // i))]) return ans if __name__ == "__main__": N = int(input()) """ l = factorization(N) """ print(multiplication(N)) """ minimu = 10 ** 10 ans = 0 for i in range(0, 2**len(l)): a = 1 b = 1 for j in range(0, len(l)): if ((i >> j) & 1): a *= l[j] else: b *= l[j] if (abs(a - b) < minimu): minimu = abs(a - b) ans = max([len(str(a)), len(str(b))]) print(ans) """
s931810459
p03773
u594956556
1590609429
Python
Python (3.4.3)
py
Runtime Error
18
3060
402
N, M = map(int, input().split()) student = [list(map(int, input().split())) for _ in range(N)] cp = [list(map(int, input().split())) for _ in range(M)] idou = [] for a, b in student: idousaki = -1 nearest = 1000000000 for i, x, y in enumerate(cp): d = abs(x-a) + abs(y-b) if d < nearest: nearest = d idousaki = i+1 idou.append(idousaki) for i in idou: print(i)
s145734431
p03773
u883866798
1590355071
Python
PyPy3 (2.4.0)
py
Runtime Error
183
38256
321
n = int(input()) i = 1 divisor = (1 + n) // 2 min_value = 10 ** 10 + 1 while i < divisor: if n % i == 0: divisor = min(n // i, divisor) if max(len(str(i)),len(str(n // i))) > min_value: break min_value = min(min_value,max(len(str(i)),len(str(n // i)))) i += 1 print(min_value)
s041357963
p03773
u895040371
1589755622
Python
Python (3.4.3)
py
Runtime Error
17
2940
46
a, b =map(in, input().split()) print((a+b)%24)
s250507258
p03773
u627600101
1589681556
Python
Python (3.4.3)
py
Runtime Error
17
2940
47
A, B = map(int,input(.split())) print((A+B)%24)
s541488597
p03773
u617659131
1589659575
Python
Python (3.4.3)
py
Runtime Error
17
2940
79
a,b = map(int input().split()) if a+b >= 24: print(a+b-24) else: print(a+b)
s970647201
p03773
u902380746
1589294907
Python
Python (3.4.3)
py
Runtime Error
17
2940
196
import sys import math import bisect def main(): a, b = map(int, input().split()) ans = a + b while (ans > 24) ans -= 24 print(ans) if __name__ == "__main__": main()
s283195350
p03773
u551109821
1589144010
Python
Python (3.4.3)
py
Runtime Error
18
2940
86
A,B = map(int,input()) sum = A+B if sum >= 24: print(sum-24) else: print(sum)
s426360073
p03773
u785883180
1588788790
Python
PyPy3 (2.4.0)
py
Runtime Error
182
38256
132
import math n=int(input()) f=[] for a in range(1,math.ceil(n**(1/2))): if n%a==0: f.append(len(str(n//a))) print(min(f))
s718838669
p03773
u785883180
1588788647
Python
PyPy3 (2.4.0)
py
Runtime Error
180
38384
132
import math n=int(input()) f=[] for a in range(1,math.ceil(n**(1/2))): if n%a==0: f.append(len(str(n//a))) print(min(f))
s358047233
p03773
u600261652
1588470999
Python
Python (3.4.3)
py
Runtime Error
17
2940
50
A, B = map(int, input().slipt()) print((A+B) % 24)
s747588425
p03773
u600261652
1588470846
Python
Python (3.4.3)
py
Runtime Error
18
2940
48
A, B = map(int, input().slipt()) print((A+B)%24)
s357813863
p03773
u144029820
1588367322
Python
Python (3.4.3)
py
Runtime Error
18
3064
83
a,b=map(int,inpput().split()) if a+b>24: print((a+b)-24) else: print(a+b)
s278596869
p03773
u106181248
1587674183
Python
PyPy3 (2.4.0)
py
Runtime Error
187
38384
75
x, y = map(int,input().split()) z = z+y print(z) if z < 25 else print(z-24)
s627875757
p03773
u038408819
1587669967
Python
Python (3.4.3)
py
Runtime Error
19
3064
969
n = int(input()) import math sq = math.sqrt(n) if isinstance(sq, int): print(len(str(sq))) quit() """nを素因数分解""" """2以上の整数n => [[素因数, 指数], ...]の2次元リスト""" # n == 1のとき、[1, 1]を返す def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: #cnt=0 while temp%i==0: #cnt+=1 temp //= i arr.append(i) #arr.append([i, cnt]) if temp!=1: #arr.append([temp, 1]) arr.append(temp) if arr==[]: #arr.append([n, 1]) arr.append(n) return arr factor = factorization(n) if len(factor) == 1: print(len(str(n))) quit() first = 1 ans = float('Inf') for i in range(len(factor) - 1): first *= factor[i] second = int(n / first) #print(first, second) ans = min(ans, max(len(str(first)), len(str(second)))) print(ans)
s385888151
p03773
u005469124
1587501773
Python
Python (3.4.3)
py
Runtime Error
18
2940
89
a = int(input()) b = int(input()) if (a+b>=24): print((a+b)-24) else: print(a+b)
s421478964
p03773
u149991748
1587421768
Python
Python (3.4.3)
py
Runtime Error
18
2940
72
a, b = input().split() ans = a+b if ans > 24: ans -=24 print(ans)
s981558734
p03773
u507116804
1587418866
Python
Python (3.4.3)
py
Runtime Error
17
2940
96
a, b = map(int, input().split()) ans = a+b if ans >=24: ans = ans-24 print(ans)
s365846183
p03773
u507116804
1587418791
Python
Python (3.4.3)
py
Runtime Error
17
2940
91
a, b = map(int, input().split()) ans=a+b if ans>=24: ans=ans-24 print(ans)
s153855847
p03773
u507116804
1587418713
Python
Python (3.4.3)
py
Runtime Error
17
2940
116
a, b = map(int, input().split()) ans=a+b if ans>=24 : ans=ans-24 print(ans)
s515163605
p03773
u507116804
1587418664
Python
Python (3.4.3)
py
Runtime Error
17
2940
80
a, b = map(int, input().split()) ans=a+b if ans>=24 ans=ans-24 print(ans)
s973235398
p03773
u353919145
1587175812
Python
Python (3.4.3)
py
Runtime Error
17
2940
113
a,b=map(int,input().split()) if (a>b): s=a+b s=s%24 if (b>a): s=a-b if (s<=0): s=s*-1 print(s)
s181243603
p03773
u457957084
1586708575
Python
Python (3.4.3)
py
Runtime Error
17
2940
89
a, b = map(int,input()) if (a + b) < 25: print(a + b) else: print((a + b) - 24)
s325265003
p03773
u457957084
1586708556
Python
Python (3.4.3)
py
Runtime Error
17
2940
88
a, b = map(int,input()) if (a + b) < 25: print(a + b) else: print(24 - (a + b))
s866244802
p03773
u440551778
1586634304
Python
Python (3.4.3)
py
Runtime Error
18
2940
757
import math n = int(input()) # def is_prime(n): # if n == 1: # return False # for i in range(2,int(n**0.5)+1): # if n % i == 0: # return False # return True # if is_prime(n): # print(len(str(n))) # exit() # rtn = math.floor(math.sqrt(n)) # for i in range(rtn,n+1): # if n % i == 0: # print(len(str(i))) # exit() # n = a * b = b * aでなのでa<=bのaの方を求めてその時のbの桁数出力すれば間に合う。 # 上記のようにbの方から求めるとぎり間に合わない。 rtn = math.ceil(math.sqrt(n)) for i in reversed(range(1, rtn + 1)): if n % i == 0: b = n // i #求めるのはa(=i)ではなくbの方 print(len(str(b))) exit()
s066780121
p03773
u852790844
1586487048
Python
Python (3.4.3)
py
Runtime Error
17
2940
50
a, b = map(int, input()) ans = (a+b)%24 print(ans)
s475114018
p03773
u015467545
1586380895
Python
PyPy3 (2.4.0)
py
Runtime Error
174
38492
166
import math P=[] n=int(input()) N=int(math.sqrt(n)) for i in range(1,n+1): if n%i==0: p=max(len(str(i)),len(str(int(n/i)))) P.append(p) print(min(P))
s997438373
p03773
u453815934
1585441675
Python
Python (3.4.3)
py
Runtime Error
22
3316
36
a,b=map(int,input()) print((a+b)%24)
s528965192
p03773
u016323272
1585070298
Python
Python (3.4.3)
py
Runtime Error
17
3064
360
#ABC057.B N,M = map(int,input().split()) L1 = [] L2 = [] for i in range(N): a,b = map(int,input().split()) L1.append([a,b]) for m in range(M): c,d = map(int,input().split()) L2.append([c,d]) for j in range(N): L3 = [] for l in range(M): L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1])) print(L3.index(min(L3))+1)
s567142630
p03773
u016323272
1585069875
Python
Python (3.4.3)
py
Runtime Error
18
3064
360
#ABC057.B N,M = map(int(input().split())) L1 = [] L2 = [] for i in range(N): a,b = map(int,input().split()) L1.append([a,b]) for m in range(M): c,d = map(int,input().split()) L2.append([c,d]) for j in range(N): L3 = [] for l in range(M): L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1])) print(L3.index(min(L3)+1)
s700112504
p03773
u197968862
1584336174
Python
Python (3.4.3)
py
Runtime Error
17
3064
235
n = int(input()) ele = [] i = 1 while i * i <= n: if n % i == 0: ele.append([len(str(i)),len(str(n // i))]) i += 1 k = max(ele[0][1],ele[0][0]) for i in range(len(ele)): k = min(max(ele[i][0],ele[i][1]),k) print(k)
s337758912
p03773
u992910889
1584225389
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38384
644
# import bisect # import copy # import fractions # import math # import numpy as np # from collections import Counter, deque # from itertools import accumulate,permutations, combinations,combinations_with_replacement,product def resolve(): N,M=map(int,input().split()) A=[list(map(int,input().split())) for i in range(N)] B=[list(map(int,input().split())) for i in range(M)] for i in A: valmin=10**5 cnt=0 for j in B: if abs(i[0]-j[0])+abs(i[1]-j[1])<valmin: valmin=abs(i[0]-j[0])+abs(i[1]-j[1]) ans=cnt+1 cnt+=1 print(ans) resolve()
s532115101
p03773
u841623074
1584201493
Python
Python (3.4.3)
py
Runtime Error
18
3064
715
N=int(input()) n=len(str(N)) m=(n//2) def wari(x): array=[] if m==0: for j in range(9,0,-1): if N%j==0: c=max(len(str(N//j)),len(str(j))) array.append(c) break for i in range(m+1): if i==0: for j in range(9,0,-1): if N%j==0: c=max(len(str(N//j)),len(str(j))) array.append(c) break else: for j in range((10**(i+1))-1,(10**i)-1,-1): if N%j==0: c=max(len(str(N//j)),len(str(j))) array.append(c) break return min(array) print(wari(N))
s822340757
p03773
u641460756
1583897526
Python
Python (3.4.3)
py
Runtime Error
17
2940
82
a,b = map(int,input().split()) c = a+b if(c>=24): print(c-24): else: print(c)
s667700462
p03773
u641460756
1583897507
Python
Python (3.4.3)
py
Runtime Error
18
2940
81
a,b = map(int.input().split()) c = a+b if(c>=24): print(c-24): else: print(c)
s244488198
p03773
u137808818
1583641705
Python
Python (3.4.3)
py
Runtime Error
17
2940
84
a,b = map(int,input().split()) if a+b =< 23: print(a+b) else: print(a+b-24)
s175197878
p03773
u634248565
1583032823
Python
Python (3.4.3)
py
Runtime Error
17
2940
82
a , b = input().split() if a+b >= 24: print ((a + b) - 24) else: print (a + b)
s288135425
p03773
u634248565
1583032427
Python
Python (3.4.3)
py
Runtime Error
17
2940
83
a , b = input().split() if (a+b) >= 24: print (a + b - 24) else: print (a + b)
s835453852
p03773
u634248565
1583032340
Python
Python (3.4.3)
py
Runtime Error
17
2940
83
a , b = input().split() if a + b > 24: print (a + b - 24) else: print (a + b)
s264648801
p03773
u634248565
1583032306
Python
Python (3.4.3)
py
Runtime Error
18
2940
85
a , b = (input().split()) if (a+b) > 24: print (a + b - 24) else: print (a + b)
s944699901
p03773
u634248565
1583032278
Python
Python (3.4.3)
py
Runtime Error
17
2940
87
a , b = int(input().split()) if (a+b) > 24: print (a + b - 24) else: print (a + b)
s738056989
p03773
u992910889
1582578427
Python
Python (3.4.3)
py
Runtime Error
17
2940
65
A,B=map(str,input().split()) #print(sorted(B)[0]) print((A+B)%24)
s662580010
p03773
u037901699
1581623596
Python
Python (3.4.3)
py
Runtime Error
17
2940
81
A, B = map(int, input().split()) print(A+B -24*((A+B)//24) if A+B > =24 else A+B)
s273453870
p03773
u185325486
1581234558
Python
Python (3.4.3)
py
Runtime Error
17
3064
678
import math def comb(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) def check(): N,A,B = [int(i) for i in input().split()] V = sorted([int(i) for i in input().split()], reverse=True) mean = sum(V[:A])/A print(mean) count_dict = dict(Counter(V)) max_v_cnt = list(count_dict.values())[0] if max_v_cnt > A: cnt = 0 for i in range(A,max_v_cnt+1): cnt += comb(max_v_cnt, i) else: for v, c in count_dict.items(): if A - c < 0: last_c = c break A -= c cnt = comb(last_c, A) print(cnt) check()
s545741109
p03773
u072717685
1580682937
Python
Python (3.4.3)
py
Runtime Error
17
3064
382
n, m = map(int,input().split()) students = [None]*n points = [None]*m students[i] = [tuple(map(int, input.split())) for _ in range(n)] points[i] = [tuple(map(int, input.split())) for _ in range(m)] ans = [] for s in students: tmp = [] for p in points: tmp.append(abs(s[0] - p[0]) + abs(s[1] - p[1])) ans.append(tmp.index(min(tmp)) + 1) for i in range(n): print(ans[i])
s920371414
p03773
u268792407
1580632365
Python
Python (3.4.3)
py
Runtime Error
17
2940
36
a,b=map(int,input()) print((a+b)%24)
s351178842
p03773
u510137738
1579545070
Python
Python (3.4.3)
py
Runtime Error
17
2940
51
a, b = map(int, input().split()) print(24 % a + b)
s077848735
p03773
u871596687
1579376530
Python
Python (3.4.3)
py
Runtime Error
17
2940
81
a,b = map(int,input().split()) if a+b>24 print(a+b-24) else: print(a+b)
s415900396
p03773
u638745327
1579033771
Python
Python (3.4.3)
py
Runtime Error
17
2940
50
A = int(input()) B = int(input()) print((A+B)%24)