message
stringlengths
2
45.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
254
108k
cluster
float64
3
3
__index_level_0__
int64
508
217k
Provide a correct Python 3 solution for this coding contest problem. Professor Tsukuba invented a mysterious jewelry box that can be opened with a special gold key whose shape is very strange. It is composed of gold bars joined at their ends. Each gold bar has the same length and is placed parallel to one of the three...
instruction
0
55,552
3
111,104
"Correct Solution: ``` # 実際に判定を行う def solve(key1, key2): key2 = Normalization(key2) for _ in range(4): key1 = x_rotate(key1) for __ in range(4): key1 = y_rotate(key1) for ___ in range(4): key1 = z_rotate(key1) ans = True for...
output
1
55,552
3
111,105
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 good old times dwarves tried to develop extrasensory abilities: * Exactly n dwarves entered completely dark cave. * Each dwarf received a hat — white or...
instruction
0
55,627
3
111,254
No
output
1
55,627
3
111,255
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 good old times dwarves tried to develop extrasensory abilities: * Exactly n dwarves entered completely dark cave. * Each dwarf received a hat — white or...
instruction
0
55,628
3
111,256
No
output
1
55,628
3
111,257
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 good old times dwarves tried to develop extrasensory abilities: * Exactly n dwarves entered completely dark cave. * Each dwarf received a hat — white or...
instruction
0
55,629
3
111,258
No
output
1
55,629
3
111,259
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 good old times dwarves tried to develop extrasensory abilities: * Exactly n dwarves entered completely dark cave. * Each dwarf received a hat — white or...
instruction
0
55,630
3
111,260
No
output
1
55,630
3
111,261
Provide tags and a correct Python 3 solution for this coding contest problem. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints on the trail. They are numbered by 0, 1, ..., n...
instruction
0
55,828
3
111,656
Tags: constructive algorithms, greedy, sortings Correct Solution: ``` import sys r = sys.stdin.readline for _ in range(int(r())): N, M = map(int, r().split()) L = [] a = [] for i in range(N): k = sorted(list(map(int, r().split()))) L.append(k) for j in k: a.append(j...
output
1
55,828
3
111,657
Provide tags and a correct Python 3 solution for this coding contest problem. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints on the trail. They are numbered by 0, 1, ..., n...
instruction
0
55,829
3
111,658
Tags: constructive algorithms, greedy, sortings Correct Solution: ``` from bisect import bisect,bisect_left from collections import * from math import gcd,ceil,sqrt,floor,inf from heapq import * from itertools import * from operator import add,mul,sub,xor,truediv,floordiv from functools import * #-------------------...
output
1
55,829
3
111,659
Provide tags and a correct Python 3 solution for this coding contest problem. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints on the trail. They are numbered by 0, 1, ..., n...
instruction
0
55,830
3
111,660
Tags: constructive algorithms, greedy, sortings Correct Solution: ``` def main(): t = int(input()) for _ in range(t): n, m = map(int, input().split()) board = []; all_runs = [] for i in range(n): b = list(map(int, input().split())) board.append(b) for ...
output
1
55,830
3
111,661
Provide tags and a correct Python 3 solution for this coding contest problem. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints on the trail. They are numbered by 0, 1, ..., n...
instruction
0
55,831
3
111,662
Tags: constructive algorithms, greedy, sortings Correct Solution: ``` import sys import math from collections import defaultdict from sys import stdin input=stdin.readline m=10**9+7 sys.setrecursionlimit(10**5) T=int(input()) for _ in range(T): n,m=map(int,input().split()) f=1 path=[] rm=[] for i in...
output
1
55,831
3
111,663
Provide tags and a correct Python 3 solution for this coding contest problem. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints on the trail. They are numbered by 0, 1, ..., n...
instruction
0
55,832
3
111,664
Tags: constructive algorithms, greedy, sortings Correct Solution: ``` for _ in range(int(input())): n,m=list(map(int,input().split())) l=[list(map(int,input().split())) for i in range(n)] par=[] for i in range(n): for j in range(m): par.append([l[i][j],i,j,0]) par.sort() ans=...
output
1
55,832
3
111,665
Provide tags and a correct Python 3 solution for this coding contest problem. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints on the trail. They are numbered by 0, 1, ..., n...
instruction
0
55,833
3
111,666
Tags: constructive algorithms, greedy, sortings Correct Solution: ``` tests = int(input()) for case in range(tests): n,m=(int(i) for i in input().split()) p=[sorted([int(i) for i in input().split()]) for j in range(n)] pp=[[] for i in p] for iii in range(m): mn=min(range(n),key=lambda x:p[x][0])...
output
1
55,833
3
111,667
Provide tags and a correct Python 3 solution for this coding contest problem. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints on the trail. They are numbered by 0, 1, ..., n...
instruction
0
55,834
3
111,668
Tags: constructive algorithms, greedy, sortings Correct Solution: ``` # SHRi GANESHA author: Kunal Verma # import os import sys from collections import Counter from io import BytesIO, IOBase from math import gcd, inf, sqrt, ceil, floor def lcm(a, b): return (a * b) // gcd(a, b) ''' mod = 10 ** 9 + 7 ...
output
1
55,834
3
111,669
Provide tags and a correct Python 3 solution for this coding contest problem. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints on the trail. They are numbered by 0, 1, ..., n...
instruction
0
55,835
3
111,670
Tags: constructive algorithms, greedy, sortings Correct Solution: ``` import sys import os.path from collections import * import math import bisect if (os.path.exists('input.txt')): sys.stdin = open("input.txt", "r") sys.stdout = open("output.txt", "w") ############## Code starts here ########################...
output
1
55,835
3
111,671
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints ...
instruction
0
55,836
3
111,672
Yes
output
1
55,836
3
111,673
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints ...
instruction
0
55,837
3
111,674
Yes
output
1
55,837
3
111,675
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints ...
instruction
0
55,838
3
111,676
Yes
output
1
55,838
3
111,677
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints ...
instruction
0
55,839
3
111,678
Yes
output
1
55,839
3
111,679
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints ...
instruction
0
55,840
3
111,680
No
output
1
55,840
3
111,681
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints ...
instruction
0
55,841
3
111,682
No
output
1
55,841
3
111,683
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints ...
instruction
0
55,842
3
111,684
No
output
1
55,842
3
111,685
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The 2050 volunteers are organizing the "Run! Chase the Rising Sun" activity. Starting on Apr 25 at 7:30 am, runners will complete the 6km trail around the Yunqi town. There are n+1 checkpoints ...
instruction
0
55,843
3
111,686
No
output
1
55,843
3
111,687
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Berlanders like to eat cones after a hard day. Misha Square and Sasha Circle are local authorities of Berland. Each of them controls its points of cone trade. Misha has n points, Sasha — m. Sinc...
instruction
0
56,033
3
112,066
No
output
1
56,033
3
112,067
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Berlanders like to eat cones after a hard day. Misha Square and Sasha Circle are local authorities of Berland. Each of them controls its points of cone trade. Misha has n points, Sasha — m. Sinc...
instruction
0
56,034
3
112,068
No
output
1
56,034
3
112,069
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Berlanders like to eat cones after a hard day. Misha Square and Sasha Circle are local authorities of Berland. Each of them controls its points of cone trade. Misha has n points, Sasha — m. Sinc...
instruction
0
56,035
3
112,070
No
output
1
56,035
3
112,071
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Berlanders like to eat cones after a hard day. Misha Square and Sasha Circle are local authorities of Berland. Each of them controls its points of cone trade. Misha has n points, Sasha — m. Sinc...
instruction
0
56,036
3
112,072
No
output
1
56,036
3
112,073
Provide a correct Python 3 solution for this coding contest problem. Taro is very good at 8 puzzles and always has his friends sort them out during breaks. At that time, my friend asked me, "Can you solve more complicated puzzles?", But I have never done other puzzles. Apparently the friend made 11 puzzles by himself....
instruction
0
56,344
3
112,688
"Correct Solution: ``` from heapq import heappush, heappop comp = [(1, 1), (2, 1), (3, 1), (0, 2), (1, 2), (2, 2), (3, 2), (4, 2), (1, 3), (2, 3), (3, 3)] numbers = range(11) zeros = (11, 12) def manhattan(v1, v2): x1, y1 = v1 x2, y2 = v2 return abs(x2 - x1) + abs(y2 - y1) def heuristic(state):...
output
1
56,344
3
112,689
Provide a correct Python 3 solution for this coding contest problem. Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. <image> In the starting points (top of the figure), numbers are assigned...
instruction
0
57,053
3
114,106
"Correct Solution: ``` w = int(input()) n = int(input()) lst = [i for i in range(1, w+1)] for i in range(n) : a, b = map(int, input().split(',')) lst[a-1], lst[b-1] = lst[b-1], lst[a-1] for i in lst : print(i) ```
output
1
57,053
3
114,107
Provide a correct Python 3 solution for this coding contest problem. Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. <image> In the starting points (top of the figure), numbers are assigned...
instruction
0
57,058
3
114,116
"Correct Solution: ``` w = int(input()) n = int(input()) nums = list(range(1, w + 1)) for i in range(n): ab = input().split(",") a = int(ab[0]) - 1 b = int(ab[1]) - 1 _a = nums[a] nums[a] = nums[b] nums[b] = _a print("\n".join([str(n) for n in nums])) ```
output
1
57,058
3
114,117
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. <image> In the s...
instruction
0
57,061
3
114,122
Yes
output
1
57,061
3
114,123
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. <image> In the s...
instruction
0
57,063
3
114,126
Yes
output
1
57,063
3
114,127
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. <image> In the s...
instruction
0
57,064
3
114,128
Yes
output
1
57,064
3
114,129
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. <image> In the s...
instruction
0
57,068
3
114,136
No
output
1
57,068
3
114,137
Provide a correct Python 3 solution for this coding contest problem. Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father. It was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zhinü. Unnishiki has a short life...
instruction
0
57,069
3
114,138
"Correct Solution: ``` class Vector: def __init__(self, x, y): self.x = x self.y = y def __sub__(self, other): return Vector(self.x - other.x, self.y - other.y) @staticmethod def cross_product(point1, point2): return point1.x * point2.y - point1.y * point2.x class Tri...
output
1
57,069
3
114,139
Provide a correct Python 3 solution for this coding contest problem. Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father. It was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zhinü. Unnishiki has a short life...
instruction
0
57,070
3
114,140
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0143 """ import sys from sys import stdin input = stdin.readline from math import sqrt, atan2, acos, sin, cos class Point(object): epsilon = 1e-10 def __init__(self, x=0.0, y=0.0): if isinstan...
output
1
57,070
3
114,141
Provide a correct Python 3 solution for this coding contest problem. Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father. It was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zhinü. Unnishiki has a short life...
instruction
0
57,071
3
114,142
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0143 """ import sys from sys import stdin input = stdin.readline from math import sqrt, atan2, acos, sin, cos class Point(object): epsilon = 1e-10 def __init__(self, x=0.0, y=0.0): if isinstan...
output
1
57,071
3
114,143
Provide a correct Python 3 solution for this coding contest problem. Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father. It was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zhinü. Unnishiki has a short life...
instruction
0
57,072
3
114,144
"Correct Solution: ``` def sign(p1, p2, p3): return (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1]) def check(triangle, pt): v1 = [triangle[0], triangle[1]] v2 = [triangle[2], triangle[3]] v3 = [triangle[4], triangle[5]] b1 = sign(pt, v1, v2) if b1 > 0: flag1 = 1...
output
1
57,072
3
114,145
Provide a correct Python 3 solution for this coding contest problem. Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father. It was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zhinü. Unnishiki has a short life...
instruction
0
57,073
3
114,146
"Correct Solution: ``` # AOJ 0143 Altair and Vega # Python3 2018.6.18 bal4u # a, b, はラインの同一側にあるか def is_atSameSide(a, b, line): sa = (line[1].real-line[0].real)*(a.imag-line[0].imag) \ + (line[1].imag-line[0].imag)*(line[0].real-a.real); sb = (line[1].real-line[0].real)*(b.imag-line[0].imag) \ + (line[1].imag-...
output
1
57,073
3
114,147
Provide a correct Python 3 solution for this coding contest problem. Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father. It was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zhinü. Unnishiki has a short life...
instruction
0
57,074
3
114,148
"Correct Solution: ``` EPS=1e-10 def crossP(aa,bb,cc,dd): a = (bb-aa).real b = (cc-dd).real c = (bb-aa).imag d = (cc-dd).imag e = (cc-aa).real f = (cc-aa).imag det = a*d - b*c if abs(det) <EPS: return(-9999+(-9999)*1j) x = (d*e-b*f)/det y = (-c*e+a*f)/det return(x+y*1...
output
1
57,074
3
114,149
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father. It was a pleasure of the Emperor to wear clothes made of a splendid cloth cal...
instruction
0
57,075
3
114,150
No
output
1
57,075
3
114,151
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character,...
instruction
0
57,532
3
115,064
Yes
output
1
57,532
3
115,065
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character,...
instruction
0
57,533
3
115,066
Yes
output
1
57,533
3
115,067
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character,...
instruction
0
57,534
3
115,068
Yes
output
1
57,534
3
115,069
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character,...
instruction
0
57,535
3
115,070
Yes
output
1
57,535
3
115,071
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character,...
instruction
0
57,536
3
115,072
No
output
1
57,536
3
115,073
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character,...
instruction
0
57,537
3
115,074
No
output
1
57,537
3
115,075
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character,...
instruction
0
57,538
3
115,076
No
output
1
57,538
3
115,077
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character,...
instruction
0
57,539
3
115,078
No
output
1
57,539
3
115,079
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 ...
instruction
0
57,701
3
115,402
Yes
output
1
57,701
3
115,403
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. 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 ...
instruction
0
57,707
3
115,414
No
output
1
57,707
3
115,415
Provide tags and a correct Python 3 solution for this coding contest problem. BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client data is really big!). Main feature of services...
instruction
0
57,741
3
115,482
Tags: dfs and similar, graphs Correct Solution: ``` import sys # sys.stind.readline lee datos el doble de # rápido que la funcion por defecto input input = sys.stdin.readline length = len def get_input(): n, m, h = [int(x) for x in input().split(' ')] digraph = [[] for _ in range(n + 1)] transpose = [[]...
output
1
57,741
3
115,483