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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given N points on a plane. Write a program which will find the sum of squares of distances between all pairs of points.
Input
The first line of input contains one integer number N (1 ≤... | instruction | 0 | 39,224 | 23 | 78,448 |
No | output | 1 | 39,224 | 23 | 78,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given N points on a plane. Write a program which will find the sum of squares of distances between all pairs of points.
Input
The first line of input contains one integer number N (1 ≤... | instruction | 0 | 39,225 | 23 | 78,450 |
No | output | 1 | 39,225 | 23 | 78,451 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given N points on a plane. Write a program which will find the sum of squares of distances between all pairs of points.
Input
The first line of input contains one integer number N (1 ≤... | instruction | 0 | 39,226 | 23 | 78,452 |
No | output | 1 | 39,226 | 23 | 78,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pie... | instruction | 0 | 39,227 | 23 | 78,454 |
Tags: geometry, math
Correct Solution:
```
from math import sqrt
n, h = map(int, input().split(' '))
for i in range(1, n):
r = h*sqrt(i/n)
print(str(r), end=" ")
``` | output | 1 | 39,227 | 23 | 78,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pie... | instruction | 0 | 39,228 | 23 | 78,456 |
Tags: geometry, math
Correct Solution:
```
import math
a = input()
x = [int(i) for i in a.split()]
number = x[0]
height = x[1]
output = ""
for i in range(1, number):
if(number == 1):
print(math.sqrt(i/number) * height)
else:
output = output + str(math.sqrt(i/number) * height) + " "
print(output)... | output | 1 | 39,228 | 23 | 78,457 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pie... | instruction | 0 | 39,229 | 23 | 78,458 |
Tags: geometry, math
Correct Solution:
```
#794B
from math import sqrt
[n,h] = list(map(int,input().split()))
for i in range(1,n):
print(sqrt(i/n)*h,end=' ')
``` | output | 1 | 39,229 | 23 | 78,459 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pie... | instruction | 0 | 39,230 | 23 | 78,460 |
Tags: geometry, math
Correct Solution:
```
# 764B
# Cutting Carrot
import math
fstline = list(map(float,input().split(' ')))
n, h, i, ans = fstline[0], fstline[1], 1, ''
while i < n:
ans+=str(math.sqrt(i/n)*h)+' '
i+=1
print(ans[:-1])
``` | output | 1 | 39,230 | 23 | 78,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pie... | instruction | 0 | 39,231 | 23 | 78,462 |
Tags: geometry, math
Correct Solution:
```
import math
n,h=map(int ,input().split())
a=1/2*(h)
ans=[]
for i in range(1,n):
ans.append(h*math.sqrt(i/n))
print(*ans)
``` | output | 1 | 39,231 | 23 | 78,463 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pie... | instruction | 0 | 39,232 | 23 | 78,464 |
Tags: geometry, math
Correct Solution:
```
import math
n,h=map(int,input().split())
for i in range(1,n):
print(h*math.sqrt(i/n),end=" ")
``` | output | 1 | 39,232 | 23 | 78,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pie... | instruction | 0 | 39,233 | 23 | 78,466 |
Tags: geometry, math
Correct Solution:
```
n, h = map(int, input().split())
for i in range(1,n):
res = (i / n)**(1/2) * h
print(res, end=' ')
``` | output | 1 | 39,233 | 23 | 78,467 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pie... | instruction | 0 | 39,234 | 23 | 78,468 |
Tags: geometry, math
Correct Solution:
```
import sys
import os
import math
import re
n,h = map(int,input().split())
for i in range(1,n):
print(str(h*math.sqrt(i/n)) + " ",end = "")
print()
``` | output | 1 | 39,234 | 23 | 78,469 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally,... | instruction | 0 | 39,235 | 23 | 78,470 |
Yes | output | 1 | 39,235 | 23 | 78,471 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally,... | instruction | 0 | 39,236 | 23 | 78,472 |
Yes | output | 1 | 39,236 | 23 | 78,473 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally,... | instruction | 0 | 39,237 | 23 | 78,474 |
Yes | output | 1 | 39,237 | 23 | 78,475 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally,... | instruction | 0 | 39,238 | 23 | 78,476 |
Yes | output | 1 | 39,238 | 23 | 78,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally,... | instruction | 0 | 39,239 | 23 | 78,478 |
No | output | 1 | 39,239 | 23 | 78,479 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally,... | instruction | 0 | 39,240 | 23 | 78,480 |
No | output | 1 | 39,240 | 23 | 78,481 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally,... | instruction | 0 | 39,241 | 23 | 78,482 |
No | output | 1 | 39,241 | 23 | 78,483 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally,... | instruction | 0 | 39,242 | 23 | 78,484 |
No | output | 1 | 39,242 | 23 | 78,485 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the ... | instruction | 0 | 39,499 | 23 | 78,998 |
"Correct Solution:
```
import fractions
a,b,c,d=map(int,input().split())
c=abs(c-a)
d=abs(d-b)
g=fractions.gcd(max(c,d),min(c,d))
j=int(c/g)
k=int(d/g)
print((j+k-1)*g)
``` | output | 1 | 39,499 | 23 | 78,999 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the ... | instruction | 0 | 39,500 | 23 | 79,000 |
"Correct Solution:
```
def gcd(x,y):
if x%y==0:
return y
while x%y>0:
x,y=y,x%y
return y
a,b,c,d=map(int,input().split())
x,y=abs(a-c),abs(b-d)
g=gcd(x,y)
print(g*(x//g+y//g-1))
``` | output | 1 | 39,500 | 23 | 79,001 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the ... | instruction | 0 | 39,501 | 23 | 79,002 |
"Correct Solution:
```
import fractions
x1,y1,x2,y2 = map(int,input().split())
if x1 == x2 or y1 == y2:
print(0)
exit()
dx,dy = abs(x1-x2),abs(y1-y2)
g = fractions.gcd(dx,dy)
print(g * (dx//g + dy//g - 1))
``` | output | 1 | 39,501 | 23 | 79,003 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the ... | instruction | 0 | 39,502 | 23 | 79,004 |
"Correct Solution:
```
from fractions import gcd
import math
a, b, c, d = [int(item) for item in input().split()]
a = abs(a - c)
b = abs(b - d)
if a > b:
a, b = b, a
g = gcd(a, b)
a //= g; b //= g
print((a + b - 1) * g)
``` | output | 1 | 39,502 | 23 | 79,005 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the ... | instruction | 0 | 39,503 | 23 | 79,006 |
"Correct Solution:
```
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
a, b, c, d = map(int, input().split())
if a == c or b == d:
print(0)
sys.exit(0)
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
x = abs(a - c)
y = abs(b - d)
_gcd = gcd(x, y)
x... | output | 1 | 39,503 | 23 | 79,007 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the ... | instruction | 0 | 39,504 | 23 | 79,008 |
"Correct Solution:
```
a,b,c,d=map(int,input().split())
gcd=lambda a,b:gcd(b,a%b)if a%b else b
def 数学は最強也(a,b):
q=gcd(a,b)
return q*((a//q)+(b//q-1))
print(数学は最強也(abs(a-c),abs(b-d)))
``` | output | 1 | 39,504 | 23 | 79,009 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the ... | instruction | 0 | 39,505 | 23 | 79,010 |
"Correct Solution:
```
import fractions
if __name__ == "__main__":
A, B, C, D = map(int, input().split())
A -= C
B -= D
W = abs(A)
H = abs(B)
if W == 0 or H == 0:
print(0)
exit()
res = W + H - 1
g = fractions.gcd(W, H)
print(res - g + 1)
``` | output | 1 | 39,505 | 23 | 79,011 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the ... | instruction | 0 | 39,506 | 23 | 79,012 |
"Correct Solution:
```
def gcd(a,b):
if b==0:return a
return gcd(b,a%b)
a,b,c,d=map(int,input().split())
c=abs(c-a)
d=abs(d-b)
g=gcd(max(c,d),min(c,d))
j=int(c/g)
k=int(d/g)
print((j+k-1)*g)
``` | output | 1 | 39,506 | 23 | 79,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment co... | instruction | 0 | 39,507 | 23 | 79,014 |
Yes | output | 1 | 39,507 | 23 | 79,015 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment co... | instruction | 0 | 39,508 | 23 | 79,016 |
Yes | output | 1 | 39,508 | 23 | 79,017 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment co... | instruction | 0 | 39,509 | 23 | 79,018 |
Yes | output | 1 | 39,509 | 23 | 79,019 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment co... | instruction | 0 | 39,510 | 23 | 79,020 |
Yes | output | 1 | 39,510 | 23 | 79,021 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment co... | instruction | 0 | 39,511 | 23 | 79,022 |
No | output | 1 | 39,511 | 23 | 79,023 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment co... | instruction | 0 | 39,512 | 23 | 79,024 |
No | output | 1 | 39,512 | 23 | 79,025 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment co... | instruction | 0 | 39,513 | 23 | 79,026 |
No | output | 1 | 39,513 | 23 | 79,027 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment co... | instruction | 0 | 39,514 | 23 | 79,028 |
No | output | 1 | 39,514 | 23 | 79,029 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in ea... | instruction | 0 | 39,608 | 23 | 79,216 |
Yes | output | 1 | 39,608 | 23 | 79,217 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in ea... | instruction | 0 | 39,609 | 23 | 79,218 |
Yes | output | 1 | 39,609 | 23 | 79,219 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in ea... | instruction | 0 | 39,610 | 23 | 79,220 |
Yes | output | 1 | 39,610 | 23 | 79,221 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in ea... | instruction | 0 | 39,611 | 23 | 79,222 |
Yes | output | 1 | 39,611 | 23 | 79,223 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in ea... | instruction | 0 | 39,612 | 23 | 79,224 |
No | output | 1 | 39,612 | 23 | 79,225 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in ea... | instruction | 0 | 39,613 | 23 | 79,226 |
No | output | 1 | 39,613 | 23 | 79,227 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in ea... | instruction | 0 | 39,614 | 23 | 79,228 |
No | output | 1 | 39,614 | 23 | 79,229 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in ea... | instruction | 0 | 39,615 | 23 | 79,230 |
No | output | 1 | 39,615 | 23 | 79,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n points on a plane. The i-th point has coordinates (x_i, y_i). You have two horizontal platforms, both of length k. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same y-coordinate) an... | instruction | 0 | 39,786 | 23 | 79,572 |
Tags: binary search, dp, sortings, two pointers
Correct Solution:
```
import sys
from bisect import bisect_right as br
input = sys.stdin.readline
for _ in range(int(input())):
n, k = map(int, input().split())
xs = list(map(int, input().split()))
input()
xs.sort()
lmax = [0] * (n + 1)
rmax = [0] * (n + 1)
... | output | 1 | 39,786 | 23 | 79,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n points on a plane. The i-th point has coordinates (x_i, y_i). You have two horizontal platforms, both of length k. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same y-coordinate) an... | instruction | 0 | 39,787 | 23 | 79,574 |
Tags: binary search, dp, sortings, two pointers
Correct Solution:
```
import io
import os
from collections import Counter, defaultdict, deque
def solve(N, K, X, Y):
X = sorted(X)
def maxSave(A, rev=False):
window = deque()
dp = []
mx = 0
dp.append(mx)
for x in A:
... | output | 1 | 39,787 | 23 | 79,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n points on a plane. The i-th point has coordinates (x_i, y_i). You have two horizontal platforms, both of length k. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same y-coordinate) an... | instruction | 0 | 39,788 | 23 | 79,576 |
Tags: binary search, dp, sortings, two pointers
Correct Solution:
```
import sys
input = sys.stdin.buffer.readline
def print(val):
sys.stdout.write(str(val) + '\n')
def prog():
for _ in range(int(input())):
n,k = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(in... | output | 1 | 39,788 | 23 | 79,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n points on a plane. The i-th point has coordinates (x_i, y_i). You have two horizontal platforms, both of length k. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same y-coordinate) an... | instruction | 0 | 39,789 | 23 | 79,578 |
Tags: binary search, dp, sortings, two pointers
Correct Solution:
```
for _ in range(int(input())):
n,k=map(int,input().split())
x,y=[int(i) for i in input().split()],[int(i) for i in input().split()]
x.sort()
x.append(9999999999999999999)
t,ans,arr,r=0,0,[0]*(n+5),0
ll=0
for i in range(n):
... | output | 1 | 39,789 | 23 | 79,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n points on a plane. The i-th point has coordinates (x_i, y_i). You have two horizontal platforms, both of length k. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same y-coordinate) an... | instruction | 0 | 39,790 | 23 | 79,580 |
Tags: binary search, dp, sortings, two pointers
Correct Solution:
```
def ans(n, k, x, y):
x.sort()
l = [0]*len(x)
r = [0]*len(x)
i = 0
j = 0
temp = 0
while(i<len(x) and j<len(x)):
temp = i-j+1
if i==j:
l[i] = temp
i+=1
else:
if x... | output | 1 | 39,790 | 23 | 79,581 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n points on a plane. The i-th point has coordinates (x_i, y_i). You have two horizontal platforms, both of length k. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same y-coordinate) an... | instruction | 0 | 39,791 | 23 | 79,582 |
Tags: binary search, dp, sortings, two pointers
Correct Solution:
```
T = int(input())
for case in range(T):
n,k=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
suf=[0 for i in range(n+2)]
ans=[0 for i in range(n+2)]
x=sorted(x)
j=0
for i in ran... | output | 1 | 39,791 | 23 | 79,583 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n points on a plane. The i-th point has coordinates (x_i, y_i). You have two horizontal platforms, both of length k. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same y-coordinate) an... | instruction | 0 | 39,792 | 23 | 79,584 |
Tags: binary search, dp, sortings, two pointers
Correct Solution:
```
t=int(input());f=input
for _ in range(t):
n,k=map(int,f().split());x=sorted(map(int,f().split()));f();r=[0]*n;c=n-1
for i in range(n-1,-1,-1):
while x[c] > x[i] + k:
c-=1
r[i]=c
m=[0]*n;c=0
for i in range(n-1,-1,-1):
m[i]=c
c=max(r[i]-... | output | 1 | 39,792 | 23 | 79,585 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.