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 tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Intelligence (AI). Unfortunately, one day the predi...
instruction
0
17,711
1
35,422
Tags: binary search, interactive, probabilities Correct Solution: ``` import sys, random n, k = list(map(int, input().split())) l = 1 r = n b = True while b: while r - l > k * 4 + 1: m = (l + r) // 2 print(l, m) sys.stdout.flush() #ans = "Yes" if random.randint(1, 2) == 1 else "No"...
output
1
17,711
1
35,423
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Intelligence (AI). Unfortunately, one day the predi...
instruction
0
17,712
1
35,424
Tags: binary search, interactive, probabilities Correct Solution: ``` import sys import random n, k = [int(x) for x in input().split()] sson = 2*k + 10 ssoff = 2*k + 10 l = 1 r = n ss = True if r-l > sson else False while True: if ss: al = l ar = (l + r) // 2 print(al, ar) sys.s...
output
1
17,712
1
35,425
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Intelligence (AI). Unfortunately, one day the predi...
instruction
0
17,713
1
35,426
Tags: binary search, interactive, probabilities Correct Solution: ``` import sys import random random.seed() n, k = [int(x) for x in input().split()] sson = 4*k + 1 ssoff = 4*k + 1 l = 1 r = n ss = True if r-l > sson else False while True: if ss: al = l ar = (l + r) // 2 print(al, ar) ...
output
1
17,713
1
35,427
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Inte...
instruction
0
17,714
1
35,428
Yes
output
1
17,714
1
35,429
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Inte...
instruction
0
17,715
1
35,430
Yes
output
1
17,715
1
35,431
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Inte...
instruction
0
17,716
1
35,432
Yes
output
1
17,716
1
35,433
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Inte...
instruction
0
17,717
1
35,434
Yes
output
1
17,717
1
35,435
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Inte...
instruction
0
17,718
1
35,436
No
output
1
17,718
1
35,437
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Inte...
instruction
0
17,719
1
35,438
No
output
1
17,719
1
35,439
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Inte...
instruction
0
17,720
1
35,440
No
output
1
17,720
1
35,441
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Inte...
instruction
0
17,721
1
35,442
No
output
1
17,721
1
35,443
Provide tags and a correct Python 3 solution for this coding contest problem. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 a...
instruction
0
17,947
1
35,894
Tags: brute force, implementation Correct Solution: ``` import sys import math as mt input=sys.stdin.buffer.readline import math as mt #t=int(input()) t=1 for __ in range(t): #n,m=map(int,input().split()) n=int(input()) a=list(map(int,input().split())) mini=min(a[0],a[-1]) i=0 while i<n-2: ...
output
1
17,947
1
35,895
Provide tags and a correct Python 3 solution for this coding contest problem. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 a...
instruction
0
17,948
1
35,896
Tags: brute force, implementation Correct Solution: ``` n, t = int(input()), list(map(int, input().split())) print(min(min(max(t[i], t[i + 1]) for i in range(1, n - 2)), t[0], t[n - 1]) if n > 2 else min(t)) ```
output
1
17,948
1
35,897
Provide tags and a correct Python 3 solution for this coding contest problem. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 a...
instruction
0
17,949
1
35,898
Tags: brute force, implementation Correct Solution: ``` n = int(input()) arr = list(map(int, input().split())) res = min(arr[0], arr[n-1]) for i in range(1, n-1): maxi = max(arr[i], arr[i+1]) res = min(res, maxi) print(res) ```
output
1
17,949
1
35,899
Provide tags and a correct Python 3 solution for this coding contest problem. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 a...
instruction
0
17,950
1
35,900
Tags: brute force, implementation Correct Solution: ``` n=int(input()) ls=list(map(int,input().split())) mn=min(ls[0],ls[n-1]) for i in range (n-2,1,-1): mn=min(mn,max(ls[i],ls[i-1])) print(mn) ```
output
1
17,950
1
35,901
Provide tags and a correct Python 3 solution for this coding contest problem. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 a...
instruction
0
17,951
1
35,902
Tags: brute force, implementation Correct Solution: ``` n = int(input()) a = [int(x) for x in input().split()] ans = min(a[-1], a[0]) for i in range(1, len(a)): current = max(a[i], a[i - 1]) ans = min(ans, current) print(ans) ```
output
1
17,951
1
35,903
Provide tags and a correct Python 3 solution for this coding contest problem. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 a...
instruction
0
17,952
1
35,904
Tags: brute force, implementation Correct Solution: ``` n=int(input()) list1=list(map(int,input().split())) m=min(list1[0],list1[-1]) i=1 while(True): if(i<n and i+1<n): if(list1[i]>=list1[i+1]): m=min(m,list1[i]) i+=1 else: m=min(m,list1[i+1]) i+=2 ...
output
1
17,952
1
35,905
Provide tags and a correct Python 3 solution for this coding contest problem. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 a...
instruction
0
17,953
1
35,906
Tags: brute force, implementation Correct Solution: ``` #walkingOnTheRoad.py n = int(input()) arr = [0] + list(map(int, input().split())) + [0] print(min(max(arr[i], arr[i + 1]) for i in range(n+1))) ```
output
1
17,953
1
35,907
Provide tags and a correct Python 3 solution for this coding contest problem. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 a...
instruction
0
17,954
1
35,908
Tags: brute force, implementation Correct Solution: ``` #!/usr/bin/env python from __future__ import division, print_function import math import os import sys from sys import stdin,stdout from io import BytesIO, IOBase from itertools import accumulate from collections import deque #sys.setrecursionlimit(10**5) if sys.v...
output
1
17,954
1
35,909
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposit...
instruction
0
17,955
1
35,910
Yes
output
1
17,955
1
35,911
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposit...
instruction
0
17,956
1
35,912
Yes
output
1
17,956
1
35,913
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposit...
instruction
0
17,957
1
35,914
Yes
output
1
17,957
1
35,915
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposit...
instruction
0
17,958
1
35,916
Yes
output
1
17,958
1
35,917
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposit...
instruction
0
17,959
1
35,918
No
output
1
17,959
1
35,919
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposit...
instruction
0
17,960
1
35,920
No
output
1
17,960
1
35,921
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposit...
instruction
0
17,961
1
35,922
No
output
1
17,961
1
35,923
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposit...
instruction
0
17,962
1
35,924
No
output
1
17,962
1
35,925
Provide tags and a correct Python 3 solution for this coding contest problem. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite ...
instruction
0
18,075
1
36,150
Tags: geometry Correct Solution: ``` homex,homey = (int(x) for x in input().split(" ")) univx,univy = (int(x) for x in input().split(" ")) n = int(input()) step = 0 for i in range(0,n): a,b,c = (int(x) for x in input().split(" ")) homearea = ((a*homex + b*homey + c) < 0) univarea = ((a*univx + b*univy + ...
output
1
18,075
1
36,151
Provide tags and a correct Python 3 solution for this coding contest problem. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite ...
instruction
0
18,076
1
36,152
Tags: geometry Correct Solution: ``` read = lambda: map(int, input().split()) dist = lambda P, a, b, c: a * P[0] + b * P[1] + c P1, P2 = tuple(read()), tuple(read()) n = int(input()) ans = 0 for i in range(n): a, b, c = read() d1 = dist(P1, a, b, c) d2 = dist(P2, a, b, c) ans += d1 * d2 < 0 print(ans) ...
output
1
18,076
1
36,153
Provide tags and a correct Python 3 solution for this coding contest problem. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite ...
instruction
0
18,077
1
36,154
Tags: geometry Correct Solution: ``` x1, y1 = map(float, input().split()) x2, y2 = map(float, input().split()) n = int(input()) ans = 0 for i in range(n): a, b, c = map(int, input().split()) if (a * x1 + b * y1 + c) * (a * x2 + b * y2 + c) < 0: ans += 1 print(ans) ```
output
1
18,077
1
36,155
Provide tags and a correct Python 3 solution for this coding contest problem. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite ...
instruction
0
18,078
1
36,156
Tags: geometry Correct Solution: ``` x1,y1=map(int,input().split()) x2,y2=map(int,input().split()) n=int(input()) p=0 for i in range(n): a,b,c=map(int,input().split()) zenklas1="" zenklas2="" if a*x1+b*y1+c<0: zenklas1+="-" else: zenklas1+="+" if a*x2+b*y2+c<0: zenklas2+="-" else: zenklas2+="+" if zenkl...
output
1
18,078
1
36,157
Provide tags and a correct Python 3 solution for this coding contest problem. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite ...
instruction
0
18,079
1
36,158
Tags: geometry Correct Solution: ``` def main(): x1, y1 = map(float, input().split()) x2, y2 = map(float, input().split()) n = int(input()) res = 0 for _ in range(n): a, b, c = map(float, input().split()) if a and b: x3, y3, x4, y4 = 0., -c / b, 1., -a / b elif a:...
output
1
18,079
1
36,159
Provide tags and a correct Python 3 solution for this coding contest problem. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite ...
instruction
0
18,080
1
36,160
Tags: geometry Correct Solution: ``` ct = 0 x1, y1 = map(int, input().split(' ')) x2, y2 = map(int, input().split(' ')) for i in range(int(input())): a, b, c = map(int, input().split(' ')) if b == 0: if x1 < -c / a < x2 or x2 < -c/a < x1: ct += 1 else: b1 = y1 > (-a * x1 - c) / b...
output
1
18,080
1
36,161
Provide tags and a correct Python 3 solution for this coding contest problem. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite ...
instruction
0
18,081
1
36,162
Tags: geometry Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * from fractions import * from bisect import * from heapq import* from io import BytesIO, IOBase def vsInput(): sys.stdin = open('input.txt', 'r') sys...
output
1
18,081
1
36,163
Provide tags and a correct Python 3 solution for this coding contest problem. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite ...
instruction
0
18,082
1
36,164
Tags: geometry Correct Solution: ``` h1,h2=input().split() u1,u2=input().split() h1,h2=int(h1),int(h2) u1,u2=int(u1),int(u2) n=int(input()) lis=[] for i in range(n): lis.append(input().split()) for i in range(n): for j in range(3): lis[i][j]=int(lis[i][j]) def status(a,b,lis): if a*lis[0]+b*lis[1]+...
output
1
18,082
1
36,165
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plan...
instruction
0
18,083
1
36,166
Yes
output
1
18,083
1
36,167
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plan...
instruction
0
18,084
1
36,168
Yes
output
1
18,084
1
36,169
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plan...
instruction
0
18,085
1
36,170
Yes
output
1
18,085
1
36,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plan...
instruction
0
18,086
1
36,172
Yes
output
1
18,086
1
36,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plan...
instruction
0
18,087
1
36,174
No
output
1
18,087
1
36,175
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plan...
instruction
0
18,088
1
36,176
No
output
1
18,088
1
36,177
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plan...
instruction
0
18,089
1
36,178
No
output
1
18,089
1
36,179
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plan...
instruction
0
18,090
1
36,180
No
output
1
18,090
1
36,181
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves volleyball very much. One day he was running late for a volleyball match. Petya hasn't bought his own car yet, that's why he had to take a taxi. The city has n junctions, some of which are connected by two-way roads. The length o...
instruction
0
18,284
1
36,568
Tags: shortest paths Correct Solution: ``` import os import sys from io import BytesIO, IOBase # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in fi...
output
1
18,284
1
36,569
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves volleyball very much. One day he was running late for a volleyball match. Petya hasn't bought his own car yet, that's why he had to take a taxi. The city has n junctions, some of which are connected by two-way roads. The length o...
instruction
0
18,285
1
36,570
Tags: shortest paths Correct Solution: ``` import os import sys from io import BytesIO, IOBase # region fastio BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in fi...
output
1
18,285
1
36,571
Provide a correct Python 3 solution for this coding contest problem. In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two i...
instruction
0
18,403
1
36,806
"Correct Solution: ``` from sys import stdin input = stdin.readline n, m = map(int,input().split()) from1 = [0]*(n+1) ton = [0]*(n+1) for i in range(m): a, b = map(int,input().split()) if a == 1: from1[b] = 1 if b == n: ton[a] = 1 for i in range(n+1): if from1[i] and ton[i]: print("POSSIBLE") ...
output
1
18,403
1
36,807
Provide a correct Python 3 solution for this coding contest problem. In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two i...
instruction
0
18,404
1
36,808
"Correct Solution: ``` def examC(): def bfs(n, e, fordfs): # 点の数、スタートの点、有向グラフ W = [-1] * n # 各点の状態量、最短距離とか,見たかどうかとか W[e] = 0 que = deque() que.append(e) while que: now = que.popleft() nowW = W[now] for ne in fordfs[now]: ...
output
1
18,404
1
36,809
Provide a correct Python 3 solution for this coding contest problem. In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two i...
instruction
0
18,405
1
36,810
"Correct Solution: ``` import sys, math, itertools, collections, heapq sys.setrecursionlimit(10 ** 7) pinf = float("inf") ninf = -float("inf") n, m = map(int, input().split()) edge = [[] for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) edge[a - 1].append(b - 1) edge[b - 1].append(a - 1...
output
1
18,405
1
36,811
Provide a correct Python 3 solution for this coding contest problem. In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two i...
instruction
0
18,406
1
36,812
"Correct Solution: ``` # -*- coding: utf-8 -*- N, M = map(int, input().split()) from1 = [] gotoN = [] for m in range(M): a, b = list(map(int, input().split())) if a==1: from1.append(b) if b==N: gotoN.append(a) can = set(from1) & set(gotoN) if len(can) > 0: print('POSSIBLE') else: ...
output
1
18,406
1
36,813
Provide a correct Python 3 solution for this coding contest problem. In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two i...
instruction
0
18,407
1
36,814
"Correct Solution: ``` def ri(): return int(input()) def rli(): return list(map(int, input().split())) def ris(): return list(input()) def pli(a): return "".join(list(map(str, a))) N, M = rli() keiro = [[False for i in range(2)] for j in range(N+1)] for i in range(M): a, b = rli() if(b == 1 or b == N): ...
output
1
18,407
1
36,815