message
stringlengths
2
44.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
276
109k
cluster
float64
23
23
__index_level_0__
int64
552
217k
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are parallel to the coordinate axes: the length of...
instruction
0
106,467
23
212,934
Tags: geometry Correct Solution: ``` mas = list(map(int, input().split())) w = mas[0] h = mas[1] alf = mas[2] import math sina = abs(math.sin(alf/180*math.pi)) cosa = abs(math.cos(alf/180*math.pi)) sinb = h / ((w ** 2 + h ** 2) ** 0.5) cosb = w / ((w ** 2 + h ** 2) ** 0.5) sin2b = 2 * sinb * cosb #print(w,h,alf) if (si...
output
1
106,467
23
212,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are...
instruction
0
106,468
23
212,936
Yes
output
1
106,468
23
212,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are...
instruction
0
106,469
23
212,938
Yes
output
1
106,469
23
212,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are...
instruction
0
106,470
23
212,940
Yes
output
1
106,470
23
212,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are...
instruction
0
106,471
23
212,942
Yes
output
1
106,471
23
212,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are...
instruction
0
106,472
23
212,944
No
output
1
106,472
23
212,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are...
instruction
0
106,473
23
212,946
No
output
1
106,473
23
212,947
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are...
instruction
0
106,474
23
212,948
No
output
1
106,474
23
212,949
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are...
instruction
0
106,475
23
212,950
No
output
1
106,475
23
212,951
Provide a correct Python 3 solution for this coding contest problem. Example Input 3 0 2 7 2 0 4 5 8 0 Output 11
instruction
0
106,976
23
213,952
"Correct Solution: ``` import sys def main(): n = int(input()) edges = [] for i in range(n): edges.append( list(map(int, sys.stdin.readline().split())) ) # ?±?????????????????????????????????°?????? # ????????????????????°?????????????????????????????????????????¨???????????? # ???...
output
1
106,976
23
213,953
Provide tags and a correct Python 3 solution for this coding contest problem. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks. What is the minimum number of minutes she ...
instruction
0
107,047
23
214,094
Tags: brute force, geometry, math Correct Solution: ``` lati = sorted([int(x) for x in input().split()]) if (lati[0]+lati[1] > lati[2]): print("0") else: print(lati[2]-lati[1]-lati[0]+1) ```
output
1
107,047
23
214,095
Provide tags and a correct Python 3 solution for this coding contest problem. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks. What is the minimum number of minutes she ...
instruction
0
107,048
23
214,096
Tags: brute force, geometry, math Correct Solution: ``` a=list(map(int,input().split())) a.sort() x=a[0] y=a[1] z=a[2]+1 ans=max(0,z-x-y) print(ans) ```
output
1
107,048
23
214,097
Provide tags and a correct Python 3 solution for this coding contest problem. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks. What is the minimum number of minutes she ...
instruction
0
107,050
23
214,100
Tags: brute force, geometry, math Correct Solution: ``` ai = list(map(int,input().split())) ai.sort() print(max(0,ai[2] - ai[1] - ai[0] + 1)) ```
output
1
107,050
23
214,101
Provide tags and a correct Python 3 solution for this coding contest problem. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks. What is the minimum number of minutes she ...
instruction
0
107,051
23
214,102
Tags: brute force, geometry, math Correct Solution: ``` a,b,c = map(int,input().split()) l = [a,b,c] a1 = [] k = 0 max1 = max(l) if a == b == c: print(0) exit() for i in l: if i == max1 and k == 0: k = 1 pass else: a1.append(i) if sum(a1) > max1: print(0) exit() ...
output
1
107,051
23
214,103
Provide tags and a correct Python 3 solution for this coding contest problem. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks. What is the minimum number of minutes she ...
instruction
0
107,052
23
214,104
Tags: brute force, geometry, math Correct Solution: ``` sides = list(map(int, input().split())) sides.sort() print("0" if sides[2] < sides[1] + sides[0] else str(sides[2] - sides[1] - sides[0] + 1)) ```
output
1
107,052
23
214,105
Provide tags and a correct Python 3 solution for this coding contest problem. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks. What is the minimum number of minutes she ...
instruction
0
107,053
23
214,106
Tags: brute force, geometry, math Correct Solution: ``` string = input() arr = string.split() fir = int(arr[0]) sec = int(arr[1]) thir = int(arr[2]) res = 1 f_summ = sec + fir + thir if fir + sec > thir: res = res else: fir += (thir - fir - sec + 1) if fir + thir > sec: res = res else: fir += (sec - fi...
output
1
107,053
23
214,107
Provide tags and a correct Python 3 solution for this coding contest problem. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks. What is the minimum number of minutes she ...
instruction
0
107,054
23
214,108
Tags: brute force, geometry, math Correct Solution: ``` a=[] a=list(map(int,input().split())) a.sort() if a[0]+a[1]>a[2]: print("0") elif a[0]+a[1]==a[2]: print("1") else: print(a[2]-a[1]-a[0]+1) ```
output
1
107,054
23
214,109
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break stic...
instruction
0
107,055
23
214,110
Yes
output
1
107,055
23
214,111
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break stic...
instruction
0
107,056
23
214,112
Yes
output
1
107,056
23
214,113
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break stic...
instruction
0
107,057
23
214,114
Yes
output
1
107,057
23
214,115
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break stic...
instruction
0
107,058
23
214,116
Yes
output
1
107,058
23
214,117
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break stic...
instruction
0
107,059
23
214,118
No
output
1
107,059
23
214,119
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break stic...
instruction
0
107,060
23
214,120
No
output
1
107,060
23
214,121
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break stic...
instruction
0
107,061
23
214,122
No
output
1
107,061
23
214,123
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break stic...
instruction
0
107,062
23
214,124
No
output
1
107,062
23
214,125
Provide tags and a correct Python 3 solution for this coding contest problem. One drew a closed polyline on a plane, that consisted only of vertical and horizontal segments (parallel to the coordinate axes). The segments alternated between horizontal and vertical ones (a horizontal segment was always followed by a ver...
instruction
0
107,233
23
214,466
Tags: constructive algorithms, dp, geometry Correct Solution: ``` #!/usr/bin/env python import os import sys from io import BytesIO, IOBase def main(): t = int(input()) for _ in range(t): if _ != 0: input() h = int(input()) l1 = list(map(int,input().split())) v = in...
output
1
107,233
23
214,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One drew a closed polyline on a plane, that consisted only of vertical and horizontal segments (parallel to the coordinate axes). The segments alternated between horizontal and vertical ones (a ...
instruction
0
107,234
23
214,468
No
output
1
107,234
23
214,469
Provide tags and a correct Python 3 solution for this coding contest problem. Given simple (without self-intersections) n-gon. It is not necessary convex. Also you are given m lines. For each line find the length of common part of the line and the n-gon. The boundary of n-gon belongs to polygon. It is possible that n...
instruction
0
107,401
23
214,802
Tags: geometry Correct Solution: ``` def main(): from math import hypot n, m = map(int, input().split()) vertices = list(tuple(map(float, input().split())) for _ in range(n)) ax, ay = vertices[-1] for i, (bx, by) in enumerate(vertices): vertices[i], ax, ay = (bx, by, bx - ax, by - ay), bx, b...
output
1
107,401
23
214,803
Provide tags and a correct Python 3 solution for this coding contest problem. Given simple (without self-intersections) n-gon. It is not necessary convex. Also you are given m lines. For each line find the length of common part of the line and the n-gon. The boundary of n-gon belongs to polygon. It is possible that n...
instruction
0
107,402
23
214,804
Tags: geometry Correct Solution: ``` import math eps = 1e-9 def sign(n): if n > eps: return 1 if n < -eps: return -1 return 0 def cross(a, b): return a.x * b.y - a.y * b.x class Vector: def __init__(self, x, y): self.x = x self.y = y def __add__(self, v): return...
output
1
107,402
23
214,805
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given simple (without self-intersections) n-gon. It is not necessary convex. Also you are given m lines. For each line find the length of common part of the line and the n-gon. The boundary of ...
instruction
0
107,403
23
214,806
No
output
1
107,403
23
214,807
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given simple (without self-intersections) n-gon. It is not necessary convex. Also you are given m lines. For each line find the length of common part of the line and the n-gon. The boundary of ...
instruction
0
107,404
23
214,808
No
output
1
107,404
23
214,809
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given simple (without self-intersections) n-gon. It is not necessary convex. Also you are given m lines. For each line find the length of common part of the line and the n-gon. The boundary of ...
instruction
0
107,405
23
214,810
No
output
1
107,405
23
214,811
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Given simple (without self-intersections) n-gon. It is not necessary convex. Also you are given m lines. For each line find the length of common part of the line and the n-gon. The boundary of ...
instruction
0
107,406
23
214,812
No
output
1
107,406
23
214,813
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given n, l and r find the number of distinct geometrical progression, each of which contains n distinct integers not less than l and not greater than r. In other words, for each progression ...
instruction
0
107,493
23
214,986
No
output
1
107,493
23
214,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given n, l and r find the number of distinct geometrical progression, each of which contains n distinct integers not less than l and not greater than r. In other words, for each progression ...
instruction
0
107,494
23
214,988
No
output
1
107,494
23
214,989
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given n, l and r find the number of distinct geometrical progression, each of which contains n distinct integers not less than l and not greater than r. In other words, for each progression ...
instruction
0
107,495
23
214,990
No
output
1
107,495
23
214,991
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given n, l and r find the number of distinct geometrical progression, each of which contains n distinct integers not less than l and not greater than r. In other words, for each progression ...
instruction
0
107,496
23
214,992
No
output
1
107,496
23
214,993
Provide a correct Python 3 solution for this coding contest problem. There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs. Takahashi says: "there are X animals in total in the garden, and they have Y legs in total." Determine whether there is a combination of numbers of...
instruction
0
107,625
23
215,250
"Correct Solution: ``` x,y=map(int,input().split()) #x匹でy本 if y<2*x or 4*x<y or y%2==1: print("No") else: print("Yes") ```
output
1
107,625
23
215,251
Provide a correct Python 3 solution for this coding contest problem. There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs. Takahashi says: "there are X animals in total in the garden, and they have Y legs in total." Determine whether there is a combination of numbers of...
instruction
0
107,627
23
215,254
"Correct Solution: ``` x, y = map(int, input().split()) if x*2<=y and y<=x*4 and y%2==0: print('Yes') else: print('No') ```
output
1
107,627
23
215,255
Provide a correct Python 3 solution for this coding contest problem. Estimating the Flood Risk Mr. Boat is the owner of a vast extent of land. As many typhoons have struck Japan this year, he became concerned of flood risk of his estate and he wants to know the average altitude of his land. The land is too vast to me...
instruction
0
107,815
23
215,630
"Correct Solution: ``` def isValid(row, col, ROWS, COLS): return row >= 0 and row < ROWS and col >= 0 and col < COLS def isSteep(board, row, col, ROWS, COLS): global adjR, adjC h = board[row][col] for i in range(4): rr = row + adjR[i] cc = col + adjC[i] if isValid(rr, cc, ROWS,...
output
1
107,815
23
215,631
Provide a correct Python 3 solution for this coding contest problem. Estimating the Flood Risk Mr. Boat is the owner of a vast extent of land. As many typhoons have struck Japan this year, he became concerned of flood risk of his estate and he wants to know the average altitude of his land. The land is too vast to me...
instruction
0
107,816
23
215,632
"Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools import time,random sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): retu...
output
1
107,816
23
215,633
Provide a correct Python 3 solution for this coding contest problem. Estimating the Flood Risk Mr. Boat is the owner of a vast extent of land. As many typhoons have struck Japan this year, he became concerned of flood risk of his estate and he wants to know the average altitude of his land. The land is too vast to me...
instruction
0
107,817
23
215,634
"Correct Solution: ``` #!/usr/bin/python3 import os import sys def main(): W, D, N = read_ints() M = [tuple(read_ints()) for _ in range(N)] ans = solve(W, D, N, M) if ans is None: print('No') else: print(ans) def solve(W, D, N, M): INF = 999 H = [[INF] * W for _ in range...
output
1
107,817
23
215,635
Provide a correct Python 3 solution for this coding contest problem. Estimating the Flood Risk Mr. Boat is the owner of a vast extent of land. As many typhoons have struck Japan this year, he became concerned of flood risk of his estate and he wants to know the average altitude of his land. The land is too vast to me...
instruction
0
107,818
23
215,636
"Correct Solution: ``` from sys import stdin, stdout import math import bisect import queue w, d, n = map(int, input().strip().split()) mapper = [[-1000 for i in range(55)] for j in range(55)] step = [[0, 1], [0, -1], [1, 0], [-1, 0]] arr = [] for i in range(n): tmp = tuple(map(int, stdin.readline().strip().spl...
output
1
107,818
23
215,637
Provide a correct Python 3 solution for this coding contest problem. π (spelled pi in English) is a mathematical constant representing the circumference of a circle whose di- ameter is one unit length. The name π is said to come from the first letter of the Greek words περιφέρεια (meaning periphery) and περίμετρος (pe...
instruction
0
107,820
23
215,640
"Correct Solution: ``` from math import pi while 1: r=float(input()) if r==0:break n=d=1 while abs(n/d-pi)>r: if n/d<pi:n+=1 else: d+=1 print('%d/%d'%(n,d)) ```
output
1
107,820
23
215,641
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elem...
instruction
0
108,122
23
216,244
Yes
output
1
108,122
23
216,245
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elem...
instruction
0
108,123
23
216,246
Yes
output
1
108,123
23
216,247
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elem...
instruction
0
108,124
23
216,248
Yes
output
1
108,124
23
216,249
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elem...
instruction
0
108,125
23
216,250
Yes
output
1
108,125
23
216,251
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elem...
instruction
0
108,126
23
216,252
No
output
1
108,126
23
216,253
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: * Elem...
instruction
0
108,127
23
216,254
No
output
1
108,127
23
216,255