message stringlengths 2 57.2k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 61 108k | cluster float64 22 22 | __index_level_0__ int64 122 217k |
|---|---|---|---|---|---|
Provide a correct Python 3 solution for this coding contest problem.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\leq C,D\leq 10^9
* All values in input are integers.
Inp... | instruction | 0 | 82,397 | 22 | 164,794 |
"Correct Solution:
```
from fractions import gcd
a,b,c,d = map(int,input().split())
k = c*d//gcd(c,d)
def f(x):
return x - x//c - x//d + x//k
print(f(b)-f(a-1))
``` | output | 1 | 82,397 | 22 | 164,795 |
Provide a correct Python 3 solution for this coding contest problem.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\leq C,D\leq 10^9
* All values in input are integers.
Inp... | instruction | 0 | 82,398 | 22 | 164,796 |
"Correct Solution:
```
A,B,C,D = map(int, input().split())
from fractions import gcd
cd = C*D//gcd(D,C)
f = lambda x: B//x - ((A-1)//x)
print(B - A + 1 - (f(C) + f(D) - f(cd)))
``` | output | 1 | 82,398 | 22 | 164,797 |
Provide a correct Python 3 solution for this coding contest problem.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\leq C,D\leq 10^9
* All values in input are integers.
Inp... | instruction | 0 | 82,399 | 22 | 164,798 |
"Correct Solution:
```
a,b,c,d=map(int,input().split())
a-=1
from fractions import*
bb=b-b//c-b//d+b//(c*d//gcd(c,d))
aa=a-a//c-a//d+a//(c*d//gcd(c,d))
print(bb-aa)
``` | output | 1 | 82,399 | 22 | 164,799 |
Provide a correct Python 3 solution for this coding contest problem.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\leq C,D\leq 10^9
* All values in input are integers.
Inp... | instruction | 0 | 82,400 | 22 | 164,800 |
"Correct Solution:
```
import fractions
A, B, C, D = map(int, input().split())
E = C*D//fractions.gcd(C, D)
X = B//C - (A-1)//C
Y = B//D - (A-1)//D
Z = B//E - (A-1)//E
print(B-A+1-X-Y+Z)
``` | output | 1 | 82,400 | 22 | 164,801 |
Provide a correct Python 3 solution for this coding contest problem.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\leq C,D\leq 10^9
* All values in input are integers.
Inp... | instruction | 0 | 82,401 | 22 | 164,802 |
"Correct Solution:
```
import math
a,b,c,d=map(int,input().split())
mc = b//c-(a-1)//c
md = b//d-(a-1)//d
cd = (c*d)//math.gcd(c,d)
mcd = b//cd - (a-1)//cd
print(b-a+1 - mc-md+mcd)
``` | output | 1 | 82,401 | 22 | 164,803 |
Provide a correct Python 3 solution for this coding contest problem.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\leq C,D\leq 10^9
* All values in input are integers.
Inp... | instruction | 0 | 82,402 | 22 | 164,804 |
"Correct Solution:
```
import fractions as f
a,b,c,d=map(int,input().split())
a-=1
print(b-a-b//c+a//c-b//d+a//d+b//c*f.gcd(c,d)//d-a//c*f.gcd(c,d)//d)
``` | output | 1 | 82,402 | 22 | 164,805 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\l... | instruction | 0 | 82,403 | 22 | 164,806 |
Yes | output | 1 | 82,403 | 22 | 164,807 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\l... | instruction | 0 | 82,404 | 22 | 164,808 |
Yes | output | 1 | 82,404 | 22 | 164,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\l... | instruction | 0 | 82,405 | 22 | 164,810 |
Yes | output | 1 | 82,405 | 22 | 164,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\l... | instruction | 0 | 82,406 | 22 | 164,812 |
Yes | output | 1 | 82,406 | 22 | 164,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
Constraints
* 1\leq A\leq B\leq 10^{18}
* 1\l... | instruction | 0 | 82,408 | 22 | 164,816 |
No | output | 1 | 82,408 | 22 | 164,817 |
Provide a correct Python 3 solution for this coding contest problem.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?
Constraints
* N is an integer between 1 and 200 (i... | instruction | 0 | 82,427 | 22 | 164,854 |
"Correct Solution:
```
n = int(input())
match = [105, 135, 165, 189, 195]
ans = 0
for i in match:
if n >= i:
ans += 1
print(ans)
``` | output | 1 | 82,427 | 22 | 164,855 |
Provide a correct Python 3 solution for this coding contest problem.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?
Constraints
* N is an integer between 1 and 200 (i... | instruction | 0 | 82,428 | 22 | 164,856 |
"Correct Solution:
```
n=int(input())
a=[135,189,105,165,195]
ans=0
for i in a:
if i<=n:
ans+=1
print(ans)
``` | output | 1 | 82,428 | 22 | 164,857 |
Provide a correct Python 3 solution for this coding contest problem.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?
Constraints
* N is an integer between 1 and 200 (i... | instruction | 0 | 82,429 | 22 | 164,858 |
"Correct Solution:
```
s=[105, 135, 165, 189, 195]
ans=0;n=int(input())
for f in s:
if n>=f:ans+=1
print(ans)
``` | output | 1 | 82,429 | 22 | 164,859 |
Provide a correct Python 3 solution for this coding contest problem.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?
Constraints
* N is an integer between 1 and 200 (i... | instruction | 0 | 82,430 | 22 | 164,860 |
"Correct Solution:
```
print([[i%j for j in range(1,i)].count(0) for i in range(1,int(input())+1,2)].count(7))
``` | output | 1 | 82,430 | 22 | 164,861 |
Provide a correct Python 3 solution for this coding contest problem.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?
Constraints
* N is an integer between 1 and 200 (i... | instruction | 0 | 82,431 | 22 | 164,862 |
"Correct Solution:
```
n=int(input())
ans=0
for i in range(1,n+1,2):
s=[i%j for j in range(1,i+1)]
if s.count(0)==8:
ans+=1
print(ans)
``` | output | 1 | 82,431 | 22 | 164,863 |
Provide a correct Python 3 solution for this coding contest problem.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?
Constraints
* N is an integer between 1 and 200 (i... | instruction | 0 | 82,432 | 22 | 164,864 |
"Correct Solution:
```
N=int(input())
ans = 0
for i in range(1,N+1,2):
tmp = 0
for j in range(1,i+1):
if i%j == 0:
tmp += 1
if tmp == 8:
ans +=1
print(ans)
``` | output | 1 | 82,432 | 22 | 164,865 |
Provide a correct Python 3 solution for this coding contest problem.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?
Constraints
* N is an integer between 1 and 200 (i... | instruction | 0 | 82,433 | 22 | 164,866 |
"Correct Solution:
```
d=[105,3*5*9,3*5*11,3*5*5*5,27*7,15*13]
n=int(input())
ans=0
for i in range(len(d)):
if d[i]<=n:
ans+=1
print(ans)
``` | output | 1 | 82,433 | 22 | 164,867 |
Provide a correct Python 3 solution for this coding contest problem.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?
Constraints
* N is an integer between 1 and 200 (i... | instruction | 0 | 82,434 | 22 | 164,868 |
"Correct Solution:
```
n=int(input())
c=0
for i in range(1,n+1,2):
count=0
for j in range(1,i+1):
if i%j==0:
count+=1
if count==8:
c+=1
print(c)
``` | output | 1 | 82,434 | 22 | 164,869 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusiv... | instruction | 0 | 82,435 | 22 | 164,870 |
Yes | output | 1 | 82,435 | 22 | 164,871 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusiv... | instruction | 0 | 82,436 | 22 | 164,872 |
Yes | output | 1 | 82,436 | 22 | 164,873 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusiv... | instruction | 0 | 82,437 | 22 | 164,874 |
Yes | output | 1 | 82,437 | 22 | 164,875 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusiv... | instruction | 0 | 82,438 | 22 | 164,876 |
Yes | output | 1 | 82,438 | 22 | 164,877 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusiv... | instruction | 0 | 82,439 | 22 | 164,878 |
No | output | 1 | 82,439 | 22 | 164,879 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusiv... | instruction | 0 | 82,440 | 22 | 164,880 |
No | output | 1 | 82,440 | 22 | 164,881 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusiv... | instruction | 0 | 82,441 | 22 | 164,882 |
No | output | 1 | 82,441 | 22 | 164,883 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusiv... | instruction | 0 | 82,442 | 22 | 164,884 |
No | output | 1 | 82,442 | 22 | 164,885 |
Provide a correct Python 3 solution for this coding contest problem.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.
In this problem, we call the greater ... | instruction | 0 | 82,496 | 22 | 164,992 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline
def create_prime_list(limit):
""" ??Β¨??????????????????????????Β§limit?????Β§????Β΄???Β°?????????????Β±???????
https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%... | output | 1 | 82,496 | 22 | 164,993 |
Provide a correct Python 3 solution for this coding contest problem.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.
In this problem, we call the greater ... | instruction | 0 | 82,497 | 22 | 164,994 |
"Correct Solution:
```
primes = [0, 0] + [1]*9999
for i in range(2, 100):
for j in range(i*i, 10001, i):
primes[j] = 0
while True:
n = int(input())
if n == 0:
break
for i in range(2, n+1)[::-1]:
if primes[i-2] and primes[i]:
print(i-2, i)
break
``` | output | 1 | 82,497 | 22 | 164,995 |
Provide a correct Python 3 solution for this coding contest problem.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.
In this problem, we call the greater ... | instruction | 0 | 82,498 | 22 | 164,996 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline
def create_prime_list(limit):
""" ??Β¨??????????????????????????Β§limit?????Β§????Β΄???Β°?????????????Β±???????
https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%... | output | 1 | 82,498 | 22 | 164,997 |
Provide a correct Python 3 solution for this coding contest problem.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.
In this problem, we call the greater ... | instruction | 0 | 82,499 | 22 | 164,998 |
"Correct Solution:
```
import math
isPrime = [True] * 10001
primes = []
def eratos(n):
isPrime[0] = isPrime[1] = False
for i in range(2,int(math.sqrt(n))):
if isPrime[i]:
j = 2 * i
while j <= n:
isPrime[j] = False
j = j + i
for i in range(2,10... | output | 1 | 82,499 | 22 | 164,999 |
Provide a correct Python 3 solution for this coding contest problem.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.
In this problem, we call the greater ... | instruction | 0 | 82,500 | 22 | 165,000 |
"Correct Solution:
```
def primes(n):
tf = [True] * (n + 1)
tf[0] = tf[1] = False
for i in range(2, int(n ** (1 / 2)) + 1):
if tf[i]:
for j in range(i ** 2, n + 1, i):
tf[j] = False
return [i for i in range(n + 1) if tf[i]]
def add_twin(prime_lst, twin_lst):
prime_lst2 = prime_lst[1:]
for... | output | 1 | 82,500 | 22 | 165,001 |
Provide a correct Python 3 solution for this coding contest problem.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.
In this problem, we call the greater ... | instruction | 0 | 82,501 | 22 | 165,002 |
"Correct Solution:
```
def isPrime(n):
for i in range(2,int(n**.5+1)):
if n%i==0:
return False
return True
while 1:
n=int(input())
if not n:break
for i in range(n,1,-1):
if isPrime(i) and isPrime(i-2):
print(i-2,i)
break
``` | output | 1 | 82,501 | 22 | 165,003 |
Provide a correct Python 3 solution for this coding contest problem.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.
In this problem, we call the greater ... | instruction | 0 | 82,502 | 22 | 165,004 |
"Correct Solution:
```
import math
MAX = 10000
def is_prime_number(num):
for divisor in range(3, int(math.sqrt(num) + 1), 2):
if num % divisor == 0:
return False
return True
def create_prime_number_list(max):
prime_number_list = list(range(0, max + 1))
prime_number_list[0] = F... | output | 1 | 82,502 | 22 | 165,005 |
Provide a correct Python 3 solution for this coding contest problem.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.
In this problem, we call the greater ... | instruction | 0 | 82,503 | 22 | 165,006 |
"Correct Solution:
```
import math
def prime(n):
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
else:
return True
while 1:
n = int(input())
if n == 0:
break
if n % 2 == 0:
n -= 1
for i in range(n, 3, -2):
if prime(i... | output | 1 | 82,503 | 22 | 165,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are ... | instruction | 0 | 82,504 | 22 | 165,008 |
Yes | output | 1 | 82,504 | 22 | 165,009 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are ... | instruction | 0 | 82,505 | 22 | 165,010 |
Yes | output | 1 | 82,505 | 22 | 165,011 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are ... | instruction | 0 | 82,506 | 22 | 165,012 |
Yes | output | 1 | 82,506 | 22 | 165,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are ... | instruction | 0 | 82,507 | 22 | 165,014 |
Yes | output | 1 | 82,507 | 22 | 165,015 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are ... | instruction | 0 | 82,508 | 22 | 165,016 |
No | output | 1 | 82,508 | 22 | 165,017 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are ... | instruction | 0 | 82,509 | 22 | 165,018 |
No | output | 1 | 82,509 | 22 | 165,019 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are ... | instruction | 0 | 82,510 | 22 | 165,020 |
No | output | 1 | 82,510 | 22 | 165,021 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are ... | instruction | 0 | 82,511 | 22 | 165,022 |
No | output | 1 | 82,511 | 22 | 165,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Try guessing the statement from this picture:
<image>
You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β
b = d.
Input
The first line contains t (1 β€ t β€ 10^3) β the... | instruction | 0 | 82,596 | 22 | 165,192 |
Tags: binary search, math
Correct Solution:
```
from math import (sqrt)
t = int(input())
for i in range(t):
d = int(input())
delta = d*d-4*d
if(delta>=0):
delta = sqrt(delta)
a = (d+delta)/2
b = (d-delta)/2
print("Y",a,b)
else:
print("N")
``` | output | 1 | 82,596 | 22 | 165,193 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Try guessing the statement from this picture:
<image>
You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β
b = d.
Input
The first line contains t (1 β€ t β€ 10^3) β the... | instruction | 0 | 82,597 | 22 | 165,194 |
Tags: binary search, math
Correct Solution:
```
t = int(input())
for i in range(t):
d = int(input())
D = d * d - 4 * d
if d == 0:
print('Y', 0.0, 0.0)
elif d < 4:
print('N')
else:
a = (d + D ** 0.5) / 2
b = (d - D ** 0.5) / 2
print('Y', a, b)
``` | output | 1 | 82,597 | 22 | 165,195 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Try guessing the statement from this picture:
<image>
You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β
b = d.
Input
The first line contains t (1 β€ t β€ 10^3) β the... | instruction | 0 | 82,598 | 22 | 165,196 |
Tags: binary search, math
Correct Solution:
```
from math import sqrt as s
for _ in" "*int(input()):n=int(input());print(*("Y ",(n+s(n**2-(4*n)))/2,n-(n+s(n**2-(4*n)))/2)if n**2-(4*n)>=0else"N")
``` | output | 1 | 82,598 | 22 | 165,197 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Try guessing the statement from this picture:
<image>
You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β
b = d.
Input
The first line contains t (1 β€ t β€ 10^3) β the... | instruction | 0 | 82,599 | 22 | 165,198 |
Tags: binary search, math
Correct Solution:
```
def fun():
test=int(input())
for i in range(test):
d=int(input())
if( 0< d< 4):
print("N")
else:
a= (d + (d*d- 4*d)**0.5)/2
b= d-a
print("Y {} {}".format(a,b))
fun()
``` | output | 1 | 82,599 | 22 | 165,199 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Try guessing the statement from this picture:
<image>
You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β
b = d.
Input
The first line contains t (1 β€ t β€ 10^3) β the... | instruction | 0 | 82,600 | 22 | 165,200 |
Tags: binary search, math
Correct Solution:
```
n = int(input())
for i in range(0,n):
d = int(input())
if d>0 and d<4:
print('N')
else:
a, b = (d + (d*(d-4))**0.5)/2 , (d - (d*(d-4))**0.5)/2
print('Y',a,b)
``` | output | 1 | 82,600 | 22 | 165,201 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Try guessing the statement from this picture:
<image>
You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β
b = d.
Input
The first line contains t (1 β€ t β€ 10^3) β the... | instruction | 0 | 82,601 | 22 | 165,202 |
Tags: binary search, math
Correct Solution:
```
for test in range(int(input())):
d = int(input())
delta = d**2 - 4*d
if delta < 0:
print('N')
else:
x = max((-d+delta**0.5)/-2,(-d-delta**0.5)/-2)
if delta == 0:
x = max(abs(x),d/2)
print('Y','%.9f %.9f' %(x,d-x)... | output | 1 | 82,601 | 22 | 165,203 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Try guessing the statement from this picture:
<image>
You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β
b = d.
Input
The first line contains t (1 β€ t β€ 10^3) β the... | instruction | 0 | 82,602 | 22 | 165,204 |
Tags: binary search, math
Correct Solution:
```
import math
t=int(input())
while(t):
d=int(input())
if(d*d < 4*d):
print('N')
else:
a=(d+math.sqrt(d*d - 4.0*d))/2.0
b=d-a
print('Y',end=' ')
print(a, b)
t-=1
``` | output | 1 | 82,602 | 22 | 165,205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.