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.
Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 poin... | instruction | 0 | 105,550 | 23 | 211,100 |
Yes | output | 1 | 105,550 | 23 | 211,101 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 poin... | instruction | 0 | 105,551 | 23 | 211,102 |
Yes | output | 1 | 105,551 | 23 | 211,103 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 poin... | instruction | 0 | 105,552 | 23 | 211,104 |
Yes | output | 1 | 105,552 | 23 | 211,105 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 poin... | instruction | 0 | 105,553 | 23 | 211,106 |
Yes | output | 1 | 105,553 | 23 | 211,107 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 poin... | instruction | 0 | 105,554 | 23 | 211,108 |
No | output | 1 | 105,554 | 23 | 211,109 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 poin... | instruction | 0 | 105,555 | 23 | 211,110 |
No | output | 1 | 105,555 | 23 | 211,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 poin... | instruction | 0 | 105,556 | 23 | 211,112 |
No | output | 1 | 105,556 | 23 | 211,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 poin... | instruction | 0 | 105,557 | 23 | 211,114 |
No | output | 1 | 105,557 | 23 | 211,115 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task is to find two distinct indices i and j such that segment ai lies within segment aj.
Segment... | instruction | 0 | 105,875 | 23 | 211,750 |
Yes | output | 1 | 105,875 | 23 | 211,751 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task is to find two distinct indices i and j such that segment ai lies within segment aj.
Segment... | instruction | 0 | 105,876 | 23 | 211,752 |
Yes | output | 1 | 105,876 | 23 | 211,753 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task is to find two distinct indices i and j such that segment ai lies within segment aj.
Segment... | instruction | 0 | 105,877 | 23 | 211,754 |
Yes | output | 1 | 105,877 | 23 | 211,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task is to find two distinct indices i and j such that segment ai lies within segment aj.
Segment... | instruction | 0 | 105,878 | 23 | 211,756 |
No | output | 1 | 105,878 | 23 | 211,757 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task is to find two distinct indices i and j such that segment ai lies within segment aj.
Segment... | instruction | 0 | 105,879 | 23 | 211,758 |
No | output | 1 | 105,879 | 23 | 211,759 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task is to find two distinct indices i and j such that segment ai lies within segment aj.
Segment... | instruction | 0 | 105,880 | 23 | 211,760 |
No | output | 1 | 105,880 | 23 | 211,761 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task is to find two distinct indices i and j such that segment ai lies within segment aj.
Segment... | instruction | 0 | 105,881 | 23 | 211,762 |
No | output | 1 | 105,881 | 23 | 211,763 |
Provide a correct Python 3 solution for this coding contest problem.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the w... | instruction | 0 | 106,038 | 23 | 212,076 |
"Correct Solution:
```
print((lambda x : int(x[0]) + int(x[1]) + 1 - (lambda *x, f=lambda f, x, y: f(f, y, x % y) if y else x: f(f, *x))(int(x[0]),int(x[1])))(input().split()))
``` | output | 1 | 106,038 | 23 | 212,077 |
Provide a correct Python 3 solution for this coding contest problem.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the w... | instruction | 0 | 106,039 | 23 | 212,078 |
"Correct Solution:
```
import math
x,y=map(int,input().split())
k=math.gcd(x,y)
if k==1:
print(x+y)
else:
m=2*x//k
print(x+y+1-2*x//m)
``` | output | 1 | 106,039 | 23 | 212,079 |
Provide a correct Python 3 solution for this coding contest problem.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the w... | instruction | 0 | 106,040 | 23 | 212,080 |
"Correct Solution:
```
def GCD(M, N) :
while True :
if N < M :
N, M = M, N
amari = N % M
if amari == 0 :
break
else :
N, M = M, amari
return M
x, y = map(int, input().split())
gcd = GCD(x, y)
x = x / gcd
y = y / gcd
print(int(x-1 + y-1 + 1) *... | output | 1 | 106,040 | 23 | 212,081 |
Provide a correct Python 3 solution for this coding contest problem.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the w... | instruction | 0 | 106,041 | 23 | 212,082 |
"Correct Solution:
```
import math
x, y = map(int, input().split())
g = math.gcd(x, y)
print(x+y-g+1)
``` | output | 1 | 106,041 | 23 | 212,083 |
Provide a correct Python 3 solution for this coding contest problem.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the w... | instruction | 0 | 106,042 | 23 | 212,084 |
"Correct Solution:
```
x, y = map(int, input().split())
def eu(x, y):
p, q = max(x, y), min(x, y)
while p % q != 0:p, q = q, p % q
return q
print(x + y - eu(x, y) + 1)
``` | output | 1 | 106,042 | 23 | 212,085 |
Provide a correct Python 3 solution for this coding contest problem.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the w... | instruction | 0 | 106,043 | 23 | 212,086 |
"Correct Solution:
```
il = lambda: list(map(int, input().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]
def gcd(a, b):
if a < b: return gcd(b, a)
if b == 0: return a
return gcd(b, a%b)
x, y = il()
a = gcd(x, y)
print(x+y-a+1)
``` | output | 1 | 106,043 | 23 | 212,087 |
Provide a correct Python 3 solution for this coding contest problem.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the w... | instruction | 0 | 106,044 | 23 | 212,088 |
"Correct Solution:
```
from math import gcd
x,y=map(int,input().split())
print(x+y-gcd(x,y)+1)
``` | output | 1 | 106,044 | 23 | 212,089 |
Provide a correct Python 3 solution for this coding contest problem.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in width, 1 m in height) and the w... | instruction | 0 | 106,045 | 23 | 212,090 |
"Correct Solution:
```
import math
x,y=list(map(int,input().split()))
print(x+y-math.gcd(x,y)+1)
``` | output | 1 | 106,045 | 23 | 212,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all ... | instruction | 0 | 106,046 | 23 | 212,092 |
Yes | output | 1 | 106,046 | 23 | 212,093 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all ... | instruction | 0 | 106,047 | 23 | 212,094 |
Yes | output | 1 | 106,047 | 23 | 212,095 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all ... | instruction | 0 | 106,048 | 23 | 212,096 |
Yes | output | 1 | 106,048 | 23 | 212,097 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all ... | instruction | 0 | 106,049 | 23 | 212,098 |
Yes | output | 1 | 106,049 | 23 | 212,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all ... | instruction | 0 | 106,050 | 23 | 212,100 |
No | output | 1 | 106,050 | 23 | 212,101 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
I am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all ... | instruction | 0 | 106,051 | 23 | 212,102 |
No | output | 1 | 106,051 | 23 | 212,103 |
Provide a correct Python 3 solution for this coding contest problem.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3... | instruction | 0 | 106,085 | 23 | 212,170 |
"Correct Solution:
```
from itertools import starmap
q = int(input())
while q:
q -= 1
p0, p1, p2, p3 = starmap(complex, zip(*[map(int, input().split())] * 2))
prod = (p1 - p0).conjugate() * (p3 - p2)
print(2 if abs(prod.imag) < 1e-6 else 1 if abs(prod.real) < 1e-6 else 0)
``` | output | 1 | 106,085 | 23 | 212,171 |
Provide a correct Python 3 solution for this coding contest problem.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3... | instruction | 0 | 106,086 | 23 | 212,172 |
"Correct Solution:
```
q = int(input())
for _ in range(q):
x0, y0, x1, y1, x2, y2, x3, y3 = map(int, input().split())
dot = (x1 - x0)*(x3 - x2) + (y1 - y0)*(y3 - y2)
if dot == 0:
print(1)
elif ((x1 - x0)**2 + (y1 - y0)**2)*((x3 - x2)**2 + (y3 - y2)**2) == dot**2:
print(2)
else:
... | output | 1 | 106,086 | 23 | 212,173 |
Provide a correct Python 3 solution for this coding contest problem.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3... | instruction | 0 | 106,087 | 23 | 212,174 |
"Correct Solution:
```
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __sub__(self, other):
return Point(self.x - other.x, self.y - other.y)
def __repr__(self):
return f"({self.x},{self.y})"
class Segment:
def __init__(self, x: Point, y: Point):
... | output | 1 | 106,087 | 23 | 212,175 |
Provide a correct Python 3 solution for this coding contest problem.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3... | instruction | 0 | 106,088 | 23 | 212,176 |
"Correct Solution:
```
#内積0の場合直行している
#外積0の場合平行
def main():
q = int(input())
for i in range(q):
print(parallel_orthogonal())
def parallel_orthogonal():
xp0, yp0, xp1, yp1, xp2, yp2, xp3, yp3 = map(int, input().split())
l1_start = complex(xp0, yp0)
l1_end = complex(xp1, yp1)
l2_start = complex(xp2, yp2)
... | output | 1 | 106,088 | 23 | 212,177 |
Provide a correct Python 3 solution for this coding contest problem.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3... | instruction | 0 | 106,089 | 23 | 212,178 |
"Correct Solution:
```
import sys
def get_line(line_info):
for line_pair in line_info:
line_axis = tuple(map(int, line_pair))
p0, p1, p2, p3 = (x + y * 1j for x, y in zip(line_axis[::2], line_axis[1::2]))
# print(p0, p1, p2, p3)
if dot(p1 - p0, p3 - p2) == 0:
print('1... | output | 1 | 106,089 | 23 | 212,179 |
Provide a correct Python 3 solution for this coding contest problem.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3... | instruction | 0 | 106,090 | 23 | 212,180 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class Point(object):
epsilon = 1e-10
def __init__(self, x=0.0, y=0.0):
if isinstance(x, tuple):
self.x =... | output | 1 | 106,090 | 23 | 212,181 |
Provide a correct Python 3 solution for this coding contest problem.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3... | instruction | 0 | 106,091 | 23 | 212,182 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')
# ベクトルの内積
def dot(a, b):
x1,y1=a... | output | 1 | 106,091 | 23 | 212,183 |
Provide a correct Python 3 solution for this coding contest problem.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3... | instruction | 0 | 106,092 | 23 | 212,184 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
import os
import pprint
#fd = os.open('CGL_2_A.txt', os.O_RDONLY)
#os.dup2(fd, sys.stdin.fileno())
def judge(lst):
x0, y0, x1, y1, x2, y2, x3, y3 = lst
v0 = (x1 - x0, y1 - y0)
v1 = (x3 - x2, y3 - y2)
dot = v0[0] * v1[0] + v0[1] * v1[1]
cr... | output | 1 | 106,092 | 23 | 212,185 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ... | instruction | 0 | 106,093 | 23 | 212,186 |
Yes | output | 1 | 106,093 | 23 | 212,187 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ... | instruction | 0 | 106,094 | 23 | 212,188 |
Yes | output | 1 | 106,094 | 23 | 212,189 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ... | instruction | 0 | 106,095 | 23 | 212,190 |
Yes | output | 1 | 106,095 | 23 | 212,191 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ... | instruction | 0 | 106,096 | 23 | 212,192 |
Yes | output | 1 | 106,096 | 23 | 212,193 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ... | instruction | 0 | 106,097 | 23 | 212,194 |
No | output | 1 | 106,097 | 23 | 212,195 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ... | instruction | 0 | 106,098 | 23 | 212,196 |
No | output | 1 | 106,098 | 23 | 212,197 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ... | instruction | 0 | 106,099 | 23 | 212,198 |
No | output | 1 | 106,099 | 23 | 212,199 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
Constraints
* 1 ≤ q ... | instruction | 0 | 106,100 | 23 | 212,200 |
No | output | 1 | 106,100 | 23 | 212,201 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Sofia is in fourth grade. Today in the geometry lesson she learned about segments and squares. On the way home, she decided to draw n squares in the snow with a side length of 1. For simplicity, we assume that Sofia lives on a plane a... | instruction | 0 | 106,152 | 23 | 212,304 |
Tags: binary search, constructive algorithms, math
Correct Solution:
```
ans=10**9
n=int(input())
i=1
while i*i<=n:
ans=min(ans, i+(n-1)//i+1)
i+=1
print(ans)
``` | output | 1 | 106,152 | 23 | 212,305 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Sofia is in fourth grade. Today in the geometry lesson she learned about segments and squares. On the way home, she decided to draw n squares in the snow with a side length of 1. For simplicity, we assume that Sofia lives on a plane a... | instruction | 0 | 106,153 | 23 | 212,306 |
Tags: binary search, constructive algorithms, math
Correct Solution:
```
from math import sqrt
n = int(input())
l = 1
r = 1
while (l+r)/2 < sqrt(n) :
if (l+r) % 2 == 0:
r+=1
else:
l+=1
print(r+l)
``` | output | 1 | 106,153 | 23 | 212,307 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Sofia is in fourth grade. Today in the geometry lesson she learned about segments and squares. On the way home, she decided to draw n squares in the snow with a side length of 1. For simplicity, we assume that Sofia lives on a plane a... | instruction | 0 | 106,154 | 23 | 212,308 |
Tags: binary search, constructive algorithms, math
Correct Solution:
```
import math
a = int(input())
lb = int(math.sqrt(a))
if lb == math.sqrt(a):
print(lb * 2)
else:
if lb + (lb*lb) >= a:
print((lb * 2) + 1 )
else:
print((lb * 2) + 2 )
``` | output | 1 | 106,154 | 23 | 212,309 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Sofia is in fourth grade. Today in the geometry lesson she learned about segments and squares. On the way home, she decided to draw n squares in the snow with a side length of 1. For simplicity, we assume that Sofia lives on a plane a... | instruction | 0 | 106,155 | 23 | 212,310 |
Tags: binary search, constructive algorithms, math
Correct Solution:
```
import math
n=int(input())
val=int(math.sqrt(n))
if val*val==n:
print(2*val)
elif n-(val*val)<=val:
print(1+(2*val))
else:
print(2+(2*val))
``` | output | 1 | 106,155 | 23 | 212,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Sofia is in fourth grade. Today in the geometry lesson she learned about segments and squares. On the way home, she decided to draw n squares in the snow with a side length of 1. For simplicity, we assume that Sofia lives on a plane a... | instruction | 0 | 106,156 | 23 | 212,312 |
Tags: binary search, constructive algorithms, math
Correct Solution:
```
import math
def main():
n = int(input())
print(int(math.ceil(math.sqrt(n) * 2)))
if __name__ == "__main__":
main()
``` | output | 1 | 106,156 | 23 | 212,313 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.