message
stringlengths
2
22.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
16
109k
cluster
float64
1
1
__index_level_0__
int64
32
217k
Provide a correct Python 3 solution for this coding contest problem. Problem I Starting a Scenic Railroad Service Jim, working for a railroad company, is responsible for planning a new tourist train service. He is sure that the train route along a scenic valley will arise a big boom, but not quite sure how big the bo...
instruction
0
49,565
1
99,130
"Correct Solution: ``` from bisect import bisect n = int(input()) P = [list(map(int, input().split())) for i in range(n)] M = 10**5+1 def policy1(P): A = [a for a, b in P] B = [b for a, b in P] A.sort(); B.sort() ans = 1 for a, b in P: left = bisect(B, a) right = n - bisect(A, b-1)...
output
1
49,565
1
99,131
Provide a correct Python 3 solution for this coding contest problem. Problem I Starting a Scenic Railroad Service Jim, working for a railroad company, is responsible for planning a new tourist train service. He is sure that the train route along a scenic valley will arise a big boom, but not quite sure how big the bo...
instruction
0
49,566
1
99,132
"Correct Solution: ``` #!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS():return li...
output
1
49,566
1
99,133
Provide a correct Python 3 solution for this coding contest problem. Divide and rule Taro, Hanako, and Jiro rule the JAG Kingdom together. There are N cities in the JAG Kingdom, some of which are connected by two-way roads. You can always reach all the other cities from any city via one or more roads. One day, Taro ...
instruction
0
49,583
1
99,166
"Correct Solution: ``` #!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return list(map(int, sys.stdin.readline().split())) def I(): return int(sys.stdin.readline()) def LS():return li...
output
1
49,583
1
99,167
Provide a correct Python 3 solution for this coding contest problem. Divide and rule Taro, Hanako, and Jiro rule the JAG Kingdom together. There are N cities in the JAG Kingdom, some of which are connected by two-way roads. You can always reach all the other cities from any city via one or more roads. One day, Taro ...
instruction
0
49,584
1
99,168
"Correct Solution: ``` import sys input = sys.stdin.readline def main(): while True: N, M = map(int, input().split()) if N == 0: break path = [[False] * N for i in range(N)] for i in range(M): u, v = map(int, input().split()) u -= 1; v -= 1; ...
output
1
49,584
1
99,169
Provide a correct Python 3 solution for this coding contest problem. Divide and rule Taro, Hanako, and Jiro rule the JAG Kingdom together. There are N cities in the JAG Kingdom, some of which are connected by two-way roads. You can always reach all the other cities from any city via one or more roads. One day, Taro ...
instruction
0
49,585
1
99,170
"Correct Solution: ``` import sys sys.setrecursionlimit(5000) def dfs(x): global ng, parity for v in adj[x]: if parity[v] == parity[x]: ng = True return elif parity[v] < 0: parity[v] = 1^parity[x] dfs(v) return while True: n, m = map(int,...
output
1
49,585
1
99,171
Provide a correct Python 3 solution for this coding contest problem. Divide and rule Taro, Hanako, and Jiro rule the JAG Kingdom together. There are N cities in the JAG Kingdom, some of which are connected by two-way roads. You can always reach all the other cities from any city via one or more roads. One day, Taro ...
instruction
0
49,586
1
99,172
"Correct Solution: ``` from collections import defaultdict import sys sys.setrecursionlimit(1000000) def dfs(graph, visited, x, c): visited[x] = c for nx in graph[x]: if visited[nx] == c: return False if visited[nx] == 0 and not dfs(graph, visited, nx, -c): return False return True while Tr...
output
1
49,586
1
99,173
Provide tags and a correct Python 3 solution for this coding contest problem. There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken ...
instruction
0
50,177
1
100,354
Tags: binary search, brute force, dp, greedy, sortings Correct Solution: ``` def list_input(): return list(map(int,input().split())) def map_input(): return map(int,input().split()) def map_string(): return input().split() n,k,p = map_input() a = list_input() b = list_input() a.sort() b.sort() ans = 10...
output
1
50,177
1
100,355
Provide tags and a correct Python 3 solution for this coding contest problem. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city. Cities are labeled ...
instruction
0
50,184
1
100,368
Tags: dp Correct Solution: ``` n=int(input()) a=[0]*n for i in range(n-1): for j in input().split(): a[int(j)-1]+=1 l=a.count(1) print((l*2**(n-l+1)+(n-l)*2**(n-l))%1000000007) ```
output
1
50,184
1
100,369
Provide tags and a correct Python 3 solution for this coding contest problem. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city. Cities are labeled ...
instruction
0
50,185
1
100,370
Tags: dp Correct Solution: ``` n=int(input()) a = [0]*(n+1) for i in range(n-1): for i in input().split(): a[int(i)]+=1 l = a.count(1) print ((l*2**(n-l+1)+(n-l)*(2**(n-l)))%(10**9+7)) ```
output
1
50,185
1
100,371
Provide tags and a correct Python 3 solution for this coding contest problem. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city. Cities are labeled ...
instruction
0
50,186
1
100,372
Tags: dp Correct Solution: ``` n = int(input()) cnt = [[] for _ in range(n)] for i in range (n - 1): fr, to = map(int, input().split()) cnt[fr - 1].append(to - 1); cnt[to - 1].append(fr - 1); l = 0 for i in range(n): if (len(cnt[i]) == 1): l += 1 ans = (n - l) * pow(2, n - l, 10 ** 9 + 7) ans +=...
output
1
50,186
1
100,373
Provide tags and a correct Python 3 solution for this coding contest problem. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city. Cities are labeled ...
instruction
0
50,187
1
100,374
Tags: dp Correct Solution: ``` def quick_mod(b, p) : s = 1 while (p != 0) : if (p & 1) : s = s * b % mod p = p // 2 b = b * b % mod return s s = input().split() n = int(s[0]) N = 100000 mod = 1000000007 enter = [] for i in range(1, N + 5) : enter.append(0) for i in range(1, n) : ...
output
1
50,187
1
100,375
Provide tags and a correct Python 3 solution for this coding contest problem. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city. Cities are labeled ...
instruction
0
50,188
1
100,376
Tags: dp Correct Solution: ``` n = int(input()) degree = n*[0] for i in range(0, n-1): u, v = input().split() u = int(u) v = int(v) u -= 1 v -= 1 degree[u] += 1 degree[v] += 1 numL = 0 for i in range(0, n): if degree[i] == 1: numL += 1 mod = 1000000007 ans = (n-numL)*2**(n-numL) ...
output
1
50,188
1
100,377
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is rea...
instruction
0
50,189
1
100,378
No
output
1
50,189
1
100,379
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is rea...
instruction
0
50,190
1
100,380
No
output
1
50,190
1
100,381
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is rea...
instruction
0
50,191
1
100,382
No
output
1
50,191
1
100,383
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is rea...
instruction
0
50,192
1
100,384
No
output
1
50,192
1
100,385
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi's office has N rooms. Each room has an ID from 1 to N. There are also N-1 corridors, and the i-th corridor connects Room a_i and Room b_i. It is known that we can travel between any tw...
instruction
0
50,329
1
100,658
No
output
1
50,329
1
100,659
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi's office has N rooms. Each room has an ID from 1 to N. There are also N-1 corridors, and the i-th corridor connects Room a_i and Room b_i. It is known that we can travel between any tw...
instruction
0
50,330
1
100,660
No
output
1
50,330
1
100,661
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi's office has N rooms. Each room has an ID from 1 to N. There are also N-1 corridors, and the i-th corridor connects Room a_i and Room b_i. It is known that we can travel between any tw...
instruction
0
50,331
1
100,662
No
output
1
50,331
1
100,663
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi's office has N rooms. Each room has an ID from 1 to N. There are also N-1 corridors, and the i-th corridor connects Room a_i and Room b_i. It is known that we can travel between any tw...
instruction
0
50,332
1
100,664
No
output
1
50,332
1
100,665
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n cities in the kingdom X, numbered from 1 through n. People travel between cities by some one-way roads. As a passenger, JATC finds it weird that from any city u, he can't start a tri...
instruction
0
50,506
1
101,012
No
output
1
50,506
1
101,013
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n cities in the kingdom X, numbered from 1 through n. People travel between cities by some one-way roads. As a passenger, JATC finds it weird that from any city u, he can't start a tri...
instruction
0
50,507
1
101,014
No
output
1
50,507
1
101,015
Provide tags and a correct Python 3 solution for this coding contest problem. They say that Berland has exactly two problems, fools and roads. Besides, Berland has n cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there are many fools in Berland, between each pair of ...
instruction
0
50,760
1
101,520
Tags: data structures, dfs and similar, trees Correct Solution: ``` # solved using sparse table from math import log2 def construct(root): stack = [root] while stack: u = stack.pop() for v in edges[u]: if v != parents[u]: parents[v] = u levels[v] = le...
output
1
50,760
1
101,521
Provide tags and a correct Python 3 solution for this coding contest problem. They say that Berland has exactly two problems, fools and roads. Besides, Berland has n cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there are many fools in Berland, between each pair of ...
instruction
0
50,761
1
101,522
Tags: data structures, dfs and similar, trees Correct Solution: ``` import os import sys from io import BytesIO, IOBase from types import GeneratorType from collections import defaultdict BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self...
output
1
50,761
1
101,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. They say that Berland has exactly two problems, fools and roads. Besides, Berland has n cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there a...
instruction
0
50,762
1
101,524
No
output
1
50,762
1
101,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. They say that Berland has exactly two problems, fools and roads. Besides, Berland has n cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there a...
instruction
0
50,763
1
101,526
No
output
1
50,763
1
101,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. They say that Berland has exactly two problems, fools and roads. Besides, Berland has n cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there a...
instruction
0
50,764
1
101,528
No
output
1
50,764
1
101,529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. They say that Berland has exactly two problems, fools and roads. Besides, Berland has n cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there a...
instruction
0
50,765
1
101,530
No
output
1
50,765
1
101,531
Provide tags and a correct Python 3 solution for this coding contest problem. You are organizing a cycling race on the streets of the city. The city contains n junctions, some pairs of them are connected by roads; on each road you can move in any direction. No two roads connect the same pair of intersections, and no r...
instruction
0
50,882
1
101,764
Tags: dfs and similar, graphs Correct Solution: ``` from typing import List import sys n, m = [int(a) for a in input().split(' ')] adj: List[List[int]] = [[]] + [[] for _ in range(n)] visited: List[bool] = [False] * (n + 1) parent: List[int] = [0] * (n + 1) depth: List[int] = [0] * (n + 1) low: List[int] = [0] * (n ...
output
1
50,882
1
101,765
Provide tags and a correct Python 3 solution for this coding contest problem. You are organizing a cycling race on the streets of the city. The city contains n junctions, some pairs of them are connected by roads; on each road you can move in any direction. No two roads connect the same pair of intersections, and no r...
instruction
0
50,883
1
101,766
Tags: dfs and similar, graphs Correct Solution: ``` from typing import List import sys n, m = [int(a) for a in input().split(' ')] adj: List[List[int]] = [[]] + [[] for _ in range(n)] visited: List[bool] = [False] * (n + 1) parent: List[int] = [0] * (n + 1) depth: List[int] = [0] * (n + 1) low: List[int] = [0] * ...
output
1
50,883
1
101,767
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are organizing a cycling race on the streets of the city. The city contains n junctions, some pairs of them are connected by roads; on each road you can move in any direction. No two roads c...
instruction
0
50,884
1
101,768
No
output
1
50,884
1
101,769
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are organizing a cycling race on the streets of the city. The city contains n junctions, some pairs of them are connected by roads; on each road you can move in any direction. No two roads c...
instruction
0
50,885
1
101,770
No
output
1
50,885
1
101,771
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are organizing a cycling race on the streets of the city. The city contains n junctions, some pairs of them are connected by roads; on each road you can move in any direction. No two roads c...
instruction
0
50,886
1
101,772
No
output
1
50,886
1
101,773
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are organizing a cycling race on the streets of the city. The city contains n junctions, some pairs of them are connected by roads; on each road you can move in any direction. No two roads c...
instruction
0
50,887
1
101,774
No
output
1
50,887
1
101,775
Provide tags and a correct Python 3 solution for this coding contest problem. A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are <image> roads in total. It takes exactly y seconds to traverse any single road. A spanning tree is a set of roads...
instruction
0
50,931
1
101,862
Tags: dfs and similar, dp, graph matchings, greedy, trees Correct Solution: ``` from collections import defaultdict from collections import deque from functools import reduce n, x, y = [int(x) for x in input().split()] E = defaultdict(set) for i in range(n-1): u, v = [int(x) for x in input().split()] E[u].add(v...
output
1
50,931
1
101,863
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are <image> roads in total. It takes exactly y seconds to traverse any ...
instruction
0
50,932
1
101,864
No
output
1
50,932
1
101,865
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are <image> roads in total. It takes exactly y seconds to traverse any ...
instruction
0
50,933
1
101,866
No
output
1
50,933
1
101,867
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are <image> roads in total. It takes exactly y seconds to traverse any ...
instruction
0
50,934
1
101,868
No
output
1
50,934
1
101,869
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are <image> roads in total. It takes exactly y seconds to traverse any ...
instruction
0
50,935
1
101,870
No
output
1
50,935
1
101,871
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's the turn of the year, so Bash wants to send presents to his friends. There are n cities in the Himalayan region and they are connected by m bidirectional roads. Bash is living in city s. Ba...
instruction
0
50,979
1
101,958
No
output
1
50,979
1
101,959
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's the turn of the year, so Bash wants to send presents to his friends. There are n cities in the Himalayan region and they are connected by m bidirectional roads. Bash is living in city s. Ba...
instruction
0
50,980
1
101,960
No
output
1
50,980
1
101,961
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's the turn of the year, so Bash wants to send presents to his friends. There are n cities in the Himalayan region and they are connected by m bidirectional roads. Bash is living in city s. Ba...
instruction
0
50,981
1
101,962
No
output
1
50,981
1
101,963
Provide a correct Python 3 solution for this coding contest problem. There is an infinitely long street that runs west to east, which we consider as a number line. There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5. Q people are ...
instruction
0
51,107
1
102,214
"Correct Solution: ``` import sys input=sys.stdin.readline import heapq n,q=map(int,input().split()) l=[list(map(int,input().split())) for i in range(n)] L1=[] for i in range(n): L1.append((l[i][0]-l[i][2],1,l[i][2])) L1.append((l[i][1]-l[i][2],-1,l[i][2])) for i in range(q): L1.append((int(input()),2,0)) L1.sort...
output
1
51,107
1
102,215
Provide a correct Python 3 solution for this coding contest problem. There is an infinitely long street that runs west to east, which we consider as a number line. There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5. Q people are ...
instruction
0
51,108
1
102,216
"Correct Solution: ``` from bisect import bisect_left N,Q = (int(x) for x in input().split()) stop_arr = [tuple(map(int, input().split())) for _ in range(N)] Q_arr = [int(input()) for _ in range(Q)] stop_arr.sort(key=lambda x:x[2]) ans_arr = [-1]*Q skip_arr = [-1]*(Q+1) for s,t,x in stop_arr: q_start = bisect_...
output
1
51,108
1
102,217
Provide a correct Python 3 solution for this coding contest problem. There is an infinitely long street that runs west to east, which we consider as a number line. There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5. Q people are ...
instruction
0
51,109
1
102,218
"Correct Solution: ``` #!/usr/bin/env python3 import sys, math, itertools, collections, bisect, heapq input = lambda: sys.stdin.buffer.readline() inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 n,q=map(int,input().split()) STX=[tuple(map(int,input().split())) for i in range(n)] D=[int(input()...
output
1
51,109
1
102,219
Provide a correct Python 3 solution for this coding contest problem. There is an infinitely long street that runs west to east, which we consider as a number line. There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5. Q people are ...
instruction
0
51,110
1
102,220
"Correct Solution: ``` from bisect import bisect_left,bisect_right n,q=map(int,input().split()) w=[list(map(int,input().split()))[::-1]for _ in range(n)] p=[int(input())for _ in range(q)] w.sort() ans=[-1]*q to=[-1]*q for x,t,s in w: l,r=bisect_left(p,s-x),bisect_left(p,t-x) while l<r: if to[l]==-1: ans[l...
output
1
51,110
1
102,221
Provide a correct Python 3 solution for this coding contest problem. There is an infinitely long street that runs west to east, which we consider as a number line. There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5. Q people are ...
instruction
0
51,111
1
102,222
"Correct Solution: ``` from heapq import heappop,heappush N,Q=map(int,input().split()) event=[] q=[] for _ in range(N): S,T,X=map(int,input().split()) event.append([S-X,1,X]) event.append([T-X,-1,X]) for i in range(Q): event.append([int(input()),2,i]) stop_set=set() event.sort() q=[] for pos,m,x i...
output
1
51,111
1
102,223
Provide a correct Python 3 solution for this coding contest problem. There is an infinitely long street that runs west to east, which we consider as a number line. There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5. Q people are ...
instruction
0
51,112
1
102,224
"Correct Solution: ``` from heapq import heappush, heappop import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) N, Q = map(int, input().split()) STX = [[int(x) for x in input().split()] for _ in range(N)] EVENT = [] for s, t, x in STX: EVENT.append((s-x, 1, x)) EVENT.append((t-x, 0, x)) for i ...
output
1
51,112
1
102,225
Provide a correct Python 3 solution for this coding contest problem. There is an infinitely long street that runs west to east, which we consider as a number line. There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5. Q people are ...
instruction
0
51,113
1
102,226
"Correct Solution: ``` import sys from heapq import heappop,heappush input = sys.stdin.readline n,Q = map(int,input().split()) stx = [list(map(int,input().split())) for i in range(n)] dls = [int(input()) for i in range(Q)] event = [] for i in range(n): s,t,x = stx[i] event.append((s-x,1,x)) event.append((t-x,-1,x...
output
1
51,113
1
102,227
Provide a correct Python 3 solution for this coding contest problem. There is an infinitely long street that runs west to east, which we consider as a number line. There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5. Q people are ...
instruction
0
51,114
1
102,228
"Correct Solution: ``` from bisect import bisect_left from operator import itemgetter n, q = map(int, input().split()) stx = [tuple(int(x) for x in input().split()) for _ in range(n)] d = [int(input()) for _ in range(q)] ans = [-1] * q skip = [-1] * q stx.sort(key=itemgetter(2)) for s, t, x in stx: L = bisect_l...
output
1
51,114
1
102,229