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.
Vasiliy finally got to work, where there is a huge amount of tasks waiting for him. Vasiliy is given a matrix consisting of n rows and m columns and q tasks. Each task is to swap two submatrices... | instruction | 0 | 8,714 | 23 | 17,428 |
No | output | 1 | 8,714 | 23 | 17,429 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasiliy finally got to work, where there is a huge amount of tasks waiting for him. Vasiliy is given a matrix consisting of n rows and m columns and q tasks. Each task is to swap two submatrices... | instruction | 0 | 8,715 | 23 | 17,430 |
No | output | 1 | 8,715 | 23 | 17,431 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vasiliy finally got to work, where there is a huge amount of tasks waiting for him. Vasiliy is given a matrix consisting of n rows and m columns and q tasks. Each task is to swap two submatrices... | instruction | 0 | 8,716 | 23 | 17,432 |
No | output | 1 | 8,716 | 23 | 17,433 |
Provide a correct Python 3 solution for this coding contest problem.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?
We remind you that the di... | instruction | 0 | 8,840 | 23 | 17,680 |
"Correct Solution:
```
[n, d], *a = [[int(i) for i in x.split()] for x in open(0)]
print(sum(x**2 + y**2 <= d**2 for x, y in a))
``` | output | 1 | 8,840 | 23 | 17,681 |
Provide a correct Python 3 solution for this coding contest problem.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?
We remind you that the di... | instruction | 0 | 8,841 | 23 | 17,682 |
"Correct Solution:
```
n, d=map(int,input().split())
sm=0
d2=d**2
for i in range(n):
x,y=map(int,input().split())
if x**2+y**2<=d2:
sm+=1
print(sm)
``` | output | 1 | 8,841 | 23 | 17,683 |
Provide a correct Python 3 solution for this coding contest problem.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?
We remind you that the di... | instruction | 0 | 8,842 | 23 | 17,684 |
"Correct Solution:
```
n,d = map(int,input().split())
cnt = 0
for i in range(n):
p,q = map(int,input().split())
cnt += p*p+q*q <= d*d
print(cnt)
``` | output | 1 | 8,842 | 23 | 17,685 |
Provide a correct Python 3 solution for this coding contest problem.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?
We remind you that the di... | instruction | 0 | 8,843 | 23 | 17,686 |
"Correct Solution:
```
n,d = map(int,input().split())
s = 0
for i in range(n):
x,y = map(int,input().split())
if x*x+y*y<=d*d:
s += 1
print(s)
``` | output | 1 | 8,843 | 23 | 17,687 |
Provide a correct Python 3 solution for this coding contest problem.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?
We remind you that the di... | instruction | 0 | 8,844 | 23 | 17,688 |
"Correct Solution:
```
n,d=map(int,input().split())
print(sum(eval("(("+input().replace(" ",")**2+(")+")**2)")**0.5<=d for _ in range(n)))
``` | output | 1 | 8,844 | 23 | 17,689 |
Provide a correct Python 3 solution for this coding contest problem.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?
We remind you that the di... | instruction | 0 | 8,845 | 23 | 17,690 |
"Correct Solution:
```
n,d=map(int,input().split())
cnt=0
for i in range(n):
a,b=map(int,input().split())
if a**2+b**2<=d**2:
cnt+=1
print(cnt)
``` | output | 1 | 8,845 | 23 | 17,691 |
Provide a correct Python 3 solution for this coding contest problem.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?
We remind you that the di... | instruction | 0 | 8,846 | 23 | 17,692 |
"Correct Solution:
```
n,d=map(int,input().split())
ans=0
for i in range(n):
x,y=map(int,input().split())
if(x*x+y*y<=d*d):
ans+=1
print(ans)
``` | output | 1 | 8,846 | 23 | 17,693 |
Provide a correct Python 3 solution for this coding contest problem.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?
We remind you that the di... | instruction | 0 | 8,847 | 23 | 17,694 |
"Correct Solution:
```
N,D=map(int,input().split())
ans=0
for i in range(N):
x,y=map(int,input().split())
if(D*D>=x*x+y*y):ans+=1
print(ans)
``` | output | 1 | 8,847 | 23 | 17,695 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. Ho... | instruction | 0 | 8,848 | 23 | 17,696 |
Yes | output | 1 | 8,848 | 23 | 17,697 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. Ho... | instruction | 0 | 8,849 | 23 | 17,698 |
Yes | output | 1 | 8,849 | 23 | 17,699 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. Ho... | instruction | 0 | 8,850 | 23 | 17,700 |
Yes | output | 1 | 8,850 | 23 | 17,701 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. Ho... | instruction | 0 | 8,851 | 23 | 17,702 |
Yes | output | 1 | 8,851 | 23 | 17,703 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. Ho... | instruction | 0 | 8,852 | 23 | 17,704 |
No | output | 1 | 8,852 | 23 | 17,705 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. Ho... | instruction | 0 | 8,853 | 23 | 17,706 |
No | output | 1 | 8,853 | 23 | 17,707 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. Ho... | instruction | 0 | 8,854 | 23 | 17,708 |
No | output | 1 | 8,854 | 23 | 17,709 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).
Among them, we are looking for the points such that the distance from the origin is at most D. Ho... | instruction | 0 | 8,855 | 23 | 17,710 |
No | output | 1 | 8,855 | 23 | 17,711 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix whi... | instruction | 0 | 9,351 | 23 | 18,702 |
Tags: constructive algorithms, dp, math
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open(... | output | 1 | 9,351 | 23 | 18,703 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix whi... | instruction | 0 | 9,352 | 23 | 18,704 |
Tags: constructive algorithms, dp, math
Correct Solution:
```
#!/usr/bin/python3.5
x = int(input())
if x == 1:
print(1)
quit()
elif x == 2:
print(3)
quit()
elif x == 3:
print(5)
quit()
else:
if x % 2 == 0:
k = x * 2
else:
k = x * 2 - 1
for n in range(1, 16, 2):
if n ... | output | 1 | 9,352 | 23 | 18,705 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix whi... | instruction | 0 | 9,353 | 23 | 18,706 |
Tags: constructive algorithms, dp, math
Correct Solution:
```
'''input
3
'''
from sys import stdin
import math
def make_dp():
dp = [0] * 1001
dp[1] = 1
dp[3] = 5
for i in range(5, 100, 2):
dp[i] = dp[i - 2] + i + i - 2
return dp
# main starts
x = int(stdin.readline().strip())
if x == 3:
print(5)
exit()
d... | output | 1 | 9,353 | 23 | 18,707 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix whi... | instruction | 0 | 9,354 | 23 | 18,708 |
Tags: constructive algorithms, dp, math
Correct Solution:
```
from bisect import bisect_left
arr = [((2*i+1)**2)//2 + 1 for i in range(7)]
n = int(input())
if n == 3:
print(5)
else:
print(2*bisect_left(arr,n)+1)
``` | output | 1 | 9,354 | 23 | 18,709 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix whi... | instruction | 0 | 9,355 | 23 | 18,710 |
Tags: constructive algorithms, dp, math
Correct Solution:
```
import sys
import math
MAXNUM = math.inf
MINNUM = -1 * math.inf
ASCIILOWER = 97
ASCIIUPPER = 65
def getInt():
return int(sys.stdin.readline().rstrip())
def getInts():
return map(int, sys.stdin.readline().rstrip().split(" "))
def getString():
... | output | 1 | 9,355 | 23 | 18,711 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix whi... | instruction | 0 | 9,356 | 23 | 18,712 |
Tags: constructive algorithms, dp, math
Correct Solution:
```
n=int(input())
if(n==3):
print(5)
else:
x=1
xx=1
while(xx<n):
x+=2
xx=x*x//2+1
print(x)
``` | output | 1 | 9,356 | 23 | 18,713 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix whi... | instruction | 0 | 9,357 | 23 | 18,714 |
Tags: constructive algorithms, dp, math
Correct Solution:
```
u = int(input())
if u == 1:
print(1)
if 2 <= u <= 5:
if u == 3:
print(5)
else:
print(3)
if 6 <= u <= 13:
print(5)
if 14 <= u <= 25:
print(7)
if 26 <= u <= 41:
print(9)
if 42 <= u <= 61:
print(11)
if 62 <= u <= 85:
... | output | 1 | 9,357 | 23 | 18,715 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix whi... | instruction | 0 | 9,358 | 23 | 18,716 |
Tags: constructive algorithms, dp, math
Correct Solution:
```
n=int(input())
if n==1:i=1
elif n!=3and n<6:i=3
else:
i=5
while i*i//2+1<n:i+=2
print(i)
# Made By Mostafa_Khaled
``` | output | 1 | 9,358 | 23 | 18,717 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this mat... | instruction | 0 | 9,359 | 23 | 18,718 |
Yes | output | 1 | 9,359 | 23 | 18,719 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this mat... | instruction | 0 | 9,360 | 23 | 18,720 |
No | output | 1 | 9,360 | 23 | 18,721 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this mat... | instruction | 0 | 9,361 | 23 | 18,722 |
No | output | 1 | 9,361 | 23 | 18,723 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this mat... | instruction | 0 | 9,362 | 23 | 18,724 |
No | output | 1 | 9,362 | 23 | 18,725 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this mat... | instruction | 0 | 9,363 | 23 | 18,726 |
No | output | 1 | 9,363 | 23 | 18,727 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The cake shop made a lot of roll cakes of various sizes. You have been tasked with arranging this cake in a box.
The roll cake is so soft that it will collapse if another roll cake is on top. T... | instruction | 0 | 9,797 | 23 | 19,594 |
No | output | 1 | 9,797 | 23 | 19,595 |
Provide a correct Python 3 solution for this coding contest problem.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $
Input
... | instruction | 0 | 9,893 | 23 | 19,786 |
"Correct Solution:
```
N = int(input())
xs = set();ys = set()
P = []
for i in range(N):
x1,y1,x2,y2 = map(int, input().split())
xs.add(x1);xs.add(x2)
ys.add(y1);ys.add(y2)
P.append((x1,x2,y1,y2))
X = sorted(xs);Y = sorted(ys)
MX = {x: i for i, x in enumerate(X)}
MY = {y: i for i, y in enumerate(Y)... | output | 1 | 9,893 | 23 | 19,787 |
Provide a correct Python 3 solution for this coding contest problem.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $
Input
... | instruction | 0 | 9,894 | 23 | 19,788 |
"Correct Solution:
```
N = int(input())
XS = set(); YS = set()
P = []
for i in range(N):
x1, y1, x2, y2 = map(int, input().split())
XS.add(x1); XS.add(x2)
YS.add(y1); YS.add(y2)
P.append((x1, y1, x2, y2))
X = sorted(XS); Y = sorted(YS)
MX = {x: i for i, x in enumerate(X)}
MY = {y: i for i, y in enume... | output | 1 | 9,894 | 23 | 19,789 |
Provide a correct Python 3 solution for this coding contest problem.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $
Input
... | instruction | 0 | 9,895 | 23 | 19,790 |
"Correct Solution:
```
#import bisect
#from collections import product
n = int(input())
co_x = set()
co_y = set()
Rec = []
for _ in range(n):
x1,y1,x2,y2 = map(int, input().split( ))
co_x = co_x | {x1,x2}
co_y = co_y | {y1,y2}
Rec.append([x1,y1,x2,y2])
Rec.sort()
co_x = list(co_x)
co_y = list(co_y)
... | output | 1 | 9,895 | 23 | 19,791 |
Provide a correct Python 3 solution for this coding contest problem.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $
Input
... | instruction | 0 | 9,896 | 23 | 19,792 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import io, sys
import bisect
def main():
N = int( sys.stdin.readline() )
x1y1x2y2_list = [ list(map(int, sys.stdin.readline().split())) for _ in range(N) ]
X1 = [a for a,b,c,d in x1y1x2y2_list]
X2 = [c for a,b,c,d in x1y1x2y2_list]
Y1 = [b for a,... | output | 1 | 9,896 | 23 | 19,793 |
Provide a correct Python 3 solution for this coding contest problem.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $
Input
... | instruction | 0 | 9,897 | 23 | 19,794 |
"Correct Solution:
```
from typing import List, Iterator, Tuple
class Rectangle(object):
def __init__(self, xy1: Tuple[int, int], xy2: Tuple[int, int]) -> None:
self.topleft = xy1
self.bottomright = xy2
def area(self) -> int:
x1, y1 = self.topleft
x2, y2 = self.bottomright
... | output | 1 | 9,897 | 23 | 19,795 |
Provide a correct Python 3 solution for this coding contest problem.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $
Input
... | instruction | 0 | 9,898 | 23 | 19,796 |
"Correct Solution:
```
#!/usr/bin/env python3
# DSL_4_A: Union of Rectangles
# O(N^2)
class Rect:
def __init__(self, p1, p2):
self.top_left = p1
self.bottom_right = p2
def intersect(self, other):
xs1, ys1 = self.top_left
xs2, ys2 = self.bottom_right
xo1, yo1 = other.to... | output | 1 | 9,898 | 23 | 19,797 |
Provide a correct Python 3 solution for this coding contest problem.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $
Input
... | instruction | 0 | 9,899 | 23 | 19,798 |
"Correct Solution:
```
from itertools import accumulate
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
def main():
N = int(input())
xs = set()
ys = set()
rect = []
for _ in range(N):
x1, y1, x2, y2 = map(int, input().split())
xs.add(x1)
xs.add(... | output | 1 | 9,899 | 23 | 19,799 |
Provide a correct Python 3 solution for this coding contest problem.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\leq 10^9 $
* $ −10^9 \leq y1_i < y2_i\leq 10^9 $
Input
... | instruction | 0 | 9,900 | 23 | 19,800 |
"Correct Solution:
```
from itertools import accumulate
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
def main():
N = int(input())
xs = set()
ys = set()
rect = []
for _ in range(N):
x1, y1, x2, y2 = map(int, input().split())
xs.add(x1)
xs.add(... | output | 1 | 9,900 | 23 | 19,801 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Given a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.
Constraints
* $ 1 \leq N \leq 2000 $
* $ −10^9 \leq x1_i < x2_i\l... | instruction | 0 | 9,901 | 23 | 19,802 |
Yes | output | 1 | 9,901 | 23 | 19,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
You are also given a two-dimensional box of width W. Note that W may or may not be a... | instruction | 0 | 10,175 | 23 | 20,350 |
Tags: binary search, bitmasks, data structures, greedy
Correct Solution:
```
import sys,math
input=sys.stdin.readline
from collections import defaultdict
for _ in range(int(input())):
n,w=map(int,input().split())
ans=0
v=list(map(int,input().split()))
d=defaultdict(int)
vis=[]
for i in v:
... | output | 1 | 10,175 | 23 | 20,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
You are also given a two-dimensional box of width W. Note that W may or may not be a... | instruction | 0 | 10,176 | 23 | 20,352 |
Tags: binary search, bitmasks, data structures, greedy
Correct Solution:
```
from heapq import heappop, heappush
T = int(input())
for _ in range(T):
N, W = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
lst = [0]
idx = 0
for a in A:
flag = False
... | output | 1 | 10,176 | 23 | 20,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
You are also given a two-dimensional box of width W. Note that W may or may not be a... | instruction | 0 | 10,177 | 23 | 20,354 |
Tags: binary search, bitmasks, data structures, greedy
Correct Solution:
```
def main():
from sys import stdin, stdout
from collections import Counter
rl = stdin.readline
wl = stdout.write
for _ in range(int(rl())):
n, w = map(int, rl().split())
a = Counter(int(x) for x in rl().split())
a = dict(a.most_comm... | output | 1 | 10,177 | 23 | 20,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
You are also given a two-dimensional box of width W. Note that W may or may not be a... | instruction | 0 | 10,178 | 23 | 20,356 |
Tags: binary search, bitmasks, data structures, greedy
Correct Solution:
```
import sys
from os import path
if(path.exists("inp.txt")):
sys.stdin = open("inp.txt",'r')
sys.stdout = open("out.txt",'w')
from collections import Counter
t=int(input())
while(t):
t-=1
n,w=map(int,input().split())
li=list(map(int,input()... | output | 1 | 10,178 | 23 | 20,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
You are also given a two-dimensional box of width W. Note that W may or may not be a... | instruction | 0 | 10,179 | 23 | 20,358 |
Tags: binary search, bitmasks, data structures, greedy
Correct Solution:
```
import sys
import heapq
input = sys.stdin.readline
for _ in range(int(input())):
n, w = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
heap = []
ans = 1
heapq.heappush(heap, -(w-a[n-1]))
for... | output | 1 | 10,179 | 23 | 20,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
You are also given a two-dimensional box of width W. Note that W may or may not be a... | instruction | 0 | 10,180 | 23 | 20,360 |
Tags: binary search, bitmasks, data structures, greedy
Correct Solution:
```
t=int(input())
for _ in range(t):
n,y=map(int,input().split())
l=list(map(int,input().split()))
d={}
ans=0
for i in l:
d[i]=d.get(i,0)+1
while d:
w=y
for j in reversed(sorted(d.keys())):
... | output | 1 | 10,180 | 23 | 20,361 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
You are also given a two-dimensional box of width W. Note that W may or may not be a... | instruction | 0 | 10,181 | 23 | 20,362 |
Tags: binary search, bitmasks, data structures, greedy
Correct Solution:
```
from collections import *
for _ in range(int(input())):
n, w = map(int, input().split())
l = list(map(int, input().split()))
C = Counter(l)
height = 0
while len(C) > 0:
height += 1
rest = w
for i in ... | output | 1 | 10,181 | 23 | 20,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x).
You are also given a two-dimensional box of width W. Note that W may or may not be a... | instruction | 0 | 10,182 | 23 | 20,364 |
Tags: binary search, bitmasks, data structures, greedy
Correct Solution:
```
# cp template by varun
from math import ceil
from math import floor
from random import random
from math import gcd
def ar ():
return [int(x) for x in input().split()]
# -----
T = 1
T = int(input())
size = 2**20 + 7
dp... | output | 1 | 10,182 | 23 | 20,365 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.