message stringlengths 2 20.2k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 757 108k | cluster float64 4 4 | __index_level_0__ int64 1.51k 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29.
Input
The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers m and d separated by a single space in a line. These integers respectively represent the month and the day.
The number of datasets is less than or equal to 50.
Output
For each dataset, print the day (please see the following words) in a line.
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Example
Input
1 1
2 29
0 0
Output
Thursday
Sunday
Submitted Solution:
```
week = {1: "Thursday", 2: "Friday", 3: "Saturday", 4: "Sunday", 5: "Monday", 6: "Tuesday", 7: "Wednesday"}
month = {1: 0, 2: 31, 3: 60, 4: 91, 5: 121, 6: 152, 7: 182, 8: 213, 9: 244, 10: 274, 11: 305, 12: 335}
m, d = map(int, input().split())
while m:
days = month[m] + d
print(week[days % 7])
m, d = map(int, input().split())
``` | instruction | 0 | 88,278 | 4 | 176,556 |
No | output | 1 | 88,278 | 4 | 176,557 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Neat lives on the world line for a total of 360 days until the 30th of every month for 1 year and 12 months. In that world, N consecutive holidays with the same schedule were applied to people all over the world every year. Consecutive holidays i are consecutive Vi days starting from Mi month Di day.
NEET is NEET, so he is closed every day regardless of consecutive holidays. One day NEET decided to go out unusually, but I hate crowds, so I don't want to go out as much as possible on busy days due to the effects of consecutive holidays. Therefore, Neat is trying to find the day with the least congestion by calculating the congestion degree of each day by the following method.
* The number that represents the degree of influence of a date x by the holiday i is Si if the date x is included in the holiday i, otherwise max (0, Si β min (from x). The number of days until the first day of consecutive holidays i, the number of days from the last day of consecutive holidays i to x)))
* The degree of congestion on a certain date x is the degree of influence that is most affected by N consecutive holidays.
Please output the lowest degree of congestion in the year. However, consecutive holidays i may span years. In addition, the dates of consecutive holidays may overlap.
Constraints
The input satisfies the following conditions.
* 1 β€ N β€ 100
* 1 β€ Mi β€ 12
* 1 β€ Di β€ 30
* 1 β€ Vi, Si β€ 360
Input
The input is given in the following format.
N
M1 D1 V1 S1
M2 D2 V2 S2
...
MN DN VN SN
The integer N is given on the first line.
The integers Mi, Di, Vi, Si are given on the 2nd to N + 1th lines separated by blanks. (1 β€ i β€ N)
Output
Outputs the least congestion level on one line.
Examples
Input
1
1 1 359 1
Output
0
Input
2
2 4 25 306
1 9 7 321
Output
158
Input
8
2 9 297 297
8 6 359 211
8 16 28 288
7 9 113 143
3 18 315 190
10 18 277 300
9 5 276 88
3 5 322 40
Output
297 | instruction | 0 | 88,309 | 4 | 176,618 |
"Correct Solution:
```
D = 360
x = [0 for i in range(D)]
n = int(input())
for i in range(n):
m,d,v,s = map(int,input().split())
m -= 1
d -= 1
start = 30*m+d
end = (start+v-1)%D
h = [False for _ in range(D)]
for j in range(v):
y = (start+j)%D
h[y] = True
for j in range(D):
if h[j]:
x[j] = max(x[j],s)
else:
A = abs(start-j)
if A>D//2:
A = D-A
B = abs(end-j)
if B>D//2:
B = D-B
x[j] = max(x[j], s-min(A,B))
print(min(x))
``` | output | 1 | 88,309 | 4 | 176,619 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Neat lives on the world line for a total of 360 days until the 30th of every month for 1 year and 12 months. In that world, N consecutive holidays with the same schedule were applied to people all over the world every year. Consecutive holidays i are consecutive Vi days starting from Mi month Di day.
NEET is NEET, so he is closed every day regardless of consecutive holidays. One day NEET decided to go out unusually, but I hate crowds, so I don't want to go out as much as possible on busy days due to the effects of consecutive holidays. Therefore, Neat is trying to find the day with the least congestion by calculating the congestion degree of each day by the following method.
* The number that represents the degree of influence of a date x by the holiday i is Si if the date x is included in the holiday i, otherwise max (0, Si β min (from x). The number of days until the first day of consecutive holidays i, the number of days from the last day of consecutive holidays i to x)))
* The degree of congestion on a certain date x is the degree of influence that is most affected by N consecutive holidays.
Please output the lowest degree of congestion in the year. However, consecutive holidays i may span years. In addition, the dates of consecutive holidays may overlap.
Constraints
The input satisfies the following conditions.
* 1 β€ N β€ 100
* 1 β€ Mi β€ 12
* 1 β€ Di β€ 30
* 1 β€ Vi, Si β€ 360
Input
The input is given in the following format.
N
M1 D1 V1 S1
M2 D2 V2 S2
...
MN DN VN SN
The integer N is given on the first line.
The integers Mi, Di, Vi, Si are given on the 2nd to N + 1th lines separated by blanks. (1 β€ i β€ N)
Output
Outputs the least congestion level on one line.
Examples
Input
1
1 1 359 1
Output
0
Input
2
2 4 25 306
1 9 7 321
Output
158
Input
8
2 9 297 297
8 6 359 211
8 16 28 288
7 9 113 143
3 18 315 190
10 18 277 300
9 5 276 88
3 5 322 40
Output
297 | instruction | 0 | 88,310 | 4 | 176,620 |
"Correct Solution:
```
N = input()
N = int(N)+1
X = [0]
C = [0]*360
for i in range(1,N):
x = input()
X.append(x.split())
i_start = (int(X[i][0])-1)*30+int(X[i][1])-1
i_end = i_start+int(X[i][2])-1
for j in range(i_start,i_end+1):
C[j%360] = max(C[j%360],int(X[i][3]))
for k in range(1,int(X[i][3])+1):
C[(i_start-k+360)%360] = max(C[(i_start-k+360)%360],int(X[i][3])-k)
C[(i_end+k)%360] = max(C[(i_end+k)%360],int(X[i][3])-k)
print(min(C))
``` | output | 1 | 88,310 | 4 | 176,621 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Neat lives on the world line for a total of 360 days until the 30th of every month for 1 year and 12 months. In that world, N consecutive holidays with the same schedule were applied to people all over the world every year. Consecutive holidays i are consecutive Vi days starting from Mi month Di day.
NEET is NEET, so he is closed every day regardless of consecutive holidays. One day NEET decided to go out unusually, but I hate crowds, so I don't want to go out as much as possible on busy days due to the effects of consecutive holidays. Therefore, Neat is trying to find the day with the least congestion by calculating the congestion degree of each day by the following method.
* The number that represents the degree of influence of a date x by the holiday i is Si if the date x is included in the holiday i, otherwise max (0, Si β min (from x). The number of days until the first day of consecutive holidays i, the number of days from the last day of consecutive holidays i to x)))
* The degree of congestion on a certain date x is the degree of influence that is most affected by N consecutive holidays.
Please output the lowest degree of congestion in the year. However, consecutive holidays i may span years. In addition, the dates of consecutive holidays may overlap.
Constraints
The input satisfies the following conditions.
* 1 β€ N β€ 100
* 1 β€ Mi β€ 12
* 1 β€ Di β€ 30
* 1 β€ Vi, Si β€ 360
Input
The input is given in the following format.
N
M1 D1 V1 S1
M2 D2 V2 S2
...
MN DN VN SN
The integer N is given on the first line.
The integers Mi, Di, Vi, Si are given on the 2nd to N + 1th lines separated by blanks. (1 β€ i β€ N)
Output
Outputs the least congestion level on one line.
Examples
Input
1
1 1 359 1
Output
0
Input
2
2 4 25 306
1 9 7 321
Output
158
Input
8
2 9 297 297
8 6 359 211
8 16 28 288
7 9 113 143
3 18 315 190
10 18 277 300
9 5 276 88
3 5 322 40
Output
297 | instruction | 0 | 88,311 | 4 | 176,622 |
"Correct Solution:
```
n = int(input())
eff = [0]*360
days = [list(map(int, input().split())) for i in range(n)]
for m, d, v, s in days:
# [a, b)
a = (m-1)*30 + d - 1
b = a + v
for i in range(a, b):
eff[i%360] = max(eff[i%360], s)
for i in range(b, a+360):
eff[i%360] = max(eff[i%360], s - min(i - b + 1, 360 + a - i))
print(min(eff))
``` | output | 1 | 88,311 | 4 | 176,623 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667 | instruction | 0 | 88,340 | 4 | 176,680 |
Tags: brute force, implementation, math
Correct Solution:
```
from collections import defaultdict
def read_int():
return list(map(int, input().split()))
n, k = read_int()
arr = read_int()
sumv = defaultdict(int)
for i in range(n):
sumv[i] = sumv[i-1] + arr[i]
ans = []
for i in range(0, n - k + 1):
for j in range(i + k - 1, n):
# print(i, j)
ans.append((sumv[j] - sumv[i - 1]) / (j - i + 1))
print(max(ans))
``` | output | 1 | 88,340 | 4 | 176,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667 | instruction | 0 | 88,341 | 4 | 176,682 |
Tags: brute force, implementation, math
Correct Solution:
```
def main():
n,k=map(int,input().split( ))
a=list(map(int,input().split( )))
ans=-1*10**9+7
for i in range(n):
s=0
for j in range(i,n):
s+=a[j]
if j-i+1>=k:
ans=max(ans,s/(j-i+1))
print(ans)
main()
``` | output | 1 | 88,341 | 4 | 176,683 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667 | instruction | 0 | 88,342 | 4 | 176,684 |
Tags: brute force, implementation, math
Correct Solution:
```
import sys,math,bisect
inf = float('inf')
mod = (10**9)+7
"=========================="
def lcm(a,b):
return int((a/math.gcd(a,b))*b)
def gcd(a,b):
return int(math.gcd(a,b))
def tobinary(n):
return bin(n)[2:]
def binarySearch(a,x):
i = bisect.bisect_left(a,x)
if i!=len(a) and a[i]==x:
return i
else:
return -1
def lowerBound(a, x):
i = bisect.bisect_left(a, x)
if i:
return (i-1)
else:
return -1
def upperBound(a,x):
i = bisect.bisect_right(a,x)
if i!= len(a)+1 and a[i-1]==x:
return (i-1)
else:
return -1
def primesInRange(n):
ans = []
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
for p in range(2, n+1):
if prime[p]:
ans.append(p)
return ans
"============================"
"""
n = int(input())
n,k = map(int,input().split())
arr = list(map(int,input().split()))
"""
from collections import deque,defaultdict
for _ in range(1):
n,k = map(int,input().split())
arr = list(map(int,input().split()))
ans=0
if k==1:
ans=max(arr)
for i in range(n):
s=0
for j in range(i,n):
s+=arr[j]
if j-i+1<k:
continue
ans= max(ans,s/(j-i+1))
print(ans)
``` | output | 1 | 88,342 | 4 | 176,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667 | instruction | 0 | 88,343 | 4 | 176,686 |
Tags: brute force, implementation, math
Correct Solution:
```
n, k = map(int, input().split())
a = list(map(int, input().split())) + [0]
q = [0] * (n + 1)
for i in range(1, n + 1):
q[i] = q[i - 1] + a[i - 1]
s = 0
for i in range(n):
j = 0
while i + k + j <= n:
rec = (q[i + k + j] - q[i]) / (k + j)
s = max(s, rec)
j += 1
print(s)
``` | output | 1 | 88,343 | 4 | 176,687 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667 | instruction | 0 | 88,344 | 4 | 176,688 |
Tags: brute force, implementation, math
Correct Solution:
```
if __name__ == "__main__":
firstRange = 0
intensitySum = 0
rangeSum = 0
intensity = 0
n, k = tuple(map(int,input().split()))
a = tuple(map(int,input().split()))
for i in range(k-1):
firstRange += a[i]
for _len in range(k, n+1):
firstRange += a[_len-1]
rangeSum = firstRange
intensitySum = firstRange
for i in range(1,n-_len+1):
rangeSum += a[i-1+_len]-a[i-1]
if intensitySum < rangeSum:
intensitySum = rangeSum
if intensitySum / _len > intensity:
intensity = intensitySum / _len
print('{:0.12f}'.format(intensity))
``` | output | 1 | 88,344 | 4 | 176,689 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667 | instruction | 0 | 88,345 | 4 | 176,690 |
Tags: brute force, implementation, math
Correct Solution:
```
from itertools import accumulate
n, k = map(int, input().split())
a = list(map(int, input().split()))
acc = [0] + list(accumulate(a))
ans = 0
for i in range(n - k + 1):
for j in range(i + k, n + 1):
s = acc[j] - acc[i]
t = s / (j - i)
ans = max(t, ans)
print(ans)
``` | output | 1 | 88,345 | 4 | 176,691 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667 | instruction | 0 | 88,346 | 4 | 176,692 |
Tags: brute force, implementation, math
Correct Solution:
```
import sys
input = sys.stdin.readline
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
for i in range(1, n + 1):
a[i] += a[i - 1]
ans = 0
for i in range(k, n + 1):
for j in range(n - i + 1):
ans = max(ans, (a[i + j] - a[j]) / i)
print(ans)
``` | output | 1 | 88,346 | 4 | 176,693 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667 | instruction | 0 | 88,347 | 4 | 176,694 |
Tags: brute force, implementation, math
Correct Solution:
```
n,k=map(int,input().split())
arr=list(map(int,input().split()))
find=[0]*n
for i in range(n):
find[i]=[0]*n
presum=[0]*n
presum[0]=arr[0]
for i in range(1,n):
presum[i]=presum[i-1]+arr[i]
for i in range(n-k+1):
for j in range(i+k-1,n):
if i==0:
find[i][j]=presum[j]/(j+1)
else:
find[i][j]=(presum[j]-presum[i-1])/(j-i+1)
maxi=0
for i in range(n):
for j in range(n):
if find[i][j]>maxi:
maxi=find[i][j]
print(maxi)
``` | output | 1 | 88,347 | 4 | 176,695 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667
Submitted Solution:
```
n, k = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
maxx = 0
for i in range(n - k + 1):
j = i
summ = 0
while j - i + 1 < k:
summ += a[j]
j += 1
while j < n:
summ += a[j]
maxx = max(maxx, summ / (j - i + 1))
j += 1
print(maxx)
``` | instruction | 0 | 88,348 | 4 | 176,696 |
Yes | output | 1 | 88,348 | 4 | 176,697 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667
Submitted Solution:
```
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
sums=[0 for i in range(n)]
for j,item in enumerate(a):
if j==0:
sums[j]=item
else:
sums[j]=item+sums[j-1]
val=k
max_val=0
while val<=n:
#print("val",val)
for i in range(0,n-val+1):
#print("i=",i,val)
d=sums[i+val-1]
if i==0:
#print(d,d/val)
max_val=max(max_val,d/val)
else:
#print(d-sums[i-1],(d-sums[i-1])/val)
max_val=max(max_val,(d-sums[i-1])/val)
val=val+1
print(max_val)
``` | instruction | 0 | 88,349 | 4 | 176,698 |
Yes | output | 1 | 88,349 | 4 | 176,699 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667
Submitted Solution:
```
n,k=map(int,input().split())
arr=list(map(int,input().split()))
avg=0
for i in range(n-k+1):
s=sum(arr[i:i+k-1])
for j in range(k,n-i+1):
s+=arr[i+j-1]
if(s/j>avg):
avg=s/j
print(avg)
``` | instruction | 0 | 88,350 | 4 | 176,700 |
Yes | output | 1 | 88,350 | 4 | 176,701 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667
Submitted Solution:
```
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=[]
for i in range(n):
s=0
for j in range(i,n):
s+=a[j]
if (j-i+1>=k):
ans.append(s/(j-i+1))
print(max(ans))
``` | instruction | 0 | 88,351 | 4 | 176,702 |
Yes | output | 1 | 88,351 | 4 | 176,703 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667
Submitted Solution:
```
n,k=map(int,input().split())
a=list(map(int,input().split()))
def max_sum(m):
pref=0
size=0
ans=sum(x-m for x in a[0:k])
for i in (x-m for x in a):
pref += i
size += 1.
if size >= k:
ans = max(ans,pref)
if pref < 0:
size = 0
pref = 0
return ans
l = 0; r = 5e6
while r - l > 1e-10:
m = (r+l)/2
if max_sum(m) >= 0:
l=m
else:
r=m
print(r)
``` | instruction | 0 | 88,352 | 4 | 176,704 |
No | output | 1 | 88,352 | 4 | 176,705 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667
Submitted Solution:
```
n,k = [int(i) for i in input().strip().split()]
temp = [int(i) for i in input().strip().split()]
avg = 0
mxavg = 0
for i in range(len(temp)-k):
mxavg = max(mxavg, sum(temp[i:i+k])/k)
print(mxavg)
``` | instruction | 0 | 88,353 | 4 | 176,706 |
No | output | 1 | 88,353 | 4 | 176,707 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667
Submitted Solution:
```
n,k=map(int,input().split())
a=list(map(int,input().split()))
def max_sum(m):
pref=0
size=0
ans=sum(x-m for x in a[0:k])
for i in (x-m for x in a):
pref += i
size += 1.
if size >= k:
ans = max(ans,pref)
if pref < 0:
size = 0
pref = 0
return ans
l = 0; r = 5e3
while abs(r - l) > 1e-12:
m = (r+l)/2
if max_sum(m) >= 0:
l=m
else:
r=m
print(r)
``` | instruction | 0 | 88,354 | 4 | 176,708 |
No | output | 1 | 88,354 | 4 | 176,709 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.
Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:
Suppose we want to analyze the segment of n consecutive days. We have measured the temperatures during these n days; the temperature during i-th day equals a_i.
We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day x to day y, we calculate it as \frac{β _{i = x}^{y} a_i}{y - x + 1} (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than k consecutive days. For example, if analyzing the measures [3, 4, 1, 2] and k = 3, we are interested in segments [3, 4, 1], [4, 1, 2] and [3, 4, 1, 2] (we want to find the maximum value of average temperature over these segments).
You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?
Input
The first line contains two integers n and k (1 β€ k β€ n β€ 5000) β the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.
The second line contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 5000) β the temperature measures during given n days.
Output
Print one real number β the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than k consecutive days.
Your answer will be considered correct if the following condition holds: |res - res_0| < 10^{-6}, where res is your answer, and res_0 is the answer given by the jury's solution.
Example
Input
4 3
3 4 1 2
Output
2.666666666666667
Submitted Solution:
```
def main():
n,k=map(int,input().split( ))
a=list(map(int,input().split( )))
s=sum(a[:k]);ans=s/k
for i in range(n-k+1):
ans=max(ans,s/k)
for j in range(i+k,n):
s=s+a[j]
ans=max(ans,s/(j+1))
s=sum(a[i+1:i+1+k])
print(ans)
main()
``` | instruction | 0 | 88,355 | 4 | 176,710 |
No | output | 1 | 88,355 | 4 | 176,711 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i β₯ i).
Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.
How many days will it take to read the whole book?
Input
The first line contains single integer n (1 β€ n β€ 10^4) β the number of pages in the book.
The second line contains n integers a_1, a_2, ..., a_n (i β€ a_i β€ n), where a_i is the number of page which contains the explanation of the mystery on page i.
Output
Print one integer β the number of days it will take to read the whole book.
Example
Input
9
1 3 3 6 7 6 8 8 9
Output
4
Note
Explanation of the example test:
During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day β pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
Submitted Solution:
```
n=int(input())
A=list(map(int,input().split()))
A.insert(0,0)
C=set()
d=0
for i in range(1,n+1):
C.add(A[i])
C.discard(i)
if len(C) == 0 :
d+=1
print(d)
``` | instruction | 0 | 88,423 | 4 | 176,846 |
Yes | output | 1 | 88,423 | 4 | 176,847 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i β₯ i).
Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.
How many days will it take to read the whole book?
Input
The first line contains single integer n (1 β€ n β€ 10^4) β the number of pages in the book.
The second line contains n integers a_1, a_2, ..., a_n (i β€ a_i β€ n), where a_i is the number of page which contains the explanation of the mystery on page i.
Output
Print one integer β the number of days it will take to read the whole book.
Example
Input
9
1 3 3 6 7 6 8 8 9
Output
4
Note
Explanation of the example test:
During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day β pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
Submitted Solution:
```
n = int(input())
l = list(map(int,input().split()))
m = 0
i=0
days = 0
while(i<n):
m = max(m,l[i])
if m>i+1:
i+=1
elif m==l[i]:
days+=1
i+=1
print(days)
``` | instruction | 0 | 88,424 | 4 | 176,848 |
Yes | output | 1 | 88,424 | 4 | 176,849 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i β₯ i).
Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.
How many days will it take to read the whole book?
Input
The first line contains single integer n (1 β€ n β€ 10^4) β the number of pages in the book.
The second line contains n integers a_1, a_2, ..., a_n (i β€ a_i β€ n), where a_i is the number of page which contains the explanation of the mystery on page i.
Output
Print one integer β the number of days it will take to read the whole book.
Example
Input
9
1 3 3 6 7 6 8 8 9
Output
4
Note
Explanation of the example test:
During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day β pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
Submitted Solution:
```
page=input()
page=int(page)
secret=input().split()
day=0
for i in range(0,page):
secret[i]=int(secret[i])
#print(secret, page)
i=0
while i<page:
x=max(secret[:i+1])-1
if i==x:
day=day+1
i=i+1
else:
i=x
print(day)
``` | instruction | 0 | 88,425 | 4 | 176,850 |
Yes | output | 1 | 88,425 | 4 | 176,851 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i β₯ i).
Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.
How many days will it take to read the whole book?
Input
The first line contains single integer n (1 β€ n β€ 10^4) β the number of pages in the book.
The second line contains n integers a_1, a_2, ..., a_n (i β€ a_i β€ n), where a_i is the number of page which contains the explanation of the mystery on page i.
Output
Print one integer β the number of days it will take to read the whole book.
Example
Input
9
1 3 3 6 7 6 8 8 9
Output
4
Note
Explanation of the example test:
During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day β pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
Submitted Solution:
```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
n = int(input())
a = [int(i) for i in input().split()]
start = time.time()
end = a[0]
ans = 0
for i in range(n):
if a[i] > end:
end = a[i]
if end == i+1:
ans += 1
print(ans)
finish = time.time()
#print(finish - start)
``` | instruction | 0 | 88,426 | 4 | 176,852 |
Yes | output | 1 | 88,426 | 4 | 176,853 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i β₯ i).
Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.
How many days will it take to read the whole book?
Input
The first line contains single integer n (1 β€ n β€ 10^4) β the number of pages in the book.
The second line contains n integers a_1, a_2, ..., a_n (i β€ a_i β€ n), where a_i is the number of page which contains the explanation of the mystery on page i.
Output
Print one integer β the number of days it will take to read the whole book.
Example
Input
9
1 3 3 6 7 6 8 8 9
Output
4
Note
Explanation of the example test:
During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day β pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
Submitted Solution:
```
n = int(input())
a = list(map(int, input().split()))
s = [] * n
ans = 0
for i in range(n):
if len(s) > 0 and i in s:
s.remove(i)
ans += 1
else:
s.append(a[i])
print(ans)
``` | instruction | 0 | 88,427 | 4 | 176,854 |
No | output | 1 | 88,427 | 4 | 176,855 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i β₯ i).
Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.
How many days will it take to read the whole book?
Input
The first line contains single integer n (1 β€ n β€ 10^4) β the number of pages in the book.
The second line contains n integers a_1, a_2, ..., a_n (i β€ a_i β€ n), where a_i is the number of page which contains the explanation of the mystery on page i.
Output
Print one integer β the number of days it will take to read the whole book.
Example
Input
9
1 3 3 6 7 6 8 8 9
Output
4
Note
Explanation of the example test:
During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day β pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
Submitted Solution:
```
n=int(input())
lst1=list(map(int,input().split()))
count=0
for i in range(len(lst1)):
if lst1[i]==i+1:
count+=1
print(count-1)
``` | instruction | 0 | 88,428 | 4 | 176,856 |
No | output | 1 | 88,428 | 4 | 176,857 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i β₯ i).
Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.
How many days will it take to read the whole book?
Input
The first line contains single integer n (1 β€ n β€ 10^4) β the number of pages in the book.
The second line contains n integers a_1, a_2, ..., a_n (i β€ a_i β€ n), where a_i is the number of page which contains the explanation of the mystery on page i.
Output
Print one integer β the number of days it will take to read the whole book.
Example
Input
9
1 3 3 6 7 6 8 8 9
Output
4
Note
Explanation of the example test:
During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day β pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
Submitted Solution:
```
n=int(input())
l=list(map(int,input().split()))
ma=l[0]
c=0
for i in range(n):
if ma<l[i]:
ma=l[i]
if ma<=i+1:
print(l[i])
c+=1
if i!=n-1:
ma=l[i+1]
print(c)
``` | instruction | 0 | 88,429 | 4 | 176,858 |
No | output | 1 | 88,429 | 4 | 176,859 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on page a_i (a_i β₯ i).
Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page i such that Ivan already has read it, but hasn't read page a_i). After that, he closes the book and continues to read it on the following day from the next page.
How many days will it take to read the whole book?
Input
The first line contains single integer n (1 β€ n β€ 10^4) β the number of pages in the book.
The second line contains n integers a_1, a_2, ..., a_n (i β€ a_i β€ n), where a_i is the number of page which contains the explanation of the mystery on page i.
Output
Print one integer β the number of days it will take to read the whole book.
Example
Input
9
1 3 3 6 7 6 8 8 9
Output
4
Note
Explanation of the example test:
During the first day Ivan will read only the first page. During the second day Ivan will read pages number 2 and 3. During the third day β pages 4-8. During the fourth (and the last) day Ivan will read remaining page number 9.
Submitted Solution:
```
n = int(input())
L = [int(x)-1 for x in input().split()]
currentPage = 0
latestMystery = 0
days = 0
while currentPage < n:
days += 1
latestMystery = L[currentPage]
while latestMystery > currentPage:
temp = currentPage
currentPage = latestMystery
for i in range(temp,max(temp,latestMystery)+1):
latestMystery = max(L[i],latestMystery)
print(currentPage,latestMystery)
print(currentPage,latestMystery)
currentPage += 1
print(days)
``` | instruction | 0 | 88,430 | 4 | 176,860 |
No | output | 1 | 88,430 | 4 | 176,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Amr is a young coder who likes music a lot. He always wanted to learn how to play music but he was busy coding so he got an idea.
Amr has n instruments, it takes ai days to learn i-th instrument. Being busy, Amr dedicated k days to learn how to play the maximum possible number of instruments.
Amr asked for your help to distribute his free days between instruments so that he can achieve his goal.
Input
The first line contains two numbers n, k (1 β€ n β€ 100, 0 β€ k β€ 10 000), the number of instruments and number of days respectively.
The second line contains n integers ai (1 β€ ai β€ 100), representing number of days required to learn the i-th instrument.
Output
In the first line output one integer m representing the maximum number of instruments Amr can learn.
In the second line output m space-separated integers: the indices of instruments to be learnt. You may output indices in any order.
if there are multiple optimal solutions output any. It is not necessary to use all days for studying.
Examples
Input
4 10
4 3 1 2
Output
4
1 2 3 4
Input
5 6
4 3 1 1 2
Output
3
1 3 4
Input
1 3
4
Output
0
Note
In the first test Amr can learn all 4 instruments.
In the second test other possible solutions are: {2, 3, 5} or {3, 4, 5}.
In the third test Amr doesn't have enough time to learn the only presented instrument.
Submitted Solution:
```
n,k=map(int,input().split())
b=list(map(int,input().split()))
a=[]
tot=0
for i in range(n):
a.append([b[i],i+1])
tot+=a[i][0]
a.sort()
pos=0
if tot<=k:
pos=n
else:
for i in range(n):
if k>=a[i][0]:
k-=a[i][0]
else:
pos=i
break
ans=[]
for i in range(pos):
ans.append(a[i][1])
ans.sort()
print(*ans)
``` | instruction | 0 | 88,832 | 4 | 177,664 |
No | output | 1 | 88,832 | 4 | 177,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5. | instruction | 0 | 88,905 | 4 | 177,810 |
Tags: geometry, math
Correct Solution:
```
h,m = list(map(int,input().split(':')))
print((h*30+m/2)%360,m*6)
``` | output | 1 | 88,905 | 4 | 177,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5. | instruction | 0 | 88,906 | 4 | 177,812 |
Tags: geometry, math
Correct Solution:
```
s=input()
h=int(s[:2])
m=int(s[3:])
print(h%12*30+m/2,m*6)
# Made By Mostafa_Khaled
``` | output | 1 | 88,906 | 4 | 177,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5. | instruction | 0 | 88,907 | 4 | 177,814 |
Tags: geometry, math
Correct Solution:
```
H, M = [int(x) for x in input().split(':')]
H = H % 12
hAngle = 360 / 12
hmAngle = hAngle / 60
mAngle = 360 / 60
print(H * hAngle + M * hmAngle, end=' ')
print(M * mAngle)
``` | output | 1 | 88,907 | 4 | 177,815 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5. | instruction | 0 | 88,908 | 4 | 177,816 |
Tags: geometry, math
Correct Solution:
```
def readln(): return tuple(map(int, input().split()))
hh, mm = tuple(map(int, input().split(':')))
print(30 * (hh % 12) + 0.5 * mm, 6 * mm)
``` | output | 1 | 88,908 | 4 | 177,817 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5. | instruction | 0 | 88,909 | 4 | 177,818 |
Tags: geometry, math
Correct Solution:
```
import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import *
from itertools import accumulate
inf = float("inf")
# input = sys.stdin.readline
flush = lambda: sys.stdout.flush
comb = lambda x, y: (factorial(x) // factorial(y)) // factorial(x - y)
# inputs
# ip = lambda : input().rstrip()
ip = lambda: input()
ii = lambda: int(input())
r = lambda: map(int, input().split())
rr = lambda: list(r())
a, b = map(int, ip().split(":"))
print((a % 12) * 30 + b / 2, b * 6)
``` | output | 1 | 88,909 | 4 | 177,819 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5. | instruction | 0 | 88,910 | 4 | 177,820 |
Tags: geometry, math
Correct Solution:
```
hh, mm = map(int, input().split(":"))
print((hh%12)*30 + mm/2, mm*6)
``` | output | 1 | 88,910 | 4 | 177,821 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5. | instruction | 0 | 88,911 | 4 | 177,822 |
Tags: geometry, math
Correct Solution:
```
#
# solving:
# from: https://vjudge.net/contest/417235#problem/D
def main():
inlist = input().split(":")
hh, mm = int(inlist[0]), int(inlist[1])
deg_per_h = 360/12
deg_per_m = 360/60
print("{} {}".format(((hh+mm/60) * deg_per_h) % 360, (mm * deg_per_m) % 360))
main()
``` | output | 1 | 88,911 | 4 | 177,823 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5. | instruction | 0 | 88,912 | 4 | 177,824 |
Tags: geometry, math
Correct Solution:
```
#
# solving:
# from: https://vjudge.net/contest/417235#problem/D
# Fits the specification exactly uwu
def main():
inlist = input().split(":")
hh, mm = int(inlist[0]), int(inlist[1])
deg_per_h = 360/12
deg_per_m = 360/60
hours = ((hh+mm/60) * deg_per_h) % 360
mins = (mm * deg_per_m) % 360
if hours % 1 == 0: hours = int(hours)
if mins % 1 == 0: mins = int(mins)
print( "{} {}".format(hours, mins) )
main()
``` | output | 1 | 88,912 | 4 | 177,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.
Submitted Solution:
```
s=input()
h=int(s[:2])
m=int(s[3:])
if h>=12:
h=h%12
m1=6*m
h1=30*h+(1/12)*m1
print(h1,m1)
``` | instruction | 0 | 88,913 | 4 | 177,826 |
Yes | output | 1 | 88,913 | 4 | 177,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.
Submitted Solution:
```
h,minutes=[int(element) for element in input().split(':')]
answer_minutes=minutes/60*360%360
answer_hours=(h/12*360+360/12*minutes/60)%360
print(answer_hours,answer_minutes)
``` | instruction | 0 | 88,914 | 4 | 177,828 |
Yes | output | 1 | 88,914 | 4 | 177,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.
Submitted Solution:
```
input_string = str(input())
time_list = input_string.split(':')
hour = int(time_list[0])%12
minutes = int(time_list[1])%60
hour_degree = (30*hour) + (minutes/2)
minute_degree = minutes*6
print(str('{0:g}'.format(hour_degree)) + ' ' + str(minute_degree))
``` | instruction | 0 | 88,915 | 4 | 177,830 |
Yes | output | 1 | 88,915 | 4 | 177,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.
Submitted Solution:
```
import re
import itertools
from collections import Counter
class Task:
time = ""
answer = ""
def getData(self):
self.time = input()
#self.x, self.y = [int(x) for x in input().split(' ')]
#inFile = open('input.txt', 'r')
#inFile.readline().rstrip()
#self.childs = inFile.readline().rstrip()
def solve(self):
hours, minutes = [int(x) for x in self.time.split(':')]
hoursAngle = (30 * hours + minutes / 2) % 360
minutesAngle = (6 * minutes) % 360
self.answer = str(hoursAngle) + " " + str(minutesAngle)
def printAnswer(self):
print(self.answer)
#outFile = open('output.txt', 'w')
#outFile.write(self.answer)
task = Task()
task.getData()
task.solve()
task.printAnswer()
``` | instruction | 0 | 88,916 | 4 | 177,832 |
Yes | output | 1 | 88,916 | 4 | 177,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.
Submitted Solution:
```
s = input()
h = int(s[0]) * 10 + int(s[1])
m = int(s[3]) * 10 + int(s[4])
ang1 = round((h + m / 60) * 30)
ang2 = m * 6
if h == 12:
ang1 = 0
print(ang1, ang2)
``` | instruction | 0 | 88,917 | 4 | 177,834 |
No | output | 1 | 88,917 | 4 | 177,835 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.
Submitted Solution:
```
takes = str(input())
clocks = takes.split(':')
h = int(clocks[0])
m = int(clocks[1])
if m != 0:
temp = 30*h
hans = temp + 30/(60/m)
mans = 360/(60/m)
print(hans, mans)
else:
if(h*30)!=360:
print(h*30,m)
else:
print(0,m)
``` | instruction | 0 | 88,918 | 4 | 177,836 |
No | output | 1 | 88,918 | 4 | 177,837 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.
Submitted Solution:
```
# link: https://codeforces.com/problemset/problem/80/B
from sys import stdin, stdout
if __name__ == "__main__":
time_ = stdin.readline()
time_ = time_.lstrip()
time_ = time_.split(':')
time_ = [int(x) for x in time_]
# print(time_)
if time_[0] == 12 and time_[-1] == 0:
print(0,0)
exit(0)
minutes_degree = time_[-1] * 6
if time_[0] == 12:
time_[0] = 0
hours_degree = round( (time_[0] + time_[-1]/60) * 30, 1 )
print( hours_degree, minutes_degree )
``` | instruction | 0 | 88,919 | 4 | 177,838 |
No | output | 1 | 88,919 | 4 | 177,839 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Do you remember a kind cartoon "Beauty and the Beast"? No, no, there was no firing from machine guns or radiation mutants time-travels!
There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle...
Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.
Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll.
Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.
You can only rotate the hands forward, that is, as is shown in the picture:
<image>
As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.
Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.
Input
The only line of input contains current time according to the digital clock, formatted as HH:MM (00 β€ HH β€ 23, 00 β€ MM β€ 59). The mantel clock initially shows 12:00.
Pretests contain times of the beginning of some morning TV programs of the Channel One Russia.
Output
Print two numbers x and y β the angles of turning the hour and minute hands, respectively (0 β€ x, y < 360). The absolute or relative error in the answer should not exceed 10 - 9.
Examples
Input
12:00
Output
0 0
Input
04:30
Output
135 180
Input
08:17
Output
248.5 102
Note
A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.
Submitted Solution:
```
x=(input())
a=int(x[0:2])
b=int(x[3:])
lol=a*30+0.5*b
yo=b*6
if a==12:
lol=0
print(lol,yo)
``` | instruction | 0 | 88,920 | 4 | 177,840 |
No | output | 1 | 88,920 | 4 | 177,841 |
Provide a correct Python 3 solution for this coding contest problem.
Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct.
Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.) However, he fell asleep during his work, and he woke up after all the songs were played. According to his record, it turned out that he fell asleep at the very end of the song titled X.
Find the duration of time when some song was played while Niwango was asleep.
Constraints
* 1 \leq N \leq 50
* s_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.
* s_1,\ldots,s_N are distinct.
* There exists an integer i such that s_i = X.
* 1 \leq t_i \leq 1000
* t_i is an integer.
Input
Input is given from Standard Input in the following format:
N
s_1 t_1
\vdots
s_{N} t_N
X
Output
Print the answer.
Examples
Input
3
dwango 2
sixth 5
prelims 25
dwango
Output
30
Input
1
abcde 1000
abcde
Output
0
Input
15
ypnxn 279
kgjgwx 464
qquhuwq 327
rxing 549
pmuduhznoaqu 832
dagktgdarveusju 595
wunfagppcoi 200
dhavrncwfw 720
jpcmigg 658
wrczqxycivdqn 639
mcmkkbnjfeod 992
htqvkgkbhtytsz 130
twflegsjz 467
dswxxrxuzzfhkp 989
szfwtzfpnscgue 958
pmuduhznoaqu
Output
6348 | instruction | 0 | 89,023 | 4 | 178,046 |
"Correct Solution:
```
n = int(input())
musics = [input().split() for _ in range(n)]
x = input()
not_yet = True
ans = 0
for m, s in musics:
if not not_yet:
ans += int(s)
if x == m:
not_yet = False
print(ans)
``` | output | 1 | 89,023 | 4 | 178,047 |
Provide a correct Python 3 solution for this coding contest problem.
Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct.
Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.) However, he fell asleep during his work, and he woke up after all the songs were played. According to his record, it turned out that he fell asleep at the very end of the song titled X.
Find the duration of time when some song was played while Niwango was asleep.
Constraints
* 1 \leq N \leq 50
* s_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.
* s_1,\ldots,s_N are distinct.
* There exists an integer i such that s_i = X.
* 1 \leq t_i \leq 1000
* t_i is an integer.
Input
Input is given from Standard Input in the following format:
N
s_1 t_1
\vdots
s_{N} t_N
X
Output
Print the answer.
Examples
Input
3
dwango 2
sixth 5
prelims 25
dwango
Output
30
Input
1
abcde 1000
abcde
Output
0
Input
15
ypnxn 279
kgjgwx 464
qquhuwq 327
rxing 549
pmuduhznoaqu 832
dagktgdarveusju 595
wunfagppcoi 200
dhavrncwfw 720
jpcmigg 658
wrczqxycivdqn 639
mcmkkbnjfeod 992
htqvkgkbhtytsz 130
twflegsjz 467
dswxxrxuzzfhkp 989
szfwtzfpnscgue 958
pmuduhznoaqu
Output
6348 | instruction | 0 | 89,024 | 4 | 178,048 |
"Correct Solution:
```
n=int(input())
S=[]
T=[]
for i in range(n):
s,t=input().split()
S.append(s)
T.append(int(t))
print(sum(T[S.index(input())+1:]))
``` | output | 1 | 89,024 | 4 | 178,049 |
Provide a correct Python 3 solution for this coding contest problem.
Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct.
Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.) However, he fell asleep during his work, and he woke up after all the songs were played. According to his record, it turned out that he fell asleep at the very end of the song titled X.
Find the duration of time when some song was played while Niwango was asleep.
Constraints
* 1 \leq N \leq 50
* s_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.
* s_1,\ldots,s_N are distinct.
* There exists an integer i such that s_i = X.
* 1 \leq t_i \leq 1000
* t_i is an integer.
Input
Input is given from Standard Input in the following format:
N
s_1 t_1
\vdots
s_{N} t_N
X
Output
Print the answer.
Examples
Input
3
dwango 2
sixth 5
prelims 25
dwango
Output
30
Input
1
abcde 1000
abcde
Output
0
Input
15
ypnxn 279
kgjgwx 464
qquhuwq 327
rxing 549
pmuduhznoaqu 832
dagktgdarveusju 595
wunfagppcoi 200
dhavrncwfw 720
jpcmigg 658
wrczqxycivdqn 639
mcmkkbnjfeod 992
htqvkgkbhtytsz 130
twflegsjz 467
dswxxrxuzzfhkp 989
szfwtzfpnscgue 958
pmuduhznoaqu
Output
6348 | instruction | 0 | 89,025 | 4 | 178,050 |
"Correct Solution:
```
N=int(input())
s,t=[0]*N,[0]*N
for i in range(N):
s[i],t[i]=input().split()
X=input()
print(sum(list(map(int,t[s.index(X)+1:]))))
``` | output | 1 | 89,025 | 4 | 178,051 |
Provide a correct Python 3 solution for this coding contest problem.
Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct.
Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.) However, he fell asleep during his work, and he woke up after all the songs were played. According to his record, it turned out that he fell asleep at the very end of the song titled X.
Find the duration of time when some song was played while Niwango was asleep.
Constraints
* 1 \leq N \leq 50
* s_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.
* s_1,\ldots,s_N are distinct.
* There exists an integer i such that s_i = X.
* 1 \leq t_i \leq 1000
* t_i is an integer.
Input
Input is given from Standard Input in the following format:
N
s_1 t_1
\vdots
s_{N} t_N
X
Output
Print the answer.
Examples
Input
3
dwango 2
sixth 5
prelims 25
dwango
Output
30
Input
1
abcde 1000
abcde
Output
0
Input
15
ypnxn 279
kgjgwx 464
qquhuwq 327
rxing 549
pmuduhznoaqu 832
dagktgdarveusju 595
wunfagppcoi 200
dhavrncwfw 720
jpcmigg 658
wrczqxycivdqn 639
mcmkkbnjfeod 992
htqvkgkbhtytsz 130
twflegsjz 467
dswxxrxuzzfhkp 989
szfwtzfpnscgue 958
pmuduhznoaqu
Output
6348 | instruction | 0 | 89,026 | 4 | 178,052 |
"Correct Solution:
```
n = int(input())
title = []
length = []
for i in range(n):
a, b = input().split()
title.append(a)
length.append(int(b))
i = title.index(input())
print(sum((length[i+1:])))
``` | output | 1 | 89,026 | 4 | 178,053 |
Provide a correct Python 3 solution for this coding contest problem.
Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct.
Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.) However, he fell asleep during his work, and he woke up after all the songs were played. According to his record, it turned out that he fell asleep at the very end of the song titled X.
Find the duration of time when some song was played while Niwango was asleep.
Constraints
* 1 \leq N \leq 50
* s_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.
* s_1,\ldots,s_N are distinct.
* There exists an integer i such that s_i = X.
* 1 \leq t_i \leq 1000
* t_i is an integer.
Input
Input is given from Standard Input in the following format:
N
s_1 t_1
\vdots
s_{N} t_N
X
Output
Print the answer.
Examples
Input
3
dwango 2
sixth 5
prelims 25
dwango
Output
30
Input
1
abcde 1000
abcde
Output
0
Input
15
ypnxn 279
kgjgwx 464
qquhuwq 327
rxing 549
pmuduhznoaqu 832
dagktgdarveusju 595
wunfagppcoi 200
dhavrncwfw 720
jpcmigg 658
wrczqxycivdqn 639
mcmkkbnjfeod 992
htqvkgkbhtytsz 130
twflegsjz 467
dswxxrxuzzfhkp 989
szfwtzfpnscgue 958
pmuduhznoaqu
Output
6348 | instruction | 0 | 89,027 | 4 | 178,054 |
"Correct Solution:
```
n=int(input())
s=[]
t=[]
for i in range(n):
ss,tt=input().split()
s.append(ss)
t.append(int(tt))
print(sum(t[s.index(input())+1:]))
``` | output | 1 | 89,027 | 4 | 178,055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.