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 a correct Python 3 solution for this coding contest problem.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the center of the base is orthogonal to the base. Also, x a... | instruction | 0 | 27,290 | 23 | 54,580 |
"Correct Solution:
```
import math
while True:
x = int(input().strip())
h = int(input().strip())
if x==0 and h==0:
break
d = math.sqrt((x/2.0)**2 + h**2)
s = x * d / 2.0 * 4 + x**2
print(s)
``` | output | 1 | 27,290 | 23 | 54,581 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the... | instruction | 0 | 27,291 | 23 | 54,582 |
Yes | output | 1 | 27,291 | 23 | 54,583 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the... | instruction | 0 | 27,292 | 23 | 54,584 |
Yes | output | 1 | 27,292 | 23 | 54,585 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the... | instruction | 0 | 27,293 | 23 | 54,586 |
Yes | output | 1 | 27,293 | 23 | 54,587 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the... | instruction | 0 | 27,294 | 23 | 54,588 |
Yes | output | 1 | 27,294 | 23 | 54,589 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the... | instruction | 0 | 27,295 | 23 | 54,590 |
No | output | 1 | 27,295 | 23 | 54,591 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the... | instruction | 0 | 27,296 | 23 | 54,592 |
No | output | 1 | 27,296 | 23 | 54,593 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the... | instruction | 0 | 27,297 | 23 | 54,594 |
No | output | 1 | 27,297 | 23 | 54,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the... | instruction | 0 | 27,298 | 23 | 54,596 |
No | output | 1 | 27,298 | 23 | 54,597 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the pol... | instruction | 0 | 27,353 | 23 | 54,706 |
"Correct Solution:
```
p=[complex(*map(int,input().split())) for _ in range(int(input()))]
s,pre=0,p[0]
while p:
now=p.pop()
s+=now.real*pre.imag-now.imag*pre.real
pre=now
print(abs(s)/2)
``` | output | 1 | 27,353 | 23 | 54,707 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the pol... | instruction | 0 | 27,354 | 23 | 54,708 |
"Correct Solution:
```
n = int(input())
P =[]
s = 0
for _ in range(n):P += [[int(i) for i in input().split()]]
for j in range(n-1):s += P[j][0]*P[j+1][1] - P[j][1]*P[j+1][0]
s += P[-1][0]*P[0][1] - P[-1][1]*P[0][0]
print(s*0.5)
``` | output | 1 | 27,354 | 23 | 54,709 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the pol... | instruction | 0 | 27,355 | 23 | 54,710 |
"Correct Solution:
```
n = int(input())
P =[]
s = 0
for i in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for i in range(n):
a = P[i][0] ; b = P[i][1]; c = P[i+1][0] ; d = P[i+1][1]
s += a * d - b * c
print(abs(s)*0.5)
``` | output | 1 | 27,355 | 23 | 54,711 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the pol... | instruction | 0 | 27,356 | 23 | 54,712 |
"Correct Solution:
```
n = int(input())
P =[]
s = 0
for i in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for i in range(n):s += (P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0])
print(abs(s)*0.5)
``` | output | 1 | 27,356 | 23 | 54,713 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the pol... | instruction | 0 | 27,357 | 23 | 54,714 |
"Correct Solution:
```
def get_area(ps):
"""頂点集合psから成る多角形の面積を求める。"""
n = len(ps)
ans = 0
for i in range(n):
p1 = ps[i]
p2 = ps[i - 1]
ans += (p1[0] * p2[1] - p2[0] * p1[1]) / 2
return abs(ans)
n = int(input())
ps = [list(map(int, input().split())) for i in range(n)]
print(... | output | 1 | 27,357 | 23 | 54,715 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the pol... | instruction | 0 | 27,358 | 23 | 54,716 |
"Correct Solution:
```
def norm(c):
a = abs(c)
return a*a
def dot_product(a,b):
return (a.conjugate()*b).real
def cross_product(a,b):
return (a.conjugate()*b).imag
def projection(p,b):
return b*dot_product(p,b)/norm(b)
P = []
N = int(input())
for i in range(N):
x,y = map(float,input().split('... | output | 1 | 27,358 | 23 | 54,717 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the pol... | instruction | 0 | 27,359 | 23 | 54,718 |
"Correct Solution:
```
n = int(input())
P =[]
s = 0
for _ in range(n):P.append(list(map(int,input().split())))
P.append(P[0])
for j in range(n):s += P[j][0]*P[j+1][1] - P[j][1]*P[j+1][0]
print(s*0.5)
``` | output | 1 | 27,359 | 23 | 54,719 |
Provide a correct Python 3 solution for this coding contest problem.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the pol... | instruction | 0 | 27,360 | 23 | 54,720 |
"Correct Solution:
```
x=range(int(input()),0,-1)
P=[]
for _ in x:P+=[[int(i) for i in input().split()]]
P+=[P[0]]
for j in x:_+=P[j-1][0]*P[j][1]-P[j-1][1]*P[j][0]
print(_*0.5-0.5)
``` | output | 1 | 27,360 | 23 | 54,721 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The lin... | instruction | 0 | 27,361 | 23 | 54,722 |
Yes | output | 1 | 27,361 | 23 | 54,723 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The lin... | instruction | 0 | 27,362 | 23 | 54,724 |
Yes | output | 1 | 27,362 | 23 | 54,725 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The lin... | instruction | 0 | 27,363 | 23 | 54,726 |
Yes | output | 1 | 27,363 | 23 | 54,727 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The lin... | instruction | 0 | 27,364 | 23 | 54,728 |
Yes | output | 1 | 27,364 | 23 | 54,729 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The lin... | instruction | 0 | 27,365 | 23 | 54,730 |
No | output | 1 | 27,365 | 23 | 54,731 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The lin... | instruction | 0 | 27,366 | 23 | 54,732 |
No | output | 1 | 27,366 | 23 | 54,733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The lin... | instruction | 0 | 27,367 | 23 | 54,734 |
No | output | 1 | 27,367 | 23 | 54,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of g. The lin... | instruction | 0 | 27,368 | 23 | 54,736 |
No | output | 1 | 27,368 | 23 | 54,737 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers... | instruction | 0 | 27,511 | 23 | 55,022 |
Tags: greedy
Correct Solution:
```
import functools
from math import inf
class event:
def __init__(self, x, type, index):
self.x = x
self.type = type
self.i = index
def custom_sort(a, b):
# if a.i == b.i:
# if a.type == "s" and b.type == "e":
# return -1
# if a.type == "e" and b.type == "s":
# retur... | output | 1 | 27,511 | 23 | 55,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers... | instruction | 0 | 27,512 | 23 | 55,024 |
Tags: greedy
Correct Solution:
```
'''
template author-: Pyduper
'''
# MAX = pow(10, 5)
# stdin = open("testdata.txt", "r")
# ip = stdin
# def input():
# return ip.readline().strip()
N = 250
n, k = map(int, input().split())
segs = [[0, 0] for _ in range(n)]
cnt = [0]*N
ans = [0]*n
for i in range(n):
segs[i][0], ... | output | 1 | 27,512 | 23 | 55,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers... | instruction | 0 | 27,513 | 23 | 55,026 |
Tags: greedy
Correct Solution:
```
n,m=map(int,input().split())
a=[[] for i in range(201)]
for i in range(n):
b,c=map(int,input().split())
a[b].append([c,i+1])
l=0
d=0
stack=[]
count=0
for i in range(1,201):
a[i].sort()
l=len(a[i])
if(l>m):
d=l-m
for j in range(d):
stack.... | output | 1 | 27,513 | 23 | 55,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers... | instruction | 0 | 27,514 | 23 | 55,028 |
Tags: greedy
Correct Solution:
```
from heapq import *
def main():
n, k = map(int, input().split())
E = []
opent = {}
for i in range(n):
l, r = map(int, input().split())
E.append([l, 1, i])
E.append([r, -1, i])
opent[i] = r
E.sort(key=lambda x: (x[0], -x[1]))
no... | output | 1 | 27,514 | 23 | 55,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers... | instruction | 0 | 27,515 | 23 | 55,030 |
Tags: greedy
Correct Solution:
```
n, k = map(int, input().split())
i = []
all_offenders = []
for q in range(n):
i.append((tuple(map(int, input().split())),q))
i.sort(key=lambda x: x[0][1])
for t in range(200):
count = 0
offenders = []
for pos in range(len(i)):
if i[pos][0][0] <= t <= i[pos][0][... | output | 1 | 27,515 | 23 | 55,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers... | instruction | 0 | 27,516 | 23 | 55,032 |
Tags: greedy
Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
line_count = 0
segments = []
for line in sys.stdin.readlines():
inputs = line.split()
if line_count == 0:
n = int(inputs[0])
k = int(inputs[1])
else:
l = int(inputs[0])
r = int(inputs[1])
segments... | output | 1 | 27,516 | 23 | 55,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers... | instruction | 0 | 27,517 | 23 | 55,034 |
Tags: greedy
Correct Solution:
```
import heapq
def main():
n,k=readIntArr()
lr=[]
for i in range(n):
l,r=readIntArr()
lr.append([l,r,i+1])
lr.sort(key=lambda x:x[0])
# store [r,idx] of segments
# maxHeapRs=[]
# minHeapRs=[]
# removedIdxes=set()
... | output | 1 | 27,517 | 23 | 55,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers... | instruction | 0 | 27,518 | 23 | 55,036 |
Tags: greedy
Correct Solution:
```
import sys,math,itertools
from collections import Counter,deque,defaultdict
from bisect import bisect_left,bisect_right
from heapq import heappop,heappush,heapify, nlargest
from copy import deepcopy
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl... | output | 1 | 27,518 | 23 | 55,037 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,519 | 23 | 55,038 |
Yes | output | 1 | 27,519 | 23 | 55,039 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,520 | 23 | 55,040 |
Yes | output | 1 | 27,520 | 23 | 55,041 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,521 | 23 | 55,042 |
Yes | output | 1 | 27,521 | 23 | 55,043 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,522 | 23 | 55,044 |
Yes | output | 1 | 27,522 | 23 | 55,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,523 | 23 | 55,046 |
No | output | 1 | 27,523 | 23 | 55,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,524 | 23 | 55,048 |
No | output | 1 | 27,524 | 23 | 55,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,525 | 23 | 55,050 |
No | output | 1 | 27,525 | 23 | 55,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,526 | 23 | 55,052 |
No | output | 1 | 27,526 | 23 | 55,053 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,527 | 23 | 55,054 |
No | output | 1 | 27,527 | 23 | 55,055 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
The only difference between easy and hard versions is constraints.
You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th ... | instruction | 0 | 27,528 | 23 | 55,056 |
No | output | 1 | 27,528 | 23 | 55,057 |
Provide tags and a correct Python 2 solution for this coding contest problem.
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie... | instruction | 0 | 27,892 | 23 | 55,784 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
from bisect import bisect
raw_input = stdin.readline
pr = stdout.write
import math
def in_num():
return int(raw_input())
... | output | 1 | 27,892 | 23 | 55,785 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie... | instruction | 0 | 27,893 | 23 | 55,786 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
import math
def main():
(n, xp, yp) = (int(x) for x in input().split())
polygon = [None] * n
for i in range(n):
(xi, yi) = (int(x) for x in input().split())
polygon[i] = (xi, yi)
print(solver((xp, yp), polygon))
def solver(P, polygon):
n = l... | output | 1 | 27,893 | 23 | 55,787 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie... | instruction | 0 | 27,894 | 23 | 55,788 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
from math import hypot, pi, copysign
def main():
n, a, b = map(int, input().split())
l, res = [], []
for _ in range(n):
x0, y0 = map(int, input().split())
l.append((x0 - a, y0 - b))
x0, y0 = l[-1]
for x1, y1 in l:
... | output | 1 | 27,894 | 23 | 55,789 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie... | instruction | 0 | 27,895 | 23 | 55,790 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
def dot_product(v1, v2):
return v1.x * v2.x + v1.y * v2.y
class vector:
def __init__(self, x, y):
self.x = x
self.y = y
def length(self):
return (self.x ** 2 + self.y ** 2) ** 0.5
def cross_product(self, v):
... | output | 1 | 27,895 | 23 | 55,791 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie... | instruction | 0 | 27,896 | 23 | 55,792 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
def main():
n, a, b = map(int, input().split())
l, res = [], []
for _ in range(n):
u, v = input().split()
l.append((int(u) - a, int(v) - b))
x0, y0 = l[-1]
for x1, y1 in l:
res.append(x1 * x1 + y1 * y1)
... | output | 1 | 27,896 | 23 | 55,793 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie... | instruction | 0 | 27,897 | 23 | 55,794 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
import math
def dot(v1, v2):
return v1[0]*v2[0] + v1[1]*v2[1]
def cross(v1, v2):
return v1[0]*v2[1] - v1[1]*v2[0]
def mag(x,y):
return math.sqrt(x**2 + y**2)
def main():
PI = 3.141592653589793
mags = []
n, x0, y0 = map(... | output | 1 | 27,897 | 23 | 55,795 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie... | instruction | 0 | 27,898 | 23 | 55,796 |
Tags: binary search, geometry, ternary search
Correct Solution:
```
__author__ = 'vboldovs'
#A613
import math
GLOBAL_INNER_PRODUCT_LIMIT = math.pow(10,-3)
class point:
def __init__(self,x,y):
self.x = x
self.y = y
class line:
def __init__(self,start_point, end_point):
self.x = end_p... | output | 1 | 27,898 | 23 | 55,797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.