message stringlengths 2 22.7k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 145 109k | cluster float64 9 9 | __index_level_0__ int64 290 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In some other world, today is Christmas.
Mr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:
* A level-0 burger is a patty.
* A level-L burger (L \geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.
For example, a level-1 burger and a level-2 burger look like `BPPPB` and `BBPPPBPBPPPBB` (rotated 90 degrees), where `B` and `P` stands for a bun and a patty.
The burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?
Constraints
* 1 \leq N \leq 50
* 1 \leq X \leq ( the total number of layers in a level-N burger )
* N and X are integers.
Input
Input is given from Standard Input in the following format:
N X
Output
Print the number of patties in the bottom-most X layers from the bottom of a level-N burger.
Examples
Input
2 7
Output
4
Input
1 1
Output
0
Input
50 4321098765432109
Output
2160549382716056
Submitted Solution:
```
n, x = map(int, input().split())
def pi(n):
return 2**(n+1)-1
def ai(n):
return 2**(n+2) - 3
def f(n, x):
if N == 0:
return 0 if X <= 0 else 1
elif (1 < x) and (x <= 1 + ai(n-1)):
return f(n - 1, x - 1)
elif x == 2 + ai(n - 1):
return pi(n - 1) + 1
elif (2 + ai(n - 1) < x) and (x <= 2 + 2 * ai(n - 1)):
return pi(n-1) + 1 + f(n-1, x-2-ai(n-1))
elif x >= ai(n):
return pi(n)
print(f(n, x))
``` | instruction | 0 | 95,924 | 9 | 191,848 |
No | output | 1 | 95,924 | 9 | 191,849 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous | instruction | 0 | 95,934 | 9 | 191,868 |
"Correct Solution:
```
x,a,b=map(int,input().split())
print("delicious"if a>=b else "safe" if b-a<=x else "dangerous")
``` | output | 1 | 95,934 | 9 | 191,869 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous | instruction | 0 | 95,935 | 9 | 191,870 |
"Correct Solution:
```
X, A, B = list(map(int, input().split()))
print("delicious" if A >= B else "safe" if B - A <= X else "dangerous")
``` | output | 1 | 95,935 | 9 | 191,871 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous | instruction | 0 | 95,936 | 9 | 191,872 |
"Correct Solution:
```
x,a,b=map(int,input().split())
if a-b>=0:
print("delicious")
elif -x<=a-b<0:
print("safe")
else:
print("dangerous")
``` | output | 1 | 95,936 | 9 | 191,873 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous | instruction | 0 | 95,937 | 9 | 191,874 |
"Correct Solution:
```
X,A,B=map(int,input().split())
print(["delicious" if -A+B<=0 else "safe","dangerous"][X<-A+B])
``` | output | 1 | 95,937 | 9 | 191,875 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous | instruction | 0 | 95,938 | 9 | 191,876 |
"Correct Solution:
```
x, a, b = [int(s) for s in input().split()]
print("delicious" if b <= a else ("safe" if b <= a + x else "dangerous"))
``` | output | 1 | 95,938 | 9 | 191,877 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous | instruction | 0 | 95,939 | 9 | 191,878 |
"Correct Solution:
```
x,a,b = map(int, input().split())
if b > a+x:
print('dangerous')
elif b > a:
print('safe')
else:
print('delicious')
``` | output | 1 | 95,939 | 9 | 191,879 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous | instruction | 0 | 95,940 | 9 | 191,880 |
"Correct Solution:
```
a,b,c=map(int,input().split());print('delicious' if c<=b else 'safe' if c<=a+b else 'dangerous')
``` | output | 1 | 95,940 | 9 | 191,881 |
Provide a correct Python 3 solution for this coding contest problem.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous | instruction | 0 | 95,941 | 9 | 191,882 |
"Correct Solution:
```
x,a,b=map(int,input().split())
if b<=a:print('delicious')
elif 0<(b-a)<=x:print('safe')
else:print('dangerous')
``` | output | 1 | 95,941 | 9 | 191,883 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous
Submitted Solution:
```
x,a,b = map(int, input().split())
if a+x < b:
print("dangerous")
elif a < b:
print("safe")
else:
print("delicious")
``` | instruction | 0 | 95,942 | 9 | 191,884 |
Yes | output | 1 | 95,942 | 9 | 191,885 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous
Submitted Solution:
```
x,a,b = [int(i) for i in input().split()]
print('delicious' if x >= b else 'safe' if x >= (b-a) else 'dangerous')
``` | instruction | 0 | 95,943 | 9 | 191,886 |
Yes | output | 1 | 95,943 | 9 | 191,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous
Submitted Solution:
```
X,A,B=map(int,input().split());print("dsdaaenflgeie cr io ou us s"[(B<=A)+(B<=A+X)::3])
``` | instruction | 0 | 95,944 | 9 | 191,888 |
Yes | output | 1 | 95,944 | 9 | 191,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous
Submitted Solution:
```
a,b,c=map(int,input().split())
if c-b>a:
print("dangerous")
else:
print("safe"if b<c else"delicious")
``` | instruction | 0 | 95,945 | 9 | 191,890 |
Yes | output | 1 | 95,945 | 9 | 191,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous
Submitted Solution:
```
x,a,b=map(int,input().split())
if a>=b:
print('delicious')
elif x>b-a:
print('safe')
else:
print('dangerous')
``` | instruction | 0 | 95,946 | 9 | 191,892 |
No | output | 1 | 95,946 | 9 | 191,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous
Submitted Solution:
```
[a,b,c]=[int(x) for x in input().split()]
if b<c:
print("delicious")
elif a+b<c:
print("safe")
else:
print("dangerous")
``` | instruction | 0 | 95,947 | 9 | 191,894 |
No | output | 1 | 95,947 | 9 | 191,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous
Submitted Solution:
```
x,a,b = map(int, input().split())
if a-b >= 0:
print("delicious")
elif 0 > a-b and abs(a-b) <= x+1:
print("safe")
else:
print("dangerous")
``` | instruction | 0 | 95,948 | 9 | 191,896 |
No | output | 1 | 95,948 | 9 | 191,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.
Constraints
* 1 β€ X,A,B β€ 10^9
Input
Input is given from Standard Input in the following format:
X A B
Output
Print `delicious` if Takahashi found the food delicious; print `safe` if he neither found it delicious nor got a stomachache; print `dangerous` if he got a stomachache.
Examples
Input
4 3 6
Output
safe
Input
6 5 1
Output
delicious
Input
3 7 12
Output
dangerous
Submitted Solution:
```
x, a, b = map(int, input().split())
if b-a<=0:
print('delicious')
elif b-a <= x:
print('safe')
else:
print('dangerouse')
``` | instruction | 0 | 95,949 | 9 | 191,898 |
No | output | 1 | 95,949 | 9 | 191,899 |
Provide a correct Python 3 solution for this coding contest problem.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
* | instruction | 0 | 95,998 | 9 | 191,996 |
"Correct Solution:
```
while True:
N=int(input())
A=0
B=0
C=0
D=0
E=0
F=0
G=0
H=0
I=0
J=0
i=0
j=0
L=[]
if N==0:
break
else:
L=[int(input()) for _ in range (N)]
for i in range (N):
if L[i]==0:
A+=1
elif L[i]==1:
B+=1
elif L[i]==2:
C+=1
elif L[i]==3:
D+=1
elif L[i]==4:
E+=1
elif L[i]==5:
F+=1
elif L[i]==6:
G+=1
elif L[i]==7:
H+=1
elif L[i]==8:
I+=1
else:
J+=1
S=[A,B,C,D,E,F,G,H,I,J]
for j in range(10):
T=S[j]
if T==0:
print("-")
else:
k=0
print("*"*T)
``` | output | 1 | 95,998 | 9 | 191,997 |
Provide a correct Python 3 solution for this coding contest problem.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
* | instruction | 0 | 95,999 | 9 | 191,998 |
"Correct Solution:
```
while True:
n= int(input())
if n== 0: break
c= [int(input()) for _ in range(n)]
for i in range(10):
cc= c.count(i)
print('-' if cc== 0 else cc*"*")
``` | output | 1 | 95,999 | 9 | 191,999 |
Provide a correct Python 3 solution for this coding contest problem.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
* | instruction | 0 | 96,000 | 9 | 192,000 |
"Correct Solution:
```
while True:
n=int(input())
if n==0:
break
x=[]
for i in range(n):
y=int(input())
x.append(y)
for j in range(10):
a=x.count(j)
if a==0:
print("-")
else:
print(a*"*")
``` | output | 1 | 96,000 | 9 | 192,001 |
Provide a correct Python 3 solution for this coding contest problem.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
* | instruction | 0 | 96,001 | 9 | 192,002 |
"Correct Solution:
```
while True:
n=int(input())
if n==0:
break
l=[0]*10
for i in range(n):
c=int(input())
l[c] +=1
for j in l:
if j==0:
print("-")
else:
for k in range(j):
print("*",end='')
print('')
``` | output | 1 | 96,001 | 9 | 192,003 |
Provide a correct Python 3 solution for this coding contest problem.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
* | instruction | 0 | 96,002 | 9 | 192,004 |
"Correct Solution:
```
# coding: utf-8
# Your code here!
while True :
n = int(input())
if n == 0 :
break
cnt = list([0] * 10)
for i in range(n) :
cnt[int(input())] += 1
for i in range(10) :
if cnt[i] > 0 :
for j in range(cnt[i]) :
print("*", sep="", end="")
print()
else :
print("-")
``` | output | 1 | 96,002 | 9 | 192,005 |
Provide a correct Python 3 solution for this coding contest problem.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
* | instruction | 0 | 96,003 | 9 | 192,006 |
"Correct Solution:
```
y=[0,1,2,3,4,5,6,7,8,9]
while True:
n=int(input())
if n==0:
break
x=[]
z=[0,0,0,0,0,0,0,0,0,0]
for i in range(n):
c=int(input())
x.append(c)
# print(x)
for i in range(10):
for j in x:
if y[i]==j:
z[i]+=1
# print(z)
for k in range(10):
if z[k]==0:
print('-')
else:
for l in range(z[k]):
print('*',end='')
print()
``` | output | 1 | 96,003 | 9 | 192,007 |
Provide a correct Python 3 solution for this coding contest problem.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
* | instruction | 0 | 96,004 | 9 | 192,008 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
a = [0] * 10
for i in range(n):
c = int(input())
a[c] += 1
for c in a:
if c == 0:
print('-')
else:
print('*'*c)
``` | output | 1 | 96,004 | 9 | 192,009 |
Provide a correct Python 3 solution for this coding contest problem.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
* | instruction | 0 | 96,005 | 9 | 192,010 |
"Correct Solution:
```
import sys
f = sys.stdin
from collections import Counter
while True:
n = int(f.readline())
if n == 0:
break
counter = Counter(int(f.readline()) for _ in range(n))
for i in range(10):
print('*' * counter[i] if 0 < counter[i] else '-')
``` | output | 1 | 96,005 | 9 | 192,011 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
Submitted Solution:
```
while True:
n=int(input())
list=[]
if n==0:
break
else:
for i in range (n):
c=int(input())
list.append(c)
for i in range (0,10):
x=list.count(i)
if x==0:
print("-")
else:
print("*"*x)
``` | instruction | 0 | 96,006 | 9 | 192,012 |
Yes | output | 1 | 96,006 | 9 | 192,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
Submitted Solution:
```
while True :
n = int(input())
if n == 0 : break
numList = [0 for i in range(10)]
for i in range(n) :
c = int(input())
numList[c] += 1
for i in range(10) :
cnt = '*' * numList[i]
if len(cnt) == 0 : print("-")
else : print(cnt)
``` | instruction | 0 | 96,007 | 9 | 192,014 |
Yes | output | 1 | 96,007 | 9 | 192,015 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
Submitted Solution:
```
while True:
n=int(input())
if n==0:
break
m=[0 for i in range(10)]
for i in range(n):
a=int(input())
m[a]+=1
for a in m:
if a>0:
print("*"*a)
else:
print("-")
``` | instruction | 0 | 96,008 | 9 | 192,016 |
Yes | output | 1 | 96,008 | 9 | 192,017 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
Submitted Solution:
```
while 1:
n=int(input())
if n==0:
break
x=[0 for i in range(10)]
for i in range(n):
c=int(input())
x[c]+=1
for i in range(10):
count='*'*x[i]
if len(count)==0:
print("-")
else:
print(count)
``` | instruction | 0 | 96,009 | 9 | 192,018 |
Yes | output | 1 | 96,009 | 9 | 192,019 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
Submitted Solution:
```
n=int(input())
x=[0 for i in range(10)]
while True:
if n==0:
break
for i in range(n):
a=int(input())
x[a]+=1
for i in range(10):
if x[i]==0:
print('{}'.format('-'))
else:
print('{}'.format(x[i]*'*'))
``` | instruction | 0 | 96,010 | 9 | 192,020 |
No | output | 1 | 96,010 | 9 | 192,021 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
Submitted Solution:
```
n=int(input())
x=[0 for i in range(10)]
while True:
if n==0:
break
for i in range(n):
a=int(input())
if a==0:
x[0]+=1
elif a==1:
x[1]+=1
elif a==2:
x[2]+=1
elif a==3:
x[3]+=1
elif a==4:
x[4]+=1
elif a==5:
x[5]+=1
elif a==6:
x[6]+=1
elif a==7:
x[7]+=1
elif a==8:
x[8]+=1
else:
x[9]+=1
for i in range(10):
if x[i]==0:
print('{}'.format('-'))
else:
print('{}'.format(x[i]*'*'))
``` | instruction | 0 | 96,011 | 9 | 192,022 |
No | output | 1 | 96,011 | 9 | 192,023 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
Submitted Solution:
```
while True:
n = int(input())
if n == 0:
break
d = {k: 0 for k in range(n)}
for _ in range(n):
x = int(input())
d[x] += 1
for k in range(n):
print("*"*d[k] + "-"*(d[k]==0))
``` | instruction | 0 | 96,012 | 9 | 192,024 |
No | output | 1 | 96,012 | 9 | 192,025 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product development.
For such a store manager, you decided to create a program that displays the number of each ice cream sold in a graph.
Enter the total number of ice creams sold in a day and the number of ice creams sold, and create a program that outputs as many * (half-width asterisks) as the number sold for each type of ice cream. However, the type of ice cream is represented by an integer from 0 to 9. Also, for ice cream with zero sales, one- (half-width hyphen) is output.
Input
A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:
n
c1
c2
::
cn
The first line gives the total number of ice creams sold per day n (1 β€ n β€ 10000). The next n lines are given the i-th ice cream type ci (0 β€ ci β€ 9).
The number of datasets does not exceed 20.
Output
For each input dataset, the number of sales is output in numerical order of each ice cream type.
Example
Input
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
Output
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
Submitted Solution:
```
#!/usr/bin/env python3
while True:
n = int(input())
data = [0] * 10
if n == 0:
break
for _ in range(n):
in_data = int(input())
data[in_data - 1] += 1
for d in data:
for _ in range(d):
print("*", end="")
if d == 0:
print("-")
else:
print(end="\n")
``` | instruction | 0 | 96,013 | 9 | 192,026 |
No | output | 1 | 96,013 | 9 | 192,027 |
Provide a correct Python 3 solution for this coding contest problem.
Problem statement
AOR Ika got a cabbage with $ N $ leaves. The leaves of this cabbage are numbered $ 1, \ ldots, N $ in order from the outside, and the dirtiness of the $ i $ th leaf is $ D_i $. The larger this value is, the worse the degree of dirt is. AOR Ika-chan decided to use the cabbage leaves for cooking, so she decided to select the dirty leaves to be discarded according to the following procedure.
1. Initialize the discard candidates to empty.
2. Focus on the outermost leaves that have not yet been examined. If all the items have been checked, the process ends.
3. If the leaf is dirty for $ A $ or more, add it to the discard candidate and return to 2. Otherwise it ends.
However, as a result of this operation, I noticed that the number of leaves that can be used for cooking may be extremely reduced. Therefore, I decided to reconsider the leaves to be discarded after the above operation and perform the following operations.
1. If there are less than $ M $ leaves that are not candidates for disposal, proceed to 2. Otherwise it ends.
2. Focus on the innermost leaf that has not been examined yet among the leaves that are candidates for disposal. If there are no leaves that are candidates for disposal, the process ends.
3. If the leaf is less than $ B $, remove it from the discard candidates and return to 2. Otherwise, discard all the leaves remaining in the discard candidates and finish.
When you perform these operations, find the number of leaves to be finally discarded.
Input constraints
$ 1 \ leq N \ leq 1000 $
$ 0 \ leq M \ leq N $
$ 1 \ leq A \ leq B \ leq 1000 $
$ 1 \ leq D_ {i} \ leq 1000 $
sample
Sample input 1
5 3 6 9
9 7 5 3 1
Sample output 1
2
Discard the first and second sheets.
Sample input 2
5 3 6 9
5 4 3 2 1
Sample output 2
0
Do not throw away from the first piece.
Sample input 3
5 3 6 9
10 8 6 4 2
Sample output 3
1
I tried to throw away the third one, but I reconsidered and decided not to throw away the second and third ones.
Sample input 4
5 3 6 9
5 10 8 6 4
Sample output 4
0
AOR Ika doesn't know that the second piece is dirty.
Sample input 5
5 0 6 9
9 9 8 8 7
Sample output 5
Five
I don't mind throwing everything away.
input
$ N \ M \ A \ B $
$ D_ {1} \ D_ {2} \ \ cdots \ D_ {N} $
output
Output the number of leaves to be finally thrown away.
Example
Input
5 3 6 9
9 7 5 3 1
Output
2 | instruction | 0 | 96,057 | 9 | 192,114 |
"Correct Solution:
```
#!/usr/bin/env python3
def solve(n, m, a, b, ds):
is_waste = [False for _ in range(n)]
for i in range(n):
if ds[i] >= a:
is_waste[i] = True
else:
break
if sum(is_waste) > n - m:
for i in range(n)[::-1]:
if is_waste[i]:
if ds[i] <= b:
is_waste[i] = False
else:
break
return sum(is_waste)
def main():
n, m, a, b = map(int, input().split())
ds = list(map(int, input().split()))
print(solve(n, m, a, b, ds))
if __name__ == '__main__':
main()
``` | output | 1 | 96,057 | 9 | 192,115 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total. | instruction | 0 | 96,189 | 9 | 192,378 |
Tags: binary search, brute force, math
Correct Solution:
```
import math
n,k=map(int,input().split())
print((3+2*n-int(math.sqrt(9+8*n+8*k)))//2)
``` | output | 1 | 96,189 | 9 | 192,379 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total. | instruction | 0 | 96,190 | 9 | 192,380 |
Tags: binary search, brute force, math
Correct Solution:
```
n,k=map(int,input().split())
for r in range(1,10**5):
if (r*(r+1))//2+r==k+n:
print(n-r)
exit()
``` | output | 1 | 96,190 | 9 | 192,381 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total. | instruction | 0 | 96,191 | 9 | 192,382 |
Tags: binary search, brute force, math
Correct Solution:
```
import sys
n, k = input().split()
n = int(n)
k = int(k)
candisInBox = 0
multi = 0
movement = 0
theDiffrance = 0
reminingCandies = 0
while movement <= n:
multi = multi + 1
movement = movement + 1
candisInBox = candisInBox + multi
theDiffrance = n - movement
reminingCandies = candisInBox - k
if candisInBox >= k:
if theDiffrance == reminingCandies:
print(theDiffrance)
sys.exit()
``` | output | 1 | 96,191 | 9 | 192,383 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total. | instruction | 0 | 96,192 | 9 | 192,384 |
Tags: binary search, brute force, math
Correct Solution:
```
def main():
import sys
input = sys.stdin.readline
n, k = map(int, input().split())
l = 1
r = n + 1
while r - l != 1:
m = l + r >> 1
candies = m * (m + 1) // 2
eat = n - m
if candies - eat <= k:
l = m
else:
r = m
print(n - l)
return 0
main()
``` | output | 1 | 96,192 | 9 | 192,385 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total. | instruction | 0 | 96,193 | 9 | 192,386 |
Tags: binary search, brute force, math
Correct Solution:
```
n, k = [int(i) for i in input().split()]
print((3 + 2 * n - int((8 * n + 8 * k + 9) ** 0.5)) // 2)
``` | output | 1 | 96,193 | 9 | 192,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total. | instruction | 0 | 96,194 | 9 | 192,388 |
Tags: binary search, brute force, math
Correct Solution:
```
n, k = [int(item) for item in input().split()]
candy = 0
add = 0
for i in range(0, 10**5):
candy += add
add += 1
if candy - k == n - i:
print(n-i)
exit()
``` | output | 1 | 96,194 | 9 | 192,389 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total. | instruction | 0 | 96,195 | 9 | 192,390 |
Tags: binary search, brute force, math
Correct Solution:
```
n, k = map(int,input().split())
cnt = 0
c = 0
i = 0
while i != n:
c = c + 1
cnt = c + cnt
if(cnt - (n-c)) == k:
break
i = i + 1
print(n-c)
``` | output | 1 | 96,195 | 9 | 192,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total. | instruction | 0 | 96,196 | 9 | 192,392 |
Tags: binary search, brute force, math
Correct Solution:
```
import math
n, k = map(int, input().split())
p = int((-3+int(math.sqrt(9+8*(n+k))))/2)
print(int(p*(p+1)/2)-k)
``` | output | 1 | 96,196 | 9 | 192,393 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total.
Submitted Solution:
```
n,k = list(map(int,input().split()))
l = (-3+(9+(4*(2*(n+k))))**(.5))//2
print(int(n-l))
``` | instruction | 0 | 96,197 | 9 | 192,394 |
Yes | output | 1 | 96,197 | 9 | 192,395 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total.
Submitted Solution:
```
n,k=input().split()
n=int(n)
k=int(k)
i=1
flag=0
while (flag==0):
put=(i*(i+1))/2
put=put-(n-i);
if (put==k):
print(n-i);
flag=1;
i+=1
``` | instruction | 0 | 96,198 | 9 | 192,396 |
Yes | output | 1 | 96,198 | 9 | 192,397 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total.
Submitted Solution:
```
from math import sqrt
n,k = map(int,input().split())
a = n**2+n-2*k
b = 2*n+3
d = sqrt(b**2-4*a)
ans = (b-d)//2
print(int(ans))
``` | instruction | 0 | 96,199 | 9 | 192,398 |
Yes | output | 1 | 96,199 | 9 | 192,399 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total.
Submitted Solution:
```
n, k = map(int,input().split())
print(int(n-(-3+(9+8*n+8*k)**(1/2))//2))
``` | instruction | 0 | 96,200 | 9 | 192,400 |
Yes | output | 1 | 96,200 | 9 | 192,401 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total.
Submitted Solution:
```
from collections import Counter
import math
n, k = [int(x) for x in input().split()]
sum = 0
if k != 0:
for i in range(n):
sum = sum + i
if sum > k:
break
else:
for i in range(n):
sum = sum + i
if sum == n-sum+1:
break
if sum == 0:
sum = 1
print(sum - k)
``` | instruction | 0 | 96,201 | 9 | 192,402 |
No | output | 1 | 96,201 | 9 | 192,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total.
Submitted Solution:
```
# cook your dish here
n,k = tuple([int(x) for x in input().split()])
l=0
u=n
if k!=0:
while l<=u:
m=(l+u)//2
#print(m)
if m*(m+1)//2>=k:
u=m-1
elif m*(m+1)//2<k:
l=m+1
if k==0:
while l<=u:
m=(l+u)//2
#print(m)
if m*(m+1)//2>=n+1:
u=m-1
elif m*(m+1)//2<n+1:
l=m+1
print(m*(m-1)//2)
else:
print(m*(m+1)//2-k)
``` | instruction | 0 | 96,202 | 9 | 192,404 |
No | output | 1 | 96,202 | 9 | 192,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total.
Submitted Solution:
```
n, k = map(int,input().split())
s = n*(n+1)//2
print(s-k)
``` | instruction | 0 | 96,203 | 9 | 192,406 |
No | output | 1 | 96,203 | 9 | 192,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs n actions. The first action performed is to put a single candy into the box. For each of the remaining moves she can choose from two options:
* the first option, in case the box contains at least one candy, is to take exactly one candy out and eat it. This way the number of candies in the box decreased by 1;
* the second option is to put candies in the box. In this case, Alya will put 1 more candy, than she put in the previous time.
Thus, if the box is empty, then it can only use the second option.
For example, one possible sequence of Alya's actions look as follows:
* put one candy into the box;
* put two candies into the box;
* eat one candy from the box;
* eat one candy from the box;
* put three candies into the box;
* eat one candy from the box;
* put four candies into the box;
* eat one candy from the box;
* put five candies into the box;
This way she will perform 9 actions, the number of candies at the end will be 11, while Alya will eat 4 candies in total.
You know the total number of actions n and the number of candies at the end k. You need to find the total number of sweets Alya ate. That is the number of moves of the first option. It's guaranteed, that for the given n and k the answer always exists.
Please note, that during an action of the first option, Alya takes out and eats exactly one candy.
Input
The first line contains two integers n and k (1 β€ n β€ 10^9; 0 β€ k β€ 10^9) β the total number of moves and the number of candies in the box at the end.
It's guaranteed, that for the given n and k the answer exists.
Output
Print a single integer β the number of candies, which Alya ate. Please note, that in this problem there aren't multiple possible answers β the answer is unique for any input data.
Examples
Input
1 1
Output
0
Input
9 11
Output
4
Input
5 0
Output
3
Input
3 2
Output
1
Note
In the first example, Alya has made one move only. According to the statement, the first move is always putting one candy in the box. Hence Alya ate 0 candies.
In the second example the possible sequence of Alya's actions looks as follows:
* put 1 candy,
* put 2 candies,
* eat a candy,
* eat a candy,
* put 3 candies,
* eat a candy,
* put 4 candies,
* eat a candy,
* put 5 candies.
This way, she will make exactly n=9 actions and in the end the box will contain 1+2-1-1+3-1+4-1+5=11 candies. The answer is 4, since she ate 4 candies in total.
Submitted Solution:
```
n,x=map(int,input().split())
formula=0
i=0
if(x==0):
while(n-(i+formula)!=0):
i=i+1
formula=(i*(i+1))//2
print(formula)
else:
while(formula<x):
i=i+1
formula=(i*(i+1))//2
#print(formula,i)
print(abs(i-n))
``` | instruction | 0 | 96,204 | 9 | 192,408 |
No | output | 1 | 96,204 | 9 | 192,409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.