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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s116606761 | p03634 | u160414758 | 1502660448 | Python | Python (3.4.3) | py | Runtime Error | 1910 | 65776 | 630 |
class edge():
def __init__(self,_to,_cost):
self.to = _to;
self.cost = _cost;
N = int(input())
tree = [[] for i in range(N)]
for i in range(N-1):
a,b,c = list(map(int,input().split()))
a = a - 1
b = b - 1
tree[a].append(edge(b,c))
tree[b].append(edge(a,c))
Q,K = list(map(int,i... |
s556258637 | p03634 | u160414758 | 1502657571 | Python | Python (3.4.3) | py | Runtime Error | 1881 | 65776 | 627 | class edge():
def __init__(self,_to,_cost):
self.to = _to;
self.cost = _cost;
N = int(input())
tree = [[] for i in range(N)]
for i in range(N-1):
a,b,c = list(map(int, input().split()))
a = a - 1
b = b - 1
tree[a].append(edge(b,c))
tree[b].append(edge(a,c))
Q, K = list(map(int,... |
s293536562 | p03634 | u160414758 | 1502657132 | Python | Python (3.4.3) | py | Runtime Error | 1901 | 65776 | 629 | N = int(input())
class edge():
def __init__(self,_to,_cost):
self.to = _to;
self.cost = _cost;
tree = [[]for i in range(N)]
for i in range(N-1):
a,b,c = list(map(int, input().split()))
a = a - 1
b = b - 1
tree[a].append(edge(b,c))
tree[b].append(edge(a,c))
Q, K = list(map(int... |
s378486045 | p03634 | u160414758 | 1502656696 | Python | Python (3.4.3) | py | Runtime Error | 1817 | 65776 | 628 | N = int(input())
class edge:
def __init__(self,_to,_cost):
self.to = _to;
self.cost = _cost;
tree = [[] for i in range(N)]
for i in range(N-1):
a,b,c = list(map(int, input().split()))
a = a - 1
b = b - 1
tree[a].append(edge(b,c))
tree[b].append(edge(a,c))
Q, K = list(map(int,... |
s839945412 | p03634 | u273084112 | 1502635091 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 562 | import sys
import collections
sys.setrecursionlimit(1e7)
def dfs(node, parent, distance):
depth[node] = distance
for next_node, cost in Tree[node]:
if next_node != parent:
dfs(next_node, node, distance + cost)
N = int(input())
Tree = collections.defaultdict(list)
for i in range(N - 1):
... |
s505919638 | p03634 | u273084112 | 1502634847 | Python | Python (3.4.3) | py | Runtime Error | 1491 | 59340 | 523 | import collections
def dfs(node, parent, distance):
depth[node] = distance
for next_node, cost in Tree[node]:
if next_node != parent:
dfs(next_node, node, distance + cost)
N = int(input())
Tree = collections.defaultdict(list)
for i in range(N - 1):
a, b, c = map(int, input().split())... |
s081160210 | p03634 | u268210555 | 1502634075 | Python | Python (3.4.3) | py | Runtime Error | 1366 | 133008 | 400 | import sys
sys.setrecursionlimit(100000)
n=int(input())
g=[[] for _ in range(n)]
for _ in range(n-1):
a,b,c=map(int,input().split())
g[a-1].append((b-1,c))
g[b-1].append((a-1,c))
q,k=map(int,input().split())
d=[-1]*n
def f(k,c):
d[k]=c
for i,v in g[k]:
if d[i]==-1:
f(i,c+v)
f(k-1... |
s627141266 | p03634 | u268210555 | 1502634002 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 399 | import sys
sys.setrecusionlimit(100000)
n=int(input())
g=[[] for _ in range(n)]
for _ in range(n-1):
a,b,c=map(int,input().split())
g[a-1].append((b-1,c))
g[b-1].append((a-1,c))
q,k=map(int,input().split())
d=[-1]*n
def f(k,c):
d[k]=c
for i,v in g[k]:
if d[i]==-1:
f(i,c+v)
f(k-1,... |
s390618214 | p03634 | u268210555 | 1502633865 | Python | Python (3.4.3) | py | Runtime Error | 1388 | 46492 | 368 | n=int(input())
g=[[] for _ in range(n)]
for _ in range(n-1):
a,b,c=map(int,input().split())
g[a-1].append((b-1,c))
g[b-1].append((a-1,c))
q,k=map(int,input().split())
d=[-1]*n
def f(k,c):
d[k]=c
for i,v in g[k]:
if d[i]==-1:
f(i,c+v)
f(k-1,0)
print(d)
for _ in range(q):
x,y=m... |
s449311399 | p03634 | u966695411 | 1502632344 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2112 | 139344 | 736 | #! /usr/bin/env python3
D = {}
L = []
def f(n):
r = []
s = 0
while n in D:
a, b = D[n]
s += L[a]
r = [(a, s)] + r
n = b
return r
def d(a, b):
r = c = 0
for i in range(min(len(a), len(b))):
if a[i][0] == b[i][0]:
c += 1
else:
... |
s230662746 | p03634 | u966695411 | 1502627079 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 52212 | 729 | #! /usr/bin/env python3
def f(diu, n):
r = []
while n != 1:
r = [diu[n][0]] + r
n = diu[n][1]
return r
def d(p, a, b):
c = 0
for i, j in zip(a, b):
if i == j:
c += 1
else:
break
return sum(p[x][2] for x in a[c:]) + sum(p[x][2] for x in b[... |
s756999075 | p03634 | u966695411 | 1502626432 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2113 | 157440 | 691 | #! /usr/bin/env python3
D = {}
L = []
def f(n):
r = []
while n != '1':
r = [D[n][0]] + r
n = D[n][1]
return r
def d(a, b):
c = 0
for i, j in zip(a, b):
if i == j:
c += 1
else:
break
return sum(L[x] for x in a[c:]) + sum(L[x] for x in b[c:... |
s171580249 | p03634 | u966695411 | 1502625007 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 50220 | 712 | #! /usr/bin/env python3
def f(diu, n):
r = []
while n != 1:
r = [diu[n][0]] + r
n = diu[n][1]
return r
def d(p, a, b):
c = 0
for i, j in zip(a, b):
if i == j:
c += 1
else:
break
return sum(p[x][2] for x in a[c:]) + sum(p[x][2] for x in b[... |
s540509514 | p03634 | u966695411 | 1502624873 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2112 | 144768 | 707 | #! /usr/bin/env python3
def f(diu, n):
r = []
while n != 1:
r = [diu[n][0]] + r
n = diu[n][1]
return r
def d(p, a, b):
c = 0
for i, j in zip(a, b):
if i == j:
c += 1
else:
break
return sum(p[x][2] for x in a[c:]) + sum(p[x][2] for x in b[... |
s432190095 | p03634 | u966695411 | 1502624502 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 52076 | 685 | #! /usr/bin/env python3
def f(diu, n):
r = []
while n != 1:
r = [diu[n][0]] + r
n = diu[n][1]
return r
def d(p, a, b):
c = 0
for i, j in zip(a, b):
if i == j:
c += 1
else:
break
return sum(p[x][2] for x in a[c:] + b[c:])
def main():
... |
s420647483 | p03634 | u966695411 | 1502624188 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 52352 | 609 | #! /usr/bin/env python3
def f(diu, n):
r = []
while n != 1:
r += [diu[n][0]]
n = diu[n][1]
return r[::-1]
def d(p, a, b):
c = 0
for i, j in zip(a, b):
if i == j:
c += 1
else:
break
return sum(p[x][2] for x in a[c:] + b[c:])
N = int(i... |
s906059423 | p03634 | u341926204 | 1502610704 | Python | Python (3.4.3) | py | Runtime Error | 454 | 37812 | 713 | N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
ai, bi, ci = map(int, input().split())
edges[ai].append((bi, ci))
edges[bi].append((ai, ci))
Q, K = map(int, input().split())
distance = [-1]*(N+1)
# def add_weight(k, pre):
# for v in edges[k]:
# d, w = v
# if d != ... |
s433150027 | p03634 | u341926204 | 1502610219 | Python | Python (3.4.3) | py | Runtime Error | 1335 | 43700 | 528 | N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
ai, bi, ci = map(int, input().split())
edges[ai].append((bi, ci))
edges[bi].append((ai, ci))
Q, K = map(int, input().split())
weighted_nodes = [0]*(N+1)
def add_weight(k, pre):
for v in edges[k]:
d, w = v
if d != pre... |
s014711805 | p03634 | u341926204 | 1502609693 | Python | Python (3.4.3) | py | Runtime Error | 930 | 57256 | 566 | N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
ai, bi, ci = map(int, input().split())
edges[ai].append((bi, ci))
edges[bi].append((ai, ci))
Q, K = map(int, input().split())
queries = [tuple(map(int, input().split())) for _ in range(Q)]
weighted_nodes = [0]*(N+1)
def add_weight(k, pr... |
s920215264 | p03634 | u341926204 | 1502609624 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 529 | N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
ai, bi, ci = map(int, input().split())
edges[ai].append((bi, ci))
edges[bi].append((ai, ci))
Q, K = map(int, input().split())
weighted_nodes = [0]*(N+1)
def add_weight(k, pre):
for v in edges[k]:
d, w = v
if d != pre... |
s386383225 | p03634 | u341926204 | 1502607504 | Python | Python (3.4.3) | py | Runtime Error | 957 | 57272 | 566 | N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
ai, bi, ci = map(int, input().split())
edges[ai].append((bi, ci))
edges[bi].append((ai, ci))
Q, K = map(int, input().split())
queries = [tuple(map(int, input().split())) for _ in range(Q)]
weighted_nodes = [0]*(N+1)
def add_weight(k, pr... |
s780986387 | p03634 | u803848678 | 1502603062 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 29652 | 1451 | def dfs_rec(start, cost, aa, bb, cc):
use_index = []
for i in range(aa.count(start)):
use_index.append(aa.index(start))
for i in range(bb.count(start)):
use_index.append(bb.index(start))
use_index = sorted(use_index)[::-1]
# この点から行けるところがないとき
if len(use_index) == 0:
return... |
s803291851 | p03634 | u451017206 | 1502599960 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 47332 | 480 | N = int(input())
g = {i: [] for i in range(1, N+1)}
l = [0] * (N + 1)
visited = []
def dfs2(v, p, d):
l[v] = d
visited.append(v)
for i,ln in g[v]:
if i == p or i in visited:
continue
dfs2(i, v, d+ln)
for i in range(N-1):
a, b, c = map(int,input().split())
g[a].appen... |
s877497284 | p03634 | u462626125 | 1502596424 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 64404 | 834 | INF = 1000000000000000
V = int(input())
E = V - 1
graph = {x:[] for x in range(V)}
cost = {}
flag = [0 for i in range(V)]
d = [0 for i in range(V)]
#****#
def rootLen(v,p,t):
d[v] = t # !
flag[v] = 1
for i in range(V):
if flag[i] == 0 and i in graph[v]:
rootLen(i,v,t+cost[(i,v)])
... |
s015901472 | p03634 | u639444166 | 1502595272 | Python | Python (2.7.6) | py | Runtime Error | 2110 | 614704 | 943 | #!usr/bim/python
#! -*- coding: utf-8 -*-
import numpy as np
n = raw_input()
n = int(n)
tree = np.zeros([n,n],dtype=np.int64)
for i in range(n-1):
abc = raw_input()
abc = abc.split()
abc = map(int, abc)
tree[abc[0]-1,abc[1]-1] = abc[2]
tree[abc[1]-1,abc[0]-1] = abc[2]
qk = raw_input()
qk = qk.sp... |
s767255854 | p03634 | u639444166 | 1502594285 | Python | Python (2.7.6) | py | Runtime Error | 2110 | 616624 | 982 | #!usr/bim/python
#! -*- coding: utf-8 -*-
import numpy as np
n = raw_input()
n = int(n)
tree = np.zeros([n,n],dtype=np.int64)
for i in range(n-1):
abc = raw_input()
abc = abc.split()
abc = map(int, abc)
tree[abc[0]-1,abc[1]-1] = abc[2]
tree[abc[1]-1,abc[0]-1] = abc[2]
qk = raw_input()
qk = qk.sp... |
s858297944 | p03634 | u639444166 | 1502593942 | Python | Python (2.7.6) | py | Runtime Error | 2110 | 615344 | 1047 | #!usr/bim/python
#! -*- coding: utf-8 -*-
import numpy as np
n = raw_input()
n = int(n)
tree = np.zeros([n,n],dtype=np.int64)
for i in range(n-1):
abc = raw_input()
abc = abc.split()
abc = map(int, abc)
tree[abc[0]-1,abc[1]-1] = abc[2]
tree[abc[1]-1,abc[0]-1] = abc[2]
qk = raw_input()
qk = qk.sp... |
s548127968 | p03634 | u341926204 | 1502592519 | Python | Python (3.4.3) | py | Runtime Error | 922 | 62020 | 701 | def d():
N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
ai, bi, ci = map(int, input().split())
edges[ai].append((bi, ci))
edges[bi].append((ai, ci))
Q, K = map(int, input().split())
queries = [tuple(map(int, input().split())) for _ in range(Q)]
we... |
s685620858 | p03634 | u341926204 | 1502592213 | Python | Python (3.4.3) | py | Runtime Error | 929 | 57412 | 689 | def d():
N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
ai, bi, ci = map(int, input().split())
edges[ai].append((bi, ci))
edges[bi].append((ai, ci))
Q, K = map(int, input().split())
queries = [tuple(map(int, input().split())) for _ in range(Q)]
we... |
s255266849 | p03634 | u341926204 | 1502592156 | Python | Python (3.4.3) | py | Runtime Error | 892 | 57408 | 757 | def d():
N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
ai, bi, ci = map(int, input().split())
edges[ai].append((bi, ci))
edges[bi].append((ai, ci))
Q, K = map(int, input().split())
queries = [tuple(map(int, input().split())) for _ in range(Q)]
fo... |
s399846181 | p03634 | u858994158 | 1502591472 | Python | Python (3.4.3) | py | Runtime Error | 1678 | 59012 | 626 | n=int(input())-1
edges = {}
lens = {}
for _ in range(n):
[a, b, c] = map(int, input().split())
if a > b:
a,b=b,a
edges.setdefault(a, []).append(b)
edges.setdefault(b, []).append(a)
lens[(a,b)] = c
q, k = map(int, input().split())
dists = {}
def build(x, d=0):
dists[x] = d
for c in... |
s029123608 | p03634 | u516828244 | 1502591398 | Python | Python (3.4.3) | py | Runtime Error | 1468 | 60668 | 452 | #!/usr/bin/env python3
import collections
def dfs(n, pre, T, dist, d) :
dist[n] = d
for i in T[n] :
if i[0] != pre :
dfs(i[0], n, T, dist, d + i[1])
N = int(input())
T = collections.defaultdict(lambda : [])
for i in range(N-1) :
a, b, c = map(int, input().split())
T[a].append((b, c))
T[b].append((a, c))
Q,... |
s540510690 | p03634 | u653807637 | 1502591245 | Python | Python (3.4.3) | py | Runtime Error | 1143 | 181172 | 1284 | # encoding:utf-8
import sys
def main():
n = int(input())
vers = [list(map(int, input().split())) for _ in range(n - 1)]
q, k = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(q)]
#n = 10 ** 5
#vers = [[i + 1, i + 2, 10 ** 9] for i in range(n - 1)]
new_vers = mapping(n... |
s358579110 | p03634 | u858994158 | 1502591182 | Python | Python (3.4.3) | py | Runtime Error | 1587 | 58912 | 511 | n=int(input())-1
edges = {}
lens = {}
for _ in range(n):
[a, b, c] = map(int, input().split())
if a > b:
a,b=b,a
edges.setdefault(a, []).append(b)
edges.setdefault(b, []).append(a)
lens[(a,b)] = c
q, k = map(int, input().split())
dists = {}
def build(x, d=0):
dists[x] = d
for c in... |
s231295136 | p03634 | u653807637 | 1502590953 | Python | Python (3.4.3) | py | Runtime Error | 1274 | 180748 | 1308 | # encoding:utf-8
import sys
sys.setrecursionlimit(100000)
def main():
n = int(input())
vers = [list(map(int, input().split())) for _ in range(n - 1)]
q, k = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(q)]
n = 10 ** 5
vers = [[i + 1, i + 2, 10 ** 9] for i in range(n... |
s443639790 | p03634 | u346222974 | 1502590931 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 618 | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
long long d[N];
vector<pair<int, int>> g[N];
void dfs(int u, int f, long long w) {
d[u] = w;
for (auto &go : g[u]) {
if (go.first != f) {
dfs(go.first, u, w + go.second);
}
}
}
int main() {
int n;
scanf("%d", &n);
for (in... |
s187980498 | p03634 | u858994158 | 1502590930 | Python | Python (3.4.3) | py | Runtime Error | 1607 | 65724 | 547 | n=int(input())-1
edges = {}
lens = {}
for _ in range(n):
[a, b, c] = map(int, input().split())
if a > b:
a,b=b,a
edges.setdefault(a, []).append(b)
edges.setdefault(b, []).append(a)
lens[(a,b)] = c
q, k = map(int, input().split())
used = set()
dists = {}
def build(x, d=0):
dists[x] = d... |
s028116178 | p03634 | u653807637 | 1502590433 | Python | Python (3.4.3) | py | Runtime Error | 1090 | 91108 | 1171 | # encoding:utf-8
def main():
n = int(input())
vers = [list(map(int, input().split())) for _ in range(n - 1)]
q, k = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(q)]
new_vers = mapping(n, vers)
dist = calcMinDist(n, new_vers, k, queries)
calcQueries(dist, queries, k)
... |
s954726575 | p03634 | u462349313 | 1502590094 | Python | Python (3.4.3) | py | Runtime Error | 1381 | 83108 | 534 | n = int(input())
d = [0 for i in range(n+1)]
adj = [[] for i in range(n+1)]
def dfs(u, par):
for p in adj[u]:
v, w = map(int, p)
# print(v, w)
if v != par:
d[v] = d[u]+w
dfs(v, u)
edge = [list(map(int, input().split())) for i in range(n-1)]
q, k = map(int, input().... |
s289907238 | p03634 | u346222974 | 1502589870 | Python | Python (3.4.3) | py | Runtime Error | 1569 | 57788 | 436 | n = int(input())
g = []
d = [0] * (n * 2)
for i in range(n * 2):
g.append([]);
for i in range(n - 1):
u, v, w = map(int, input().split())
g[u].append([v, w])
g[v].append([u, w])
q, k = map(int, input().split())
def dfs(u, f, w):
d[u] = w;
for go in g[u]:
if go[0] != f:
dfs(go... |
s282014860 | p03634 | u346222974 | 1502589611 | Python | Python (3.4.3) | py | Runtime Error | 1596 | 49844 | 436 | n = int(input())
g = []
d = [0] * (n + 1)
for i in range(n + 1):
g.append([]);
for i in range(n - 1):
u, v, w = map(int, input().split())
g[u].append([v, w])
g[v].append([u, w])
q, k = map(int, input().split())
def dfs(u, f, w):
d[u] = w;
for go in g[u]:
if go[0] != f:
dfs(go... |
s212805513 | p03634 | u858994158 | 1502589560 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 27616 | 561 | n=int(input())-1
nodes = {1: (None, 0, 0)}
for _ in range(n):
[a, b, c] = map(int, input().split())
if a > b:
a,b=b,a
if a not in nodes:
import time
time.sleep(3)
nodes[b] = nodes[a], c, c + nodes[a][2]
def dist(a, b):
if a == b:
return 0
if a[2] < b[2]:
... |
s852389408 | p03634 | u346222974 | 1502589479 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1690 | 116384 | 436 | n = int(input())
g = []
d = [0] * (n + 1)
for i in range(n + 1):
g.append([]);
for i in range(n - 1):
u, v, w = map(int, input().split())
g[u].append([v, w])
g[v].append([u, w])
q, k = map(int, input().split())
def dfs(u, f, w):
d[u] = w;
for go in g[u]:
if go[0] != f:
dfs(go... |
s019508221 | p03634 | u653807637 | 1502589399 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 57624 | 1124 | # encoding:utf-8
def main():
n = int(input())
vers = [list(map(int, input().split())) for _ in range(n - 1)]
q, k = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(q)]
#print(vers)
#print(queries)
dist = calcMinDist(n, vers, k, queries)
calcQueries(dist, queries, k)
... |
s159505946 | p03634 | u858994158 | 1502589245 | Python | Python (3.4.3) | py | Runtime Error | 1472 | 28560 | 496 | n=int(input())-1
nodes = {1: (None, 0, 0)}
for _ in range(n):
[a, b, c] = map(int, input().split())
if a > b:
a,b=b,a
nodes[b] = nodes[a], c, c + nodes[a][2]
def dist(a, b):
if a == b:
return 0
if a[2] < b[2]:
return b[1] + dist(a, b[0])
if a[2] > b[2]:
return a... |
s588285487 | p03634 | u272028993 | 1502588108 | Python | Python (2.7.6) | py | Runtime Error | 974 | 47976 | 525 | def dfs(now, par, d, dist, g):
dist[now] = d
for to, cost in g[now]:
if to == par: continue
dfs(to, now, d + cost, dist, g)
n = int(raw_input())
g = [[] for _ in xrange(n)]
for i in xrange(n - 1):
a, b, c = map(int, raw_input().split())
a -= 1; b -= 1
g[a].append([b, c])
g[b].a... |
s872399607 | p03634 | u629650917 | 1502587849 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1303 | #include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#incl... |
s679724480 | p03634 | u951877352 | 1502587697 | Python | Python (2.7.6) | py | Runtime Error | 895 | 45292 | 419 | n=int(raw_input())
tr=[[] for i in range(n)]
for i in range(n-1) :
a,b,c=map(int,raw_input().split())
a -= 1
b -= 1
tr[a].append((b,c))
tr[b].append((a,c))
m,k=map(int,raw_input().split())
k -= 1
dis=[0 for i in range(n)]
def dfs(u,w=-1,l=0) :
dis[u]=l
for v,v1 in tr[u] :
if v!=w :
dfs(v,u,l+v1)... |
s806841967 | p03634 | u119714109 | 1502587052 | Python | Python (3.4.3) | py | Runtime Error | 766 | 141460 | 605 | import sys
sys.setrecursionlimit(100001)
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
n = ni()
g = []
for i in range(n+1): g.append([])
for i in range(n-1):
a, b, c = na()
g[a].append((b,c))
g[b].append((a,c))
q,k = na()
de... |
s415091024 | p03634 | u119714109 | 1502586704 | Python | Python (3.4.3) | py | Runtime Error | 707 | 47752 | 578 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
n = ni()
g = []
for i in range(n+1): g.append([])
for i in range(n-1):
a, b, c = na()
g[a].append((b,c))
g[b].append((a,c))
q,k = na()
def dfs(cur, pre, g, par, dw, w... |
s495918294 | p03635 | u375065632 | 1600899255 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9036 | 45 | x,y = int(input().split())
print((x-1)*(y-1)) |
s167141458 | p03635 | u085186789 | 1600652404 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8984 | 58 | n = int(input())
m = int(input())
print((n - 1) * (m - 1)) |
s333507777 | p03635 | u678246254 | 1600550253 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9000 | 72 | n, m = [map(int, input().split()) for i in range(2)]
print((n-1)*(m-1))
|
s452490032 | p03635 | u678246254 | 1600550097 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9168 | 58 | n, m = [int(input()) for i in range(2)]
print((n-1)*(m-1)) |
s573567476 | p03635 | u889405092 | 1599976490 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9056 | 48 | n,m =map(int,imput().split())
print((n-1)*(m-1)) |
s794952911 | p03635 | u889405092 | 1599976429 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8932 | 48 | n,m =map(int,imput().split())
print((n-1)*(m-1)) |
s794159162 | p03635 | u889405092 | 1599976380 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8964 | 50 | n,m =map(int(),imput().split())
print((n-1)*(m-1)) |
s355605436 | p03635 | u889405092 | 1599976351 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9028 | 48 | n,m =map(int(),imput().split)
print((n-1)*(m-1)) |
s928308675 | p03635 | u648315264 | 1599847386 | Python | Python (3.8.2) | py | Runtime Error | 33 | 9344 | 1016 | import math
from math import gcd,pi,sqrt
INF = float("inf")
import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N... |
s719468418 | p03635 | u034855798 | 1599673359 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 74812 | 46 | n, m = map(int,input.split)
print((n-1)*(m-1)) |
s732391010 | p03635 | u344959959 | 1599615249 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8996 | 3 | aaa |
s698231730 | p03635 | u555356625 | 1598650186 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9008 | 53 | n, m = = map(int, input().split())
print((n-1)*(m-1)) |
s277029503 | p03635 | u031852574 | 1598648999 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9152 | 40 | n = int(input())
print(2 * n,end = "\n") |
s429889517 | p03635 | u512551187 | 1598296362 | Python | PyPy3 (7.3.0) | py | Runtime Error | 100 | 74752 | 320 | n=int(input())
l=list(map(int,input().split()))
x=0
y=0
c=0
for i in range(n):
if(l[i]%4==0):
x+=1
elif(l[i]%2==0):
y+=1
else:
c+=1
if(n%2==0):
if(x>=c):
print("Yes")
else:
print('No')
else:
if(x>=(c-1)):
print("Yes")
else:
print("No")
|
s248763656 | p03635 | u773686010 | 1597672230 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9128 | 305 | ##
N = int(input())
N_List = list(map(int,input().split()))
Four_List = [i for i in N_List if i % 4 == 0]
Two_List = [i for i in N_List if i % 2 == 0]
if len(Two_List)-len(Four_List) > 0:
N = N - (len(Two_List) - len(Four_List)) + 1
if N // 2 <= len(Four_List):
print("Yes")
else:
print("No") |
s401899664 | p03635 | u773686010 | 1597672099 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9092 | 290 | ##
N = int(input())
N_List = list(map(int,input().split()))
Four_List = [i for i in N_List if i % 4 == 0]
Two_List = [i for i in N_List if i % 2 == 0]
if len(Two_List) > 0:
N = N - (len(Two_List) - len(Four_List)) + 1
if N // 2 <= len(Four_List):
print("Yes")
else:
print("No") |
s165502074 | p03635 | u096294926 | 1597286045 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 74412 | 409 | import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
if A[i]%4 == 0:
l.append(A[i])
if A[i]%2 == 0:
ll.append(A[i])
if A[i]%2 != 0:
lll.append(A[i])
four = len(l)
two = four - len(ll)
zero = N-two
a = math.floor(N/2)
b = A.count(0)
if zero <= ... |
s219798515 | p03635 | u863370423 | 1597235063 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9048 | 185 | from sys import stdin, stdout
def main():
line = stdin.readline()
parts = line.split()
n = int(parts[1])
m = int(parts[2])
stdout.write(str((n-1)*(m-1)))
main()
|
s190375165 | p03635 | u353919145 | 1597234812 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8860 | 175 | from sys import stdin, stdout
def main():
line = stdin.readLine()
parts = line.split()
a = int(parts[1])
b = int(parts[2])
stdout.write((a-1)*(b-1))
main() |
s144972716 | p03635 | u018679195 | 1597234767 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9044 | 163 | from sys import stdin,stdout
def main():
line=stdin.readline()
parts=line.split()
a=int(parts[0])
b=int(parts[1])
stdout.write(a-1*b-1)
main() |
s152363917 | p03635 | u018679195 | 1597234655 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8936 | 192 | from sys import stdin, stdout
def main():
line = stdin.readLine()
parts = line.split()
n = int(parts[1]) #n
m = int(parts[2]) #m
stdout.write(str((n-1)*(m-1)))
main()
|
s705154632 | p03635 | u353919145 | 1597234624 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8936 | 167 | from sys import stdin, stdout
def main():
line = stdin.readLine()
parts = line.split()
a = int(parts[1])
b = int(parts[2])
stdout.write(a*b)
main() |
s003013616 | p03635 | u018679195 | 1597234549 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9088 | 68 | def main():
ans=n-1*m-1
print(ans)
main()
|
s051719201 | p03635 | u921632705 | 1597166715 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9084 | 48 | x,y = input().split()
a = x-1
b = y-1
print(a*b) |
s372905711 | p03635 | u921632705 | 1597166635 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8912 | 40 | x,y = input().split()
print((x-1)*(y-1)) |
s011149873 | p03635 | u921632705 | 1597166517 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8948 | 54 | x, y = int(input().split())
a = x-1
b = y-1
print(a*b) |
s237280685 | p03635 | u921632705 | 1597166462 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9008 | 45 | x,y = int(input().split())
print((x-1)*(y-1)) |
s422885614 | p03635 | u921632705 | 1597166428 | Python | Python (3.8.2) | py | Runtime Error | 29 | 8948 | 43 | x,y = int(input().split)
print((x-1)*(y-1)) |
s390628417 | p03635 | u875769753 | 1596938395 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9152 | 40 | print((int(input())-1)*(int(input())-1)) |
s640851513 | p03635 | u572032237 | 1596774194 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9084 | 58 | n, n = map(int, input().split())
print((n - 1) * (m - 1)) |
s152291111 | p03635 | u370721525 | 1596539996 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9028 | 53 | n, m = map(int, input())
ans = (n-1)*(m-1)
print(ans) |
s196443116 | p03635 | u516554284 | 1595987690 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9044 | 287 | n=int(input())
a=list(map(int,input().split()))
x2=0
x4=0
x1=0
for x in a:
if x%2==0:
x2+=1
if x%4==0:
x4+=1
if x%2==1:
x1+=1
if x4+x1==n:
if x4>=x1-1:
print('Yes')
else:
print('No')
else:
if x4>=x1:
print('Yes')
else:
print('No')
|
s406080151 | p03635 | u487288850 | 1595533282 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9048 | 50 | n,m = map(int,input().split())
print(n*m-2(n+m)+4) |
s521808195 | p03635 | u089230684 | 1595299004 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8820 | 58 | a, b = map(int, input().split(" ''))
print((a-1) * (b-1))
|
s235798642 | p03635 | u772371451 | 1595259329 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9088 | 51 | n,m = int(input().split())
k = (n-1)*(m-1)
print(k) |
s144310730 | p03635 | u825343780 | 1595165895 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8936 | 55 | n, m = map(int, input.split())
print((n - 1) * (m - 1)) |
s535689194 | p03635 | u729627789 | 1594149448 | Python | PyPy3 (7.3.0) | py | Runtime Error | 93 | 74748 | 43 | n, m = map(int, input())
print((n-1)*(m-1)) |
s850608189 | p03635 | u159335277 | 1593400532 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9036 | 56 | a, b = list(map(int, input()))
print((a - 1) * (b - 1)) |
s851034887 | p03635 | u184796829 | 1593174722 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9020 | 45 | n,m=map(int,input.split())
print((n-1)*(m-1)) |
s730566730 | p03635 | u184796829 | 1593174651 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9156 | 48 | n=int(input())
m=int(input())
print((n-1)*(m-1)) |
s950662549 | p03635 | u611090896 | 1593132773 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9148 | 40 | print((int(input())-1)*(int(input())-1)) |
s149552631 | p03635 | u021657949 | 1592873452 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8960 | 44 | n,m=map(intput().split())
print((n-1)*(m-1)) |
s841380155 | p03635 | u021657949 | 1592873424 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9016 | 44 | n,m=int(intput().split())
print((n-1)*(m-1)) |
s695283420 | p03635 | u472333691 | 1592865377 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9092 | 50 | n=int(input())
m=int(input())
print((n-1) * (m-1)) |
s492674910 | p03635 | u472333691 | 1592865215 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9144 | 35 | n, m =int(input())
print(n-1 * m-1) |
s758143271 | p03635 | u972892985 | 1592790439 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8944 | 35 | print(s[0] + str(len(s)-2) + s[-1]) |
s193339840 | p03635 | u773440446 | 1591713881 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 52 | n,m = map(int,input())
s = (n - 1)*(m - 1)
print(s) |
s631153988 | p03635 | u347600233 | 1591155484 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 50 | n, m = map(int, input())
print((n - 1) * (m - 1))
|
s497026456 | p03635 | u347600233 | 1591155455 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 50 | n, m = map(int, input())
print((n - 1) * (m - 1))
|
s363668829 | p03635 | u347600233 | 1591155421 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 50 | n, m = map(int, input())
print((n - 1) * (m - 1))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.