Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
8 values
p02833
n = int(input()) res = 0 if n % 2 == 0: m = n // 2 while m > 5: res += m // 5 m //= 5 print(res)
n = int(input()) res = 0 if n % 2 == 0: m = n // 2 while m >= 5: res += m // 5 m //= 5 print(res)
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
637,130
637,131
u933341648
python
p02833
N = int(input()) num = 10 ans = 0 if N%2 == 0: for i in range(10**6): if num<N: ans += N//num num = num*5 else: print(ans) break else: print(0)
N = int(input()) num = 10 ans = 0 if N%2 == 0: for i in range(10**6): if num<=N: ans += N//num num = num*5 else: print(ans) break else: print(0)
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,132
637,133
u556589653
python
p02833
N = int(input()) num = 10 ans = 0 if N%2 == 0: for i in range(100): if num<N: ans += N//num num = num*5 else: print(ans) break else: print(0)
N = int(input()) num = 10 ans = 0 if N%2 == 0: for i in range(10**6): if num<=N: ans += N//num num = num*5 else: print(ans) break else: print(0)
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,134
637,133
u556589653
python
p02833
N = int(input()) d = 2 count = 0 if N % 2 == 1: print(0) else: for i in range(N+1):#n回回す 0~n-1まで d *= 5 if d > N: break count += int(N/d) print(count)
N = int(input()) d = 2 count = 0 if N % 2 == 1: print(0) else: for i in range(N+1):#n回回す 0~n-1まで d *= 5 if d > N: break count += N//d print(count)
[ "call.remove", "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change" ]
637,141
637,142
u334703235
python
p02833
''' sekai_no_owari 愛 ''' def findTrailingZeros(n): # Initialize result count = 0 # Keep dividing n by # powers of 5 and # update Count i=10 while (n/i>=1): count += int(n/i) i *= 5 return int(count) n = int(input()) if n%2 != 0: print(0) else: print(findTrailingZeros(n))
''' sekai_no_owari 愛 ''' def findTrailingZeros(n): # Initialize result count = 0 # Keep dividing n by # powers of 5 and # update Count i=10 while (n/i>0): count += n//i i *= 5 return int(count) n = int(input()) if n%2 != 0: print(0) else: print(findTrailingZeros(n))
[ "call.remove", "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change" ]
637,163
637,164
u539850805
python
p02833
#e n = int(input()) #f(n) = 1 (n < 2) #f(n) = n*f(n - 2) (n>=2) #def f(n): # if n < 2: return 1 # else: return n * f(n - 2) #n * (n-2) * ... * 3 if n is odd #n * (n-2) * ... * 2 if n is even # 2,4,6,8,10,...50,...,250,...,1250 # 10 # 20 * 50 # 40 * 250 # 60 * 500 if n % 2 == 1: ans = 0 else: ans = 0 k = 5 while 2 * k < n: ans += n // (2 * k) k *= 5 print(int(ans))
#e n = int(input()) #f(n) = 1 (n < 2) #f(n) = n*f(n - 2) (n>=2) #def f(n): # if n < 2: return 1 # else: return n * f(n - 2) #n * (n-2) * ... * 3 if n is odd #n * (n-2) * ... * 2 if n is even # 2,4,6,8,10,...50,...,250,...,1250 # 10 # 20 * 50 # 40 * 250 # 60 * 500 if n % 2 == 1: ans = 0 else: ans = 0 k = 5 while 2 * k <= n: ans += n // (2 * k) k *= 5 print(int(ans))
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
637,166
637,167
u055529891
python
p02833
#e n = int(input()) #f(n) = 1 (n < 2) #f(n) = n*f(n - 2) (n>=2) #def f(n): # if n < 2: return 1 # else: return n * f(n - 2) #n * (n-2) * ... * 3 if n is odd #n * (n-2) * ... * 2 if n is even # 2,4,6,8,10,...50,...,250,...,1250 # 10 # 20 * 50 # 40 * 250 # 60 * 500 if n % 2 == 1: ans = 0 else: ans = 0 k = 5 while 2 * k < n: ans += n // (2 * k) k *= 5 print(ans)
#e n = int(input()) #f(n) = 1 (n < 2) #f(n) = n*f(n - 2) (n>=2) #def f(n): # if n < 2: return 1 # else: return n * f(n - 2) #n * (n-2) * ... * 3 if n is odd #n * (n-2) * ... * 2 if n is even # 2,4,6,8,10,...50,...,250,...,1250 # 10 # 20 * 50 # 40 * 250 # 60 * 500 if n % 2 == 1: ans = 0 else: ans = 0 k = 5 while 2 * k <= n: ans += n // (2 * k) k *= 5 print(int(ans))
[ "expression.operator.compare.change", "control_flow.loop.condition.change", "call.add", "call.arguments.change" ]
637,168
637,167
u055529891
python
p02833
N=int(input()) def fact(N,k): t=0 c=0 while(k**t<N): t=t+1 for i in range(1,t+1): c+=N//(k**i) return c if N%2!=0: print(0) else: c2=fact(N,2) c5=fact(N,5) print(min(c2,c5))
N=int(input()) def fact(N,k): t=0 c=0 while(k**t<N): t=t+1 for i in range(1,t+1): c+=N//(k**i) return c if N%2!=0: print(0) else: c2=fact(N//2,2) c5=fact(N//2,5) print(min(c2,c5))
[ "assignment.change" ]
637,169
637,170
u692311686
python
p02833
def trail(N): if N&1: return 0 cnt=0 x=1 while x*10 < N: cnt+=(N//(x*10)) x=5*x return cnt print(trail(int(input())))
def trail(N): if N&1: return 0 cnt=0 x=1 while x < N: cnt+=(N//(x*10)) x=5*x return cnt print(trail(int(input()))) # print(trail(400))
[ "expression.operation.binary.remove" ]
637,177
637,178
u859773831
python
p02833
N = int(input()) f = 5 ans = 0 if(N % 2 == 1): print(0) else: while N >= f: ans += int(N / (f * 2)) f *= 5 print(ans)
N = int(input()) f = 5 ans = 0 if(N % 2 == 1): print(0) else: while N >= f: ans += int(N // (f * 2)) f *= 5 print(ans)
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change" ]
637,190
637,191
u580073714
python
p02833
N = int(input()) f = 5 ans = 0 if(N % 2 == 1): print(0) else: while N > f: ans += int(N / (f * 2)) f *= 5 print(ans)
N = int(input()) f = 5 ans = 0 if(N % 2 == 1): print(0) else: while N >= f: ans += int(N // (f * 2)) f *= 5 print(ans)
[ "expression.operator.compare.change", "control_flow.loop.condition.change", "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change" ]
637,192
637,191
u580073714
python
p02833
n = int(input()) m = n//2 list = [] ans = 0 if n%2==1: print(0) else: for j in range(1,10000): ans += m//(5**j) print(ans)
n = int(input()) m = n//2 ans = 0 if n%2==1: print(0) else: for j in range(1,100): ans += m//(5**j) print(ans)
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
637,209
637,210
u970082363
python
p02833
n=int(input()) if n%2==1: print(0) else: c=0 i=0 while True: i+=1 c+=int(n/((5**i)*2)) if int(n/(5**i))==0: break #i+=1 print(c)
n=int(input()) if n%2==1: print(0) else: c=0 i=0 while True: i+=1 c+=int(n//((5**i)*2)) #print((5**i)*2,c) if int(n//(5**i))==0: break #i+=1 print(c)
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
637,219
637,220
u811132356
python
p02833
n=int(input()) if n%2==1: print(0) else: c=0 i=0 while True: i+=1 c+=int(n/((5**i)*2)) if int(n/((5**i)*2))==0: break #i+=1 print(c)
n=int(input()) if n%2==1: print(0) else: c=0 i=0 while True: i+=1 c+=int(n//((5**i)*2)) #print((5**i)*2,c) if int(n//(5**i))==0: break #i+=1 print(c)
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
637,221
637,220
u811132356
python
p02833
n = int(input()) if n%2==1: print(0) else: ans = n//10 k = 1 n = n//10 while 5**k < n: ans += n//(5**k) k+=1 print(ans)
n = int(input()) if n%2==1: print(0) else: ans = n//10 k = 1 n = n//10 while 5**k <= n: ans += n//(5**k) k+=1 print(ans)
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
637,226
637,227
u202570162
python
p02833
from math import log n = int(input(n)) if n % 2 == 1: print(0) else: m = n // 2 total = 0 for p in range(1, int(log(m, 5)) + 1): total += m // (5 ** p) print(total)
from math import log n = int(input()) if n % 2 == 1 or n == 0: print(0) else: m = n // 2 total = 0 for p in range(1, int(log(m, 5)) + 1): total += m // (5 ** p) print(total)
[ "call.arguments.change", "control_flow.branch.if.condition.change" ]
637,234
637,233
u401830498
python
p02834
from collections import defaultdict N, u, v = map(int, input().split()) d = defaultdict(list) for _ in range(N-1): A, B = map(int, input().split()) d[A].append(B) d[B].append(A) def get_dist(s): dist = [-1]*(N+1) dist[s] = 0 q = [s] while q: a = q.pop() for b in d[a]: if dist[b]!=-1: continue dist[b] = dist[a] + 1 q.append(b) return dist du, dv = get_dist(u), get_dist(v) ds = [(i,j[0], j[1]) for i,j in enumerate(zip(du, dv)) if j[0]<j[1]] ds.sort(key=lambda x:-x[1]) a, b, c = ds[0] print(c-1)
from collections import defaultdict N, u, v = map(int, input().split()) d = defaultdict(list) for _ in range(N-1): A, B = map(int, input().split()) d[A].append(B) d[B].append(A) def get_dist(s): dist = [-1]*(N+1) dist[s] = 0 q = [s] while q: a = q.pop() for b in d[a]: if dist[b]!=-1: continue dist[b] = dist[a] + 1 q.append(b) return dist du, dv = get_dist(u), get_dist(v) ds = [(i,j[0], j[1]) for i,j in enumerate(zip(du, dv)) if j[0]<j[1]] ds.sort(key=lambda x:-x[2]) a, b, c = ds[0] print(c-1)
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change" ]
637,260
637,261
u690536347
python
p02834
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from collections import deque n, u, v = map(int, readline().split()) graph = [[] for _ in range(n + 1)] for i in range(n - 1): a, b = map(int, readline().split()) graph[a].append(b) graph[b].append(a) def dfs(v): dist = [-1] * (n + 1) stack = deque([v]) dist[v] = 0 while stack: v = stack.popleft() memo = dist[v] + 1 for w in graph[v]: if dist[w] >= 0: continue dist[w] = memo stack.append(w) return dist U, V = dfs(u), dfs(v) ans = 0 for x, y in zip(U[1:], V[1:]): print(x, y) if x < y: ans = max(ans, y - 1) print(ans)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from collections import deque n, u, v = map(int, readline().split()) graph = [[] for _ in range(n + 1)] for i in range(n - 1): a, b = map(int, readline().split()) graph[a].append(b) graph[b].append(a) def dfs(v): dist = [-1] * (n + 1) stack = deque([v]) dist[v] = 0 while stack: v = stack.popleft() memo = dist[v] + 1 for w in graph[v]: if dist[w] >= 0: continue dist[w] = memo stack.append(w) return dist U, V = dfs(u), dfs(v) ans = 0 for x, y in zip(U[1:], V[1:]): if x < y: ans = max(ans, y - 1) print(ans)
[ "call.remove" ]
637,264
637,265
u691018832
python
p02834
import sys sys.setrecursionlimit(2*10**5) n, u, v = map(int, input().split()) edge = [tuple(map(int, input().split())) for _ in range(n-1)] u -= 1 v -= 1 connect = [set() for _ in range(n)] for a, b in edge: connect[a-1].add(b-1) connect[b-1].add(a-1) du = [0] * n dv = [0] * n def dfs(v, dis, ng, d): d[v] = dis ng.add(v) for w in connect[v]: if w not in ng: dfs(w, dis+1, ng, d) dfs(u, 0, set(), du) dfs(v, 0, set(), dv) ans = 0 for i in range(n): if du[i] < du[i]: ans = max(ans, du[v]-1) print(ans)
import sys sys.setrecursionlimit(2*10**5) n, u, v = map(int, input().split()) edge = [tuple(map(int, input().split())) for _ in range(n-1)] u -= 1 v -= 1 connect = [set() for _ in range(n)] for a, b in edge: connect[a-1].add(b-1) connect[b-1].add(a-1) du = [0] * n dv = [0] * n def dfs(v, dis, ng, d): d[v] = dis ng.add(v) for w in connect[v]: if w not in ng: dfs(w, dis+1, ng, d) dfs(u, 0, set(), du) dfs(v, 0, set(), dv) ans = 0 for i in range(n): if du[i] < dv[i]: ans = max(ans, dv[i]-1) print(ans)
[ "identifier.change", "control_flow.branch.if.condition.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "variable_access.subscript.index.change" ]
637,278
637,279
u955251526
python
p02834
import sys sys.setrecursionlimit(10**9) N, u, v = map(int, input().split()) u, v = u-1, v-1 edge = [[] for _ in range(N)] for i in range(N-1): a, b = map(int, input().split()) a, b = a-1, b-1 edge[a].append(b) edge[b].append(a) taka = [0] * N aoki = [0] * N def dfs(v, pre, cost, i): for e in edge[v]: if e == pre: continue cost = dfs(e, v, cost, i+1) cost[v] = i return cost taka = dfs(u, -1, [0] * N, 0) aoki = dfs(v, -1, [0] * N, 0) m = 0 for i in range(N): if taka[i] < aoki[i]: m = max(m, aoki[i]) print(m)
import sys sys.setrecursionlimit(10**9) N, u, v = map(int, input().split()) u, v = u-1, v-1 edge = [[] for _ in range(N)] for i in range(N-1): a, b = map(int, input().split()) a, b = a-1, b-1 edge[a].append(b) edge[b].append(a) taka = [0] * N aoki = [0] * N def dfs(v, pre, cost, i): for e in edge[v]: if e == pre: continue cost = dfs(e, v, cost, i+1) cost[v] = i return cost taka = dfs(u, -1, [0] * N, 0) aoki = dfs(v, -1, [0] * N, 0) m = 0 for i in range(N): if taka[i] < aoki[i]: m = max(m, aoki[i]) print(m-1)
[ "expression.operation.binary.add" ]
637,282
637,283
u814781830
python
p02834
import sys sys.setrecursionlimit(10**9) N, u, v = map(int, input().split()) u, v = u-1, v-1 edge = [[] for _ in range(N)] for i in range(N-1): a, b = map(int, input().split()) a, b = a-1, b-1 edge[a].append(b) edge[b].append(a) taka = [0] * N aoki = [0] * N def dfs(v, pre, cost, i): for e in edge[v]: if e == pre: continue cost = dfs(e, v, cost, i+1) cost[v] = i return cost taka = dfs(u, -1, [0] * N, 0) aoki = dfs(v, -1, [0] * N, 0) m = 0 for i in range(N): if taka[i] < aoki[i]: m = max(m, taka[i]) print(m)
import sys sys.setrecursionlimit(10**9) N, u, v = map(int, input().split()) u, v = u-1, v-1 edge = [[] for _ in range(N)] for i in range(N-1): a, b = map(int, input().split()) a, b = a-1, b-1 edge[a].append(b) edge[b].append(a) taka = [0] * N aoki = [0] * N def dfs(v, pre, cost, i): for e in edge[v]: if e == pre: continue cost = dfs(e, v, cost, i+1) cost[v] = i return cost taka = dfs(u, -1, [0] * N, 0) aoki = dfs(v, -1, [0] * N, 0) m = 0 for i in range(N): if taka[i] < aoki[i]: m = max(m, aoki[i]) print(m-1)
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
637,284
637,283
u814781830
python
p02834
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 minans = inf ;ans = 0 ;count = 0 ;pro = 1 sys.setrecursionlimit(10**7) n,u,v=map(int,input().split()) u-=1;v-=1 G=[[] for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a-=1;b-=1 G[a].append(b) G[b].append(a) D=[-1]*n maxD=[-1]*n def make_tree_dfs(n,d): D[n]=d tmp=0 f=True for gi in G[n]: if D[gi]==-1: f=False tmp=max(tmp,make_tree_dfs(gi,d+1)) if f: tmp=d maxD[n]=tmp return tmp make_tree_dfs(v,0) sdis=D[u] def good_dfs(v,d,sdis): f=True for gi in G[v]: if D[gi]==d-1 and d-1>sdis-(d-1): return good_dfs(D[gi],d-1,sdis) return (maxD[v],d) gd,orid=good_dfs(u,D[u],sdis) k=orid-(sdis-orid) print(gd-orid+(sdis-orid)+k-1) # print(D) # print(maxD) # print(sdis,orid,gd,k)
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 minans = inf ;ans = 0 ;count = 0 ;pro = 1 sys.setrecursionlimit(10**7) n,u,v=map(int,input().split()) u-=1;v-=1 G=[[] for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a-=1;b-=1 G[a].append(b) G[b].append(a) D=[-1]*n maxD=[-1]*n def make_tree_dfs(n,d): D[n]=d tmp=0 f=True for gi in G[n]: if D[gi]==-1: f=False tmp=max(tmp,make_tree_dfs(gi,d+1)) if f: tmp=d maxD[n]=tmp return tmp make_tree_dfs(v,0) sdis=D[u] def good_dfs(v,d,sdis): f=True for gi in G[v]: if D[gi]==d-1 and d-1>sdis-(d-1): return good_dfs(gi,d-1,sdis) return (maxD[v],d) gd,orid=good_dfs(u,D[u],sdis) k=orid-(sdis-orid) print(gd-orid+(sdis-orid)+k-1) # print(D) # print(maxD) # print(sdis,orid,gd,k)
[ "call.arguments.change" ]
637,289
637,290
u716530146
python
p02834
N,u,v = map(int,input().split()) E = [[] for _ in range(N + 1)] for i in range(N-1): a,b = map(int,input().split()) E[a].append(b) E[b].append(a) #print(E) def bfs(start,N): d = [-1]*(N+1) d[start] = 0 q = [start] while q: #print(d,q) v = q.pop() cnt = d[v]+1 for i in E[v]: if(d[i] == -1): q.append(i) d[i] = cnt return d taka = bfs(u,N) aoki = bfs(v,N) #print(taka,aoki) for i in range(N+1): if(taka[i] < aoki[i]): fin = max(fin,aoki[i]) print(fin - 1)
N,u,v = map(int,input().split()) E = [[] for _ in range(N + 1)] for i in range(N-1): a,b = map(int,input().split()) E[a].append(b) E[b].append(a) #print(E) def bfs(start,N): d = [-1]*(N+1) d[start] = 0 q = [start] while q: #print(d,q) v = q.pop() cnt = d[v]+1 for i in E[v]: if(d[i] == -1): q.append(i) d[i] = cnt return d taka = bfs(u,N) aoki = bfs(v,N) #print(taka,aoki) fin = 0 for i in range(N+1): if(taka[i] < aoki[i]): fin = max(fin,aoki[i]) print(fin - 1)
[ "assignment.add" ]
637,295
637,296
u557282438
python
p02834
import heapq import sys input = sys.stdin.readline def dijkstra_heap(s,edge,n): #始点sから各頂点への最短距離 d = [10**20] * n used = [True] * n #True:未確定 d[s] = 0 used[s] = False edgelist = [] for a,b in edge[s]: heapq.heappush(edgelist,a*(10**6)+b) while len(edgelist): minedge = heapq.heappop(edgelist) #まだ使われてない頂点の中から最小の距離のものを探す if not used[minedge%(10**6)]: continue v = minedge%(10**6) d[v] = minedge//(10**6) used[v] = False for e in edge[v]: if used[e[1]]: heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1]) return d def main(): N, u, v = map(int, input().split()) u -= 1 v -= 1 edge = [[] for i in range(N)] for _ in range(N-1): A, B = map(int, input().split()) A -= 1 B -= 1 edge[A].append([1,B]) edge[B].append([1,A]) d1 = dijkstra_heap(u,edge, N) d2 = dijkstra_heap(v,edge, N) ans = 0 for i in range(N): if d1[i] < d2[i]: ans = max(0, d2[i]-1) print(ans) if __name__ == "__main__": main()
import heapq import sys input = sys.stdin.readline def dijkstra_heap(s,edge,n): #始点sから各頂点への最短距離 d = [10**20] * n used = [True] * n #True:未確定 d[s] = 0 used[s] = False edgelist = [] for a,b in edge[s]: heapq.heappush(edgelist,a*(10**6)+b) while len(edgelist): minedge = heapq.heappop(edgelist) #まだ使われてない頂点の中から最小の距離のものを探す if not used[minedge%(10**6)]: continue v = minedge%(10**6) d[v] = minedge//(10**6) used[v] = False for e in edge[v]: if used[e[1]]: heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1]) return d def main(): N, u, v = map(int, input().split()) u -= 1 v -= 1 edge = [[] for i in range(N)] for _ in range(N-1): A, B = map(int, input().split()) A -= 1 B -= 1 edge[A].append([1,B]) edge[B].append([1,A]) d1 = dijkstra_heap(u,edge, N) d2 = dijkstra_heap(v,edge, N) ans = 0 for i in range(N): if d1[i] < d2[i]: ans = max(ans, d2[i]-1) print(ans) if __name__ == "__main__": main()
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change" ]
637,297
637,298
u761529120
python
p02834
def main(): from functools import lru_cache import sys input=sys.stdin.readline sys.setrecursionlimit(100000000) n,u,v=map(int,input().split()) u-=1 v-=1 tree=[[] for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a-=1 b-=1 tree[a].append(b) tree[b].append(a) depth=[0]*n depth[v]=0 def dfs(i,before=-1): for e in tree[i]: if e!=before: depth[e]=depth[i]+1 dfs(e,i) dfs(v) #print(depth) max_depth=[-1]*n max_depth[v]=0 @lru_cache(maxsize=None) def dfs2(i,before=-1): t=-1 for e in tree[i]: if e!=before: t=max(t,dfs2(e,i)) if t!=-1: max_depth[i]=t return max_depth[i] else: max_depth[i]=depth[i] return max_depth[i] dfs2(v) #print(max_depth) lim=depth[u] i,key=u,u while i!=v: if 2*depth[i]<lim and max_depth[key]<max_depth[i]: key=i for e in tree[i]: if depth[e]<depth[i]: i=e break print(max_depth[key]-1) if __name__=='__main__': main()
def main(): from functools import lru_cache import sys input=sys.stdin.readline sys.setrecursionlimit(100000000) n,u,v=map(int,input().split()) u-=1 v-=1 tree=[[] for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) a-=1 b-=1 tree[a].append(b) tree[b].append(a) depth=[0]*n depth[v]=0 def dfs(i,before=-1): for e in tree[i]: if e!=before: depth[e]=depth[i]+1 dfs(e,i) dfs(v) #print(depth) max_depth=[-1]*n max_depth[v]=0 @lru_cache(maxsize=None) def dfs2(i,before=-1): t=-1 for e in tree[i]: if e!=before: t=max(t,dfs2(e,i)) if t!=-1: max_depth[i]=t return max_depth[i] else: max_depth[i]=depth[i] return max_depth[i] dfs2(v) #print(max_depth) lim=depth[u] i,key=u,u while i!=v: if 2*depth[i]>lim and max_depth[key] < max_depth[i]: key=i for e in tree[i]: if depth[e]<depth[i]: i=e break print(max_depth[key]-1) if __name__=='__main__': main()
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,301
637,302
u561231954
python
p02834
from collections import deque n, u, v = map(int, input().split()) u-=1; v-=1; a = []; b = []; dist = [[] for i in range(n)] for i in range(n-1): a, b = map(int, input().split()) a -= 1; b -= 1 dist[a].append(b) dist[b].append(a) def bfs(u): d = [-1]*n stack = deque([u]) d[u] = 0 while len(stack)!=0: s = stack.popleft() for t in dist[s]: if d[t]==-1: d[t] = d[s]+1 stack.append(t) return d A = bfs(v) T = bfs(u) ans=0 for i in range(n): if A[i]>d[i]: ans = max(A[i]-1, ans) print(ans)
from collections import deque n, u, v = map(int, input().split()) u-=1; v-=1; a = []; b = []; dist = [[] for i in range(n)] for i in range(n-1): a, b = map(int, input().split()) a -= 1; b -= 1 dist[a].append(b) dist[b].append(a) def bfs(u): d = [-1]*n stack = deque([u]) d[u] = 0 while len(stack)!=0: s = stack.popleft() for t in dist[s]: if d[t]==-1: d[t] = d[s]+1 stack.append(t) return d A = bfs(v) T = bfs(u) ans=0 for i in range(n): if A[i]>T[i]: ans = max(A[i]-1, ans) print(ans)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
637,303
637,304
u056801547
python
p02834
n,u,v = map(int,input().split()) inf = 10 ** 6 u -= 1 v -= 1 peer = [[] for _ in range(n)] for _ in range(n-1): a,b = map(int,input().split()) a -= 1 b -= 1 peer[a].append(b) peer[b].append(a) seen = [0 for _ in range(n)] rank = [0 for _ in range(n)] seen[v] = 1 now = [v] pst = [[] for _ in range(n)] pre = [inf for _ in range(n)] while now: last = now now = [] for x in last: for y in peer[x]: if seen[y] == 0: seen[y] = 1 rank[y] = rank[x] + 1 pst[x].append(y) pre[y] = x now.append(y) print(rank) r = rank[u] if r % 2 == 0: m = r//2 + 1 M = u for _ in range(r-m): M = pre[M] now = [M] while now != []: last = now now = [] for x in last: for y in pst[x]: now.append(y) ans = rank[last[0]] - m + r - m + 1 #print(r,m,M,rank[last[0]],last[0]) #print(0,ans) else: m = r//2 + 1 M = u for _ in range(r-m): M = pre[M] now = [M] while now != []: last = now now = [] for x in last: for y in pst[x]: now.append(y) ans = rank[last[0]] - m + r - m #print(r,m,M,rank[last[0]],last[0]) #print(1,ans) print(ans)
n,u,v = map(int,input().split()) inf = 10 ** 6 u -= 1 v -= 1 peer = [[] for _ in range(n)] for _ in range(n-1): a,b = map(int,input().split()) a -= 1 b -= 1 peer[a].append(b) peer[b].append(a) seen = [0 for _ in range(n)] rank = [0 for _ in range(n)] seen[v] = 1 now = [v] pst = [[] for _ in range(n)] pre = [inf for _ in range(n)] while now: last = now now = [] for x in last: for y in peer[x]: if seen[y] == 0: seen[y] = 1 rank[y] = rank[x] + 1 pst[x].append(y) pre[y] = x now.append(y) #print(rank) r = rank[u] if r % 2 == 0: m = r//2 + 1 M = u for _ in range(r-m): M = pre[M] now = [M] while now != []: last = now now = [] for x in last: for y in pst[x]: now.append(y) ans = rank[last[0]] - m + r - m + 1 #print(r,m,M,rank[last[0]],last[0]) #print(0,ans) else: m = r//2 + 1 M = u for _ in range(r-m): M = pre[M] now = [M] while now != []: last = now now = [] for x in last: for y in pst[x]: now.append(y) ans = rank[last[0]] - m + r - m #print(r,m,M,rank[last[0]],last[0]) #print(1,ans) print(ans)
[ "call.remove" ]
637,312
637,313
u111365362
python
p02834
import sys sys.setrecursionlimit(200000) def dfs(array, current, count): array[current - 1] = count for neighbour in graph[current]: if array[neighbour - 1] == -1: array = dfs(array, neighbour, count + 1) else: return array T = [-1 for x in range(100000)] A = [-1 for x in range(100000)] graph = {} N,u,v = map(int,input().split()) for i in range(N-1): a,b = map(int,input().split()) try: graph[a].append(b) except KeyError: graph[a] = [b] try: graph[b].append(a) except KeyError: graph[b] = [a] T = dfs(T, u, 0) A = dfs(A, v, 0) ans = -1 for i in range(N): if T[i] < A[i]: ans = max(ans, A[ImportError] - 1) print(max(0,ans))
import sys sys.setrecursionlimit(200000) def dfs(array, current, count): array[current - 1] = count for neighbour in graph[current]: if array[neighbour - 1] == -1: array = dfs(array, neighbour, count + 1) else: return array T = [-1 for x in range(100000)] A = [-1 for x in range(100000)] graph = {} N,u,v = map(int,input().split()) for i in range(N-1): a,b = map(int,input().split()) try: graph[a].append(b) except KeyError: graph[a] = [b] try: graph[b].append(a) except KeyError: graph[b] = [a] T = dfs(T, u, 0) A = dfs(A, v, 0) ans = -1 for i in range(N): if T[i] < A[i]: ans = max(ans, A[i] - 1) print(max(0,ans))
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change" ]
637,326
637,327
u638057737
python
p02834
n,u,v=map(int,input().split()) u-=1;v-=1 edge=[[]*n for _ in range(n)] for _ in range(n-1): a,b=map(int,input().split()) a-=1;b-=1 edge[a].append(b) edge[b].append(a) # from u 逃げる # uはvからみた距離が大きい方に進むのかな # from v 追う # v始点でBFSして各頂点への距離を持つ dist=[-1]*n from collections import deque q=deque() q.append(v) dist[v]=0 while q: p=q.popleft() d=dist[p] for i in edge[p]: if dist[i]==-1: dist[i]=d+1 q.append(i) #print(dist) far=[-1]*n q=deque() q.append(u) far[u]=0 while q: p=q.popleft() d=far[p] for i in edge[p]: if far[i]==-1: if dist[i]>d+1: far[i]=d+1 q.append(i) #print(far) far_mx=max(far) if far_mx==-1: print(0) exit() ind=[i for i,v in enumerate(far) if v==far_mx] to=max(dist[i] for i in ind) ans=(to-1) print(ans)
n,u,v=map(int,input().split()) u-=1;v-=1 edge=[[]*n for _ in range(n)] for _ in range(n-1): a,b=map(int,input().split()) a-=1;b-=1 edge[a].append(b) edge[b].append(a) # from u 逃げる # uはvからみた距離が大きい方に進むのかな # from v 追う # v始点でBFSして各頂点への距離を持つ dist=[-1]*n from collections import deque q=deque() q.append(v) dist[v]=0 while q: p=q.popleft() d=dist[p] for i in edge[p]: if dist[i]==-1: dist[i]=d+1 q.append(i) # print(dist) far=[-1]*n q=deque() q.append(u) far[u]=0 while q: p=q.popleft() d=far[p] for i in edge[p]: if far[i]==-1: if dist[i]>d+1: far[i]=d+1 q.append(i) # print(far) far_mx=max(far) if far_mx==-1: print(0) exit() ind=[i for i,v in enumerate(far) if v!=-1] to=max(dist[i] for i in ind) ans=(to-1) print(ans)
[ "expression.operation.unary.add" ]
637,359
637,360
u130900604
python
p02834
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools import math, fractions import sys, copy def L(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline().rstrip()) def SL(): return list(sys.stdin.readline().rstrip()) def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return [list(x) for x in sys.stdin.readline().split()] def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def LIR1(n): return [LI1() for _ in range(n)] def SR(n): return [SL() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] def LR(n): return [L() for _ in range(n)] def perm(n, r): return math.factorial(n) // math.factorial(r) def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r)) def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)] def adjacency_list(N, edges): g = make_list(N, 0) for a, b in edges: g[a].append(b), g[b].append(a) return g def tree_utils(start, g): parent, children, depth, q = [-1]*len(g), make_list(len(g), 0), [-1]*len(g), deque([start]); depth[start] = 0 while q: i = q.popleft() for j in g[i]: if depth[j] != -1: parent[i] = j else: depth[j] = depth[i] + 1; children[i].append(j), q.append(j) return parent, children, depth def graph_distance(start, g): dist, q = [-1] * len(g), deque([start]); dist[start] = 0 while q: i = q.popleft() for j in g[i]: if dist[j] == -1: dist[j] = dist[i] + 1; q.append(j) return dist sys.setrecursionlimit(1000000) dire, dire8 = [[1, 0], [0, 1], [-1, 0], [0, -1]], [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] alphabets, ALPHABETS = "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ" MOD, INF = 1000000007, float("inf") def main(): N, u, v = LI() AB = LIR1(N-1) max_dist = [None] * N g = adjacency_list(N, AB) udist = graph_distance(u-1, g) vdist = graph_distance(v-1, g) ans = vdist[u-1] - 1 for ud, vd in zip(udist, vdist): if ud < vd: ans = max(ans, ud) print(ans) if __name__ == '__main__': main()
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools import math, fractions import sys, copy def L(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline().rstrip()) def SL(): return list(sys.stdin.readline().rstrip()) def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return [list(x) for x in sys.stdin.readline().split()] def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def LIR1(n): return [LI1() for _ in range(n)] def SR(n): return [SL() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] def LR(n): return [L() for _ in range(n)] def perm(n, r): return math.factorial(n) // math.factorial(r) def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r)) def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)] def adjacency_list(N, edges): g = make_list(N, 0) for a, b in edges: g[a].append(b), g[b].append(a) return g def tree_utils(start, g): parent, children, depth, q = [-1]*len(g), make_list(len(g), 0), [-1]*len(g), deque([start]); depth[start] = 0 while q: i = q.popleft() for j in g[i]: if depth[j] != -1: parent[i] = j else: depth[j] = depth[i] + 1; children[i].append(j), q.append(j) return parent, children, depth def graph_distance(start, g): dist, q = [-1] * len(g), deque([start]); dist[start] = 0 while q: i = q.popleft() for j in g[i]: if dist[j] == -1: dist[j] = dist[i] + 1; q.append(j) return dist sys.setrecursionlimit(1000000) dire, dire8 = [[1, 0], [0, 1], [-1, 0], [0, -1]], [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] alphabets, ALPHABETS = "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ" MOD, INF = 1000000007, float("inf") def main(): N, u, v = LI() AB = LIR1(N-1) max_dist = [None] * N g = adjacency_list(N, AB) udist = graph_distance(u-1, g) vdist = graph_distance(v-1, g) ans = vdist[u-1] - 1 for ud, vd in zip(udist, vdist): if ud < vd: ans = max(ans, vd - 1) print(ans) if __name__ == '__main__': main()
[ "assignment.value.change", "call.arguments.change" ]
637,366
637,367
u481187938
python
p02834
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools import math, fractions import sys, copy def L(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline().rstrip()) def SL(): return list(sys.stdin.readline().rstrip()) def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return [list(x) for x in sys.stdin.readline().split()] def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def LIR1(n): return [LI1() for _ in range(n)] def SR(n): return [SL() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] def LR(n): return [L() for _ in range(n)] def perm(n, r): return math.factorial(n) // math.factorial(r) def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r)) def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)] def adjacency_list(N, edges): g = make_list(N, 0) for a, b in edges: g[a].append(b), g[b].append(a) return g def tree_utils(start, g): parent, children, depth, q = [-1]*len(g), make_list(len(g), 0), [-1]*len(g), deque([start]); depth[start] = 0 while q: i = q.popleft() for j in g[i]: if depth[j] != -1: parent[i] = j else: depth[j] = depth[i] + 1; children[i].append(j), q.append(j) return parent, children, depth def graph_distance(start, g): dist, q = [-1] * len(g), deque([start]); dist[start] = 0 while q: i = q.popleft() for j in g[i]: if dist[j] == -1: dist[j] = dist[i] + 1; q.append(j) return dist sys.setrecursionlimit(1000000) dire, dire8 = [[1, 0], [0, 1], [-1, 0], [0, -1]], [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] alphabets, ALPHABETS = "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ" MOD, INF = 1000000007, float("inf") def main(): N, u, v = LI() AB = LIR1(N-1) max_dist = [None] * N g = adjacency_list(N, AB) udist = graph_distance(u-1, g) vdist = graph_distance(v-1, g) visit = [False] * N ans = vdist[u-1] - 1 q = deque([u-1]) while q: i = q.popleft() visit[i] = True if udist[i] < vdist[i]: ans = max(ans, udist[i]) for j in g[i]: if not visit[j]: q.append(j) print(ans) if __name__ == '__main__': main()
#!usr/bin/env python3 from collections import defaultdict, deque, Counter, OrderedDict from bisect import bisect_left, bisect_right from functools import reduce, lru_cache from heapq import heappush, heappop, heapify import itertools import math, fractions import sys, copy def L(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline().rstrip()) def SL(): return list(sys.stdin.readline().rstrip()) def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LS(): return [list(x) for x in sys.stdin.readline().split()] def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def LIR1(n): return [LI1() for _ in range(n)] def SR(n): return [SL() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] def LR(n): return [L() for _ in range(n)] def perm(n, r): return math.factorial(n) // math.factorial(r) def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r)) def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)] def adjacency_list(N, edges): g = make_list(N, 0) for a, b in edges: g[a].append(b), g[b].append(a) return g def tree_utils(start, g): parent, children, depth, q = [-1]*len(g), make_list(len(g), 0), [-1]*len(g), deque([start]); depth[start] = 0 while q: i = q.popleft() for j in g[i]: if depth[j] != -1: parent[i] = j else: depth[j] = depth[i] + 1; children[i].append(j), q.append(j) return parent, children, depth def graph_distance(start, g): dist, q = [-1] * len(g), deque([start]); dist[start] = 0 while q: i = q.popleft() for j in g[i]: if dist[j] == -1: dist[j] = dist[i] + 1; q.append(j) return dist sys.setrecursionlimit(1000000) dire, dire8 = [[1, 0], [0, 1], [-1, 0], [0, -1]], [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]] alphabets, ALPHABETS = "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ" MOD, INF = 1000000007, float("inf") def main(): N, u, v = LI() AB = LIR1(N-1) max_dist = [None] * N g = adjacency_list(N, AB) udist = graph_distance(u-1, g) vdist = graph_distance(v-1, g) visit = [False] * N ans = vdist[u-1] - 1 q = deque([u-1]) while q: i = q.popleft() visit[i] = True if udist[i] < vdist[i]: ans = max(ans, vdist[i]-1) for j in g[i]: if not visit[j]: q.append(j) print(ans) if __name__ == '__main__': main()
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
637,368
637,369
u481187938
python
p02834
from collections import deque def nearlist(N, LIST): # 隣接リスト NEAR = [set() for _ in range(N)] for a, b in LIST: NEAR[a - 1].add(b - 1) NEAR[b - 1].add(a - 1) return NEAR def bfs(NEAR, S, N): # 幅優先探索 # キュー dist = [-1 for _ in range(N)] # 前処理 dist[S] = 0 que, frag = deque([S]), set([S]) while len(que) > 0: q = que.popleft() for i in NEAR[q]: # 移動先の候補 if i in frag: # 処理済みか否か continue dist[i] = dist[q] + 1 que.append(i), frag.add(i) return dist n, u, v = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n - 1)] near = nearlist(n, ab) tkdist, akdist = bfs(near, u - 1, n), bfs(near, v - 1, n) node = [i for i in range(n) if tkdist[i] <= akdist[i]] ans = max(akdist[i] for i in node) print(ans[0] - 1)
from collections import deque def nearlist(N, LIST): # 隣接リスト NEAR = [set() for _ in range(N)] for a, b in LIST: NEAR[a - 1].add(b - 1) NEAR[b - 1].add(a - 1) return NEAR def bfs(NEAR, S, N): # 幅優先探索 # キュー dist = [-1 for _ in range(N)] # 前処理 dist[S] = 0 que, frag = deque([S]), set([S]) while len(que) > 0: q = que.popleft() for i in NEAR[q]: # 移動先の候補 if i in frag: # 処理済みか否か continue dist[i] = dist[q] + 1 que.append(i), frag.add(i) return dist n, u, v = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(n - 1)] near = nearlist(n, ab) tkdist, akdist = bfs(near, u - 1, n), bfs(near, v - 1, n) node = [i for i in range(n) if tkdist[i] <= akdist[i]] ans = max(akdist[i] for i in node) print(ans - 1)
[]
637,381
637,382
u222668979
python
p02834
from collections import deque n, u, v = map(int,input().split()) tree = [[] for _ in range(n+1)] for _i in range(n-1): a, b = map(int, input().split()) tree[a].append(b) tree[b].append(a) def solve(x): visit = [-1 for _ in range(n+1)] visit[x] = 0 q = deque([x]) while q: p = q.popleft() for i in tree[p]: if visit[i] < 0: visit[i] = visit[p]+1 q.append(i) return visit visit_a = solve(v) visit_t = solve(u) x, y = [], [] for i in range(1, n+1): if visit_a[i] >= visit_t[i]: x.append(visit_a[i]) y.append(visit_t[i]) p = y.index(max(y)) print(x[p]-1)
from collections import deque n, u, v = map(int,input().split()) tree = [[] for _ in range(n+1)] for _i in range(n-1): a, b = map(int, input().split()) tree[a].append(b) tree[b].append(a) def solve(x): visit = [-1 for _ in range(n+1)] visit[x] = 0 q = deque([x]) while q: p = q.popleft() for i in tree[p]: if visit[i] < 0: visit[i] = visit[p]+1 q.append(i) return visit visit_a = solve(v) visit_t = solve(u) x, y = [], [] for i in range(1, n+1): if visit_a[i] >= visit_t[i]: x.append(visit_a[i]) y.append(visit_t[i]) p = x.index(max(x)) print(x[p]-1)
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
637,444
637,445
u413165887
python
p02834
import sys sys.setrecursionlimit(10**9) from collections import deque class LCA1(): def __init__(self, l, start): self.n = len(l) self.dep=[0]*self.n self.par=[[-1]*self.n for i in range(18)] def bfs(start): is_leaf = [0]*n que = deque() que.append((start, -1, 0)) while que: c,p,d = que.pop() self.dep[v]=d self.par[0][v]=p cnt = 0 for to in G[c]: if to != p: que.append((to,c,d+1)) cnt += 1 if not cnt: is_leaf[c] = 1 return is_leaf self.is_leaf = bfs(start) for i in range(17): for j in range(self.n): self.par[i+1][j]=self.par[i][self.par[i][j]] def lca(self,a,b): if self.dep[a]>self.dep[b]: a,b=b,a for i in range(18): if (self.dep[b]-self.dep[a]) & 1<<i: b=self.par[i][b] if a==b: return a for i in range(18)[::-1]: if self.par[i][a]!=self.par[i][b]: a=self.par[i][a] b=self.par[i][b] return self.par[0][a] def dist(self, a,b): return abs(self.dep[a]-self.dep[b]) n, u, v = map(int, input().split()) u, v = u-1, v-1 G = [[] for i in range(n)] for i in range(n-1): a,b = map(int, input().split()) a,b = a-1,b-1 G[a].append(b) G[b].append(a) LCA = LCA1(G, v) ans = 0 for i in range(n): if not LCA.is_leaf[i]: continue lca = LCA.lca(u, i) if lca == v: continue if LCA.dist(lca, u) >= LCA.dist(lca, v): continue turn = 0 tmp = 0 d = LCA.dist(u, lca) + LCA.dist(lca, i) if d != 0: tmp = 2*d aoki = d else: aoki = 0 tak = LCA.dep[i] m = tak-aoki if m%2==1: tmp += 2*m -1 else: tmp += 2*(m-1) ans = max(ans, tmp) print(ans//2)
import sys sys.setrecursionlimit(10**9) from collections import deque class LCA1(): def __init__(self, l, start): self.n = len(l) self.dep=[0]*self.n self.par=[[-1]*self.n for i in range(18)] def bfs(start): is_leaf = [0]*n que = deque() que.append((start, -1, 0)) while que: c,p,d = que.pop() self.dep[c]=d self.par[0][c]=p cnt = 0 for to in G[c]: if to != p: que.append((to,c,d+1)) cnt += 1 if not cnt: is_leaf[c] = 1 return is_leaf self.is_leaf = bfs(start) for i in range(17): for j in range(self.n): self.par[i+1][j]=self.par[i][self.par[i][j]] def lca(self,a,b): if self.dep[a]>self.dep[b]: a,b=b,a for i in range(18): if (self.dep[b]-self.dep[a]) & 1<<i: b=self.par[i][b] if a==b: return a for i in range(18)[::-1]: if self.par[i][a]!=self.par[i][b]: a=self.par[i][a] b=self.par[i][b] return self.par[0][a] def dist(self, a,b): return abs(self.dep[a]-self.dep[b]) n, u, v = map(int, input().split()) u, v = u-1, v-1 G = [[] for i in range(n)] for i in range(n-1): a,b = map(int, input().split()) a,b = a-1,b-1 G[a].append(b) G[b].append(a) LCA = LCA1(G, v) ans = 0 for i in range(n): if not LCA.is_leaf[i]: continue lca = LCA.lca(u, i) if lca == v: continue if LCA.dist(lca, u) >= LCA.dist(lca, v): continue turn = 0 tmp = 0 d = LCA.dist(u, lca) + LCA.dist(lca, i) if d != 0: tmp = 2*d aoki = d else: aoki = 0 tak = LCA.dep[i] m = tak-aoki if m%2==1: tmp += 2*m -1 else: tmp += 2*(m-1) ans = max(ans, tmp) print(ans//2)
[ "assignment.variable.change", "identifier.change", "variable_access.subscript.index.change" ]
637,464
637,465
u803848678
python
p02834
from collections import deque def solve(n, u, v, edge_list): # graph g = [[] for i in range(n)] for a, b in edge_list: g[a].append(b) g[b].append(a) # root at v parent = [0] * n depth = [0] * n parent[v] = -1 queue = deque([v]) while len(queue) > 0: p = queue.popleft() for q in g[p]: if parent[p] != q: parent[q] = p depth[q] = depth[p] + 1 queue.append(q) # collect max_depth from leaf temp_list = [[i, -depth[i]] for i in range(n)] temp_list = list(sorted(temp_list, key=lambda x: x[1])) run_list = [temp_list[i][0] for i in range(n)] max_children_depth = depth.copy() for i in run_list[:-1]: max_children_depth[parent[i]] = max(max_children_depth[parent[i]], max_children_depth[i]) # print(depth) # print(max_children_depth) du = depth[u] up = u res = 0 if du > 2: for _ in range(du // 2): up = parent[up] res += 1 res += max_children_depth[up] - depth[up] if du % 2 == 0: res += 1 return res def main(): n, u, v = map(int, input().split()) edge_list = [[0, 0] for _ in range(n - 1)] for i in range(n - 1): a, b = map(int, input().split()) edge_list[i][0] = a - 1 edge_list[i][1] = b - 1 u -= 1 v -= 1 res = solve(n, u, v, edge_list) print(res) def test(): assert solve(5, 3, 0, [[0, 1], [1, 2], [2, 3], [2, 4]]) == 2 assert solve(5, 3, 4, [[0, 1], [0, 2], [0, 3], [0, 4]]) == 1 assert solve(2, 0, 1, [[0, 1]]) == 0 if __name__ == "__main__": test() main()
from collections import deque def solve(n, u, v, edge_list): # graph g = [[] for i in range(n)] for a, b in edge_list: g[a].append(b) g[b].append(a) # root at v parent = [0] * n depth = [0] * n parent[v] = -1 queue = deque([v]) while len(queue) > 0: p = queue.popleft() for q in g[p]: if parent[p] != q: parent[q] = p depth[q] = depth[p] + 1 queue.append(q) # collect max_depth from leaf temp_list = [[i, -depth[i]] for i in range(n)] temp_list = list(sorted(temp_list, key=lambda x: x[1])) run_list = [temp_list[i][0] for i in range(n)] max_children_depth = depth.copy() for i in run_list[:-1]: max_children_depth[parent[i]] = max(max_children_depth[parent[i]], max_children_depth[i]) # print(depth) # print(max_children_depth) du = depth[u] up = u res = 0 if du > 2: for _ in range((du - 1) // 2): up = parent[up] res += 1 res += max_children_depth[up] - depth[up] if du % 2 == 0: res += 1 return res def main(): n, u, v = map(int, input().split()) edge_list = [[0, 0] for _ in range(n - 1)] for i in range(n - 1): a, b = map(int, input().split()) edge_list[i][0] = a - 1 edge_list[i][1] = b - 1 u -= 1 v -= 1 res = solve(n, u, v, edge_list) print(res) def test(): assert solve(5, 3, 0, [[0, 1], [1, 2], [2, 3], [2, 4]]) == 2 assert solve(5, 3, 4, [[0, 1], [0, 2], [0, 3], [0, 4]]) == 1 assert solve(2, 0, 1, [[0, 1]]) == 0 if __name__ == "__main__": test() main()
[ "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
637,472
637,473
u104282757
python
p02834
import sys sys.setrecursionlimit(1000000) def dfs(cur, par, g, d): pars[cur] = par for to in g[cur]: if to == par: continue d[to] = d[cur]+1 md[cur] = max(md[cur], dfs(to, cur, g, d)+1) return md[cur] n, u, v = map(int, input().split()) u -= 1 v -= 1 g = [] for i in range(n): g.append([]) for i in range(n-1): a, b = map(int, input().split()) g[a-1].append(b-1) g[b-1].append(a-1) d = [] md = [] pars = [] f = [] for i in range(n): d.append(-1) md.append(0) pars.append(-1) f.append(False) d[u] = 0 dfs(u, -1, g, d) cur = v while cur != u: f[cur] = True cur = pars[cur] f[u] = True res = d[v]//2 for i in range(n): if f[i] and d[i]*2 < d[v]: for to in g[i]: if to == pars[i] or f[to]: continue res = max(res, md[to]+1+d[v]-d[i] - 1) print(res)
import sys sys.setrecursionlimit(1000000) def dfs(cur, par, g, d): pars[cur] = par for to in g[cur]: if to == par: continue d[to] = d[cur]+1 md[cur] = max(md[cur], dfs(to, cur, g, d)+1) return md[cur] n, u, v = map(int, input().split()) u -= 1 v -= 1 g = [] for i in range(n): g.append([]) for i in range(n-1): a, b = map(int, input().split()) g[a-1].append(b-1) g[b-1].append(a-1) d = [] md = [] pars = [] f = [] for i in range(n): d.append(-1) md.append(0) pars.append(-1) f.append(False) d[u] = 0 dfs(u, -1, g, d) cur = v while cur != u: f[cur] = True cur = pars[cur] f[u] = True res = d[v]-1 for i in range(n): if f[i] and d[i]*2 < d[v]: for to in g[i]: if to == pars[i] or f[to]: continue res = max(res, md[to]+1+d[v]-d[i] - 1) print(res)
[]
637,474
637,475
u591717585
python
p02834
from collections import deque N,u,v=map(int,input().split()) u-=1 v-=1 L=[list() for _ in range(N)] for _ in range(N-1): a,b=map(int,input().split()) a-=1 b-=1 L[a].append(b) L[b].append(a) q=deque([(v,0)]) T=[-1]*N A=[-1]*N while q: p,x=q.pop() A[p]=x for to in L[p]: if A[to]==-1: q.append((to,x+1)) q=deque([(u,0)]) while q: p,x=q.pop() T[p]=x for to in L[p]: if T[to]==-1 and A[to]>x+1: q.append((to,x+1)) Tcan=[i for i,x in enumerate(A) if x!=-1] cnt,gi=max([(A[i], i) for i in Tcan]+[(0,0)]) if cnt==0: print(0) exit() print(A[gi]-1)
from collections import deque N,u,v=map(int,input().split()) u-=1 v-=1 L=[list() for _ in range(N)] for _ in range(N-1): a,b=map(int,input().split()) a-=1 b-=1 L[a].append(b) L[b].append(a) q=deque([(v,0)]) T=[-1]*N A=[-1]*N while q: p,x=q.pop() A[p]=x for to in L[p]: if A[to]==-1: q.append((to,x+1)) q=deque([(u,0)]) while q: p,x=q.pop() T[p]=x for to in L[p]: if T[to]==-1 and A[to]>x+1: q.append((to,x+1)) Tcan=[i for i,x in enumerate(T) if x!=-1] cnt,gi=max([(A[i], i) for i in Tcan]+[(0,0)]) if cnt<=1: print(0) exit() print(A[gi]-1)
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
637,505
637,506
u722535636
python
p02834
import heapq; n, u, v = [int(v) for v in input().split()] vert = [] for i in range(n): vert.append([]) for i in range(n - 1): a, b = [int(v) - 1 for v in input().split()] vert[a].append(b) vert[b].append(a) taka = u-1 aoki = v-1 if taka == aoki: print(0) exit() q = [(0, aoki)] aoki_dist = [-1] * n aoki_dist[aoki] = 0 index = 0 while index < len(q): c0, i = q[index] c = c0 + 1 for l in vert[i]: if aoki_dist[l] >= 0: continue aoki_dist[i] = c q.append((c, l)) index += 1 q = [(0, taka)] max_dist = aoki_dist[taka] aoki_dist[taka] = -1 index = 0 while index < len(q): c0, i = q[index] c = c0 + 1 for l in vert[i]: if aoki_dist[l] < 0: continue if c >= aoki_dist[l]: continue if max_dist < aoki_dist[l]: max_dist = aoki_dist[l] aoki_dist[l] = -1 q.append((c, l)) index += 1 print(max_dist - 1)
import heapq; n, u, v = [int(v) for v in input().split()] vert = [] for i in range(n): vert.append([]) for i in range(n - 1): a, b = [int(v) - 1 for v in input().split()] vert[a].append(b) vert[b].append(a) taka = u-1 aoki = v-1 if taka == aoki: print(0) exit() q = [(0, aoki)] aoki_dist = [-1] * n aoki_dist[aoki] = 0 index = 0 while index < len(q): c0, i = q[index] c = c0 + 1 for l in vert[i]: if aoki_dist[l] >= 0: continue aoki_dist[l] = c q.append((c, l)) index += 1 q = [(0, taka)] max_dist = aoki_dist[taka] aoki_dist[taka] = -1 index = 0 while index < len(q): c0, i = q[index] c = c0 + 1 for l in vert[i]: if aoki_dist[l] < 0: continue if c >= aoki_dist[l]: continue if max_dist < aoki_dist[l]: max_dist = aoki_dist[l] aoki_dist[l] = -1 q.append((c, l)) index += 1 print(max_dist - 1)
[ "assignment.variable.change", "identifier.change", "variable_access.subscript.index.change" ]
637,595
637,596
u006883624
python
p02834
import sys sys.setrecursionlimit(10 ** 5) def dfs(v, parent, depth): parents[v] = parent self_depths[v] = depth sd = 0 for u in links[v]: if u == parent: continue res = dfs(u, v, depth + 1) sd = max(sd, res + 1) subtree_depths[v] = sd return sd def solve(u): catch = self_depths[u] // 2 while self_depths[u] > catch: u = parents[u] return self_depths[u] + subtree_depths[u] - 1 n, u, v = map(int, input().split()) u -= 1 v -= 1 links = [set() for _ in range(n)] for line in sys.stdin: a, b = map(int, line.split()) a -= 1 b -= 1 links[a].add(b) links[b].add(a) parents = [-1] * n self_depths = [0] * n subtree_depths = [0] * n dfs(v, -1, 0) print(solve(u))
import sys sys.setrecursionlimit(10 ** 5) def dfs(v, parent, depth): parents[v] = parent self_depths[v] = depth sd = 0 for u in links[v]: if u == parent: continue res = dfs(u, v, depth + 1) sd = max(sd, res + 1) subtree_depths[v] = sd return sd def solve(u): catch = self_depths[u] // 2 while self_depths[parents[u]] > catch: u = parents[u] return self_depths[u] + subtree_depths[u] - 1 n, u, v = map(int, input().split()) u -= 1 v -= 1 links = [set() for _ in range(n)] for line in sys.stdin: a, b = map(int, line.split()) a -= 1 b -= 1 links[a].add(b) links[b].add(a) parents = [-1] * n self_depths = [0] * n subtree_depths = [0] * n dfs(v, -1, 0) print(solve(u))
[ "control_flow.loop.condition.change" ]
637,599
637,600
u340781749
python
p02834
import sys import collections def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n, u, v = list(map(int, readline().split())) tmd = collections.defaultdict(list) for i in range(n-1): tma, tmb = list(map(int, readline().split())) tmd[tma-1] += [tmb-1] tmd[tmb-1] += [tma-1] qlt = [[0, u-1]] qlt = collections.deque(qlt) fqt = collections.defaultdict(int) fqt[u-1] while True: if len(qlt) != 0: cost, tmp = qlt.popleft() for tmv in tmd[tmp]: if tmv not in fqt: qlt.append([cost + 1, tmv]) fqt[tmv] = cost + 1 else: break qla = [[0, v-1]] qla = collections.deque(qla) fqa = collections.defaultdict(int) fqa[v-1] while True: if len(qla) != 0: cost, tmp = qla.popleft() for tmv in tmd[tmp]: if tmv not in fqa: qla.append([cost + 1, tmv]) fqa[tmv] = cost + 1 else: break mt = 0 for kt, vt in sorted(fqt.items(), key=lambda x: x[1], reverse=True): if vt < fqa[kt]: mt = max(mt, fqa[kt]) print(mt) if __name__ == '__main__': solve()
import sys import collections def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n, u, v = list(map(int, readline().split())) tmd = collections.defaultdict(list) for i in range(n-1): tma, tmb = list(map(int, readline().split())) tmd[tma-1] += [tmb-1] tmd[tmb-1] += [tma-1] qlt = [[0, u-1]] qlt = collections.deque(qlt) fqt = collections.defaultdict(int) fqt[u-1] while True: if len(qlt) != 0: cost, tmp = qlt.popleft() for tmv in tmd[tmp]: if tmv not in fqt: qlt.append([cost + 1, tmv]) fqt[tmv] = cost + 1 else: break qla = [[0, v-1]] qla = collections.deque(qla) fqa = collections.defaultdict(int) fqa[v-1] while True: if len(qla) != 0: cost, tmp = qla.popleft() for tmv in tmd[tmp]: if tmv not in fqa: qla.append([cost + 1, tmv]) fqa[tmv] = cost + 1 else: break mt = 0 for kt, vt in sorted(fqt.items(), key=lambda x: x[1], reverse=True): if vt < fqa[kt]: mt = max(mt, fqa[kt]) print(mt - 1) if __name__ == '__main__': solve()
[ "expression.operation.binary.add" ]
637,605
637,606
u753803401
python
p02834
import sys from collections import deque input = sys.stdin.readline n, u, v = map(int, input().split()) E = [[] for i in range(n)] for i in range(n - 1): a, b = map(int, input().split()) E[a-1].append(b-1) E[b-1].append(a-1) memo = [[0, 0] for i in range(n)] def dfs(cur, pre, p): stack = deque([[cur, pre]]) while stack: cur, pre = stack.pop() if pre != -1: memo[cur][p] = memo[pre][p] + 1 for e in E[cur]: if e != pre: stack.append([e, cur]) dfs(u - 1, - 1, 0) dfs(v - 1, -1, 1) # print(memo) ans = 0 for a, b in memo: if a >= b: ans = max(ans, b - 1) print(ans)
import sys from collections import deque input = sys.stdin.readline n, u, v = map(int, input().split()) E = [[] for i in range(n)] for i in range(n - 1): a, b = map(int, input().split()) E[a-1].append(b-1) E[b-1].append(a-1) memo = [[0, 0] for i in range(n)] def dfs(cur, pre, p): stack = deque([[cur, pre]]) while stack: cur, pre = stack.pop() if pre != -1: memo[cur][p] = memo[pre][p] + 1 for e in E[cur]: if e != pre: stack.append([e, cur]) dfs(u - 1, - 1, 0) dfs(v - 1, -1, 1) # print(memo) ans = 0 for a, b in memo: if a <= b: ans = max(ans, b - 1) print(ans)
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,624
637,625
u711539583
python
p02834
import sys from collections import deque input = sys.stdin.readline n, u, v = map(int, input().split()) E = [[] for i in range(n)] for i in range(n - 1): a, b = map(int, input().split()) E[a-1].append(b-1) E[b-1].append(a-1) memo = [[0, 0] for i in range(n)] def dfs(cur, pre, p): stack = deque([[cur, pre]]) while stack: cur, pre = stack.pop() if pre != -1: memo[cur][p] = memo[pre][p] + 1 for e in E[cur]: if e != pre: stack.append([e, cur]) dfs(u - 1, - 1, 0) dfs(v - 1, -1, 1) # print(memo) ans = 0 for a, b in memo: ans = max(ans, b - 1) print(ans)
import sys from collections import deque input = sys.stdin.readline n, u, v = map(int, input().split()) E = [[] for i in range(n)] for i in range(n - 1): a, b = map(int, input().split()) E[a-1].append(b-1) E[b-1].append(a-1) memo = [[0, 0] for i in range(n)] def dfs(cur, pre, p): stack = deque([[cur, pre]]) while stack: cur, pre = stack.pop() if pre != -1: memo[cur][p] = memo[pre][p] + 1 for e in E[cur]: if e != pre: stack.append([e, cur]) dfs(u - 1, - 1, 0) dfs(v - 1, -1, 1) # print(memo) ans = 0 for a, b in memo: if a <= b: ans = max(ans, b - 1) print(ans)
[ "control_flow.branch.if.add" ]
637,626
637,625
u711539583
python
p02835
print('bust' if sum(list(map,input().split()))>=22 else 'win')
print('bust' if sum(list(map(int,input().split())))>=22 else 'win')
[ "call.arguments.add", "call.arguments.change" ]
637,646
637,647
u539367121
python
p02835
a = list(map(int, input().split())) print('bust' if sum(a) >= 22 else 'Win')
a = list(map(int, input().split())) print('bust' if sum(a) >= 22 else 'win')
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
637,658
637,659
u363421241
python
p02835
a1, a2, a3 = map(int,input().split()) if a1 + a2 + a3 <= 22: print('bust') else: print('win')
a1, a2, a3 = map(int,input().split()) if a1 + a2 + a3 >= 22: print('bust') else: print('win')
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,664
637,665
u418826171
python
p02835
print('win' if sum(map(int, input().split())) < 21 else 'bust')
print('win' if sum(map(int, input().split())) < 22 else 'bust')
[ "literal.number.integer.change", "call.arguments.change", "io.output.change" ]
637,666
637,667
u682672120
python
p02835
p = list(map(int, input().split())) if sum(p) >= 22: print('bust') else: print('Win')
p = list(map(int, input().split())) if sum(p) >= 22: print('bust') else: print('win')
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
637,668
637,669
u162612857
python
p02835
A = list(map(int, input().split())) if sum(A) >= 22: print('bust') else: print('Yes')
A = list(map(int, input().split())) if sum(A) >= 22: print('bust') else: print('win')
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
637,674
637,675
u819910751
python
p02835
print("win" if sun(map(int,input().split()))<=21 else "bust")
print("win" if sum(map(int,input().split()))<=21 else "bust")
[ "identifier.change", "call.function.change", "call.arguments.change", "io.output.change" ]
637,678
637,679
u556594202
python
p02835
print(['bust','win'][sum(map(int,input.split()))<22])
print(['bust','win'][sum(map(int,input().split()))<22])
[ "call.add" ]
637,682
637,683
u179169725
python
p02835
a,b,c = map(int,input().split()) if a + b + c < 21: print('bust') else: print('win')
a, b, c = map(int, input().split()) if a + b + c > 21: print('bust') else: print('win')
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,700
637,702
u506910932
python
p02835
def main(): A = list(map(int, input().split())) if sum(A) <= 22: print('win') else: print('bust') main()
def main(): A = list(map(int, input().split())) if sum(A) <= 21: print('win') else: print('bust') main()
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
637,705
637,706
u690833702
python
p02835
def main(): A = list(map(int, input().split())) if sum(A) <= 22: print('win') else: print('dust') main()
def main(): A = list(map(int, input().split())) if sum(A) <= 21: print('win') else: print('bust') main()
[ "literal.number.integer.change", "control_flow.branch.if.condition.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
637,707
637,706
u690833702
python
p02835
A = list(map(int, input().split())) if sum(A) >= 22: print("burst") else: print("win")
A = list(map(int, input().split())) if sum(A) >= 22: print("bust") else: print("win")
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
637,722
637,723
u870518235
python
p02835
print("win" if sum(list(map(int,input().split())))<21 else "bust")
print("win" if sum(list(map(int,input().split())))<=21 else "bust")
[ "expression.operator.compare.change", "call.arguments.change", "io.output.change" ]
637,724
637,725
u519968172
python
p02835
a, b, c = map(int, input()) if a + b + c >= 22: print('bust') else: print('win')
a, b, c = map(int, input().split()) if a + b + c >= 22: print('bust') else: print('win')
[ "call.add" ]
637,759
637,760
u841021102
python
p02835
lst = list(map(int, input().split())) total = 0 for i in lst: total += 1 if total>= 22: print('bust') else: print('win')
lst = list(map(int, input().split())) total = 0 for i in lst: total += i if total>= 22: print('bust') else: print('win')
[ "identifier.replace.add", "literal.replace.remove" ]
637,773
637,774
u004233621
python
p02835
a,b,c=map(int,input().split()) if a+b+c >= 22: print('burst') else: print('win')
a,b,c=map(int,input().split()) if a+b+c >= 22: print('bust') else: print('win')
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
637,775
637,776
u640800355
python
p02835
L,M,N = map(int,input().split()) print("win" if L+M+N >= 22 else "bust")
L,M,N = map(int,input().split()) print("bust" if L+M+N >= 22 else "win")
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
637,777
637,778
u626228246
python
p02835
a1, a2, a3 = map(int, input()) if a1+a2+a3 >= 22: print('bust') else: print('win')
a1, a2, a3 = map(int, input().split()) if a1+a2+a3 >= 22: print('bust') else: print('win')
[ "call.add" ]
637,779
637,780
u920694585
python
p02835
a = list(map(int,input().split())) ans = sum(a) if ans >= 22: ans = "burst" else: ans = "win" print(ans)
a = list(map(int,input().split())) ans = sum(a) if ans >= 22: ans = "bust" else: ans = "win" print(ans)
[ "literal.string.change", "assignment.value.change" ]
637,781
637,782
u624613992
python
p02835
a = list(map(int,input().split())) ans = sum(a) if a >= 22: ans = "burst" else: ans = "win" print(ans)
a = list(map(int,input().split())) ans = sum(a) if ans >= 22: ans = "bust" else: ans = "win" print(ans)
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.string.change", "assignment.value.change" ]
637,783
637,782
u624613992
python
p02834
import sys input=sys.stdin.readline n,u,v=map(int,input().split()) Edge=[[] for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) Edge[a-1].append(b-1) Edge[b-1].append(a-1) from collections import deque def BFS(s): dist=[-1]*n que=deque([s-1]) dist[s-1]=0 while que: v=que.popleft() d=dist[v] for w in Edge[v]: if dist[w]>-1: continue dist[w]=d+1 que.append(w) return dist U_d,V_d=BFS(u),BFS(v) ans=0 for i in range(n): if U_d[i]<V_d[i]: ans=max(ans,U_d[i]) print(ans)
import sys input=sys.stdin.readline n,u,v=map(int,input().split()) Edge=[[] for i in range(n)] for i in range(n-1): a,b=map(int,input().split()) Edge[a-1].append(b-1) Edge[b-1].append(a-1) from collections import deque def BFS(s): dist=[-1]*n que=deque([s-1]) dist[s-1]=0 while que: v=que.popleft() d=dist[v] for w in Edge[v]: if dist[w]>-1: continue dist[w]=d+1 que.append(w) return dist U_d,V_d=BFS(u),BFS(v) ans=0 for i in range(n): if U_d[i]<V_d[i]: ans=max(ans,V_d[i]-1) print(ans)
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
637,794
637,795
u969190727
python
p02835
import sys stdin=sys.stdin ip=lambda: int(sp()) lp=lambda:list(map(int,stdin.readline().split())) sp=lambda:stdin.readline().rstrip() a,b,c=lp() if a+b+c>=22: print('burst') else: print('win')
import sys stdin=sys.stdin ip=lambda: int(sp()) lp=lambda:list(map(int,stdin.readline().split())) sp=lambda:stdin.readline().rstrip() a,b,c=lp() if a+b+c>=22: print('bust') else: print('win')
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
637,822
637,823
u516554284
python
p02835
from sys import stdin, stdout def print(x): stdout.write(str(x)) def solve(): A = [int(x) for x in stdin.readline().split()] sum = 0 for a in A: sum += a if sum <= 22 : print("win") else: print("bust") def main(): solve() if __name__ == "__main__": main()
from sys import stdin, stdout def print(x): stdout.write(str(x)) def solve(): A = [int(x) for x in stdin.readline().split()] sum = 0 for a in A: sum += a if sum < 22 : print("win") else: print("bust") def main(): solve() if __name__ == "__main__": main()
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,830
637,831
u161190523
python
p02835
if sum(list(map(int,input().split())))>21: print("burst") else: print("win")
if sum(list(map(int,input().split())))>21: print("bust") else: print("win")
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
637,902
637,903
u630211216
python
p02835
#ABC147 a = [map(int,input().split())] print("bust" if sum(a)>=22 else "win")
#ABC147 a = list(map(int,input().split())) print("bust" if sum(a)>=22 else "win")
[ "assignment.value.change", "call.arguments.change" ]
637,908
637,909
u904995051
python
p02835
a=list(input().split()) if sum(a)>=22: print("bust") elif sum(a)<=21: print("win")
a=list(map(int,input().split())) if sum(a)>=22: print("bust") elif sum(a)<=21: print("win")
[ "call.add", "call.arguments.change" ]
637,912
637,913
u886902015
python
p02834
from collections import defaultdict # def find_distances(edge_dict, node, distances): # for end in edge_dict[node]: # if distances[end] < 0: # distances[end] = distances[node] + 1 # distances = find_distances(edge_dict, end, distances) # return distances def find_distances(edge_dict, node, V): distances = [-1] * V stack = [(0, node)] while stack: dist, node = stack.pop() if distances[node] > 0: continue distances[node] = dist for end in edge_dict[node]: stack.append((dist + 1, end)) return distances if __name__ == "__main__": V, T, A = map(int, input().split()) T -= 1 A -= 1 edge_dict = defaultdict(list) for _ in range(V - 1): start, end = map(int, input().split()) edge_dict[start - 1].append(end - 1) edge_dict[end - 1].append(start - 1) dist_T = [-1] * V dist_T[T] = 0 dist_T = find_distances(edge_dict, T, V) dist_A = [-1] * V dist_A[A] = 0 dist_A = find_distances(edge_dict, A, V) max_dist = 0 for i in range(V): if dist_T[i] <= dist_A[i]: max_dist = max(max_dist, dist_A[i]) print(max_dist - 1)
from collections import defaultdict # def find_distances(edge_dict, node, distances): # for end in edge_dict[node]: # if distances[end] < 0: # distances[end] = distances[node] + 1 # distances = find_distances(edge_dict, end, distances) # return distances def find_distances(edge_dict, node, V): distances = [-1] * V stack = [(0, node)] while stack: dist, node = stack.pop() if distances[node] >= 0: continue distances[node] = dist for end in edge_dict[node]: stack.append((dist + 1, end)) return distances if __name__ == "__main__": V, T, A = map(int, input().split()) T -= 1 A -= 1 edge_dict = defaultdict(list) for _ in range(V - 1): start, end = map(int, input().split()) edge_dict[start - 1].append(end - 1) edge_dict[end - 1].append(start - 1) dist_T = [-1] * V dist_T[T] = 0 dist_T = find_distances(edge_dict, T, V) dist_A = [-1] * V dist_A[A] = 0 dist_A = find_distances(edge_dict, A, V) max_dist = 0 for i in range(V): if dist_T[i] <= dist_A[i]: max_dist = max(max_dist, dist_A[i]) print(max_dist - 1)
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
637,926
637,927
u314585898
python
p02834
N, U, V = map(int, input().split()) A = [[] for _ in range(N)] import sys sys.setrecursionlimit(10**8) for _ in range(N - 1): a, b = map(int, input().split()) A[a - 1].append(b - 1) A[b - 1].append(a - 1) C = [0] * N D = [0] * N def DFS(x, pre, cnt, C): C[x] = cnt cnt += 1 for a in A[x]: if a == pre: continue DFS(a, x, cnt, C) DFS(V - 1, -1, 0, C) DFS(U - 1, -1, 0, D) for i in range(N): if C[i]>D[i]: ans =max(ans, C[i]-1) print(ans)
N, U, V = map(int, input().split()) A = [[] for _ in range(N)] import sys sys.setrecursionlimit(10**8) for _ in range(N - 1): a, b = map(int, input().split()) A[a - 1].append(b - 1) A[b - 1].append(a - 1) C = [0] * N D = [0] * N def DFS(x, pre, cnt, C): C[x] = cnt cnt += 1 for a in A[x]: if a == pre: continue DFS(a, x, cnt, C) DFS(V - 1, -1, 0, C) DFS(U - 1, -1, 0, D) ans=0 for i in range(N): if C[i]>D[i]: ans =max(ans, C[i]-1) print(ans)
[ "assignment.add" ]
637,962
637,963
u223904637
python
p02834
import sys sys.setrecursionlimit(1000000) N, u, v = map(int, input().split()) u -= 1 v -= 1 G = [[] for _ in range(N)] elens = [0] * N for _ in range(N - 1): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) elens[a] += 1 elens[b] += 1 depths = [0] * N dists = [0] * N TAKAHASHI = [0] * N AOKI = [0] * N def dfs_aoki(cur: int, past: int, d: int): AOKI[cur] = d for nx in G[cur]: if nx == past: continue dfs_aoki(nx, cur, d + 1) def dfs_takahashi(cur: int, past: int, d: int): TAKAHASHI[cur] = d for nx in G[cur]: if nx == past: continue dfs_aoki(nx, cur, d + 1) dfs_takahashi(u, -1, 0) dfs_aoki(v, -1, 0) ans = 0 for i in range(N): if TAKAHASHI[i] < AOKI[i]: ans = max(ans, AOKI[i] - 1) print(ans)
import sys sys.setrecursionlimit(1000000) N, u, v = map(int, input().split()) u -= 1 v -= 1 G = [[] for _ in range(N)] elens = [0] * N for _ in range(N - 1): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) elens[a] += 1 elens[b] += 1 depths = [0] * N dists = [0] * N TAKAHASHI = [0] * N AOKI = [0] * N def dfs_aoki(cur: int, past: int, d: int): AOKI[cur] = d for nx in G[cur]: if nx == past: continue dfs_aoki(nx, cur, d + 1) def dfs_takahashi(cur: int, past: int, d: int): TAKAHASHI[cur] = d for nx in G[cur]: if nx == past: continue dfs_takahashi(nx, cur, d + 1) dfs_takahashi(u, -1, 0) dfs_aoki(v, -1, 0) ans = 0 for i in range(N): if TAKAHASHI[i] < AOKI[i]: ans = max(ans, AOKI[i] - 1) print(ans)
[ "identifier.change", "call.function.change" ]
637,973
637,974
u726872801
python
p02834
sys.setrecursionlimit(1000000) class Tree: C, RL = {}, {} R, N, D, S, P = None, None, None, None, None def __init__(s, num): s.N = num def setC(s, a, b): if a in s.C: s.C[a].append(b) else: s.C[a] = [b] if b in s.C: s.C[b].append(a) else: s.C[b] = [a] def makeRank(s, root): s.R = [0] * s.N s.R[root] = 1 s.RL[1] = [root] s.S = {} s.P = {} F = [root] s.D = 2 while F != []: Ft = [] s.RL[s.D] = [] for i in F: for j in s.C[i]: if s.R[j] == 0: s.R[j] = s.D Ft.append(j) s.RL[s.D].append(j) if i not in s.S: s.S[i] = [j] else: s.S[i].append(j) s.P[j] = i s.D += 1 F = Ft def getDeep(s, x): ans = 0 if x in s.S: for i in s.S[x]: ans = max(ans, s.getDeep(i)) return ans + 1 else: return 0 def getParent(s, x, n): if n == 0: return x return s.getParent(s.P[x], n - 1) N, u, v = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(N - 1)] T = Tree(N) for a, b in AB: T.setC(a - 1, b - 1) T.makeRank(v - 1) t = (T.R[u - 1] // 2) - 1 f = T.R[u - 1] % 2 k = T.getDeep(T.getParent(u - 1, t)) print(t + k + f)
import sys sys.setrecursionlimit(1000000) class Tree: C, RL = {}, {} R, N, D, S, P = None, None, None, None, None def __init__(s, num): s.N = num def setC(s, a, b): if a in s.C: s.C[a].append(b) else: s.C[a] = [b] if b in s.C: s.C[b].append(a) else: s.C[b] = [a] def makeRank(s, root): s.R = [0] * s.N s.R[root] = 1 s.RL[1] = [root] s.S = {} s.P = {} F = [root] s.D = 2 while F != []: Ft = [] s.RL[s.D] = [] for i in F: for j in s.C[i]: if s.R[j] == 0: s.R[j] = s.D Ft.append(j) s.RL[s.D].append(j) if i not in s.S: s.S[i] = [j] else: s.S[i].append(j) s.P[j] = i s.D += 1 F = Ft def getDeep(s, x): ans = 0 if x in s.S: for i in s.S[x]: ans = max(ans, s.getDeep(i)) return ans + 1 else: return 0 def getParent(s, x, n): if n == 0: return x return s.getParent(s.P[x], n - 1) N, u, v = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(N - 1)] T = Tree(N) for a, b in AB: T.setC(a - 1, b - 1) T.makeRank(v - 1) t = (T.R[u - 1] // 2) - 1 f = T.R[u - 1] % 2 k = T.getDeep(T.getParent(u - 1, t)) print(t + k + f)
[]
637,986
637,987
u456353530
python
p02834
sys.setrecursionlimit(100000) class Tree: C, RL = {}, {} R, N, D, S, P = None, None, None, None, None def __init__(s, num): s.N = num def setC(s, a, b): if a in s.C: s.C[a].append(b) else: s.C[a] = [b] if b in s.C: s.C[b].append(a) else: s.C[b] = [a] def makeRank(s, root): s.R = [0] * s.N s.R[root] = 1 s.RL[1] = [root] s.S = {} s.P = {} F = [root] s.D = 2 while F != []: Ft = [] s.RL[s.D] = [] for i in F: for j in s.C[i]: if s.R[j] == 0: s.R[j] = s.D Ft.append(j) s.RL[s.D].append(j) if i not in s.S: s.S[i] = [j] else: s.S[i].append(j) s.P[j] = i s.D += 1 F = Ft def getDeep(s, x): ans = 0 if x in s.S: for i in s.S[x]: ans = max(ans, s.getDeep(i)) return ans + 1 else: return 0 def getParent(s, x, n): if n == 0: return x return s.getParent(s.P[x], n - 1) N, u, v = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(N - 1)] T = Tree(N) for a, b in AB: T.setC(a - 1, b - 1) T.makeRank(v - 1) t = (T.R[u - 1] // 2) - 1 f = T.R[u - 1] % 2 k = T.getDeep(T.getParent(u - 1, t)) print(t + k + f)
import sys sys.setrecursionlimit(1000000) class Tree: C, RL = {}, {} R, N, D, S, P = None, None, None, None, None def __init__(s, num): s.N = num def setC(s, a, b): if a in s.C: s.C[a].append(b) else: s.C[a] = [b] if b in s.C: s.C[b].append(a) else: s.C[b] = [a] def makeRank(s, root): s.R = [0] * s.N s.R[root] = 1 s.RL[1] = [root] s.S = {} s.P = {} F = [root] s.D = 2 while F != []: Ft = [] s.RL[s.D] = [] for i in F: for j in s.C[i]: if s.R[j] == 0: s.R[j] = s.D Ft.append(j) s.RL[s.D].append(j) if i not in s.S: s.S[i] = [j] else: s.S[i].append(j) s.P[j] = i s.D += 1 F = Ft def getDeep(s, x): ans = 0 if x in s.S: for i in s.S[x]: ans = max(ans, s.getDeep(i)) return ans + 1 else: return 0 def getParent(s, x, n): if n == 0: return x return s.getParent(s.P[x], n - 1) N, u, v = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(N - 1)] T = Tree(N) for a, b in AB: T.setC(a - 1, b - 1) T.makeRank(v - 1) t = (T.R[u - 1] // 2) - 1 f = T.R[u - 1] % 2 k = T.getDeep(T.getParent(u - 1, t)) print(t + k + f)
[ "literal.number.integer.change", "call.arguments.change" ]
637,988
637,987
u456353530
python
p02834
N, u, v = map(int, input().split()) u -= 1 v -= 1 table = [[] for i in range(N)] for i in range(N-1): A, B = map(int, input().split()) A -= 1 B -= 1 table[A].append(B) table[B].append(A) dist_u = [-1]*N dist_v = [-1]*N dist_u[u] = 0 dist_v[v] = 0 from collections import deque H = deque() H.append(u) while H: x = H.popleft() for nx in table[x]: if dist_u[nx] == -1: H.append(nx) dist_u[nx] = dist_u[x]+1 H = deque() H.append(v) while H: x = H.popleft() for nx in table[x]: if dist_v[nx] == -1: H.append(nx) dist_v[nx] = dist_v[x]+1 tmp = 0 for i in range(N): if dist_u[i] <= dist_v[i] and dist_u[i] > tmp: tmp = dist_u[i] memo = i print(tmp)
N, u, v = map(int, input().split()) u -= 1 v -= 1 table = [[] for i in range(N)] for i in range(N-1): A, B = map(int, input().split()) A -= 1 B -= 1 table[A].append(B) table[B].append(A) dist_u = [-1]*N dist_v = [-1]*N dist_u[u] = 0 dist_v[v] = 0 from collections import deque H = deque() H.append(u) while H: x = H.popleft() for nx in table[x]: if dist_u[nx] == -1: H.append(nx) dist_u[nx] = dist_u[x]+1 H = deque() H.append(v) while H: x = H.popleft() for nx in table[x]: if dist_v[nx] == -1: H.append(nx) dist_v[nx] = dist_v[x]+1 tmp = 0 for i in range(N): if dist_u[i] < dist_v[i] and dist_v[i] >= tmp: tmp = dist_v[i] memo = i print(tmp-1)
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "identifier.change", "assignment.value.change" ]
637,995
637,996
u285443936
python
p02834
n, uplus, vplus = map(int, input().split()) u, v = uplus-1, vplus-1 adj = [[] for _ in range(n)] for _ in range(n-1): aplus, bplus = map(int, input().split()) a, b = aplus-1, bplus-1 adj[a].append(b) adj[b].append(a) u_dist = [n] * n u_dist[u] = 0 stack = [u] while stack: vertex = stack.pop() for nxt in adj[vertex]: if u_dist[nxt] == n: u_dist[nxt] = u_dist[vertex] + 1 stack.append(nxt) v_dist = [n] * n v_dist[v] = 0 stack = [v] leaves = [] while stack: vertex = stack.pop() isleaf = True for nxt in adj[vertex]: if u_dist[nxt] == n: u_dist[nxt] = u_dist[vertex] + 1 stack.append(nxt) isleaf = False if isleaf: leaves.append(vertex) max_depth = 0 for leaf in leaves: depth = v_dist[leaf] if u_dist[leaf] < depth and max_depth < depth: max_depth = depth print(max_depth - 1)
n, uplus, vplus = map(int, input().split()) u, v = uplus-1, vplus-1 adj = [[] for _ in range(n)] for _ in range(n-1): aplus, bplus = map(int, input().split()) a, b = aplus-1, bplus-1 adj[a].append(b) adj[b].append(a) u_dist = [n] * n u_dist[u] = 0 stack = [u] while stack: vertex = stack.pop() for nxt in adj[vertex]: if u_dist[nxt] == n: u_dist[nxt] = u_dist[vertex] + 1 stack.append(nxt) v_dist = [n] * n v_dist[v] = 0 stack = [v] leaves = [] while stack: vertex = stack.pop() isleaf = True for nxt in adj[vertex]: if v_dist[nxt] == n: v_dist[nxt] = v_dist[vertex] + 1 stack.append(nxt) isleaf = False if isleaf: leaves.append(vertex) max_depth = 0 for leaf in leaves: depth = v_dist[leaf] if u_dist[leaf] < depth and max_depth < depth: max_depth = depth print(max_depth - 1)
[ "identifier.change", "control_flow.branch.if.condition.change", "assignment.variable.change", "assignment.value.change", "expression.operation.binary.change" ]
637,997
637,998
u686230543
python
p02834
n,u,v = map(int, input().split( )) u-=1 v-=1 Tr = [[] for _ in range(n)] for i in range(n-1): ai,bi = map(int, input().split( )) ai -=1 bi-=1 Tr[ai].append(bi) Tr[bi].append(ai) Dep_u = [-1] *n Dep_v = [-1] *n Dep_u[u] = 0 Dep_v[v] = 0 from collections import deque ##bfs2回が簡明 def bfs(L,x): Q = deque() Q.append(x) while Q: y = Q.popleft() for z in Tr[y]: if L[z] == -1: L[z] = L[y] + 1 Q.append(z) bfs(Dep_u,u) bfs(Dep_v,v) ans = 1 for i in range(n): if Dep_v[i]>Dep_u[i]: ans = max(ans,Dep_v[i]-1)###v print(ans)
n,u,v = map(int, input().split( )) u-=1 v-=1 Tr = [[] for _ in range(n)] for i in range(n-1): ai,bi = map(int, input().split( )) ai -=1 bi-=1 Tr[ai].append(bi) Tr[bi].append(ai) Dep_u = [-1] *n Dep_v = [-1] *n Dep_u[u] = 0 Dep_v[v] = 0 from collections import deque ##bfs2回が簡明 def bfs(L,x): Q = deque() Q.append(x) while Q: y = Q.popleft() for z in Tr[y]: if L[z] == -1: L[z] = L[y] + 1 Q.append(z) bfs(Dep_u,u) bfs(Dep_v,v) ans = 0###0から for i in range(n): if Dep_v[i]>Dep_u[i]: ans = max(ans,Dep_v[i]-1)###v print(ans)
[ "literal.number.integer.change", "assignment.value.change" ]
638,004
638,005
u520276780
python
p02834
n,u,v = map(int, input().split( )) u-=1 v-=1 Tr = [[] for _ in range(n)] for i in range(n-1): ai,bi = map(int, input().split( )) ai -=1 bi-=1 Tr[ai].append(bi) Tr[bi].append(ai) Dep_u = [-1] *n Dep_v = [-1] *n Dep_u[u] = 0 Dep_v[v] = 0 from collections import deque ##bfs2回が簡明 def bfs(L,x): Q = deque() Q.append(x) while Q: y = Q.popleft() for z in Tr[y]: if L[z] == -1: L[z] = L[y] + 1 Q.append(z) bfs(Dep_u,u) bfs(Dep_v,v) ans = 1 for i in range(n): if Dep_v[i]>Dep_u[i]: ans = max(ans,Dep_u[i]) print(ans)
n,u,v = map(int, input().split( )) u-=1 v-=1 Tr = [[] for _ in range(n)] for i in range(n-1): ai,bi = map(int, input().split( )) ai -=1 bi-=1 Tr[ai].append(bi) Tr[bi].append(ai) Dep_u = [-1] *n Dep_v = [-1] *n Dep_u[u] = 0 Dep_v[v] = 0 from collections import deque ##bfs2回が簡明 def bfs(L,x): Q = deque() Q.append(x) while Q: y = Q.popleft() for z in Tr[y]: if L[z] == -1: L[z] = L[y] + 1 Q.append(z) bfs(Dep_u,u) bfs(Dep_v,v) ans = 0###0から for i in range(n): if Dep_v[i]>Dep_u[i]: ans = max(ans,Dep_v[i]-1)###v print(ans)
[ "literal.number.integer.change", "assignment.value.change", "identifier.change", "call.arguments.change" ]
638,006
638,005
u520276780
python
p02835
a = list(map(int, input().split())) if sum(a) >= 22: print('bust') else: printt('win')
a = list(map(int, input().split())) if sum(a) >= 22: print('bust') else: print('win')
[ "identifier.change", "call.function.change", "io.output.change" ]
638,047
638,048
u471503862
python
p02835
a1,a2,a3 = map(int,input().split()) if a1+a2+a3>=22: print("burst") else: print("win")
a1,a2,a3=map(int,input().split()) if a1+a2+a3>=22: print("bust") else: print("win")
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
638,051
638,052
u287930276
python
p02835
As = list(map(int, input().split())) print("bust" if sum(As) >22 else "win")
As = list(map(int, input().split())) print("bust" if sum(As) >= 22 else "win")
[ "expression.operator.compare.change", "call.arguments.change", "io.output.change" ]
638,053
638,054
u655663334
python
p02835
print('win' if sum(list(map(int,input().split())))<22 else 'burst')
print('win' if sum(list(map(int,input().split())))<22 else 'bust')
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
638,059
638,060
u480264129
python
p02835
# coding: utf-8 a = list(map(int, input().split())) if sum(a) > 21: print("bust") else: print(win)
# coding: utf-8 a = list(map(int, input().split())) if sum(a) > 21: print("bust") else: print("win")
[ "call.arguments.change" ]
638,067
638,068
u502247093
python
p02835
a, b, c = map(int, input().split()) k = a+b+c if k >= 22: print("win") else: print("bust")
a, b, c = map(int, input().split()) k = a+b+c if k >= 22: print("bust") else: print("win")
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
638,069
638,070
u685244071
python
p02835
a = list(map9int, input().split()) if sum(a) >= 22: print('bust') else: print('win')
a = list(map(int, input().split())) if sum(a) >= 22: print('bust') else: print('win')
[ "assignment.value.change", "call.arguments.change", "call.arguments.add" ]
638,079
638,080
u313291636
python
p02835
print("Yes" if sum(list(map(int,input().split())))>=22 else "No")
print("bust" if sum(list(map(int,input().split())))>=22 else "win")
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
638,087
638,088
u383450070
python
p02835
A = list(map(int,input().split())) if sum(A) <= 22: print("bust") else: print("win")
A = list(map(int,input().split())) if sum(A) >= 22: print("bust") else: print("win")
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
638,097
638,098
u364862909
python
p02835
# input A1, A2, A3 = map(int, input().split()) if sum([A1, A2, A3]) <= 22: print("bust") else: print("win")
# input A1, A2, A3 = map(int, input().split()) if sum([A1, A2, A3]) >= 22: print("bust") else: print("win")
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
638,099
638,100
u284363684
python
p02835
A = list(map(int, input.split())) print("bust" if sum(A)>=22 else "win")
A = list(map(int, input().split())) print("bust" if sum(A)>=22 else "win")
[ "call.add" ]
638,111
638,112
u165268875
python
p02835
A = list(map(int, input().split())) print('bust' if sum(a) >= 22 else 'win')
a = list(map(int, input().split())) print('bust' if sum(a) >= 22 else 'win')
[ "assignment.variable.change", "identifier.change" ]
638,119
638,120
u331997680
python
p02835
a,b,c= map(int, input().split()) val = a+b+c if val > 22: print("bust") else: print("win")
a,b,c= map(int, input().split()) val = a+b+c if val > 21: print("bust") else: print("win")
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
638,143
638,144
u605327527
python
p02835
a,b,c = map(int,input().split()) if a+b+c<=21: print("win") else: prnt("bust")
a,b,c = map(int,input().split()) if a+b+c<=21: print("win") else: print("bust")
[ "identifier.change", "call.function.change" ]
638,145
638,146
u592248346
python
p02835
a,b,c = mac(int,input().split()) if a+b+c > 21: print('bust') else: print('win')
a,b,c = map(int,input().split()) if a+b+c > 21: print('bust') else: print('win')
[ "assignment.value.change", "identifier.change", "call.function.change" ]
638,155
638,156
u316390754
python
p02835
print("bust" if sum(list(map(int, input().split()))) > 22 else "win")
print("bust" if sum(list(map(int, input().split()))) >= 22 else "win")
[ "expression.operator.compare.change", "call.arguments.change", "io.output.change" ]
638,161
638,162
u417096287
python
p02835
a,b.c=map(int,input().split()) print('bust' if a+b+c>21 else 'win')
a, b, c = map(int, input().split()) print('bust' if a+b+c > 21 else 'win')
[ "misc.typo", "assignment.variable.change" ]
638,175
638,176
u706786134
python
p02835
a,b,c=[int(i) for i in input().split()] d=a+b+c if d>22: print('bust') else: print('win')
a,b,c=[int(i) for i in input().split()] d=a+b+c if d>=22: print('bust') else: print('win')
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
638,177
638,178
u235066013
python
p02835
a,b,c = map(int, input().split()) if (a+b+c)>22: print('bust') else: print('win')
a,b,c = map(int, input().split()) if (a+b+c)>=22: print('bust') else: print('win')
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
638,188
638,189
u989306199
python
p02835
A = list(map(int, input().split())) total = sum(A) if total > 22: print("bust") else: print("win")
A = list(map(int, input().split())) total = sum(A) if total > 21: print("bust") else: print("win")
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
638,208
638,209
u238084414
python
p02835
a,b,c =input().split() total = int(a) + int(b) + int(c) if total >= 22: print('bust') else: print('won')
a,b,c =input().split() total = int(a) + int(b) + int(c) if total >= 22: print('bust') else: print('win')
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
638,212
638,213
u329817560
python
p02835
A = [map(int, input().split())] print("win" if sum(A) < 22 else "bust")
A = list(map(int, input().split())) print("win" if sum(A) < 22 else "bust")
[ "assignment.value.change", "call.arguments.change" ]
638,214
638,215
u573144253
python
p02835
A = [map(int, input().split())] print("win" if sum(A) >= 22 else "bust")
A = list(map(int, input().split())) print("win" if sum(A) < 22 else "bust")
[ "assignment.value.change", "call.arguments.change", "expression.operator.compare.change", "io.output.change" ]
638,216
638,215
u573144253
python