message stringlengths 2 30.5k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 237 109k | cluster float64 10 10 | __index_level_0__ int64 474 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft k torches. One torch can be crafted using one stick and one coal.
Hopefully, you've met a very handsome wandering trader who has two trade offers:
* exchange 1 stick for x sticks (you lose 1 stick and gain x sticks).
* exchange y sticks for 1 coal (you lose y sticks and gain 1 coal).
During one trade, you can use only one of these two trade offers. You can use each trade offer any number of times you want to, in any order.
Your task is to find the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 2 β
10^4) β the number of test cases. Then t test cases follow.
The only line of the test case contains three integers x, y and k (2 β€ x β€ 10^9; 1 β€ y, k β€ 10^9) β the number of sticks you can buy with one stick, the number of sticks required to buy one coal and the number of torches you need, respectively.
Output
For each test case, print the answer: the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
Example
Input
5
2 1 5
42 13 24
12 11 12
1000000000 1000000000 1000000000
2 1000000000 1000000000
Output
14
33
25
2000000003
1000000001999999999
Submitted Solution:
```
import math
t = int(input())
for i in range(t):
x , y , k = map(int , input().split())
#print(x,y,k)
a = (k*y + k - 3 + x) // (x-1) + k
#print(math.ceil((k*y + k - 1) / x-1) , k)
print(a)
``` | instruction | 0 | 51,547 | 10 | 103,094 |
Yes | output | 1 | 51,547 | 10 | 103,095 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft k torches. One torch can be crafted using one stick and one coal.
Hopefully, you've met a very handsome wandering trader who has two trade offers:
* exchange 1 stick for x sticks (you lose 1 stick and gain x sticks).
* exchange y sticks for 1 coal (you lose y sticks and gain 1 coal).
During one trade, you can use only one of these two trade offers. You can use each trade offer any number of times you want to, in any order.
Your task is to find the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 2 β
10^4) β the number of test cases. Then t test cases follow.
The only line of the test case contains three integers x, y and k (2 β€ x β€ 10^9; 1 β€ y, k β€ 10^9) β the number of sticks you can buy with one stick, the number of sticks required to buy one coal and the number of torches you need, respectively.
Output
For each test case, print the answer: the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
Example
Input
5
2 1 5
42 13 24
12 11 12
1000000000 1000000000 1000000000
2 1000000000 1000000000
Output
14
33
25
2000000003
1000000001999999999
Submitted Solution:
```
for i in range(int(input())):
l = [int(j) for j in input().split(" ")]
ans=0
coal = l[2]
ans+=coal
stickreq = coal*l[1]+l[2]
steps = int((stickreq-1)/(l[0]-1))
if (stickreq-1)%(l[0]-1)!=0:
steps+=1
ans+=steps
print(ans)
``` | instruction | 0 | 51,548 | 10 | 103,096 |
No | output | 1 | 51,548 | 10 | 103,097 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft k torches. One torch can be crafted using one stick and one coal.
Hopefully, you've met a very handsome wandering trader who has two trade offers:
* exchange 1 stick for x sticks (you lose 1 stick and gain x sticks).
* exchange y sticks for 1 coal (you lose y sticks and gain 1 coal).
During one trade, you can use only one of these two trade offers. You can use each trade offer any number of times you want to, in any order.
Your task is to find the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 2 β
10^4) β the number of test cases. Then t test cases follow.
The only line of the test case contains three integers x, y and k (2 β€ x β€ 10^9; 1 β€ y, k β€ 10^9) β the number of sticks you can buy with one stick, the number of sticks required to buy one coal and the number of torches you need, respectively.
Output
For each test case, print the answer: the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
Example
Input
5
2 1 5
42 13 24
12 11 12
1000000000 1000000000 1000000000
2 1000000000 1000000000
Output
14
33
25
2000000003
1000000001999999999
Submitted Solution:
```
from collections import defaultdict as dd
import math
import sys
import string
input=sys.stdin.readline
def nn():
return int(input())
def li():
return list(input())
def mi():
return map(int, input().split())
def lm():
return list(map(int, input().split()))
def solve():
x,y,k=mi()
n_sticks = k + k*y
n_move_1 = (n_sticks-1 + x-2)//(x-1)
n_move_2 = k
print(n_sticks, n_move_1, n_move_2)
print(n_move_1+n_move_2)
q=nn()
for _ in range(q):
solve()
``` | instruction | 0 | 51,549 | 10 | 103,098 |
No | output | 1 | 51,549 | 10 | 103,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft k torches. One torch can be crafted using one stick and one coal.
Hopefully, you've met a very handsome wandering trader who has two trade offers:
* exchange 1 stick for x sticks (you lose 1 stick and gain x sticks).
* exchange y sticks for 1 coal (you lose y sticks and gain 1 coal).
During one trade, you can use only one of these two trade offers. You can use each trade offer any number of times you want to, in any order.
Your task is to find the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 2 β
10^4) β the number of test cases. Then t test cases follow.
The only line of the test case contains three integers x, y and k (2 β€ x β€ 10^9; 1 β€ y, k β€ 10^9) β the number of sticks you can buy with one stick, the number of sticks required to buy one coal and the number of torches you need, respectively.
Output
For each test case, print the answer: the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
Example
Input
5
2 1 5
42 13 24
12 11 12
1000000000 1000000000 1000000000
2 1000000000 1000000000
Output
14
33
25
2000000003
1000000001999999999
Submitted Solution:
```
import math
for z in range(int(input())):
(x,y,k)=map(int,input().strip().split(" "))
req=(y+1)*k
sticks=1
count=0
while(sticks*x<req):
count+=sticks
sticks=sticks*x
count+=int(math.floor((req-sticks)/sticks))
print(count+k)
``` | instruction | 0 | 51,550 | 10 | 103,100 |
No | output | 1 | 51,550 | 10 | 103,101 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft k torches. One torch can be crafted using one stick and one coal.
Hopefully, you've met a very handsome wandering trader who has two trade offers:
* exchange 1 stick for x sticks (you lose 1 stick and gain x sticks).
* exchange y sticks for 1 coal (you lose y sticks and gain 1 coal).
During one trade, you can use only one of these two trade offers. You can use each trade offer any number of times you want to, in any order.
Your task is to find the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
You have to answer t independent test cases.
Input
The first line of the input contains one integer t (1 β€ t β€ 2 β
10^4) β the number of test cases. Then t test cases follow.
The only line of the test case contains three integers x, y and k (2 β€ x β€ 10^9; 1 β€ y, k β€ 10^9) β the number of sticks you can buy with one stick, the number of sticks required to buy one coal and the number of torches you need, respectively.
Output
For each test case, print the answer: the minimum number of trades you need to craft at least k torches. The answer always exists under the given constraints.
Example
Input
5
2 1 5
42 13 24
12 11 12
1000000000 1000000000 1000000000
2 1000000000 1000000000
Output
14
33
25
2000000003
1000000001999999999
Submitted Solution:
```
import math
for _ in range(int(input())):
x,y,n=map(int,input().split())
req=y*n+n
count=1
count+=((req-1)//(x-1))
#print(count)
print(count+n)
``` | instruction | 0 | 51,551 | 10 | 103,102 |
No | output | 1 | 51,551 | 10 | 103,103 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO | instruction | 0 | 51,810 | 10 | 103,620 |
Tags: brute force, two pointers
Correct Solution:
```
def play(l, r, x, y, k):
for i in range(x, y + 1):
if l <= k * i <= r:
return "YES"
return "NO"
L, R, X, Y, K = [int(j) for j in input().split()]
print(play(L, R, X, Y, K))
``` | output | 1 | 51,810 | 10 | 103,621 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO | instruction | 0 | 51,811 | 10 | 103,622 |
Tags: brute force, two pointers
Correct Solution:
```
l,r,x,y,k=map(float,input().split())
lis=[]
l=int(l)
r=int(r)
x=int(x)
y=int(y)
for i in range(x,y+1):
lis+=[i]
mid=0
while(len(lis)!=0):
mid = int((len(lis)/2)//1)
if lis[mid]*k>=l and lis[mid]*k<=r and lis[mid]*k.is_integer():
print("YES")
break
elif lis[-1]*k>=l and lis[-1]*k<=r and lis[-1]*k.is_integer():
print("YES")
break
elif lis[mid]*k<l:
lis=lis[mid:-1:]
elif lis[mid]*k>r:
lis=lis[:mid:]
if(len(lis)==0):print("NO")
``` | output | 1 | 51,811 | 10 | 103,623 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO | instruction | 0 | 51,812 | 10 | 103,624 |
Tags: brute force, two pointers
Correct Solution:
```
l,r,x,y,k=map(int,input().split())
if (x*k<r and y*k>l):
if ((r//k)-((l-1)//k))>0 and r!=l:
print("YES")
elif l==r and l%k==0:
print("YES")
else:
print("NO")
elif (x*k==r or y*k==l or x*k==l or x*k==r):
print("YES")
else:
print("NO")
``` | output | 1 | 51,812 | 10 | 103,625 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO | instruction | 0 | 51,813 | 10 | 103,626 |
Tags: brute force, two pointers
Correct Solution:
```
I = lambda: map(int, input().rstrip().split())
l, r, x, y, k = I()
for cost in range(x, y + 1):
if r >= cost * k >= l:
print("YES")
exit()
print("NO")
``` | output | 1 | 51,813 | 10 | 103,627 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO | instruction | 0 | 51,814 | 10 | 103,628 |
Tags: brute force, two pointers
Correct Solution:
```
l,r,x,y,k=[int(a) for a in input().split()]
i=l
j=x
s=0
while(i<=r and j<=y):
d=(i/j)
if(d==k):
s=1
break
elif(d<k):
i=i+1
else:
j=j+1
if(s):
print("YES")
else:
print("NO")
``` | output | 1 | 51,814 | 10 | 103,629 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO | instruction | 0 | 51,815 | 10 | 103,630 |
Tags: brute force, two pointers
Correct Solution:
```
l, r, x, y, k = map(int , input().split())
flag = "NO"
for cost in range(x,y+1):
value = k * cost
if value>=l and value<=r:
flag = "YES"
break
print(flag)
``` | output | 1 | 51,815 | 10 | 103,631 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO | instruction | 0 | 51,816 | 10 | 103,632 |
Tags: brute force, two pointers
Correct Solution:
```
l, r, x, y, k = map(int, input().split())
if y * k < l or x * k > r:
print('NO')
elif y * k <= r or x * k >= l:
print('YES')
elif l // k == r // k and l % k != 0:
print('NO')
else:
print('YES')
``` | output | 1 | 51,816 | 10 | 103,633 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO | instruction | 0 | 51,817 | 10 | 103,634 |
Tags: brute force, two pointers
Correct Solution:
```
l, r, x, y, k = map(int, input().split())
low_ex, high_ex = x * k, y * k
if high_ex < l or low_ex > r:
print('NO')
else:
low = l // k * k
up = r // k * k + k
a = low
b = low // k
ok = 0
while a <= up:
if x <= b and b <= y and l <= a and a <= r:
ok = 1
a += k
b += 1
if ok == 1:
print('YES')
else:
print('NO')
``` | output | 1 | 51,817 | 10 | 103,635 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO
Submitted Solution:
```
from sys import maxsize, stdout, stdin,stderr
mod = int(1e9 + 7)
import re #can use multiple splits
def tup():return map(int,stdin.readline().split())
def I(): return int(stdin.readline())
def lint(): return [int(x) for x in stdin.readline().split()]
def S(): return input().strip()
def grid(r, c): return [lint() for i in range(r)]
def debug(*args, c=6): print('\033[3{}m'.format(c), *args, '\033[0m', file=stderr)
from math import log2,sqrt
# R,D = tup()
# cnt =0
#
# for _ in range(I()):
# x, y , r = tup()
# if sqrt(x**2 + y**2) + r <= R and sqrt(x**2 + y**2) >= R -D + r:
# cnt+=1
# debug(sqrt(x**2 + y**2),r)
# print(cnt)
#
def work():
l,r,x,y,k = tup() ; f = False
if k >= l/y and k<= r/x:
if k==l/y or k==r/x :return "YES"
i = l ; j = x
nu = set() ; de = set()
while i <=r and i >=l and j <=y and j>=x:
if i not in nu and j not in de :
if i/j < k:
nu.add(i)
i+=1
elif i/j > k:
de.add(j)
j+=1
else:return "YES"
else:
if i in nu:i+=1
elif j in de :j+=1
else:return "NO"
debug(i , j, k)
return "NO"
else:return "NO"
print(work())
``` | instruction | 0 | 51,818 | 10 | 103,636 |
Yes | output | 1 | 51,818 | 10 | 103,637 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO
Submitted Solution:
```
l, r, x, y, k = [int(x) for x in (input().split())]
ans = "NO"
for i in range(x, y + 1):
if i * k >= l and i * k <= r:
ans = "YES"
break
print(ans)
#
``` | instruction | 0 | 51,819 | 10 | 103,638 |
Yes | output | 1 | 51,819 | 10 | 103,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO
Submitted Solution:
```
l,r,x,y,k=[int(i) for i in input().split()]
global is_potion
is_potion=False
for b in range(x,y+1):
if(k*b>=l and k*b<=r):
is_potion=is_potion or True
else:
is_potion=is_potion or False
if(is_potion):
print('YES')
else:
print('NO')
``` | instruction | 0 | 51,820 | 10 | 103,640 |
Yes | output | 1 | 51,820 | 10 | 103,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO
Submitted Solution:
```
l, r, x, y, k = map(int, input().split())
for i in range(x, y + 1):
if l <= i * k <= r:
print("YES")
exit()
print("NO")
``` | instruction | 0 | 51,821 | 10 | 103,642 |
Yes | output | 1 | 51,821 | 10 | 103,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO
Submitted Solution:
```
l,r,x,y,k = map(int, input().strip().split(' '))
if k>(y/l):
print('no')
elif k<(x/r):
print('no')
else:
i=l
j=x
f=0
while(i<=r and j<=y):
if j>=i and j%i==0:
if j//i==k:
f=1
print('yes')
break
elif (j//i)>k:
i+=1
else:
j+=1
else:
if j/i>k:
i+=1
else:
j+=1
#print(j/i)
if f==0:
print('no')
``` | instruction | 0 | 51,822 | 10 | 103,644 |
No | output | 1 | 51,822 | 10 | 103,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO
Submitted Solution:
```
l, r, x, y, k = map(int, input().split(' '))
if l <= x * k <= r:
print("YES")
else:
print("NO")
``` | instruction | 0 | 51,823 | 10 | 103,646 |
No | output | 1 | 51,823 | 10 | 103,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO
Submitted Solution:
```
l,r,x,y,k = map(int,input().split())
c = 0
for i in range(l,r+1):
if x<=i//k<=y:
c=1
break
if c:
print("YES")
else:
print("NO")
``` | instruction | 0 | 51,824 | 10 | 103,648 |
No | output | 1 | 51,824 | 10 | 103,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers β amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.
For each two integer numbers a and b such that l β€ a β€ r and x β€ b β€ y there is a potion with experience a and cost b in the store (that is, there are (r - l + 1)Β·(y - x + 1) potions).
Kirill wants to buy a potion which has efficiency k. Will he be able to do this?
Input
First string contains five integer numbers l, r, x, y, k (1 β€ l β€ r β€ 107, 1 β€ x β€ y β€ 107, 1 β€ k β€ 107).
Output
Print "YES" without quotes if a potion with efficiency exactly k can be bought in the store and "NO" without quotes otherwise.
You can output each of the letters in any register.
Examples
Input
1 10 1 10 1
Output
YES
Input
1 5 6 10 1
Output
NO
Submitted Solution:
```
l,r,x,y,k=map(int,input().split())
for i in range(l,r+1):
if(i*k>=x and i*k<=y):
print("YES")
break
else:
print("NO")
``` | instruction | 0 | 51,825 | 10 | 103,650 |
No | output | 1 | 51,825 | 10 | 103,651 |
Provide a correct Python 3 solution for this coding contest problem.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800 | instruction | 0 | 52,098 | 10 | 104,196 |
"Correct Solution:
```
N = int(input())
for _ in range(N):
A = []
x, y, b, p = map(int, input().split())
s = x*b+y*p #ε
¨ι¨γγ©
A.append(int(s))
wari = 0.8*(5*x+2*y)
for i in range(1, 4):
s = wari*i
if b-(5*i)>0:
s += 0.8*(b-(5*i))*x
if p-(2*i)>0:
s += 0.8*(p-(2*i))*y
A.append(int(s))
print(min(A))
``` | output | 1 | 52,098 | 10 | 104,197 |
Provide a correct Python 3 solution for this coding contest problem.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800 | instruction | 0 | 52,099 | 10 | 104,198 |
"Correct Solution:
```
N = int(input())
for i in range(N):
x,y,b,p = list(map(int,input().split()))
def calc(x,y,b,p):
m = min(p//2,b//5)
#return 0.8*(5*m*x + 2*m*y) + (b-5*m)*x + (p-2*m)*y
c = x*b + y*p
return 0.8*c if m > 0 else c
v = []
v.append(calc(x,y,b,p))
add_p = 2 - p % 2
add_b = 5 - b % 5
v.append(calc(x,y,b+add_b,p))
v.append(calc(x,y,b,p+add_p))
v.append(calc(x,y,b+add_b,p+add_p))
print(int(min(v)))
#print(v)
``` | output | 1 | 52,099 | 10 | 104,199 |
Provide a correct Python 3 solution for this coding contest problem.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800 | instruction | 0 | 52,100 | 10 | 104,200 |
"Correct Solution:
```
N = int(input())
for i in range(N):
x, y, b, p = map(int, input().split())
print(min(x*b+y*p, (x*max(b,5)+y*max(p,2))*4//5))
``` | output | 1 | 52,100 | 10 | 104,201 |
Provide a correct Python 3 solution for this coding contest problem.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800 | instruction | 0 | 52,101 | 10 | 104,202 |
"Correct Solution:
```
N = int(input())
xybp = [list(map(int,input().split())) for _ in range(N)]
for X in xybp:
x,y,b,p = X[0],X[1],X[2],X[3]
kouho1 = x*b+y*p
if b <= 5 and p <= 2:
kouho2 = 0.8*x*5+0.8*y*2
elif b > 5 and p <= 2:
kouho2 = 0.8*x*b+0.8*y*2
elif b <= 5 and p > 2:
kouho2 = 0.8*x*5+0.8*y*p
else:
kouho2 = 0.8*x*b+0.8*y*p
print(min(kouho1,int(kouho2)))
``` | output | 1 | 52,101 | 10 | 104,203 |
Provide a correct Python 3 solution for this coding contest problem.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800 | instruction | 0 | 52,102 | 10 | 104,204 |
"Correct Solution:
```
n = int(input())
for i in range(n):
x,y,b,p = map(int,input().split())
s = x * b + y * p
t = int((x * 5 + y * 2) * 0.8)
u = s
if s <= t:
print(s)
else:
if 5 - b > 0:
u += (5 - b) * x
if 2 - p > 0:
u += (2 - p) * y
print(min(s,int(u * 0.8)))
``` | output | 1 | 52,102 | 10 | 104,205 |
Provide a correct Python 3 solution for this coding contest problem.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800 | instruction | 0 | 52,103 | 10 | 104,206 |
"Correct Solution:
```
N = int(input())
for i in range(N):
x, y, b, p = map(int, input().split())
print(int(min(x*b + y*p, (x*max(b, 5) + y*max(p, 2))*0.8)))
``` | output | 1 | 52,103 | 10 | 104,207 |
Provide a correct Python 3 solution for this coding contest problem.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800 | instruction | 0 | 52,104 | 10 | 104,208 |
"Correct Solution:
```
N = int(input())
for l in range(N):
x,y,b,p = [int(i) for i in input().split()]
ans = x*b + y*p
if b < 5:
b = 5
if p < 2:
p = 2
ans = min(ans, (x*b + y*p) * 4 // 5)
print(ans)
``` | output | 1 | 52,104 | 10 | 104,209 |
Provide a correct Python 3 solution for this coding contest problem.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800 | instruction | 0 | 52,105 | 10 | 104,210 |
"Correct Solution:
```
import sys
f = sys.stdin
n = int(f.readline())
for line in f:
x, y, b, p = map(int, line.split())
regular = x * b + y * p
discount = int(x * 0.8) * max(b, 5) + int(y * 0.8) * max(p, 2)
print(min(regular, discount))
``` | output | 1 | 52,105 | 10 | 104,211 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800
Submitted Solution:
```
n=int(input())
for i in range(n):
x,y,b,p=map(int,input().split())
if b>=5 and p>=2:
print(int((x*b+y*p)*0.8))
else:
keep=x*b+y*p
if b<5:b=5
if p<2:p=2
keep2=int((x*b+y*p)*0.8)
print(min(keep,keep2))
``` | instruction | 0 | 52,106 | 10 | 104,212 |
Yes | output | 1 | 52,106 | 10 | 104,213 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800
Submitted Solution:
```
# -*- coding: utf-8 -*-
"""
Admission Fee
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0278
"""
import sys
def solve():
x, y, b, p = map(int, input().split())
p1 = x * b + y * p
p2 = (x * max(b, 5) + y * max(p, 2)) * 8 // 10
return min(p1, p2)
def main(args):
N = int(input())
for _ in range(N):
ans = solve()
print(ans)
if __name__ == '__main__':
main(sys.argv[1:])
``` | instruction | 0 | 52,107 | 10 | 104,214 |
Yes | output | 1 | 52,107 | 10 | 104,215 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800
Submitted Solution:
```
n = int(input())
for _ in range(n):
x, y, b, p = map(int, input().split())
if b < 5 and p < 2:
ans = min((x*b+y*p), ((x*5+y*2)*0.8))
elif b >= 5 and p < 2:
ans = min((x*b+y*p), ((x*b+y*2)*0.8))
elif b < 5 and p >= 2:
ans = min((x*b+y*p), ((x*5+y*p)*0.8))
else:
ans = (x*b+y*p)*0.8
print(int(ans))
``` | instruction | 0 | 52,108 | 10 | 104,216 |
Yes | output | 1 | 52,108 | 10 | 104,217 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800
Submitted Solution:
```
inputs = [list(map(int, input().split())) for _ in range(int(input()))]
ans = []
def niwari(x, y, _b, _p):
b = 5 if _b < 5 else _b
p = 2 if _p < 2 else _p
return int(0.8*(x*b+y*p))
for inpt in inputs:
x, y, b, p = inpt
if b >= 5 and p >= 2:
# γΎγ¨γθ²·γγ§2ε²εΌ
ans.append(str(int((x*b+y*p)*0.8)))
else:
ans.append(str(min(int(x*b+y*p), niwari(x, y, b, p))))
print('\n'.join(ans))
``` | instruction | 0 | 52,109 | 10 | 104,218 |
Yes | output | 1 | 52,109 | 10 | 104,219 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800
Submitted Solution:
```
n=int(input())
for i in range(n):
a,b,c,d=map(int,input().split())
q,w,e,r=0,0,0,0
q,w=a*c,b*d
e=q+w
if c>=5 and d>=2:
e=e*0.8
e=int(e)
print(e)
``` | instruction | 0 | 52,110 | 10 | 104,220 |
No | output | 1 | 52,110 | 10 | 104,221 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800
Submitted Solution:
```
n=int(input().split())
for i in range(n):
a,b,c,d=map(int,input().split())
q,w,e,r=0,0,0,0
q,w=a*c,b*d
e=q+w
if c<=5 and d<=2:
r=e*0.8
print(r)
``` | instruction | 0 | 52,111 | 10 | 104,222 |
No | output | 1 | 52,111 | 10 | 104,223 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800
Submitted Solution:
```
N = int(input())
for i in range(N):
x,y,b,p = list(map(int,input().split()))
def calc(x,y,b,p):
m = min(p//2,b//5)
return 0.8*(5*m*x + 2*m*y) + (b-5*m)*x + (p-2*m)*y
v = []
v.append(calc(x,y,b,p))
add_p = 2 - p % 2
add_b = 5 - b % 5
v.append(calc(x,y,b+add_b,p))
v.append(calc(x,y,b,p+add_p))
v.append(calc(x,y,b+add_b,p+add_p))
print(int(min(v)))
``` | instruction | 0 | 52,112 | 10 | 104,224 |
No | output | 1 | 52,112 | 10 | 104,225 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.
* Tickets are valid only once on the day of purchase.
* If you buy 5 or more bathing tickets and 2 or more pool tickets at once, you will get a 20% discount on all tickets.
Sadayoshi, who loves hot springs, and his friends go to Aiz Onsen almost every day. They are all capricious and use different numbers from day to day. Aiz Onsen has discount rules, so if you work together as a group and buy well, you may be able to reduce the total price.
Create a program that outputs the cheapest total price when the bathing ticket and pool ticket charges, the number of bathing tickets to be used and the number of pool tickets are given as inputs. However, if buying more tickets than you use will reduce the total price, you do not have to use all the tickets you bought.
input
The input is given in the following format.
N
x1 y1 b1 p1
x2 y2 b2 p2
::
xN yN bN pN
N (1 β€ N β€ 365) on the first line is the number of days for which you want to calculate the charge. In the next N lines, the bathing ticket fee xi (100 β€ xi β€ 1000) for the i-day day, the pool ticket fee yi (100 β€ yi β€ 1000), the number of bathing tickets used bi (0 β€ bi β€ 6), The number of pool tickets to use pi (0 β€ pi β€ 6) is given. Both bathing tickets and pool tickets are charged in increments of 50 yen.
output
Print the cheapest total price on one line for each day.
Example
Input
2
100 100 1 1
1000 500 5 2
Output
200
4800
Submitted Solution:
```
n=int(input())
for i in range(n):
a,b,c,d=map(int,input().split())
q,w,e,r=0,0,0,0
q,w=a*c,b*d
e=q+w
if c<=5 and d>=2:
e=e*0.8
e=int(e)
print(e)
``` | instruction | 0 | 52,113 | 10 | 104,226 |
No | output | 1 | 52,113 | 10 | 104,227 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. | instruction | 0 | 52,570 | 10 | 105,140 |
Tags: brute force, implementation
Correct Solution:
```
n, s = map(int, input().split())
a = [[int(i) for i in input().split()] for j in range(n)]
ans = -1
for i in a:
if i[0] + min(1, i[1]) <= s:
ans = max(ans, (100 - i[1]) % 100)
print(ans)
``` | output | 1 | 52,570 | 10 | 105,141 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. | instruction | 0 | 52,571 | 10 | 105,142 |
Tags: brute force, implementation
Correct Solution:
```
n,s=map(int,input().split())
mx,fg=0,0
for i in range(0,n):
a,b=map(int,input().split())
if b!=0:
if (a+1)<=s:
fg=1
mx=max(mx,100-b)
elif a<=s:
fg=1
if fg==0:print(-1)
else:print(mx)
``` | output | 1 | 52,571 | 10 | 105,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. | instruction | 0 | 52,572 | 10 | 105,144 |
Tags: brute force, implementation
Correct Solution:
```
n, s = map(int, input().split())
s = s * 100
max_ost = -1
for i in range(n):
x, y = map(int, input().split())
if s >= x * 100 + y:
max_ost = max(max_ost, (s - (x * 100 + y)) % 100)
print(max_ost)
``` | output | 1 | 52,572 | 10 | 105,145 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. | instruction | 0 | 52,573 | 10 | 105,146 |
Tags: brute force, implementation
Correct Solution:
```
n, s = map(int, input().split())
ans = -1
for _ in range(n):
x, y = map(int, input().split())
if x*100+y <= s*100:
ans = max(ans, (100*s-x*100-y)%100)
print(ans)
``` | output | 1 | 52,573 | 10 | 105,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. | instruction | 0 | 52,574 | 10 | 105,148 |
Tags: brute force, implementation
Correct Solution:
```
n, s = map(int, input().split())
mn = 101
zero = False
for i in range(n):
d, c = map(int, input().split())
if d==s and c==0:
zero = True
continue
if d<s and c<mn:
if c==0:
zero = True
else:
mn=c
if mn>100 and zero:
print ("0")
elif mn>100:
print ("-1")
else:
print (100-mn)
``` | output | 1 | 52,574 | 10 | 105,149 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. | instruction | 0 | 52,575 | 10 | 105,150 |
Tags: brute force, implementation
Correct Solution:
```
n, s = map(int, input().split())
ans = -1
for i in range(n):
x, y = map(int, input().split())
if 100 * x + y > 100 * s:
continue
ans = max(ans, 0 if y == 0 else 100 - y)
print(ans)
``` | output | 1 | 52,575 | 10 | 105,151 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. | instruction | 0 | 52,576 | 10 | 105,152 |
Tags: brute force, implementation
Correct Solution:
```
inp = lambda : [*map(int, input().split())]
n, s = inp()
s *= 100
ans = -1
for i in range(n):
x, y = inp()
if x * 100 + y <= s:
ans = max(ans, (100 - y) % 100)
print(ans)
``` | output | 1 | 52,576 | 10 | 105,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change. | instruction | 0 | 52,577 | 10 | 105,154 |
Tags: brute force, implementation
Correct Solution:
```
import sys
n, s = [int(x) for x in (sys.stdin.readline()).split()]
result = -1
for c in range(n):
x, y = [int(x) for x in (sys.stdin.readline()).split()]
t = x
if(y > 0):
t += 1
if(t <= s):
a = 100 - y
if(a == 100):
a = 0
if(a > result):
result = a
print(result)
``` | output | 1 | 52,577 | 10 | 105,155 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change.
Submitted Solution:
```
n,s=map(int,input().split())
mim=0
d=0
l=[]
for i in range(n):
a,b=map(int,input().split())
if ((a*100)+b)<=(s*100):
mim=(s*100)-((a*100)+b)
d=mim%100
l.append(d)
if len(l)>0:
print(max(l))
else:
print("-1")
``` | instruction | 0 | 52,578 | 10 | 105,156 |
Yes | output | 1 | 52,578 | 10 | 105,157 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change.
Submitted Solution:
```
#Mamma don't raises quitter.................................................
from collections import deque as de
import math
import sys
import re
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr
from bisect import bisect_left as bl, bisect_right as br
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
class My_stack():
def __init__(self):
self.data = []
def my_push(self, x):
return (self.data.append(x))
def my_pop(self):
return (self.data.pop())
def my_peak(self):
return (self.data[-1])
def my_contains(self, x):
return (self.data.count(x))
def my_show_all(self):
return (self.data)
def isEmpty(self):
return len(self.data)==0
arrStack = My_stack()
#decimal to binary
def decimalToBinary(n):
return bin(n).replace("0b", "")
#binary to decimal
def binarytodecimal(n):
return int(n,2)
def isPrime(n) :
if (n <= 1) :
return False
if (n <= 3) :
return True
if (n % 2 == 0 or n % 3 == 0) :
return False
i = 5
while(i * i <= n) :
if (n % i == 0 or n % (i + 2) == 0) :
return False
i = i + 6
return True
def get_prime_factors(number):
prime_factors = []
while number % 2 == 0:
prime_factors.append(2)
number = number / 2
for i in range(3, int(math.sqrt(number)) + 1, 2):
while number % i == 0:
prime_factors.append(int(i))
number = number / i
if number > 2:
prime_factors.append(int(number))
return prime_factors
def get_frequency(list):
dic={}
for ele in list:
if ele in dic:
dic[ele] += 1
else:
dic[ele] = 1
return dic
def Log2(x):
return (math.log10(x) /
math.log10(2));
# Function to get product of digits
def getProduct(n):
product = 1
while (n != 0):
product = product * (n % 10)
n = n // 10
return product
# function to count consecutive duplicate element in an array
def dupconscount(nums):
element = []
freque = []
if not nums:
return element
running_count = 1
for i in range(len(nums)-1):
if nums[i] == nums[i+1]:
running_count += 1
else:
freque.append(running_count)
element.append(nums[i])
running_count = 1
freque.append(running_count)
element.append(nums[i+1])
return element,freque
def isPowerOfTwo(n):
return (math.ceil(Log2(n)) == math.floor(Log2(n)));
#to check whether the given sorted sequnce is forming an AP or not....
def checkisap(list):
d=list[1]-list[0]
for i in range(2,len(list)):
temp=list[i]-list[i-1]
if temp !=d:
return False
return True
#ceil function gives wrong answer after 10^17 so i have to create my own :)
# because i don't want to doubt on my solution of 900-1000 problem set.
def ceildiv(x,y):
return (x+y-1)//y
def di():return map(int, input().split())
def ii():return int(input())
def li():return list(map(int, input().split()))
def si():return list(map(str, input()))
def indic():
dic = {}
for index, value in enumerate(input().split()):
dic[int(value)] = int(index)+1
return dic
#Here we go......................
#concentration and mental toughness are margins of victory
n,s=di()
l=[]
nn=n
while n:
n-=1
x,y=di()
l.append([x, y])
l.sort()
temp=[]
for row in l:
temp.append(row[0])
ind=bl(temp, s)
if ind==0:
if l[0][0]==s and l[0][1]==0:
print(0)
else:
print(-1)
else:
mx=0
for i in range(min(nn,ind )):
if l[i][1]:
diff =100-l[i][1]
if diff > mx:
mx=diff
print(mx)
``` | instruction | 0 | 52,579 | 10 | 105,158 |
Yes | output | 1 | 52,579 | 10 | 105,159 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change.
Submitted Solution:
```
import math
n,s = map(int,input().split())
max_ = -1
for i in range(n):
d,c = map(int,input().split())
if (c != 0):
if (d + 1 <= s):
if ((100 - c) > max_):
max_ = 100 - c
else:
if (d <= s):
if (c > max_):
max_ = 0
print(max_)
``` | instruction | 0 | 52,580 | 10 | 105,160 |
Yes | output | 1 | 52,580 | 10 | 105,161 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change.
Submitted Solution:
```
string = input()
numbers = string.split()
a = int(numbers[0])
b = int(numbers[1]) * 100
sweets = [-1]
for x in range(a):
string = input()
numbers = string.split()
d = int(numbers[0])
c = int(numbers[1])
m = d * 100 + c
if b >= m:
sweets.append(-c % 100)
print(max(sweets))
``` | instruction | 0 | 52,581 | 10 | 105,162 |
Yes | output | 1 | 52,581 | 10 | 105,163 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).
Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.
Input
The first line contains two space-separated integers n, s (1 β€ n, s β€ 100).
The i-th of the next n lines contains two integers xi, yi (1 β€ xi β€ 100; 0 β€ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.
Output
Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.
Examples
Input
5 10
3 90
12 0
9 70
5 50
7 0
Output
50
Input
5 5
10 10
20 20
30 30
40 40
50 50
Output
-1
Note
In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change.
Submitted Solution:
```
from sys import stdin
def main():
inp=stdin
lectura=[ int(x) for x in inp.readline().strip().split()]
dulce=100
count=0
p=True
while (count < lectura[0]):
bolsas=[ int(x) for x in inp.readline().strip().split()]
if lectura[1] >= bolsas[0]:
p=False
if bolsas[1] != 0 and bolsas[1] < dulce:
dulce=bolsas[1]
count+=1
if dulce == 100 and p:
print(-1)
else:
if dulce == 100:
print(0)
else:
print(100-dulce)
main()
``` | instruction | 0 | 52,582 | 10 | 105,164 |
No | output | 1 | 52,582 | 10 | 105,165 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.