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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s057875876 | p03837 | u977389981 | 1555706707 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3572 | 1274 | import heapq
import copy
V, M = map(int, input().split())
d = [0] * V
prev = [0] * V
cost = [[INF] * V for i in range(V)]
for i in range(M):
a, b, c = map(int, input().split())
cost[a - 1][b - 1] = c
cost[b - 1][a - 1] = c
def dijkstra_back(s, t):
for i in range(V):
prev[i] = s
d[i] = float('inf')
d[s] = 0
h = []
heapq.heappush(h, [0, s])
while h != []:
p = heapq.heappop(h)
v = p[1]
if d[v] < p[0]:
continue
for i in range(V):
if d[i] > d[v] + cost[v][i]:
d[i] = d[v] + cost[v][i]
heapq.heappush(h, [d[i], i])
prev[i] = v
path = [t]
while prev[t] != s:
path.append(prev[t])
prev[t] = prev[prev[t]]
path.append(s)
path = path[::-1]
return path
cost2 = copy.deepcopy(cost)
for i in range(V - 1):
for j in range(i + 1, V):
g = dijkstra_back(i, j)
# print(i, j, g)
for k in range(len(g) - 1):
cost2[g[k]][g[k + 1]] = INF
cost2[g[k + 1]][g[k]] = INF
cnt = 0
for i in range(V):
for j in range(V):
if cost2[i][j] != INF:
cnt += 1
print(cnt // 2) |
s181173681 | p03837 | u977389981 | 1555706512 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3572 | 1274 | import heapq
import copy
V, M = map(int, input().split())
d = [0] * V
prev = [0] * V
cost = [[INF] * V for i in range(V)]
for i in range(M):
a, b, c = map(int, input().split())
cost[a - 1][b - 1] = c
cost[b - 1][a - 1] = c
def dijkstra_back(s, t):
for i in range(V):
prev[i] = s
d[i] = float('inf')
d[s] = 0
h = []
heapq.heappush(h, [0, s])
while h != []:
p = heapq.heappop(h)
v = p[1]
if d[v] < p[0]:
continue
for i in range(V):
if d[i] > d[v] + cost[v][i]:
d[i] = d[v] + cost[v][i]
heapq.heappush(h, [d[i], i])
prev[i] = v
path = [t]
while prev[t] != s:
path.append(prev[t])
prev[t] = prev[prev[t]]
path.append(s)
path = path[::-1]
return path
cost2 = copy.deepcopy(cost)
for i in range(V - 1):
for j in range(i + 1, V):
g = dijkstra_back(i, j)
# print(i, j, g)
for k in range(len(g) - 1):
cost2[g[k]][g[k + 1]] = INF
cost2[g[k + 1]][g[k]] = INF
cnt = 0
for i in range(V):
for j in range(V):
if cost2[i][j] != INF:
cnt += 1
print(cnt // 2) |
s517658925 | p03837 | u675497468 | 1554911420 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38588 | 2834 | def gen_graph(input_list):
graph = {}
for item in input_list:
if not item[0] in graph:
graph[item[0]] = {}
if not item[1] in graph:
graph[item[1]] = {}
graph[item[0]][item[1]] = item[2]
graph[item[1]][item[0]] = item[2]
return graph
def get_lowest_cost_vertex(costs, processed):
lowest_cost = float("inf")
lowest_cost_node = None
for node in costs:
cost = costs[node]
if cost < lowest_cost and node not in processed:
lowest_cost = cost
lowest_cost_node = node
return lowest_cost_node
def get_best_routes(graph, start):
costs = {}
parents = {}
processed = []
costs[start] = 0
parents[start] = None
processed.append(start)
for item in graph[start].keys():
costs[item] = graph[start][item]
parents[item] = start
for item in graph.keys():
if not (item in costs.keys() or item == start):
costs[item] = float("inf")
parents[item] = None
node = get_lowest_cost_vertex(costs, processed)
while node is not None:
cost = costs[node]
neighbors = graph[node]
for n in neighbors.keys():
new_cost = cost + neighbors[n]
if costs[n] > new_cost:
costs[n] = new_cost
parents[n] = node
processed.append(node)
node = get_lowest_cost_vertex(costs, processed)
routes = []
for item in graph.keys():
if item != start:
route = []
route.append(item)
parent = parents[item]
while 1:
route.append(parent)
if parent == start:
break
parent = parents[parent]
route.reverse()
routes.append(route)
return routes
def main(vertex_count, input_list):
graph = gen_graph(input_list)
routes = []
for start in range(1, vertex_count+1):
for route in get_best_routes(graph, start):
routes.append(route)
route_strs = []
for route in routes:
route_strs.append(''.join(list(map(str, route))))
side_strs = []
for item in input_list:
side_strs.append(str(item[0]) + str(item[1]))
side_strs.append(str(item[1]) + str(item[0]))
count = 0
route_strs_joined = '/'.join(route_strs)
for side_str in side_strs:
if route_strs_joined.find(side_str) == -1:
count += 1
return count / 2
if __name__ == "__main__":
vertex_count, sides_count = list(map(int, input().split()))
input_list = []
for _ in sides_count:
vertex_1, vertex_2, distance = list(map(int, input().split()))
input_list.append((vertex_1, vertex_2, distance))
print(main(vertex_count, input_list))
|
s832768219 | p03837 | u674885198 | 1553810383 | Python | Python (3.4.3) | py | Runtime Error | 173 | 4980 | 1117 | n,m=list(map(int, input().split()))
abc = []
for i in range(m):
abc.append(list(map(int, input().split())))
bools = [False for i in range(n)]
dp =[[[0,[]] for i in range(n)] for i in range(n)]
for i in range(len(abc)):
a=abc[i][0]
b=abc[i][1]
c=abc[i][2]
a=a-1
b=b-1
dp[a][b][0]=dp[a][b][0]+c
dp[b][a][0]=dp[b][a][0]+c
dp[a][b][1]=[i]
dp[b][a][1]=[i]
for i in range(n):
for j in range(i,n):
if dp[i][j][0]>0:
for cand in range(n):
if dp[i][cand][0]>0:
if dp[j][cand][0]>=dp[i][cand][0]+dp[i][j][0]:
dp[j][cand][0]=dp[i][cand][0]+dp[i][j][0]
dp[j][cand][1]=dp[i][cand][1]+dp[i][j][1]
if dp[i][cand][0]>=dp[j][cand][0]+dp[i][j][0]:
dp[i][cand][0]=dp[j][cand][0]+dp[i][j][0]
dp[i][cand][1]=dp[j][cand][1]+dp[i][j][1]
for i in range(n):
for j in range(i,n):
for x in dp[i][j][1]:
bools[x]=True
count=0
for i in range(n):
if bools[i]==False:
count+=1
print(count) |
s203705926 | p03837 | u352623442 | 1553808439 | Python | PyPy3 (2.4.0) | py | Runtime Error | 334 | 52056 | 883 | n,m =map(int,input().split())
inf = 10**15
dist = [[inf for i in range(n)] for i in range(n)]
route = [[ [] for i in range(n)] for i in range(n)]
import copy
for i in range(m):
ak,bk,ck = map(int,input().split())
dist[ak-1][bk-1] =ck
dist[bk-1][ak-1] =ck
for i in range(n):
for k in range(n):
route[i][k] = [i,k]
route[k][i] = [k,i]
for a in range(n):
for b in range(n):
for c in range(n):
if dist[b][a]+dist[a][c] < dist[b][c]:
if route[b][a] == None:
route[b][c] = copy.deepcopy(route[a][c])[1:]
else:
route[b][c] = copy.deepcopy(route[b][a]).extend(copy.deepcopy(route[a][c])[1:])
dist[b][c] = dist[b][a]+dist[a][c]
ans = 0
for i in range(n):
for k in range(n):
if route[i][k]:
ans += 1
print(m-ans//2)
|
s562341915 | p03837 | u352623442 | 1553808117 | Python | PyPy3 (2.4.0) | py | Runtime Error | 331 | 53900 | 751 | n,m =map(int,input().split())
inf = 10**15
dist = [[inf for i in range(n)] for i in range(n)]
route = [[ [] for i in range(n)] for i in range(n)]
import copy
for i in range(m):
ak,bk,ck = map(int,input().split())
dist[ak-1][bk-1] =ck
dist[bk-1][ak-1] =ck
for i in range(n):
for k in range(n):
route[i][k] = [i,k]
route[k][i] = [k,i]
for a in range(n):
for b in range(n):
for c in range(n):
if dist[b][a]+dist[a][c] < dist[b][c]:
route[b][c] = copy.deepcopy(route[b][a]).extend(copy.deepcopy(route[a][c])[1:])
dist[b][c] = dist[b][a]+dist[a][c]
ans = 0
for i in range(n):
for k in range(n):
if route[i][k]:
ans += 1
print(m-ans//2)
|
s107654394 | p03837 | u824237520 | 1552575188 | Python | Python (3.4.3) | py | Runtime Error | 2121 | 269628 | 1166 | import sys
sys.setrecursionlimit(10000)
n, m = map(int, input().split())
abc = [tuple(int(x) - 1 for x in input().split()) for _ in range(m)]
#res = [[9999999 for _ in range(n)] for _ in range(n)]
e = [dict() for _ in range(n)]
for i in range(m):
a, b, c = abc[i][0], abc[i][1], abc[i][2]
e[a][b] = [c, i]
e[b][a] = [c, i]
ans = set()
for i in range(n-1):
for j in range(i + 1, n):
temp = [[0, i]]
res = []
for k in range(n):
next = []
for x in temp:
if x[1] == j:
res.append(x)
continue
for z in e[x[1]].keys():
if len(x) == 2:
next.append([ x[0] + e[x[1]][z][0], z ] + [ e[x[1]][z][1] ])
else:
next.append([ x[0] + e[x[1]][z][0], z ] + x[2:] + [ e[x[1]][z][1] ])
temp = [] + next
mr = 99999999
p = 0
for i in range(len(res)):
if res[i][0] < mr:
mr = res[i][0]
p = i
#print(set(res[p][2:]))
ans = ans | set(res[p][2:])
print(m - len(ans)) |
s976815720 | p03837 | u603253967 | 1551720815 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1638 | from collections import defaultdict
def dd(N, abc, ne_table, start_i):
used_edge = set()
pivot = start_i
kouho = {start_i: (0, 0, True)} # value: (d, path,kakutei)
for _ in range(N - 1):
current_dist, path, kaku = kouho[pivot]
assert kaku
edges_i = ne_table[pivot] # エッジリスト取得
for i in edges_i:
a, b, weight = abc[i]
target = a if a != pivot else b
if target in kouho:
tmp_d, tmp_path, kakutei = kouho[target]
if kakutei:
continue
if current_dist + weight < tmp_d: # 更新
kouho[target] = (current_dist + weight, i, False)
continue
kouho[target] = (current_dist + weight, i, False)
min_kouho = min([(k, d, p) for k, (d, p, kakutei) in kouho.items() if not kakutei], key=lambda q: q[1])
min_kouho_i = min_kouho[0]
used_edge.add(min_kouho[2])
kouho[min_kouho_i] = (*kouho[min_kouho_i][:2], True)
pivot = min_kouho_i
return used_edge
def main():
N, M = [int(a) for a in input().split()]
def pre(a, b, c):
return a - 1, b - 1, c
abc = [
pre(*[int(a) for a in input().split()])
for _ in range(M)
]
ne_table = defaultdict(lambda: [])
for i, (a, b, c) in enumerate(abc):
ne_table[a].append(i)
ne_table[b].append(i)
total_used = set()
for i in range(N):
used = dd(N, abc, ne_table, i)
total_used.update(used)
print(M - len(total_used))
if __name__ == '__main__':
main()
|
s855005660 | p03837 | u572144347 | 1551024419 | Python | PyPy3 (2.4.0) | py | Runtime Error | 197 | 38896 | 296 | #!/mnt/c/Users/moiki/bash/env/bin/python
sx,sy,tx,ty = map(int, input().split())
ans = ""
#UP
ans += "U" * (ty-sy)
ans += "R" * (tx-sx)
ans += "D" * (ty-sy)
ans += "L" * (tx-sx)
ans += "L" + "U"* (ty-sy+1) + "R" * (tx-sx+1) + "D"
ans += "R" + "D" * (ty-sy+1) + "L"*(tx-sx+1) + "U"
print(ans)
|
s213294744 | p03837 | u316386814 | 1550367641 | Python | Python (3.4.3) | py | Runtime Error | 148 | 12636 | 462 | n, m = list(map(int, input().split()))
import numpy as np
dists = np.ones((n + 1, n + 1)) * (10 ** 6)
edges = []
for _ in range(m):
a, b, c = list(map(int, input().split()))
dists[a, b] = dists[b, a] = c
edges.append(a, b, c)
for i in range(1, n + 1):
dists[i, i] = 0
for i in range(1, 1 + n):
dists = np.minimum(dists, dists[i: i + 1] + dists[:, i: i + 1])
cnt = 0
for a, b, c in edges:
if dists[a, b] < c:
cnt += 1
print(cnt)
|
s945595786 | p03837 | u983918956 | 1550355950 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38684 | 1435 | from collections import deque
sx,sy,tx,ty = map(int,input().split())
ans_list = []
(tx,ty) = (tx-sx,ty-sy); (sx,sy) = (0,0)
H,W = ty+3,tx+3
visited = [[0]*(tx+3) for i in range(ty+3)]
d = [[1,0],[0,1],[-1,0],[0,-1]]
(sx,sy) = (sx+1,sy+1); (tx,ty) = (tx+1,ty+1)
def bfs(si,sj,gi,gj):
tr = [[si,sj]]
q = deque([[si,sj,tr]])
while q:
i,j,tr = q.popleft()
if (i,j) == (gi,gj):
return tr
for di,dj in d:
ni = i + di; nj = j + dj
if 0 <= ni <= H-1 and 0 <= nj <= W-1 and visited[ni][nj] == 0:
visited[ni][nj] = 1
ntr = tr[:]; ntr.append([ni,nj])
q.append([ni,nj,ntr])
def change(tr):
def func(d):
if d == (1,0):return "U"
if d == (-1,0):return "D"
if d == (0,-1):return "L"
if d == (0,1):return "R"
for i in range(len(tr)-1):
(ni,nj) = (tr[i+1][0],tr[i+1][1])
(i,j) = (tr[i][0],tr[i][1])
d = (ni-i,nj-j)
ans_list.append(func(d))
tr = []
for cnt in range(2):
res = bfs(sy,sx,ty,tx)
for k in range(1,len(res)):
i,j = res[k][0],res[k][1]
rei, rej = ty + sx - i, tx + sy - j
res.append([rei,rej])
if cnt == 0:
tr += res
else:
tr += res[1:]
visited = [[0]*W for i in range(H)]
for i,j in tr:
visited[i][j] = 1
visited[ty][tx] = 0
change(tr)
ans = "".join(ans_list)
print(ans) |
s621636772 | p03837 | u054106284 | 1543981338 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3828 | 1656 | import heapq
import math
def make_Graph(N, edges):#頂点の名前はi - 1で受け付ける
graph = {}
for i in range(N):
graph[i] = {}
for j in range(N):
graph[i][j] = 0
for edge in edges:
a, b, c = edge
graph[a][b] = c
graph[b][a] = c
return graph
def Dijkstra(graph, start):
N = len(graph)
d = {}
prev = {}
for i in range(N):
prev[i] = None
if i == start:
d[i] = 0
else:
d[i] = math.inf
Q = []
heapq.heappush(Q, (0, start))
while Q:
d_u, u = heapq.heappop(Q)
if d[u] < d_u:#ダブりを回避
continue
for i in range(N):
if graph[u][i]:
temp = d_u + graph[u][i]
if d[i] > temp:
d[i] = temp
prev[i] = u
heapq.heappush(Q, (d[i], i))
return (d, prev)
def saitan(start, goal, d, prev):
temp = goal
res = [goal]
while True:
res.append(prev[temp])
if prev[temp] == start:
break
else:
temp = prev[temp]
return res
N,M = (int(i) for i in input().split())
edges = []
for i in range(M):
a,b,c = (int(i) for i in input().split())
edges.append((a-1, b-1, c))
graph = make_Graph(N, edges)
res = []
for i in range(N):
d, prev = Dijkstra(graph, i)
for j in range(N):
if i != j:
sait = saitan(i, j, d, prev)
for k in range(len(sait) - 1):
res.append( (min(sait[k], sait[k + 1]) , max(sait[k], sait[k + 1]) ) )
res = set(res)
print(M - len(res)) |
s791274953 | p03837 | u505420467 | 1543434071 | Python | Python (3.4.3) | py | Runtime Error | 279 | 17176 | 431 | from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse.csgraph import dijkstra
n,m=map(int,input().split())
dis=[[float('inf') for i in range(n)]for j in range(n)]
for i in range(n):
dis[i][i]=0
for i in range(m):
a,b,t=map(int,input().split())
dis[a-1][b-1]=t
dis[b-1][a-1]=t
cost=dijkstra(dis,directed=False,unweighted=False)
cnt=0
for i,j,k in dis:
if k>costs[i-1][j-1]:
cnt+=1
print(cnt)
|
s489056248 | p03837 | u200030766 | 1542489448 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3188 | 938 | #ダイクストラ法
V, E=map(int,input().strip().split(' '))
inf=10**9
cost=[[inf]*V for i in range(V)]
edge=[]
for i in range(E):
fr, to, co=map(int,input().strip().split(' '))
cost[fr-1][to-1]=co
cost[to-1][fr-1]=co
edge.append([fr-1,to-1])
d=[]
for i in range(V):
d.append(dijkstra(i))
cand=E
for i in range(E):
fl=False
for j in range(V):
for k in range(V):
if d[j][edge[i][0]]==cost[edge[i][0]][edge[i][1]]+d[k][edge[i][1]]:
cand-=1
fl=True
break
if fl:
break
print(cand)
def dijkstra(s):
d=[inf]*V
used=[False]*V
d[s]=0
while True:
v=-1
for u in range(V):
if used[u]==False and(v==-1 or d[u]<d[v]):
v=u
if v==-1:
break
used[v]=True
for u in range(V):
d[u]=min(d[u],d[v]+cost[v][u])
return d
|
s182501619 | p03837 | u169650582 | 1542393994 | Python | Python (3.4.3) | py | Runtime Error | 2121 | 258744 | 634 | N,M=map(int,input().split())
Islands=[[] for i in range(N)]
Edge=[]
S=0
for i in range(M):
a,b,c=map(int,input().split())
Islands[a-1].append([b-1,c])
Islands[b-1].append([a-1,c])
Edge.append([a-1,b-1])
for m in range(M):
a=Edge[m][0]
b=Edge[m][1]
for i in Islands[a]:
if i[0]==b:
c_m=i[1]
List=[[a,-1]]
for l in List:
c=(-1)*(l[-1]+1)
if l[-2]==b:
if c_m>c:
S+=1
break
else:
for n in Islands[l[-2]]:
if n[0] in l:
pass
else:
c+=n[1]
del l[-1]
List.append(l+[n[0],(-1)*(c+1)])
print(S) |
s600072643 | p03837 | u620084012 | 1540295000 | Python | PyPy3 (2.4.0) | py | Runtime Error | 200 | 41196 | 572 | # ABC 051 D
INF = 7+10**9
N, M = map(int,input().split())
P = []
D = [[INF for k in range(N)] for l in range(N)]
for k in range(N):
D[k][k] = 0
for k in range(M):
a, b, c = map(int,input().split())
P.append([a-1,b-1,c])
D[a-1][b-1] = c
D[b-1][a-1] = c
# Floyd-Warshall
for k in range(M):
for l in range(M):
for m in range(M):
D[l][m] = min(D[l][m], D[l][k]+D[k][m])
ans = M
for p in P:
a, b, c = p[0], p[1], p[2]
for k in range(N):
if D[a][k] + c == D[b][k]:
ans -= 1
break
print(ans)
|
s396835419 | p03837 | u785989355 | 1538295731 | Python | Python (2.7.6) | py | Runtime Error | 376 | 2948 | 750 |
INF = 10**6 + 1
N,M = map(int,raw_input().split())
a_l=[]
b_l=[]
c_l=[]
for i in range(M):
a,b,c=map(int,raw_input().split())
a_l.append(a-1)
b_l.append(b-1)
c_l.append(c-1)
d = [[INF for j in range(N)] for i in range(N)]
for i in range(N):
d[i][i]=0
for i in range(M):
d[a_l[i]][b_l[i]] = min(c_l[i],d[a_l[i]][b_l[i]])
d[b_l[i]][a_l[i]] = min(c_l[i],d[b_l[i]][a_l[i]])
for i in range(N):
for j in range(N):
for k in range(N):
d[i][j] = min(d[i][j],d[i][k]+d[k][j])
ans = M
for i in range(M):
flag=False
for j in range(N):
for k in range(N):
if d[j][k]==d[j][a[i]]+d[b[i]][k]:
flag=True
if flag:
ans-=1
print ans |
s850611178 | p03837 | u785989355 | 1538295613 | Python | Python (2.7.6) | py | Runtime Error | 13 | 2816 | 829 | INF = 10**6 + 1
N,M = map(int,raw_input().split())
a_l=[]
b_l=[]
c_l=[]
for i in range(M):
a,b,c=map(int,raw_input().split())
a_l.append(a-1)
b_l.append(b-1)
c_l.append(c-1)
d = [[] for i in range(N)]
for i in range(N):
for j in range(N):
if i==j:
d[i][j].append(0)
else:
d[i][j].append(INF)
for i in range(M):
d[a_l[i]][b_l[i]] = min(c_l[i],d[a_l[i]][b_l[i]])
d[b_l[i]][a_l[i]] = min(c_l[i],d[b_l[i]][a_l[i]])
for i in range(N):
for j in range(N):
for k in range(N):
d[i][j] = min(d[i][j],d[i][k]+d[k][j])
ans = M
for i in range(M):
flag=False
for j in range(N):
for k in range(N):
if d[j][k]==d[j][a[i]]+d[b[i]][k]:
flag=True
if flag:
ans-=1
print ans |
s124361553 | p03837 | u690536347 | 1535740252 | Python | Python (3.4.3) | py | Runtime Error | 599 | 3380 | 528 | n,m=map(int,input().split())
inf=float("inf")
r=lambda n:range(n)
l=[[inf if i!=j else 0 for j in r(n)] for i in r(n)]
a,b,c=[None]*n,[None]*n,[None]*n
for i in r(m):
a[i],b[i],c[i]=map(int,input().split())
a[i]-=1
b[i]-=1
l[a[i]][b[i]]=min(l[a[i]][b[i]],c[i])
l[b[i]][a[i]]=min(l[b[i]][a[i]],c[i])
for k in r(n):
for i in r(n):
for j in r(n):
l[i][j]=min(l[i][j],l[i][k]+l[k][j])
ans=m
for i in r(m):
f=False
for j in r(n):
if l[j][a[i]]+c[i]==l[j][b[i]]:
f=True
if f:ans-=1
print(ans) |
s718038058 | p03837 | u690536347 | 1535740151 | Python | Python (3.4.3) | py | Runtime Error | 582 | 3380 | 490 | n,m=map(int,input().split())
inf=float("inf")
r=lambda n:range(n)
l=[[inf if i!=j else 0 for j in r(n)] for i in r(n)]
a,b,c=[None]*n,[None]*n,[None]*n
for i in r(m):
a[i],b[i],c[i]=map(int,input().split())
a[i]-=1
b[i]-=1
l[a[i]][b[i]]=c[i]
l[b[i]][a[i]]=c[i]
for k in r(n):
for i in r(n):
for j in r(n):
l[i][j]=min(l[i][j],l[i][k]+l[k][j])
ans=m
for i in r(m):
f=False
for j in r(n):
if l[j][a[i]]+c[i]==l[j][b[i]]:
f=True
if f:ans-=1
print(ans) |
s214754452 | p03837 | u690536347 | 1535739886 | Python | Python (3.4.3) | py | Runtime Error | 637 | 3380 | 482 | n,m=map(int,input().split())
inf=float("inf")
r=lambda n:range(n)
l=[[inf if i!=j else 0 for j in r(n)] for i in r(n)]
a,b,c=[None]*n,[None]*n,[None]*n
for i in r(m):
a[i],b[i],c[i]=map(int,input().split())
l[a[i]-1][b[i]-1]=c[i]
l[b[i]-1][a[i]-1]=c[i]
for k in r(n):
for i in r(n):
for j in r(n):
l[i][j]=min(l[i][j],l[i][k]+l[k][j])
ans=m
for i in r(m):
f=False
for j in r(n):
if l[j][a[i]-1]+c[i]==l[j][b[i]-1]:
f=True
if f:ans-=1
print(ans) |
s314868252 | p03837 | u690536347 | 1535739697 | Python | Python (3.4.3) | py | Runtime Error | 661 | 3444 | 489 | from itertools import product as p
n,m=map(int,input().split())
inf=float("inf")
r=lambda n:range(n)
l=[[inf if i!=j else 0 for j in r(n)] for i in r(n)]
a,b,c=[None]*n,[None]*n,[None]*n
for i in r(m):
a[i],b[i],c[i]=map(int,input().split())
l[a[i]-1][b[i]-1]=c[i]
l[b[i]-1][a[i]-1]=c[i]
for k,i,j in p(*[r(n)]*3):
l[i][j]=min(l[i][j],l[i][k]+l[k][j])
ans=m
for i in r(m):
f=False
for j in r(n):
if l[j][a[i]-1]+c[i]==l[j][b[i]-1]:
f=True
if f:ans-=1
print(ans) |
s233769290 | p03837 | u690536347 | 1535739555 | Python | PyPy3 (2.4.0) | py | Runtime Error | 246 | 45932 | 505 | from itertools import product as p
n,m=map(int,input().split())
inf=float("inf")
r=lambda n:range(n)
l=[[inf if i!=j else 0 for j in range(n)] for i in r(n)]
a,b,c=[None]*n,[None]*n,[None]*n
for i in r(m):
a[i],b[i],c[i]=map(int,input().split())
l[a[i]-1][b[i]-1]=c[i]
l[b[i]-1][a[i]-1]=c[i]
for k,i,j in p(*[r(n)]*3):
l[i][j]=min(l[i][j],l[i][k]+l[k][j])
ans=m
for i in r(m):
f=False
for j in r(n):
if l[j][a[i]-1]+c[i]==l[j][b[i]-1]:
f=True
break
if f:ans-=1
print(ans) |
s929930376 | p03837 | u584355711 | 1488862800 | Python | Python (3.4.3) | py | Runtime Error | 502 | 3188 | 881 | # -*- coding: utf-8 -*-
INF=10**10
def main():
n,m=list(map(int,input().split()))
a=[0 for _ in range(n)]
b=[0 for _ in range(n)]
c=[0 for _ in range(n)]
d=[[INF for i in range(n)] for i in range(n)]
for i in range(m):
a[i],b[i],c[i]=list(map(int,input().split()))
a[i]-=1
b[i]-=1
d[a[i]][b[i]]=c[i]
d[b[i]][a[i]]=c[i]
for i in range(n):
d[i][i]=0
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j]=min(d[i][j],d[i][k]+d[k][j])
d[j][i]=d[i][j]
ans=0
for j in range(m):
temp=1
for i in range(n):
if d[i][b[j]]==d[i][a[j]]+c[j]:
temp=0
break
ans+=temp
print(ans)
if __name__=="__main__":
main()
|
s424792364 | p03837 | u584355711 | 1488862003 | Python | Python (3.4.3) | py | Runtime Error | 508 | 3312 | 881 | # -*- coding: utf-8 -*-
INF=10**10
def main():
n,m=list(map(int,input().split()))
a=[0 for _ in range(n)]
b=[0 for _ in range(n)]
c=[0 for _ in range(n)]
d=[[INF for i in range(n)] for i in range(n)]
for i in range(n):
a[i],b[i],c[i]=list(map(int,input().split()))
a[i]-=1
b[i]-=1
d[a[i]][b[i]]=c[i]
d[b[i]][a[i]]=c[i]
for i in range(n):
d[i][i]=0
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j]=min(d[i][j],d[i][k]+d[k][j])
d[j][i]=d[i][j]
ans=0
for j in range(m):
temp=1
for i in range(n):
if d[i][b[j]]==d[i][a[j]]+c[j]:
temp=0
break
ans+=temp
print(ans)
if __name__=="__main__":
main()
|
s352817267 | p03837 | u252805217 | 1487071861 | Python | Python (3.4.3) | py | Runtime Error | 29 | 3444 | 732 | from itertools import product as prod
n, m = [int(x) for x in input().split()]
gr = [[] for _ in range(n)]
for _ in range(m):
a, b, c = [int(x) for x in input().split()]
a -= 1
b -= 1
gr[a].append((b, c))
gr[b].append((a, c))
numset = set(range(n))
def dist(i, j, gr=gr):
tmp_d = float("inf")
if i == j:
return 0
for (node, d) in gr[i]:
if node == j:
tmp_d = d
# gr_cp = [[(n, d) for (n, d) in g if n != i] for g in gr]
numset.remove(i)
routes = [d + dist(n, j, gr=gr) for (n, d) in gr[i] if n in numset]
return min(routes + [tmp_d])
ans = 0
for i in range(n):
for (j, d) in gr[i]:
if dist(i, j) < d:
ans += 1
print(ans // 2)
|
s661287284 | p03837 | u010110540 | 1487006621 | Python | Python (3.4.3) | py | Runtime Error | 29 | 3444 | 491 | MAX = 9999
N, M = map(int, input().split())
cost = []
dist = [[MAX] * N for i in range(N)]
for i in range(N):
dist[i][i] = 0
#print(dist)
for i in range(M):
cost.append(list(map(int, input().split())))
#print(cost)
for a, b, c in cost:
dist[a-1][b-1] = c
dist[b-1][a-1] = c
print(dist)
for k in range(N):
for i in range(N):
for j in range(N):
dist[i][j] = min(dist[i][j], dist[i][k] + dis[k][j])
ans = 0
for a, b, c in cost:
if dist[a-1][b-1] < c:
ans += 1
print(ans) |
s566998985 | p03837 | u156163787 | 1483846387 | Python | PyPy3 (2.4.0) | py | Runtime Error | 193 | 38640 | 787 | import numpy
import random
def used(dp,u,v,w):
n=len(dp)
for i in range(n):
for j in range(i+1,n):
if dp[i][j]==dp[i][u]+w+dp[v][j] or dp[i][j]==dp[i][v]+w+dp[u][j]:
return True
return False
while 1:
try:
n,m=map(int,input().split())
es=[]
for _ in range(m):
u,v,w=map(int,input().split())
es.append((u-1,v-1,w))
except: break
random.shuffle(es)
dp=[[float('inf')]*n for _ in range(n)]
for i in range(n):
dp[i][i]=0
for u,v,w in es:
dp[u][v]=dp[v][u]=w
for k in range(n):
for i in range(n):
for j in range(n):
dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j])
print(sum(int(not used(dp,u,v,w)) for u,v,w in es))
|
s722905919 | p03837 | u205166254 | 1483844530 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1109 | 45916 | 1053 | n, m = map(int, input().split())
nd = [[] for _ in range(n + 1)]
eg = [True] * m
for i in range(m):
a, b, c = map(int, input().split())
nd[a].append([b, c, i])
nd[b].append([a, c, i])
for i in range(1, n):
for j in range(i + 1, n + 1):
tr = [10 * 10] * (n + 1)
fg = [False] * (n + 1)
fr = [[] for _ in range(n + 1)]
tr[i] = 0
while True:
mi = 0
for k in range(1, n + 1):
if fg[k]:
continue
if mi == 0 or tr[k] < tr[mi]:
mi = k
if mi == 0:
break
fg[mi] = True
for xc in nd[mi]:
x, c, e = xc
nc = c + tr[mi]
if nc < tr[x]:
tr[x] = nc
fr[x] = [mi, e]
mi, e = fr[j]
eg[e] = False
while len(fr[mi]) > 0:
mi, e = fr[mi]
eg[e] = False
ans = 0
for f in eg:
if f:
ans += 1
print(ans)
|
s546864772 | p03838 | u306412379 | 1601324047 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9036 | 381 | x, y = map(int, input().split())
if 0 <= x <= y:
ans = y - x
elif 0 <= y <= x:
ans = x + y + 1
elif x < 0 and 0 < y and -x <= y:
ans = x + y + 1
elif x < 0 and 0 < y and -x > y:
ans = y - x
elif x > 0 and y < 0 and -x <= y:
ans = x + y + 1
elif x > 0 and y < 0 and -x > y:
ans = -x - y + 2
elif x < y < 0:
ans = y - x
elif y < x < 0:
ans = x - y + 2
print(ans) |
s933302834 | p03838 | u350093546 | 1600780701 | Python | PyPy3 (7.3.0) | py | Runtime Error | 108 | 74572 | 123 | x,y=map(int,input().split())
ans=abs(abs(x)-abs(y))
if y<x<0 or 0<y<x:
ans+=2
elif y<x x<0<y:
ans+=1
print(ans) |
s982916278 | p03838 | u634046173 | 1600146451 | Python | PyPy3 (7.3.0) | py | Runtime Error | 79 | 74748 | 449 | x,y = map(int, input().split())
if x == y :
print(0)
elif (-x) == y:
print(1)
elif x >= 0 and x <= y:
print(y-x)
elif x >= 0 and x > y:
if x <= (-y): #10 -11
print(abs(x-(-y))+1)
else: # 10 -9
print(abs(y-(-x))+1)
elif x < 0 and x > y: # -1 -3
print(min(abs(x-y)+2, -y -x+1))
elif x < 0 and x < y: # -3 -1
if (-x) < y: # -5 6
print(min(abs(y-x),abs(y-(-x))+1))
else:
rint(abs(y - x))
|
s043530974 | p03838 | u411923565 | 1599838226 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9124 | 355 | # A - Simple Calculator
x,y = map(int,input().split())
if y > x:
ans = y - x
else:
# B を押す
if x != 0:
x *= -1
ans = 1
# y の絶対値との差分を押す
ans += max(abs(x),abs(y)) - min(abs(x),abs(y))
x += max(abs(x),abs(y)) - min(abs(x),abs(y))
# B を押す
if x != y:
ans += 1
print(ans) |
s376300250 | p03838 | u536034761 | 1599515259 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9208 | 248 | x, y = map(int, input().split())
ans = 10 ** 9 + 3
if y >= x:
ans = min(ans, abs(y - x))
if - y >= x:
ans = min(ans, abs(-y - x) + 1)
if y >= -x:
ans = min(ans, abs(y + x) + 1)
if - y >= -x:
ans(min(ans, abs(-y + x) + 2))
print(ans) |
s181139044 | p03838 | u794448346 | 1598563020 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9028 | 484 | x,y = map(int,input().split())
ax = abs(x)
ay = abs(y)
if ax == ay and x != y:
a = 1
elif x > y and 0 < y:
a = ax - ay + 2
elif x > y and y = 0:
a = ax - ay + 1
elif x > y and 0 > y:
if ay > ax and x >= 0:
a = ay - ax + 1
elif ay > ax and x < 0:
a = ay - ax + 2
elif ax > ay:
a = ax - ay + 1
elif y > x and x < 0 and ay > ax:
a = ay - ax + 1
elif y > x and x < 0 and y > 0 and ax > ay:
a = ax - ay + 1
else:
a = y-x
print(a) |
s079001556 | p03838 | u794448346 | 1598561248 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8992 | 391 | x,y = map(int,input().split())
ax = abs(x)
ay = abs(y)
if x > y and 0 < y:
x = -x
a = y - x + 1
if ay > ax and x >= 0:
a = ay - x +
elif x > y and 0 >= y:
if ay > ax and x >= 0:
a = ay - x + 1
elif ay > ax and x < 0:
a = ay + x + 2
else:
a = 1
elif y > x and x < 0:
if ay > ax:
a = ay - ax + 1
else:
a = y-x
print(a) |
s023056514 | p03838 | u397384480 | 1598559482 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9128 | 533 | x,y = map(int,input().split())
if y == x:
print(0)
else:
if abs(y) >= abs(x):
tmp = abs(y)-abs(x)
if x>=0 and y>=0:
print(tmp)
elif x>=0 and y<0:
print(tmp+1)
elif x<0 and y>=0:
print(tmp+1)
else:
print(abs(y)-x+1)
else:
if x>=0 and y>=0:
print(x+y+1)
elif x>=0 and y<0:
print(x+y+1)
elif x<0 and y>=0:
print(y-x)
print(1/0)
else:
print(y-x) |
s579767658 | p03838 | u397384480 | 1598559456 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9224 | 534 | x,y = map(int,input().split())
if y == x:
print(0)
else:
if abs(y) >= abs(x):
tmp = abs(y)-abs(x)
if x>=0 and y>=0:
print(tmp)
elif x>=0 and y<0:
print(tmp+1)
elif x<0 and y>=0:
#print(tmp+1)
print(1/0)
else:
print(abs(y)-x+1)
else:
if x>=0 and y>=0:
print(x+y+1)
elif x>=0 and y<0:
print(x+y+1)
elif x<0 and y>=0:
print(y-x)
else:
print(y-x) |
s331784934 | p03838 | u397384480 | 1598559420 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9228 | 534 | x,y = map(int,input().split())
if y == x:
print(0)
else:
if abs(y) >= abs(x):
tmp = abs(y)-abs(x)
if x>=0 and y>=0:
print(tmp)
elif x>=0 and y<0:
print(tmp+1)
elif x<0 and y>=0:
print(tmp+1)
else:
#print(abs(y)-x+1)
print(1/0)
else:
if x>=0 and y>=0:
print(x+y+1)
elif x>=0 and y<0:
print(x+y+1)
elif x<0 and y>=0:
print(y-x)
else:
print(y-x) |
s861017933 | p03838 | u072717685 | 1597638960 | Python | PyPy3 (7.3.0) | py | Runtime Error | 93 | 74744 | 670 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
x, y = map(int, input().split())
if x < y:
if 0 < y and 0 < x:
print(y - x)
elif 0 < x and 0 < y:
print(y - abs(x) + 1)
elif y == 0:
print(-x)
elif x == 0:
print(y)
else:
print(y - x)
else:
if 0 < y and 0 < x:
print(x * 2 - (x - y) + 1)
elif y < 0 and 0 < x:
print(x - abs(y) + 1)
elif y == 0:
print(x + 1)
elif x == 0:
print(-y + 1)
else:
print((x - y) + 2)
if __name__ == '__mai |
s962095632 | p03838 | u503111914 | 1597375246 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9108 | 213 | x,y = map(int,input().split())
if abs(x) == abs(y):
print(0 if a == b else 1)
elif x < y:
print(min(y - x,abs(y + x) + 1))
else:
print(min(abs(y+x),abs(y-x))+ 1 if a * b <= 0 else min(abs(y+x),abs(y-x))+ 2)
|
s401348994 | p03838 | u503111914 | 1597373943 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9096 | 92 | x,y = map(int,input().split())
ans = abs(abs(x)-abs(y))
print(ans if X * y > 0 else ans + 1) |
s666062135 | p03838 | u503111914 | 1597370863 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8920 | 61 | x,y = map(int,input().split())
print(min(abs(y-x),abs(x+y)+1) |
s514721457 | p03838 | u201928947 | 1597368269 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 68744 | 151 | x,y = map(int,input().split())
ans = 10000000000
for a,b,c in [(x,y,0)(x,-y,1)(-x,y,1)(-x,-y,2)]:
if a < b:
ans = min(ans,b-a+c)
print(ans) |
s228696393 | p03838 | u835283937 | 1596364829 | Python | Python (3.8.2) | py | Runtime Error | 21 | 9024 | 247 | def main2():
x, y = map(int, input().split())
delta = abs(abs(x) - abs(y))
c1 = delta + 0 + 0
c2 = delta + 0 + 1
c3 = delta + 1 + 0
c4 = delta + 1 + 1
print(min(c1, c2, c3, c4))
if __name__ == "__main__":
main() |
s171208704 | p03838 | u933341648 | 1595676284 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9132 | 145 | x, y = map(int, input().split())
d = abs(abs(y) - abs(x))
if x // abs(x) == y // abs(y):
if x > y:
d += 2
else:
d += 1
print(d)
|
s531706178 | p03838 | u781262926 | 1594769415 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8992 | 159 | x, y = map(int, input().split())
d = abs(abs(x) - abs(y))
if 0 <= x < y or x < y <= 0:
print(d)
elif y <= 0 <= x or x < 0 < y:
print(d+1)
else
print(d+2) |
s286581943 | p03838 | u597455618 | 1594423299 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8944 | 129 | def main():
x, y = map(int, input().split())
print(min(max(y-x, x-y+2), abs(x+y)+1)
if __name__ == '__main__':
main() |
s455297817 | p03838 | u597455618 | 1594423217 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8956 | 129 | def main():
x, y = map(int, input().split())
print(min(max(x+y, y-x+2), abs(x+y)+1)
if __name__ == '__main__':
main() |
s020522061 | p03838 | u437215432 | 1594061231 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9204 | 797 | # AGC008A
def func(x, y):
if y >= x:
if x >= 0:
return y - x
else:
if y > 0:
if abs(x) > abs(y):
return 1 - x - y
else:
return 1 + x + y
elif y <= 0:
return y - x
else:
if x >= 0:
if y < 0:
if abs(x) > abs(y):
return 1 + x + y
else:
return 1 - x - y
elif y == 0 or y == 1:
return x + 1
else:
if abs(x) > abs(y):
return 1 + x + y
else:
return 1 + y - x
else:
return 2 + x - y
x, y = map(int, input().split())
print(f(x, y))
|
s888529284 | p03838 | u962718741 | 1594049857 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9188 | 393 | def main():
x, y = map(int, input().split())
A = abs(abs(x) - abs(y))
if x * y > 0:
if x < y:
B = 0
else:
B = 2
elif x == 0:
if x < y:
B = 0
else:
B = 1
elif y == 0:
if x < y:
B = 0
else:
B = 1
print(A + B)
if __name__ == "__main__":
main()
|
s111324131 | p03838 | u848263468 | 1593197221 | Python | Python (3.8.2) | py | Runtime Error | 30 | 8868 | 177 | x,y=map(int,input().split())
if abs(x),abs(y)>pow(10,9):
exit()
s=abs(y)-abs(x)
buttona=s
buttonb=0
if y < 0:
buttonb+=1
if x < 0:
buttonb+=1
print(buttona+buttonb)
|
s530499400 | p03838 | u179169725 | 1592967099 | Python | PyPy3 (7.3.0) | py | Runtime Error | 96 | 74704 | 412 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = map(int, input().split())
if x * y < 0: # 異符号ならば答えは一つ
print(abs(abs(x) - abs(y)) + 1)
elif 0 <= x < y:
print(y - x)
elif 0 <= y < x:
print(x + y + 1)
raise ValueError()
elif x < y <= 0:
print(y - x)
else:
print(2 + x - y)
|
s964565214 | p03838 | u179169725 | 1592967078 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 68348 | 412 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = map(int, input().split())
if x * y < 0: # 異符号ならば答えは一つ
print(abs(abs(x) - abs(y)) + 1)
elif 0 <= x < y:
print(y - x)
elif 0 <= y < x:
print(x + y + 1)
elif x < y <= 0:
print(y - x)
raise ValueError()
else:
print(2 + x - y)
|
s161665659 | p03838 | u179169725 | 1592966058 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9200 | 587 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = map(int, input().split())
if x > 0:
if x < y:
print(y - x)
elif 0 <= y: # ここがちがうまじ?
print(x + y + 1)
else:
print(min(1 + x + y, -y - x + 1, key=lambda z: 10 ** 10 if z < 1 else z))
raise ValueError('')
else: # xが負
if y < x:
print(2 + x - y)
elif y <= 0:
print(y - x)
else:
print(min(y - x, 1 + y + x, key=lambda z: 10**10 if z < 1 else z))
|
s356011674 | p03838 | u179169725 | 1592965987 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 74496 | 602 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = map(int, input().split())
if x > 0:
if x < y:
print(y - x)
elif 0 <= y: # ここがちがうまじ?
print(x + y + 1)
else:
print(min(1 + x + y, -y - x + 1, key=lambda z: 10**10 if z < 1 else z))
else: # xが負
if y < x:
print(2 + x - y)
elif y <= 0: # ここも違う
print(y - x)
raise ValueError()
else:
print(min(y - x, 1 + y + x, key=lambda z: 10**10 if z < 1 else z))
|
s650925471 | p03838 | u179169725 | 1592965481 | Python | PyPy3 (7.3.0) | py | Runtime Error | 84 | 74664 | 517 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = map(int, input().split())
if x > 0:
if x < y:
print(y - x)
elif 0 <= y: # ここがちがう
print(x + y + 1)
else:
print(min(1 + x + y, -y - x + 1))
else: # xが負
if y < x:
print(2 + x - y)
elif y <= 0: # ここも違う
print(y - x)
else:
print(min(y - x, 1 + y + x))
raise ValueError()
|
s450434611 | p03838 | u179169725 | 1592965455 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 74588 | 498 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = map(int, input().split())
if x > 0:
if x < y:
print(y - x)
elif 0 <= y: # ここがちがう
print(x + y + 1)
else:
print(min(1 + x + y, -y - x + 1))
else: # xが負
if y < x:
print(2 + x - y)
elif y <= 0:
print(y - x)
raise ValueError()
else:
print(min(y - x, 1 + y + x))
|
s595319693 | p03838 | u179169725 | 1592965418 | Python | PyPy3 (7.3.0) | py | Runtime Error | 92 | 74544 | 477 | # https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け
x, y = map(int, input().split())
if x > 0:
if x < y:
print(y - x)
elif 0 <= y:
print(x + y + 1)
raise ValueError()
else:
print(min(1 + x + y, -y - x + 1))
else: # xが負
if y < x:
print(2 + x - y)
elif y <= 0:
print(y - x)
else:
print(min(y - x, 1 + y + x))
|
s923318393 | p03838 | u445624660 | 1592713010 | Python | Python (3.8.2) | py | Runtime Error | 33 | 9140 | 1195 | # 0<=a<=bのときの攻め方 ... 進むしかないね
# 0<=b<=a ... 一回だけ符号をかえたらあとは進むしかないね <- 意味不明だがなんかちがうらしい は????????????????
# ...よくよく考えたら進んだあとにもっかい符号変えてショートカットできるわ...
# a<=0<=b ... abs(a)<abs(b)なら符号をかえたらショートカットできるね ちがったらすすむしかないね
# b<=0<=a ... abs(a)<abs(b)ならすすんでから符号かえればいいね ちがったら符号かえてからすすめばいいね これは同じことだよ
# a<=b<=0 ... 進むしかないね
# b<=a<=0 ... 符号変えてすすんで符号かえればいいね
a, b = map(int, input().split())
if 0 <= a <= b:
print(b - a)
elif 0 <= b <= a:
print(min(1 + a + b, 2 + a - b))
elif a <= 0 <= b:
raise "あやしい"
if abs(a) <= abs(b):
print(1 + b - abs(a))
else:
print(b + abs(a))
elif b <= 0 <= a:
print(1 + abs(abs(b) - abs(a)))
elif a <= b <= 0:
print(abs(b - a))
elif b <= a <= 0:
print(2 + abs(abs(b) - abs(a)))
else:
raise "fuck"
|
s330095315 | p03838 | u445624660 | 1592712509 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9204 | 981 | # 0<=a<=bのときの攻め方 ... 進むしかないね
# 0<=b<=a ... 一回だけ符号をかえたらあとは進むしかないね
# a<=0<=b ... abs(a)<abs(b)なら符号をかえたらショートカットできるね ちがったらすすむしかないね
# b<=0<=a ... abs(a)<abs(b)ならすすんでから符号かえればいいね ちがったら符号かえてからすすめばいいね これは同じことだよ
# a<=b<=0 ... 進むしかないね
# b<=a<=0 ... 符号変えてすすんで符号かえればいいね
a, b = map(int, input().split())
if 0 <= a <= b:
print(b - a)
elif 0 <= b <= a:
print(1 + a + b)
raise "????ERl;ew;klrtjopq34[[[[[b-yyyfosßåç"
elif a <= 0 <= b:
if abs(a) <= abs(b):
print(1 + b - abs(a))
else:
print(b + abs(a))
elif b <= 0 <= a:
print(1 + abs(abs(b) - abs(a)))
elif a <= b <= 0:
print(abs(b - a))
elif b <= a <= 0:
print(2 + abs(abs(b) - abs(a)))
else:
raise "fuck"
|
s526861220 | p03838 | u445624660 | 1592712149 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9196 | 984 | # 0<=a<=bのときの攻め方 ... 進むしかないね
# 0<=b<=a ... 一回だけ符号をかえたらあとは進むしかないね
# a<=0<=b ... abs(a)<abs(b)なら符号をかえたらショートカットできるね ちがったらすすむしかないね
# b<=0<=a ... abs(a)<abs(b)ならすすんでから符号かえればいいね ちがったら符号かえてからすすめばいいね これは同じことだよ
# a<=b<=0 ... 進むしかないね
# b<=a<=0 ... 符号変えてすすんで符号かえればいいね
a, b = map(int, input().split())
if 0 <= a <= b:
print(b - a)
elif 0 <= b <= a:
print(1 + a - b)
raise ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
elif a <= 0 <= b:
if abs(a) <= abs(b):
print(1 + b - abs(a))
else:
print(abs(b) + abs(a))
elif b <= 0 <= a:
print(1 + abs(abs(b) - abs(a)))
elif a <= b <= 0:
print(abs(b - a))
elif b <= a <= 0:
print(2 + abs(abs(b) - abs(a)))
else:
raise "fuck"
|
s239420898 | p03838 | u445624660 | 1592712107 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9132 | 974 | # 0<=a<=bのときの攻め方 ... 進むしかないね
# 0<=b<=a ... 一回だけ符号をかえたらあとは進むしかないね
# a<=0<=b ... abs(a)<abs(b)なら符号をかえたらショートカットできるね ちがったらすすむしかないね
# b<=0<=a ... abs(a)<abs(b)ならすすんでから符号かえればいいね ちがったら符号かえてからすすめばいいね これは同じことだよ
# a<=b<=0 ... 進むしかないね
# b<=a<=0 ... 符号変えてすすんで符号かえればいいね
a, b = map(int, input().split())
if 0 <= a <= b:
print(b - a)
elif 0 <= b <= a:
print(1 + a + b)
elif a <= 0 <= b:
if abs(a) <= abs(b):
print(1 + b - abs(a))
raise "????????????????????????"
else:
print(abs(b) + abs(a))
elif b <= 0 <= a:
print(1 + abs(abs(b) - abs(a)))
elif a <= b <= 0:
print(abs(b - a))
elif b <= a <= 0:
print(2 + abs(abs(b) - abs(a)))
else:
raise "fuck"
|
s397988851 | p03838 | u263824932 | 1591839586 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 421 | x,y=map(int,input().split())
if abs(x) == abs(y):
print(1)
elif x==0:
if y < 0:
print(1-y)
else:
print(y)
elif x > 0:
if abs(y) < x:
print(1+y+x)
else:
if y > 0:
print(y-x)
else:
print(y-x)+1
else:
if abs(y) <x:
print(y-x)
else:
if y >=0:
print(y-x)
else:
print(2+x-y)
|
s742817113 | p03838 | u474925961 | 1591500698 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 191 | x,y=map(int,input().split())
cnt=0
cnt+=y-x
cnt1=1
cnt1+=y+x
cnt2=1
cnt2+=-y-x
cnt3=2
cnt3+=-y+x
a=[cnt,cnt1,cnt2,cnt3]
foe i in a:
if i<0:
i=10**10
print(min(cnt,cnt1,cnt2,cnt3)) |
s773563313 | p03838 | u227085629 | 1591136352 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 147 | x,y = map(int,input().split())
k = abs(abs(x)-abs(y))
if x < 0 and y <= 0 or x >= 0 and y > 0:
if x > y:
ans += 2
else:
ans += 1
print(ans) |
s663252774 | p03838 | u924691798 | 1590871069 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 289 | x, y = map(int, input().split())
if x >= 0 and y >= 0:
if x <= y:
ans = abs(x-y)
else:
ans = abs(x-y)+2
elif x < 0 and y < 0:
if x <= y:
ans = abs(x-y)
else:
ans = abs(x-y)+2
elif x >= 0 and y <= 0:
ans = abs(abs(x)-abs(y))+1
print(ans)
|
s737290257 | p03838 | u075595666 | 1590815550 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 225 | a = list(map(int,input().split()))
ans = a[1]
c = a[0]%2+a[3]%2+a[4]%2
if c == 3:
ans += a[0]+a[3]+a[4]
elif c == 2 and a[0]*a[3]*a[4] != 0:
ans += a[0]+a[3]+a[4]-1
else:
ans += a[0]//2*2+a[3]//2*2+a[4]//2*2
print(ans)
|
s195828599 | p03838 | u346395915 | 1590590541 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 289 | sys.stdin = open('../ABC/test.txt')
x, y = map(int, input().split())
ans = 10**18
if y - x >= 0:
ans = min(ans, y-x)
x *= -1
if y - x >= 0:
ans = min(ans, y-x)
x *= -1
y *= -1
if y - x >= 0:
ans = min(ans, y-x)
x *= -1
if y -x >= 0:
ans = min(ans, y-x)
print(ans) |
s211220213 | p03838 | u314089899 | 1590554979 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 391 | x,y = map(int, input().split())
#方法は
#ずっと加算 #ex 5 10 , -10 -5
#反転させてから加算 ex 10 -5 , -10 20
#反転して加算して反転 -10 -20, 10 -5
#の3パターン
#ずっと加算
ans = 2*10**9
if y==x:
print(0)
elif y=-x:
print(1)
else:
for i in [y-x,abs(y-x),1+y-(-x),1+abs(y-(-x))+1]:
if i > 0:
ans = min(ans,i)
print(ans) |
s095077899 | p03838 | u314089899 | 1590554822 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 288 | x,y = map(int, input().split())
#方法は
#ずっと加算 #ex 5 10
#反転させてから加算 ex 10 -5
#反転して加算して反転 -10 -20
#の3パターン
#ずっと加算
ans = 2*10**9
for i in [y-x,1+y-(-x),1+abs(y-(-x))+1]
if i > 0:
ans = min(ans,i)
print(ans) |
s834367313 | p03838 | u314089899 | 1590554053 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1193 | x,y = map(int, input().split())
if x == y: #ex. 10 10
print(0)
elif x == -y: #ex. 10 -10
print(1)
elif x == 0:
if y > 0:
print(y) #数字を合わせるだけ
elif y < 0:
print(y+1) #数字を合わせてから反転
elif x > 0:
if y > 0:
if x > y: #20 10
print(1+x-y+1) #反転させて合わせて反転
elif x < y:
print(y-x) #数字を合わせるだけ
elif y < 0:
if abs(y) < x: #10 -1
print(1+x-y) #反転させて数字を合わせる
elif abs(y) > x: #10 -20
print(abs(y)-x+1) #数字を合わせて反転
elif y == 0:
print(1+x) #反転させて0にもっていく
elif x < 0:
if y > 0:
if abs(x) < y: #-20 40
print(1+y-abs(x) #反転させて数字を合わせる
elif abs(x) > y: #-20 10
print(abs(x)-y+1) #数字を合わせて反転
elif y < 0:
if x > y: #-10 -20
print(1+abs(y)-abs(x)+1) #反転させて合わせて反転
elif x < y: #-10 -5
print(abs(x)-abs(y)) #数字を合わせるだけ
elif y == 0:
print(abs(x)) #0にもっていく |
s023972756 | p03838 | u871980676 | 1590260436 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 179 | x,y=map(int,input().split())
res = []
if x>0 and y>0:
res.append(abs(y-x))
elif x*y<0:
res.append(1+abs(y+x))
elif x<0 and y<0:
res.append(2+abs(y-x))
print(min(res))
|
s844551014 | p03838 | u811000506 | 1590197933 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 172 | x,y = map(int,input().split())
if x<0:
m_x = x*(-1)
x = m_x*(-1)
if x<=y:
print(y-x)
elif m_x<=y and y<x:
print(abs(y-m_x)+1)
else:
print(abs(y-x)+2) |
s807967925 | p03838 | u502731482 | 1590195598 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 398 | x, y = map(int, input().split())
ans = 10 ** 10
for i in range(2):
for j in range(2):
a = x
b = y
cnt = 0
if i == 1:
a *= -1
cnt = 1
if j == 1:
b *= -1
cnt += 1
if a >= b:
continue
cnt += b - a
a += b - a¥
if a == b:
ans = min(ans, cnt)
print(ans)
|
s734523312 | p03838 | u276204978 | 1589612737 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 128 | x, y = map(int, input().split())
def f(x):
return 10**10 if x < 0 else x
print(min(f(y-x), f(y+x)+1, f(-y-x)+1, f(-y+x2))) |
s566270383 | p03838 | u276204978 | 1589612607 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 128 | x, y = map(int, input().split())
mn = 10**9
f = lambda x: mn if x < 0 else x
print(min(f(y-x), f(y+x)+1, f(-y-x)+1, f(-y+x2))) |
s232686588 | p03838 | u474423089 | 1589509092 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 112 | from math import inf
A,B=map(int,input().split(' '))
print(min([i if i>0 else inf for i in [B-A,A+B+1,-B+A+2]])) |
s481384752 | p03838 | u474423089 | 1589507802 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 171 | A,B=map(int,input().split(' '))
if A<=B:
print(min(B-A,abs(B)-abs(A)))
elif A<0 or 0<B:
raise TypeError
print(A-B+2)
else:
raise TypeError
print(A+B+1) |
s866991176 | p03838 | u263753244 | 1589077227 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38256 | 257 | x,y=map(int,input().split())
x0=x
y0=y
X=[1,1,-1,-1]
Y=[1,-1,1,-1]
l=[]
for i in range(4):
x=x*X[i]
y=y*Y[i]
if y-x>=0:
q=y-x
if X[i]==-1:
q+=1
if Y[i]==-1:
q+=1
l.append(q)
x=x0
y=y0
print(min(l)) |
s779049357 | p03838 | u293198424 | 1588693140 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38640 | 184 | x,y = map(int,input().split())
mn = 10**10
if x<=y: ans = min(ans,y-x)
if -x<=y: ans = min(ans,1+y-(-x))
if x<=-y: ans = min(ans,-y-x+1)
if -x<=-y: ans = min(ans,-y-(-x)+1)
print(ans)
|
s921335766 | p03838 | u366886346 | 1588650425 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 749 | n=int(input())
x=list(map(int,input().split()))
a=[]
b=[]
ans=[]
yn=0
count=1
count2=0
count3=0
for i in range(n):
check=i*n+((n-i-1)*(n-i))//2
if check+i+1<x[i] or x[i]<((i+2)*(i+1))//2:
yn+=1
break
lena=len(a)
if yn==1:
print("No")
else:
print("Yes")
for i in range(n):
for j in range(i):
a.append(i+1)
for i in range(n):
for j in range(n-i-1):
b.append(i+1)
for i in range(n*n):
if x.count(i+1)==1:
ans.append(count)
count+=1
else:
if count2<lena:
ans.append(a[count2])
count2+=1
else:
ans.append(b[count3])
count3+=1
print(*ans)
|
s777514808 | p03838 | u459419927 | 1588253123 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 317 | from sys import stdin
N,Y=list(map(int,stdin.readline().strip().split()))
YY=abs(Y)
NN=abs(N)
count=YY-NN
if count<0:
print(NN-YY+1)
elif count==0:print(0)
else:
if N>0 and Y>0:
print(count)
elif N>0 and Y<0:
print(count+1)
elif N<0 and Y>0:
print(count+1)
else:N<0(count+2) |
s889853937 | p03838 | u459419927 | 1588252982 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 290 | from sys import stdin
N,Y=list(map(int,stdin.readline().strip().split()))
YY=abs(Y)
NN=abs(N)
count=YY-NN
if count<0:
print(Y-N)
else:
if N>0 and Y>0:
print(count)
elif N>0 and Y<0:
print(count+1)
elif N<0 and Y>0:
print(count+1)
else:N<0(count+2) |
s807976095 | p03838 | u810356688 | 1587680761 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 474 | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
x,y=map(int,input().split())
if x==-y:
print(1)
elif x*y>0:
if x<y:
print(y-x)
else:
print(x-y+2)
elif x*y<0
print(abs(x+y)+1)
else:
if x>0:
print(x+1)
elif x<0:
print(-x)
elif y>0:
print(y)
else:
print(-y+1)
if __name__=='__main__':
main() |
s066291906 | p03838 | u375695365 | 1587665956 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 340 | x,y=map(int,input().split())
ans=abs(x)-abs(y)
if ans==0:
if x==y:
print(ans)
else:
print(1)
elif ans<0:
if x<0 and y<0 :
print(ans+2)
else:
print(ans)
else:
if x<=0 and y=<0:
print(abs(ans))
elif 0<x and 0<y:
print(abs(ans)+2)
else:
print(abs(ans)+1)
|
s147104270 | p03838 | u024340351 | 1587660144 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 623 | x, y = map(int, input().split())
if x == y:
print(0)
exit()
if x == -y:
print(1)
exit()
if x > y:
if x > 0 and y > 0:
print(x-y+2)
exit()
elif x > 0 and y == 0:
print(x+1)
exit()
elif x > 0 and abs(y) <x:
print(1+x-abs(y))
exit()
elif x>0 and abs(y) == x:
print(1)
exit()
elif x >0 and abs(y) > x:
print(1+abs(y)-x)
exit()
elif x ==0:
print(abs(y)+1)
else:
print(2+abs(y)-abs(x))
else:
if x > 0 and y > 0:
print(y-x)
exit()
elif y ==0:
print(abs(x))
exit()
elif x < 0 and y < 0:
print(y-x)
exit()
elif x<0 and y>abs(x):
print(1+y-abx(x))
exit()
else:
print(y-x) |
s676240488 | p03838 | u148551245 | 1587571151 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 92 | a, b = map(int, input().split())
ans = min(
b - a if b >= a else 2 + (-b - a)
)
print(ans) |
s549064933 | p03838 | u668785999 | 1586647789 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 506 | x,y = map(int,input().split())
ans = 0
if(y > 0):
if(x > y):
ans += 1
ans += -y +x
elif(x >= 0):
ans += y -x
elif(x > -y):
ans += 1
ans += y + x
else:
ans += 1
ans += -y -x
else:
if(x > -y):
ans += 1
ans += y + x
elif(x >= 0):
ans += 1
ans += -y -x
elif(x > y):
ans += 1
ans += -y +x
ans += 1
else:
ans += y -x
if(x == 0 and y == 0) ans = 0
print(ans)
|
s572258726 | p03838 | u135389999 | 1584764162 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 762 | x,y = map(int,input().split())
if abs(y) > abs(x):
if x > 0 and y > 0:
print(y-x)
elif x < 0 and y <0:
print(abs(y)-abs(x)+2)
else:
print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
if x > 0 and y > 0:
print(x - y + 2)
elif x < 0 and y <0:
print(abs(y-x)+ 2)
else:
print(abs(abs(y)-abs(x))+1)
else:
if x == y:
print("0")
else:
print("1")
x,y = map(int,input().split())
if abs(y) > abs(x):
if x > 0 and y > 0:
print(y-x)
elif x < 0 and y <0:
print(abs(y)-abs(x)+2)
else:
print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
if x > 0 and y > 0:
print(x - y + 2)
elif x < 0 and y <0:
print(abs(y-x))
else:
print(abs(abs(y)-abs(x))+1)
else:
if x == y:
print("0")
else:
print("1") |
s330695983 | p03838 | u135389999 | 1584763728 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 380 | x,y = map(int,input().split())
if abs(y) > abs(x):
if x > 0 and y > 0:
print(y-x)
elif x < 0 and y <0:
print(abs(y)-abs(x)+2)
else:
print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
if x > 0 and y > 0:
print(ads(y-x+2))
elif x < 0 and y <0:
print(abs(y-x))
else:
print(abs(abs(y)-abs(x))+1)
else:
if x == y:
print("0")
else:
print("1") |
s779646910 | p03838 | u135389999 | 1584762973 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 354 | x,y = map(int,input().split())
if abs(y) > abs(x):
if x > 0 and y > 0:
print(y-x)
elif x < 0 and y <0:
print(y-x+2)
else:
print(y-x+1)
elif abs(y) < abs(x):
if x > 0 and y > 0:
print(ads(y-x+2))
elif x < 0 and y <0:
print(abs(y-x))
else:
print(abs(y-x+1))
else:
if x == y:
print("0")
else:
print("1")
|
s976380877 | p03838 | u434872492 | 1584676412 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 487 | x,y=map(int,input().split())
ans=0
if x<y:
if 0<=x:
ans=abs(y-x)
else:
z=abs(x)
ans=abs(y-x)
if z<=y:
b=ans(y-z)
if b<ans:
ans=1
ans+=b
else:
if 0<=y:
z=-x
ans+=1
ans+=abs(y-z)
else:
y=-y
ans+=1
z=-x
a=abs(y-x)
b=abs(y-z)
if b<a:
ans+=1
ans+=b
else:
ans+=a
print(ans) |
s500393814 | p03838 | u836737505 | 1584589465 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 383 | x,y = map(int, input().split())
if abs(x) <= abs(y):
c = abs(abs(x) - abs(y))
if x >= 0 and y >= 0:
print(c)
elif x < 0 and y < 0:
print(c+2)
else:
print(c+1)
else:
c = abs(abs(x) - abs(y))
if y = 0:
print(c)
elif x >= 0 and y >= 0:
print(c+2)
elif x < 0 and y < 0:
print(c)
else:
print(c+1) |
s145179088 | p03838 | u813174766 | 1584459716 | Python | PyPy3 (2.4.0) | py | Runtime Error | 162 | 38256 | 59 | a,b=map(int,input()split())
print(min(abs(a-b),abs(a+b)+1)) |
s421611383 | p03838 | u547608423 | 1583737014 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 291 | x,y=map(int,input().split())
X=abs(x)
Y=abs(y)
if x<y:
if x*y>0:
print(y-x)
elif x*y==0:
print(abs(X-Y))
else:
print(abs(X-Y)+1)
else:
if x*y>=0:
print(abs(X-Y)+2)
elif x*y=0:
print(abs(X-Y)+1)
else:
print(abs(X-Y)+1) |
s690431413 | p03838 | u704563784 | 1583372371 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 323 | a, b = map(int, input().split())
def cal(a,b):
if a < b:
dist1 = b - a
dist2 = abs(b + a) + 1
return min(dist1, dist2)
elif a > b:
if a >= 0 and b < 0:
return abs(a+b) + 1
else:
dist1 = a - b + 2
return min(dist1, dist2)
print(cal(a,b))
|
s005388299 | p03838 | u088552457 | 1583042262 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38384 | 190 | x, y = map(int, input().split())
l = []
if x <= y:
l.appen(y-x)
if -x <= y:
l.append(y + x + 1)
if x <= -y:
l.append(-y-x+1)
if -x <= -y:
l.append(-y+x+2)
print(min(l)) |
s325997946 | p03838 | u088552457 | 1583042128 | Python | PyPy3 (2.4.0) | py | Runtime Error | 161 | 38256 | 190 | x, y = map(int, input().split())
l = []
if x <= y:
l.appen(y-x)
if -x <= y:
l.append(y + x + 1)
if x <= -y:
l.append(-y-x+1)
if -x <= -y:
l.append(-y+x+2)
print(min(l)) |
s297799009 | p03838 | u857428111 | 1582517398 | Python | PyPy3 (2.4.0) | py | Runtime Error | 161 | 38256 | 83 | x,y=map(int,input())
t=abs(y)-abs(x)
if x*y<0:
t+=1
elif x>y:
t+=2
print(t) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.