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 |
|---|---|---|---|---|---|
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,028 | 4 | 178,056 |
"Correct Solution:
```
N = int(input())
s = [None] * N
t = [None] * N
for i in range(N):
p, q = input().split()
s[i] = p
t[i] = int(q)
X = input()
print(sum(t[s.index(X)+1:]))
``` | output | 1 | 89,028 | 4 | 178,057 |
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,029 | 4 | 178,058 |
"Correct Solution:
```
n = int(input())
s,t = [0]*n,[0]*n
for i in range(n):
s[i],t[i] = input().split()
t = list(map(int,t))
print(sum(t[s.index(input())+1:]))
``` | output | 1 | 89,029 | 4 | 178,059 |
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,030 | 4 | 178,060 |
"Correct Solution:
```
n=int(input())
l=[input().split() for i in range(n)]
x=input()
ans=0
for i in range(n):
if l[i][0]==x:
ans=0
else:
ans+=int(l[i][1])
print(ans)
``` | output | 1 | 89,030 | 4 | 178,061 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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
Submitted Solution:
```
n = int(input())
ans = 0
music = {}
for i in range(n):
a, b = input().split()
ans += int(b)
music[a] = ans
print(ans-music[input()])
``` | instruction | 0 | 89,031 | 4 | 178,062 |
Yes | output | 1 | 89,031 | 4 | 178,063 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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
Submitted Solution:
```
n=int(input())
box1=[]
box2=[]
for i in range(n):
i=input().rstrip().split(" ")
box1.append(i[0])
box2.append(int(i[1]))
num=box1.index(input())
del box2[:num+1]
print(sum(box2))
``` | instruction | 0 | 89,032 | 4 | 178,064 |
Yes | output | 1 | 89,032 | 4 | 178,065 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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
Submitted Solution:
```
N = int(input())
S = []
T = []
for _ in range(N):
s, t = input().split()
S.append(s)
T.append(int(t))
X = input()
ans = sum(T[S.index(X)+1:])
print(ans)
``` | instruction | 0 | 89,033 | 4 | 178,066 |
Yes | output | 1 | 89,033 | 4 | 178,067 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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
Submitted Solution:
```
n=int(input())
l=[list(input().split()) for _ in range(n)]
x=input()
ans=0
for i in range(n):
s,t=l[i]
t=int(t)
ans+=t
if s==x:
c=ans
print(ans-c)
``` | instruction | 0 | 89,034 | 4 | 178,068 |
Yes | output | 1 | 89,034 | 4 | 178,069 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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
Submitted Solution:
```
def f(X,s,t):
N=len(s)
i=0
c=0
while s[i]!=X:
c+=int(t[i])
i+=1
return sum(t)-(c+int(t[i]))
N=int(input())
s=[0]*N
t=[0]*N
for a in range(0,N):
(s[a],t[a])=map(str,input().split())
X=input()
print(f(X,s,t))
``` | instruction | 0 | 89,035 | 4 | 178,070 |
No | output | 1 | 89,035 | 4 | 178,071 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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
Submitted Solution:
```
n = int(input())
s = [0] * n
t = [0] * n
for i in range(n):
s[i], t[i] = map(str, input().split())
x = input()
a = 0
b = 0
c = 0
while a <= n - 1:
if s[a] == x:
while b <= n - 1:
c += int(t[b])
b += 1
else:
a += 1
b += 1
else:
print(c)
``` | instruction | 0 | 89,036 | 4 | 178,072 |
No | output | 1 | 89,036 | 4 | 178,073 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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
Submitted Solution:
```
n,k = map(int,input().split())
a = tuple(map(int,input().split()))
mod = 10**9+7
rng = 1001
fctr = [1]
finv = [1]
for i in range(1,rng):
fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
finv.append(pow(fctr[i],mod-2,mod))
def cmb(n,k):
if n<0 or k<0:
return 0
else:
return fctr[n]*finv[n-k]*finv[k]%mod
dp = [[0 for i in range(n+1)] for j in range(k+1)]
dp[0][0] = 1
for i in range(1,k+1):
x = a[i-1]
for j in range(n+1):
for t in range(min(n-j,x)+1):
dp[i][j+t]=(dp[i][j+t]+dp[i-1][j]*cmb(n-j,t)*cmb(n-t,x-t))%mod
print(dp[k][n])
``` | instruction | 0 | 89,037 | 4 | 178,074 |
No | output | 1 | 89,037 | 4 | 178,075 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
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
Submitted Solution:
```
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq
## input functions for me
def rsa(sep = ''):
if sep == '' :
return input().split()
else: return input().split(sep)
def rip(sep = ''):
if sep == '' :
return map(int, input().split())
else: return map(int, input().split(sep))
def ria(sep = ''):
return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
N = ri()
S = []
T = []
for i in range(N):
S[i], T[i] = rip()
X = ri()
ans = 0
sleep = False
for i in range(N):
if S[i] == X:
sleep = True
continue
if sleep:
ans += T[i]
print(ans)
if __name__ == "__main__":
main()
``` | instruction | 0 | 89,038 | 4 | 178,076 |
No | output | 1 | 89,038 | 4 | 178,077 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Well, the series which Stepan watched for a very long time, ended. In total, the series had n episodes. For each of them, Stepan remembers either that he definitely has watched it, or that he definitely hasn't watched it, or he is unsure, has he watched this episode or not.
Stepan's dissatisfaction is the maximum number of consecutive series that Stepan did not watch.
Your task is to determine according to Stepan's memories if his dissatisfaction could be exactly equal to k.
Input
The first line contains two integers n and k (1 β€ n β€ 100, 0 β€ k β€ n) β the number of episodes in the series and the dissatisfaction which should be checked.
The second line contains the sequence which consists of n symbols "Y", "N" and "?". If the i-th symbol equals "Y", Stepan remembers that he has watched the episode number i. If the i-th symbol equals "N", Stepan remembers that he hasn't watched the epizode number i. If the i-th symbol equals "?", Stepan doesn't exactly remember if he has watched the episode number i or not.
Output
If Stepan's dissatisfaction can be exactly equal to k, then print "YES" (without qoutes). Otherwise print "NO" (without qoutes).
Examples
Input
5 2
NYNNY
Output
YES
Input
6 1
????NN
Output
NO
Note
In the first test Stepan remembers about all the episodes whether he has watched them or not. His dissatisfaction is 2, because he hasn't watch two episodes in a row β the episode number 3 and the episode number 4. The answer is "YES", because k = 2.
In the second test k = 1, Stepan's dissatisfaction is greater than or equal to 2 (because he remembers that he hasn't watch at least two episodes in a row β number 5 and number 6), even if he has watched the episodes from the first to the fourth, inclusive.
Submitted Solution:
```
n, k = map(int, input().split())
string = input()
series = []
now = ""
for elem in string:
if elem == "Y":
if now:
series.append(now)
now = ""
else:
now += elem
if now:
series.append(now)
answer = False
no_max = True
for elem in series:
m = len(elem)
for i in range(m - k + 1):
if (not i or elem[i - 1] == '?') and ((i + k - 1) == m - 1 or elem[i + k] == '?'):
answer = True
counter = 0
for letter in elem:
if letter == 'N':
counter += 1
no_max = not counter > k
else:
counter = 0
print("YES" if answer and no_max else "NO")
``` | instruction | 0 | 89,788 | 4 | 179,576 |
No | output | 1 | 89,788 | 4 | 179,577 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.
During cooking, Julia goes to the kitchen every d minutes and turns on the stove if it is turned off. While the cooker is turned off, it stays warm. The stove switches on and off instantly.
It is known that the chicken needs t minutes to be cooked on the stove, if it is turned on, and 2t minutes, if it is turned off. You need to find out, how much time will Julia have to cook the chicken, if it is considered that the chicken is cooked evenly, with constant speed when the stove is turned on and at a constant speed when it is turned off.
Input
The single line contains three integers k, d and t (1 β€ k, d, t β€ 1018).
Output
Print a single number, the total time of cooking in minutes. The relative or absolute error must not exceed 10 - 9.
Namely, let's assume that your answer is x and the answer of the jury is y. The checker program will consider your answer correct if <image>.
Examples
Input
3 2 6
Output
6.5
Input
4 2 20
Output
20.0
Note
In the first example, the chicken will be cooked for 3 minutes on the turned on stove, after this it will be cooked for <image>. Then the chicken will be cooked for one minute on a turned off stove, it will be cooked for <image>. Thus, after four minutes the chicken will be cooked for <image>. Before the fifth minute Julia will turn on the stove and after 2.5 minutes the chicken will be ready <image>.
In the second example, when the stove is turned off, Julia will immediately turn it on, so the stove will always be turned on and the chicken will be cooked in 20 minutes.
Submitted Solution:
```
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 8 22:15:19 2018
@author: Nikita
"""
from math import ceil, floor
k, d, t = map(int, input().split())
period = 0
if k <= d:
period = d
else:
period = ceil(k / d) * d
cooking = k + period
num = floor(2 * t / cooking)
carry = 2 * t - num * cooking
ans = 0
if carry > 2 * k:
ans = num * period + carry - k
else:
ans = num * period + carry / 2
print(ans)
``` | instruction | 0 | 89,843 | 4 | 179,686 |
Yes | output | 1 | 89,843 | 4 | 179,687 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes a_1 seconds, secondly β the part which takes a_2 seconds, and so on. After reciting the verse, Vasya will get the number of presents equal to the number of parts he fully recited.
Vasya can skip at most one part of the verse while reciting it (if he skips more than one part, then Santa will definitely notice it).
Santa will listen to Vasya's verse for no more than s seconds. For example, if s = 10, a = [100, 9, 1, 1], and Vasya skips the first part of verse, then he gets two presents.
Note that it is possible to recite the whole verse (if there is enough time).
Determine which part Vasya needs to skip to obtain the maximum possible number of gifts. If Vasya shouldn't skip anything, print 0. If there are multiple answers, print any of them.
You have to process t test cases.
Input
The first line contains one integer t (1 β€ t β€ 100) β the number of test cases.
The first line of each test case contains two integers n and s (1 β€ n β€ 10^5, 1 β€ s β€ 10^9) β the number of parts in the verse and the maximum number of seconds Santa will listen to Vasya, respectively.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the time it takes to recite each part of the verse.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print one integer β the number of the part that Vasya needs to skip to obtain the maximum number of gifts. If Vasya shouldn't skip any parts, print 0.
Example
Input
3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
Output
2
1
0
Note
In the first test case if Vasya skips the second part then he gets three gifts.
In the second test case no matter what part of the verse Vasya skips.
In the third test case Vasya can recite the whole verse.
Submitted Solution:
```
q = int(input())
for _ in range(q):
n,s = map(int, input().split())
arr = list(map(int, input().split()))
ma = arr[0]
idx = 0
if(sum(arr) <= s):
print(0)
continue
for i, num in enumerate(arr):
s -= num
if ma < num:
ma = num
idx = i
if s < 0:
if s + ma >= 0:
print(idx+1)
break
else:
print(0)
break
``` | instruction | 0 | 90,267 | 4 | 180,534 |
Yes | output | 1 | 90,267 | 4 | 180,535 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes a_1 seconds, secondly β the part which takes a_2 seconds, and so on. After reciting the verse, Vasya will get the number of presents equal to the number of parts he fully recited.
Vasya can skip at most one part of the verse while reciting it (if he skips more than one part, then Santa will definitely notice it).
Santa will listen to Vasya's verse for no more than s seconds. For example, if s = 10, a = [100, 9, 1, 1], and Vasya skips the first part of verse, then he gets two presents.
Note that it is possible to recite the whole verse (if there is enough time).
Determine which part Vasya needs to skip to obtain the maximum possible number of gifts. If Vasya shouldn't skip anything, print 0. If there are multiple answers, print any of them.
You have to process t test cases.
Input
The first line contains one integer t (1 β€ t β€ 100) β the number of test cases.
The first line of each test case contains two integers n and s (1 β€ n β€ 10^5, 1 β€ s β€ 10^9) β the number of parts in the verse and the maximum number of seconds Santa will listen to Vasya, respectively.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the time it takes to recite each part of the verse.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print one integer β the number of the part that Vasya needs to skip to obtain the maximum number of gifts. If Vasya shouldn't skip any parts, print 0.
Example
Input
3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
Output
2
1
0
Note
In the first test case if Vasya skips the second part then he gets three gifts.
In the second test case no matter what part of the verse Vasya skips.
In the third test case Vasya can recite the whole verse.
Submitted Solution:
```
import sys
input = sys.stdin.readline
from itertools import accumulate
import bisect
t=int(input())
for test in range(t):
n,s=map(int,input().split())
A=list(map(int,input().split()))
S=list(accumulate(A))
if S[-1]<=s:
print(0)
continue
ANS=0
MAX=0
#print(A)
#print(S)
for i in range(n):
x=bisect.bisect_right(S,A[i]+s)
if i>=x:
continue
if x>MAX:
MAX=x
ANS=i
#print(i,x)
print(ANS+1)
``` | instruction | 0 | 90,268 | 4 | 180,536 |
Yes | output | 1 | 90,268 | 4 | 180,537 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes a_1 seconds, secondly β the part which takes a_2 seconds, and so on. After reciting the verse, Vasya will get the number of presents equal to the number of parts he fully recited.
Vasya can skip at most one part of the verse while reciting it (if he skips more than one part, then Santa will definitely notice it).
Santa will listen to Vasya's verse for no more than s seconds. For example, if s = 10, a = [100, 9, 1, 1], and Vasya skips the first part of verse, then he gets two presents.
Note that it is possible to recite the whole verse (if there is enough time).
Determine which part Vasya needs to skip to obtain the maximum possible number of gifts. If Vasya shouldn't skip anything, print 0. If there are multiple answers, print any of them.
You have to process t test cases.
Input
The first line contains one integer t (1 β€ t β€ 100) β the number of test cases.
The first line of each test case contains two integers n and s (1 β€ n β€ 10^5, 1 β€ s β€ 10^9) β the number of parts in the verse and the maximum number of seconds Santa will listen to Vasya, respectively.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the time it takes to recite each part of the verse.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print one integer β the number of the part that Vasya needs to skip to obtain the maximum number of gifts. If Vasya shouldn't skip any parts, print 0.
Example
Input
3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
Output
2
1
0
Note
In the first test case if Vasya skips the second part then he gets three gifts.
In the second test case no matter what part of the verse Vasya skips.
In the third test case Vasya can recite the whole verse.
Submitted Solution:
```
t = int(input())
for _ in range(t):
n,k = map(int,input().split())
a = list(map(int,input().split()))
max_index = []
prefix_array = []
prefix_array.append(a[0])
max_elem = 0
max_index.append(0)
i = 1
while i < n:
prefix_array.append((prefix_array[i-1] + a[i]))
if a[i] > a[max_elem]:
max_elem = i
max_index.append(max_elem)
i += 1
skipped = False
skip = -1
for i in range(n):
if prefix_array[i] > k:
if not skipped:
skip = max_index[i]
skipped = True
elif prefix_array[i] - a[skip] > k:
break
print(skip + 1)
``` | instruction | 0 | 90,269 | 4 | 180,538 |
Yes | output | 1 | 90,269 | 4 | 180,539 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes a_1 seconds, secondly β the part which takes a_2 seconds, and so on. After reciting the verse, Vasya will get the number of presents equal to the number of parts he fully recited.
Vasya can skip at most one part of the verse while reciting it (if he skips more than one part, then Santa will definitely notice it).
Santa will listen to Vasya's verse for no more than s seconds. For example, if s = 10, a = [100, 9, 1, 1], and Vasya skips the first part of verse, then he gets two presents.
Note that it is possible to recite the whole verse (if there is enough time).
Determine which part Vasya needs to skip to obtain the maximum possible number of gifts. If Vasya shouldn't skip anything, print 0. If there are multiple answers, print any of them.
You have to process t test cases.
Input
The first line contains one integer t (1 β€ t β€ 100) β the number of test cases.
The first line of each test case contains two integers n and s (1 β€ n β€ 10^5, 1 β€ s β€ 10^9) β the number of parts in the verse and the maximum number of seconds Santa will listen to Vasya, respectively.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the time it takes to recite each part of the verse.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print one integer β the number of the part that Vasya needs to skip to obtain the maximum number of gifts. If Vasya shouldn't skip any parts, print 0.
Example
Input
3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
Output
2
1
0
Note
In the first test case if Vasya skips the second part then he gets three gifts.
In the second test case no matter what part of the verse Vasya skips.
In the third test case Vasya can recite the whole verse.
Submitted Solution:
```
n=int(input())
for _ in range(n):
a,k=map(int,input().split())
l=list(map(int,input().split()))
s=0
for i in range(a):
s+=l[i]
if(s>k):
l=l[:i+1]
break
if(s>k):
p=l.index(max(l))
print(p+1)
else:
print("0")
``` | instruction | 0 | 90,270 | 4 | 180,540 |
Yes | output | 1 | 90,270 | 4 | 180,541 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes a_1 seconds, secondly β the part which takes a_2 seconds, and so on. After reciting the verse, Vasya will get the number of presents equal to the number of parts he fully recited.
Vasya can skip at most one part of the verse while reciting it (if he skips more than one part, then Santa will definitely notice it).
Santa will listen to Vasya's verse for no more than s seconds. For example, if s = 10, a = [100, 9, 1, 1], and Vasya skips the first part of verse, then he gets two presents.
Note that it is possible to recite the whole verse (if there is enough time).
Determine which part Vasya needs to skip to obtain the maximum possible number of gifts. If Vasya shouldn't skip anything, print 0. If there are multiple answers, print any of them.
You have to process t test cases.
Input
The first line contains one integer t (1 β€ t β€ 100) β the number of test cases.
The first line of each test case contains two integers n and s (1 β€ n β€ 10^5, 1 β€ s β€ 10^9) β the number of parts in the verse and the maximum number of seconds Santa will listen to Vasya, respectively.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the time it takes to recite each part of the verse.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print one integer β the number of the part that Vasya needs to skip to obtain the maximum number of gifts. If Vasya shouldn't skip any parts, print 0.
Example
Input
3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
Output
2
1
0
Note
In the first test case if Vasya skips the second part then he gets three gifts.
In the second test case no matter what part of the verse Vasya skips.
In the third test case Vasya can recite the whole verse.
Submitted Solution:
```
tests = int(input())
for te in range(tests):
n,s = list(map(int,input().split()))
arr = list(map(int,input().split()))
pref = [0 for i in range(n)]
pref[0] = arr[0]
for i in range(1,n):
pref[i] = pref[i-1] + arr[i]
if(pref[n-1] <= s):
print(0)
continue
maxa = -1
answer = -1
for i in range(n):
score = s + arr[i]
low = 0
high = n-1
index = -1
while(low <= high):
mid = (low + high)//2
if(mid >= i and score >= pref[mid]):
index = mid
low = mid + 1
elif(mid < i and s >= pref[i]):
index = mid
low = mid + 1
else:
high = mid - 1
if(maxa < index):
maxa = index
answer = i
if(answer == -1):
print(0)
else:
print(answer + 1)
``` | instruction | 0 | 90,271 | 4 | 180,542 |
No | output | 1 | 90,271 | 4 | 180,543 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes a_1 seconds, secondly β the part which takes a_2 seconds, and so on. After reciting the verse, Vasya will get the number of presents equal to the number of parts he fully recited.
Vasya can skip at most one part of the verse while reciting it (if he skips more than one part, then Santa will definitely notice it).
Santa will listen to Vasya's verse for no more than s seconds. For example, if s = 10, a = [100, 9, 1, 1], and Vasya skips the first part of verse, then he gets two presents.
Note that it is possible to recite the whole verse (if there is enough time).
Determine which part Vasya needs to skip to obtain the maximum possible number of gifts. If Vasya shouldn't skip anything, print 0. If there are multiple answers, print any of them.
You have to process t test cases.
Input
The first line contains one integer t (1 β€ t β€ 100) β the number of test cases.
The first line of each test case contains two integers n and s (1 β€ n β€ 10^5, 1 β€ s β€ 10^9) β the number of parts in the verse and the maximum number of seconds Santa will listen to Vasya, respectively.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the time it takes to recite each part of the verse.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print one integer β the number of the part that Vasya needs to skip to obtain the maximum number of gifts. If Vasya shouldn't skip any parts, print 0.
Example
Input
3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
Output
2
1
0
Note
In the first test case if Vasya skips the second part then he gets three gifts.
In the second test case no matter what part of the verse Vasya skips.
In the third test case Vasya can recite the whole verse.
Submitted Solution:
```
for i in range(int(input())):
n,s=map(int,input().split())
x=list(map(int,input().split()))
count=0
for j in range(n):
if(sum(x)<=s):
break
ma=max(x)
inde=x.index(ma)
x.remove(ma)
count+=1
print(count)
``` | instruction | 0 | 90,272 | 4 | 180,544 |
No | output | 1 | 90,272 | 4 | 180,545 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes a_1 seconds, secondly β the part which takes a_2 seconds, and so on. After reciting the verse, Vasya will get the number of presents equal to the number of parts he fully recited.
Vasya can skip at most one part of the verse while reciting it (if he skips more than one part, then Santa will definitely notice it).
Santa will listen to Vasya's verse for no more than s seconds. For example, if s = 10, a = [100, 9, 1, 1], and Vasya skips the first part of verse, then he gets two presents.
Note that it is possible to recite the whole verse (if there is enough time).
Determine which part Vasya needs to skip to obtain the maximum possible number of gifts. If Vasya shouldn't skip anything, print 0. If there are multiple answers, print any of them.
You have to process t test cases.
Input
The first line contains one integer t (1 β€ t β€ 100) β the number of test cases.
The first line of each test case contains two integers n and s (1 β€ n β€ 10^5, 1 β€ s β€ 10^9) β the number of parts in the verse and the maximum number of seconds Santa will listen to Vasya, respectively.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the time it takes to recite each part of the verse.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print one integer β the number of the part that Vasya needs to skip to obtain the maximum number of gifts. If Vasya shouldn't skip any parts, print 0.
Example
Input
3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
Output
2
1
0
Note
In the first test case if Vasya skips the second part then he gets three gifts.
In the second test case no matter what part of the verse Vasya skips.
In the third test case Vasya can recite the whole verse.
Submitted Solution:
```
for _ in range(int(input())):
n,s=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)<=s: print(0); continue
for i in range(n-1):
if a[i+1]<=a[i]: print(i+1); break
``` | instruction | 0 | 90,273 | 4 | 180,546 |
No | output | 1 | 90,273 | 4 | 180,547 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes a_1 seconds, secondly β the part which takes a_2 seconds, and so on. After reciting the verse, Vasya will get the number of presents equal to the number of parts he fully recited.
Vasya can skip at most one part of the verse while reciting it (if he skips more than one part, then Santa will definitely notice it).
Santa will listen to Vasya's verse for no more than s seconds. For example, if s = 10, a = [100, 9, 1, 1], and Vasya skips the first part of verse, then he gets two presents.
Note that it is possible to recite the whole verse (if there is enough time).
Determine which part Vasya needs to skip to obtain the maximum possible number of gifts. If Vasya shouldn't skip anything, print 0. If there are multiple answers, print any of them.
You have to process t test cases.
Input
The first line contains one integer t (1 β€ t β€ 100) β the number of test cases.
The first line of each test case contains two integers n and s (1 β€ n β€ 10^5, 1 β€ s β€ 10^9) β the number of parts in the verse and the maximum number of seconds Santa will listen to Vasya, respectively.
The second line of each test case contains n integers a_1, a_2, ..., a_n (1 β€ a_i β€ 10^9) β the time it takes to recite each part of the verse.
It is guaranteed that the sum of n over all test cases does not exceed 10^5.
Output
For each test case print one integer β the number of the part that Vasya needs to skip to obtain the maximum number of gifts. If Vasya shouldn't skip any parts, print 0.
Example
Input
3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
Output
2
1
0
Note
In the first test case if Vasya skips the second part then he gets three gifts.
In the second test case no matter what part of the verse Vasya skips.
In the third test case Vasya can recite the whole verse.
Submitted Solution:
```
t=int(input())
for _ in range(t):
n,s=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)<=s:
print(0)
continue
mx=0
sm=0
end=-1
for i in range(n):
sm+=a[i]
if a[i]>a[mx]:
mx=i
if sm>s:
end=i
break
print(end+1)
``` | instruction | 0 | 90,274 | 4 | 180,548 |
No | output | 1 | 90,274 | 4 | 180,549 |
Provide tags and a correct Python 3 solution for this coding contest problem.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all. | instruction | 0 | 90,467 | 4 | 180,934 |
Tags: implementation
Correct Solution:
```
from sys import stdin
from datetime import datetime, timedelta
def main():
s = stdin.readline().strip()
t = stdin.readline().strip()
s = datetime.strptime(s, '%H:%M')
t = datetime.strptime(t, '%H:%M')
t = timedelta(hours = t.hour, minutes = t.minute)
p = s - t
print('{:02}:{:02}'.format(p.hour, p.minute))
if __name__ == '__main__': main()
``` | output | 1 | 90,467 | 4 | 180,935 |
Provide tags and a correct Python 3 solution for this coding contest problem.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all. | instruction | 0 | 90,468 | 4 | 180,936 |
Tags: implementation
Correct Solution:
```
# ///==========Libraries, Constants and Functions=============///
#mkraghav
import sys
inf = float("inf")
mod = 1000000007
def get_array(): return list(map(int, sys.stdin.readline().split()))
def get_ints(): return map(int, sys.stdin.readline().split())
def input(): return sys.stdin.readline()
def int1():return int(input())
import string
import math
from itertools import combinations
# ///==========MAIN=============///
def main():
s1=input()
s2=input()
x1=int(s1[:2])
x2=int(s1[3:])
y1=int(s2[:2])
y2=int(s2[3:])
x3=x1-y1
y=x2-y2
if y<0:
y=60+y
x3=x3-1
if x3<0:
x3=24+x3
if x3<10:
x3=str(0)+str(x3)
if y<10:
y=str(0)+str(y)
print(str(x3)+':'+str(y))
if __name__ == "__main__":
main()
``` | output | 1 | 90,468 | 4 | 180,937 |
Provide tags and a correct Python 3 solution for this coding contest problem.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all. | instruction | 0 | 90,469 | 4 | 180,938 |
Tags: implementation
Correct Solution:
```
wu = input()
t = input()
a = wu.split(':')
b = t.split(':')
resHr = int(a[0]) - int(b[0])
resMin = int(a[1]) - int(b[1])
if int(resMin) < 0:
resMin = str(int(resMin) % 60)
resHr = str(int(resHr) - 1)
else:
resMin = str(resMin)
if int(resHr) < 0:
resHr = str(int(resHr) % 24)
else:
resHr = str(resHr)
if int(resHr) < 10:
resHr = '0'+str(abs(int(resHr)))
else:
resHr = str(resHr)
if abs(int(resMin)) < 10:
resMin = '0'+str(abs(int(resMin)))
else:
resMin = str(resMin)
print(resHr+':'+resMin)
``` | output | 1 | 90,469 | 4 | 180,939 |
Provide tags and a correct Python 3 solution for this coding contest problem.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all. | instruction | 0 | 90,470 | 4 | 180,940 |
Tags: implementation
Correct Solution:
```
a=input()
b=input()
c=a.split(":")
d=b.split(":")
currenttime1=int (c[0])
if int(c[0][0])==0 :
currenttime1=int(c[0][1])
currenttime2= int (c[1])
if int(c[-1][0])==0 :
currenttime2=int(c[1][1])
duration1=int(d[0])
if int(d[0][0])==0 :
duration1=int(d[0][1])
duration2=int(d[1])
if int(d[-1][0])==0 :
duration=int(d[1][1])
time2 = currenttime2-duration2
if currenttime2<duration2:
time2= 60 - (duration2-currenttime2)
duration1= duration1+1
time =currenttime1-duration1
if currenttime1 < duration1:
time = 24 - (duration1-currenttime1)
if time <=9 :
time='0'+ str(time)
if time2 <=9 :
time2='0'+ str(time2)
print(str(time)+':'+str(time2))
``` | output | 1 | 90,470 | 4 | 180,941 |
Provide tags and a correct Python 3 solution for this coding contest problem.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all. | instruction | 0 | 90,471 | 4 | 180,942 |
Tags: implementation
Correct Solution:
```
s, t = (tuple(map(int, input().split(':'))) for i in "01")
z = ((s[0], 24)[not s[0]] - t[0]) * 60 + s[1] - t[1]
print('{:02}:{:02}'.format((z // 60) % 24, z % 60))
``` | output | 1 | 90,471 | 4 | 180,943 |
Provide tags and a correct Python 3 solution for this coding contest problem.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all. | instruction | 0 | 90,472 | 4 | 180,944 |
Tags: implementation
Correct Solution:
```
s=input().split(':')
s[0]=int(s[0])
s[1]=int(s[1])
t=input().split(':')
t[0]=int(t[0])
t[1]=int(t[1])
def v(n):
n=str(n)
if len(n)==1:
return '0'+n
else:
return n
if s[0]>=t[0] and s[1]>=t[1]:
print(v(s[0]-t[0])+':'+v(s[1]-t[1]))
elif s[0]>t[0] and s[1]<t[1]:
print(v(s[0]-t[0]-1)+':'+v(s[1]+60-t[1]))
elif s[0]==t[0] and s[1]<t[1]:
print('23'+':'+v(s[1]+60-t[1]))
elif s[0]<t[0] and s[1]>=t[1]:
print(v(24-(t[0]-s[0]))+':'+v(s[1]-t[1]))
elif s[0]<t[0] and s[1]<t[1]:
print(v(24-(t[0]-s[0])-1)+':'+v(60+s[1]-t[1]))
``` | output | 1 | 90,472 | 4 | 180,945 |
Provide tags and a correct Python 3 solution for this coding contest problem.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all. | instruction | 0 | 90,473 | 4 | 180,946 |
Tags: implementation
Correct Solution:
```
def func(s):
a, b = list(map(int, s.split(":")))
return a*60+b
ct = func(input())
ts = func(input())
ans = ct - ts
if ans < 0:
ans += 60*24
print("%02i:%02i" % (ans//60, ans%60))
``` | output | 1 | 90,473 | 4 | 180,947 |
Provide tags and a correct Python 3 solution for this coding contest problem.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all. | instruction | 0 | 90,474 | 4 | 180,948 |
Tags: implementation
Correct Solution:
```
a,b = map(int, input().split(":"))
c, d = map(int, input().split(":"))
a1, a2 = [0]*2
if b< d:
a2 = b - d + 60
if a:
a -= 1
else:
a = 23
else:
a2= b - d
if a < c:
a1 = a - c + 24
else:
a1 = a - c
a1 = str(a1)
a2 =str(a2)
if len(a1) != 2:
a1 = "0" + a1
if len(a2) != 2:
a2 = "0" + a2
print(a1, a2, sep = ":")
``` | output | 1 | 90,474 | 4 | 180,949 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all.
Submitted Solution:
```
s = [int(x) for x in input().split(":")]
t = [int(x) for x in input().split(":")]
s1 = s[0] * 60 + s[1] + 1440
t1 = t[0] * 60 + t[1]
p = (s1 - t1) % 1440
print("0" * (2 - len(str(p // 60))) + str(p // 60) + ":" + "0" * (2 - len(str(p % 60))) + str(p % 60))
``` | instruction | 0 | 90,475 | 4 | 180,950 |
Yes | output | 1 | 90,475 | 4 | 180,951 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all.
Submitted Solution:
```
s = list(map(int, input().split(':')))
t = list(map(int, input().split(':')))
p = [0, 0]
if s[0] - t[0] < 0:
p[0] = 24 - (t[0] - s[0])
else:
p[0] = s[0] - t[0]
if s[1] - t[1] < 0:
p[1] = 60 - (t[1] - s[1])
if p[0] == 0:
p[0] = 23
else:
p[0] -= 1
else:
p[1] = s[1] - t[1]
if p[0] < 10:
print('0', p[0], sep = '', end = ':')
else:
print(p[0], end = ':')
if p[1] < 10:
print('0', p[1], sep = '')
else:
print(p[1])
``` | instruction | 0 | 90,476 | 4 | 180,952 |
Yes | output | 1 | 90,476 | 4 | 180,953 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all.
Submitted Solution:
```
h1,m1=map(int,input().split(':'))
h2,m2=map(int,input().split(':'))
if h1 == 00:
h1=24
if h2 == 00:
h2=24
time1=h1*60+m1
time2=h2*60+m2
if time2>time1:
time1+=24*60
timex=time1-time2
hx=timex//60
mx=timex%60
if hx<10 :
hx='0'+str(hx)
if mx<10 :
mx='0'+str(mx)
print(hx,end='')
print(':',end='')
print(mx,end='')
``` | instruction | 0 | 90,477 | 4 | 180,954 |
Yes | output | 1 | 90,477 | 4 | 180,955 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all.
Submitted Solution:
```
bangun = input().split(":")
lama_tidur = input().split(":")
menit = int(bangun[1]) - int(lama_tidur[1])
jam = int(bangun[0]) - int(lama_tidur[0])
if menit < 0:
menit += 60
jam -= 1
if jam < 0:
jam += 24
A = str(menit)
B = str(jam)
if len(A) < 2:
A = "0"+A
if len(B)<2:
B = "0"+B
print(B+":"+A)
``` | instruction | 0 | 90,478 | 4 | 180,956 |
Yes | output | 1 | 90,478 | 4 | 180,957 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all.
Submitted Solution:
```
a=input()
b=input()
c=a.split(":")
d=b.split(":")
currenttime1=int (c[0])
if int(c[0][0])==0 :
currenttime1=int(c[0][1])
currenttime2= int (c[1])
if int(c[-1][0])==0 :
currenttime2=int(c[1][1])
duration1=int(d[0])
if int(c[0][0])==0 :
duration1=int(d[0][1])
duration2=int(d[1])
if int(c[-1][0])==0 :
duration=int(d[1][1])
time =currenttime1-duration1
if currenttime1<duration1:
time = 24 - duration1
time2 = currenttime2-duration2
if currenttime2<duration2:
time2= 60 - duration2
if time == 0 :
time= 24 - 1
else:
time= time -1
if time <=9 :
time='0'+ str(time)
if time2 <=9 :
time2='0'+ str(time2)
print(str(time)+':'+str(time2))
``` | instruction | 0 | 90,479 | 4 | 180,958 |
No | output | 1 | 90,479 | 4 | 180,959 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all.
Submitted Solution:
```
s=input()
t=input()
cth=sth=ctm=stm=''
for i in range(0,5):
if i<2:
cth+=s[i]
sth+=t[i]
elif i>2:
ctm += s[i]
stm+=t[i]
ah=int(cth)-int(sth)
am=int(ctm)-int(stm)
if ah>0 and am!=0:
ah=ah-1
if cth==sth and ctm<stm:
ah=23
if ah<0 and am>=0:
ah=24+ah
if ah<0 and am<0:
ah=23+ah
if am<0:
am=60+am
if len(str(ah))==1 and len(str(am))==1:
print("0",ah,":","0",am,sep='')
elif len(str(ah))==1 and len(str(am))==2:
print("0",ah,":",am,sep='')
elif len(str(ah))==2 and len(str(am))==1:
print(ah,":","0",am,sep='')
else:
print(ah,":",am,sep='')
``` | instruction | 0 | 90,480 | 4 | 180,960 |
No | output | 1 | 90,480 | 4 | 180,961 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all.
Submitted Solution:
```
a = input()
q1, q2, q3, q4 = int(a[0]), int(a[1]), int(a[3]), int(a[4])
b = input()
w1, w2, w3, w4 = int(b[0]), int(b[1]), int(b[3]), int(b[4])
ww = (q3*10 + q4) + (q1*10 + q2)*60
qq = (w3*10 + w4) + (w1*10 + w2)*60
s = ""
if q1 == q2 and q3 == q2 and q3 == q4 and w1== q1 and w2 == q1 and w3 == q1 and w4 == q1:
print("00:00")
elif (ww - qq) > 0:
if(ww - qq) // 60 > 9:
d = str((ww - qq)//60)
s += d
else:
s += "0"
d = str((ww - qq)//60)
s += d
s += ":"
if (ww - qq) % 60 > 9:
d = str((ww - qq)%60)
s += d
else:
s += "0"
d = str((ww - qq)%60)
s += d
print(s)
else:
if(ww - qq + 1440) // 60 > 9:
d = str((ww - qq+ 1440)//60)
s += d
else:
s += "0"
d = str((ww - qq+ 1440)//60)
s += d
s += ":"
if (ww - qq + 1440) % 60 > 9:
d = str((ww - qq + 1440)%60)
s += d
else:
s += "0"
d = str((ww - qq + 1440)%60)
s += d
print(s)
``` | instruction | 0 | 90,481 | 4 | 180,962 |
No | output | 1 | 90,481 | 4 | 180,963 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current time (see the second test sample).
Input
The first line contains current time s as a string in the format "hh:mm". The second line contains time t in the format "hh:mm" β the duration of George's sleep. It is guaranteed that the input contains the correct time in the 24-hour format, that is, 00 β€ hh β€ 23, 00 β€ mm β€ 59.
Output
In the single line print time p β the time George went to bed in the format similar to the format of the time in the input.
Examples
Input
05:50
05:44
Output
00:06
Input
00:00
01:00
Output
23:00
Input
00:01
00:00
Output
00:01
Note
In the first sample George went to bed at "00:06". Note that you should print the time only in the format "00:06". That's why answers "0:06", "00:6" and others will be considered incorrect.
In the second sample, George went to bed yesterday.
In the third sample, George didn't do to bed at all.
Submitted Solution:
```
while True:
current = input().split(":")
duration = input().split(":")
if len(current) == 2 and len(duration) == 2:
break
jam = 0
menit = 0
jam = int(current[0]) - int(duration[0])
menit = int(current[1]) - int(duration[1])
if int(current[1]) + int(duration[1]) >= 60:
jam -= 1
if jam < 0:
jam = 24 + jam
if menit < 0:
menit = 60 + menit
if 0 <= jam < 10:
jam = "0" + str(jam)
if 0 <= menit < 10:
menit = "0" + str(menit)
print(str(jam) + ":" + str(menit))
``` | instruction | 0 | 90,482 | 4 | 180,964 |
No | output | 1 | 90,482 | 4 | 180,965 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52. | instruction | 0 | 90,564 | 4 | 181,128 |
Tags: implementation, math
Correct Solution:
```
t, s, x = map(int, input().split())
if (x - 1 == t and s != 1) or t > x:
print('NO')
elif (x - t) % s == 0 or (x - t) % s == 1:
print('YES')
else:
print('NO')
``` | output | 1 | 90,564 | 4 | 181,129 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52. | instruction | 0 | 90,565 | 4 | 181,130 |
Tags: implementation, math
Correct Solution:
```
i = input().split()
for j in range(3):
i[j]=int(i[j])
if (i[2]+i[1]-i[0])%i[1]==0 and i[2]>=i[0]:
print("YES\n")
else:
i[2]-=1
if(i[2]+i[1]-i[0])%i[1]==0 and i[2]!=i[0] and i[2]>=i[0]:
print("YES\n")
else:
print("NO\n")
``` | output | 1 | 90,565 | 4 | 181,131 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52. | instruction | 0 | 90,566 | 4 | 181,132 |
Tags: implementation, math
Correct Solution:
```
t, s, x = [int(i) for i in input().split()]
if x < t+s:
if x == t:
print("YES")
else:
print("NO")
else:
if (x-t)%s == 0 or (x-t)%s == 1:
print("YES")
else:
print("NO")
``` | output | 1 | 90,566 | 4 | 181,133 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52. | instruction | 0 | 90,567 | 4 | 181,134 |
Tags: implementation, math
Correct Solution:
```
a=list(map(int,input().split()))
if a[0]>a[2]:
print("NO")
else :
if abs((a[2]-a[0]))%a[1]==1 and abs(a[2]-a[0])!=1 or abs((a[2]-a[0]))%a[1]==0 and abs(a[2]-a[0])!=1 :
print('YES')
else :
print('NO')
``` | output | 1 | 90,567 | 4 | 181,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52. | instruction | 0 | 90,568 | 4 | 181,136 |
Tags: implementation, math
Correct Solution:
```
t, s, x = map(int, input().split())
print('YES' if x - t >= 0 and x - t != 1 and (x - t) % s <= 1 else 'NO')
``` | output | 1 | 90,568 | 4 | 181,137 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52. | instruction | 0 | 90,569 | 4 | 181,138 |
Tags: implementation, math
Correct Solution:
```
read = lambda: map(int, input().split())
t, s, x = read()
f1 = (x - t) % s == 0 and x >= t
f2 = (x - t - 1) % s == 0 and x > t + 1
print('YES' if (f1 or f2) else 'NO')
``` | output | 1 | 90,569 | 4 | 181,139 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52. | instruction | 0 | 90,570 | 4 | 181,140 |
Tags: implementation, math
Correct Solution:
```
# Description of the problem can be found at http://codeforces.com/problemset/problem/697/A
t, s, x = map(int, input().split())
if t == x:
print("YES")
else:
if (x - t) % s <= 1 and (x - t) // s > 0:
print("YES")
else:
print("NO")
``` | output | 1 | 90,570 | 4 | 181,141 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52. | instruction | 0 | 90,571 | 4 | 181,142 |
Tags: implementation, math
Correct Solution:
```
a = input().split()
t = int(a[0])
s = int(a[1])
x = int(a[2])
if (((x-t)%s!=0) and (((x-t)-1)%s!=0)) or (x-1==t) or x<t:
print("NO")
else:
print("YES")
``` | output | 1 | 90,571 | 4 | 181,143 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52.
Submitted Solution:
```
t,s,x=map(int,input().split())
if(x==t):
print("YES")
exit(0)
else:
if(x>t):
if((x-t)%s==0 and (x-t)/s>=1):
print("YES")
exit(0)
if((x-t-1)%s==0 and (x-t-1)/s>=1):
print("YES")
exit(0)
print("NO")
``` | instruction | 0 | 90,572 | 4 | 181,144 |
Yes | output | 1 | 90,572 | 4 | 181,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52.
Submitted Solution:
```
[t,s,x]=[int(x) for x in input().split()]
x-=t
if (x%s==0 or x%s==1 and x!=1) and x>=0:
print("YES")
else:
print("NO")
``` | instruction | 0 | 90,573 | 4 | 181,146 |
Yes | output | 1 | 90,573 | 4 | 181,147 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52.
Submitted Solution:
```
t,s,x=map(int,input().split())
print('NO'if(x<t)or(x-t)%s>>(x!=t+1)else'YES')
``` | instruction | 0 | 90,574 | 4 | 181,148 |
Yes | output | 1 | 90,574 | 4 | 181,149 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52.
Submitted Solution:
```
t,s,x = map(int, input().split(" "))
res = x-t
if res < 0:
print("NO")
else:
if res % s == 0 or ((res-1) % s) == 0:
if res != 1:
print("YES")
else:
print("NO")
else:
print("NO")
``` | instruction | 0 | 90,575 | 4 | 181,150 |
Yes | output | 1 | 90,575 | 4 | 181,151 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ted has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s, t + s + 1, t + 2s, t + 2s + 1, etc.
<image>
Barney woke up in the morning and wants to eat the pineapple, but he can't eat it when it's barking. Barney plans to eat it at time x (in seconds), so he asked you to tell him if it's gonna bark at that time.
Input
The first and only line of input contains three integers t, s and x (0 β€ t, x β€ 109, 2 β€ s β€ 109) β the time the pineapple barks for the first time, the pineapple barking interval, and the time Barney wants to eat the pineapple respectively.
Output
Print a single "YES" (without quotes) if the pineapple will bark at time x or a single "NO" (without quotes) otherwise in the only line of output.
Examples
Input
3 10 4
Output
NO
Input
3 10 3
Output
YES
Input
3 8 51
Output
YES
Input
3 8 52
Output
YES
Note
In the first and the second sample cases pineapple will bark at moments 3, 13, 14, ..., so it won't bark at the moment 4 and will bark at the moment 3.
In the third and fourth sample cases pineapple will bark at moments 3, 11, 12, 19, 20, 27, 28, 35, 36, 43, 44, 51, 52, 59, ..., so it will bark at both moments 51 and 52.
Submitted Solution:
```
x,y,z=[int(a) for a in input().split()]
if x==z:
print("YES")
xx=x
while xx<z:
xx+=xx+y
if xx==z or xx+1==z:
print("YES")
quit()
if xx==z or xx+1==z:
print("YES")
else:
print("NO")
``` | instruction | 0 | 90,576 | 4 | 181,152 |
No | output | 1 | 90,576 | 4 | 181,153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.