Problem:


Score : 100 points

Problem Statement

In this problem, we use the 24-hour clock.

Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.)
He has decided to study for K consecutive minutes while he is up.
What is the length of the period in which he can start studying?

Constraints

0 \le H_1, H_2 \le 23

0 \le M_1, M_2 \le 59

The time H_1 : M_1 comes before the time H_2 : M_2.

K \ge 1

Takahashi is up for at least K minutes.

All values in input are integers (without leading zeros).

Input

Input is given from Standard Input in the following format:

H_1 M_1 H_2 M_2 K

Output

Print the length of the period in which he can start studying, as an integer.

Sample Input 1

10 0 15 0 30

Sample Output 1

270

Takahashi gets up at exactly ten in the morning and goes to bed at exactly three in the afternoon.
It takes 30 minutes to do the study, so he can start it in the period between ten o'clock and half-past two. The length of this period is 270 minutes, so we should print 270.

Sample Input 2

10 0 12 0 120

Sample Output 2

0

Takahashi gets up at exactly ten in the morning and goes to bed at exactly noon. It takes 120 minutes to do the study, so he has to start it at exactly ten o'clock. Thus, we should print 0.



Sample input:
10 0 15 0 30


Sample output:
270

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
H = h2 - h1
if m1 <= m2:
    M = m2 - m1
else:
    M = 60 - m1 + m2
# print(H)
# print(M)
print(H*60 + M - k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
H = h2 - h1
if m1 <= m2:
    M = m2 - m1
else:
    M = 60 - m1 + m2
print(H)
print(M)
print(H*60 + M - k)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b,c,d,k = inpl()
sa = c*60+d - (a*60-b)
print(sa-k)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


H1,M1,H2,M2,K = MI()
print(max(0,60*H2+M2-60*H1+M1-K))

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())

if m1 <= m2:
    h = h2 - h1
    m = m2 - m1
else:
    h = h2 - h1 - 1
    m = m2 - m1 + 60

m += h * 60

print((m // k - 1) * k)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k=map(int,input().split())
ans=h2*60+m2-k-h1*60+m1
print(ans)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int ,input().split())

h = (h2-h1)*60
m = m2-m1-1
ans = 0
while ans+k < h+m: ans += k
print(ans)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int ,input().split())

h = (h2-h1)*60
m = m2 -m1
print((h+m-1)//k*k)

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
print((a[2]-a[0])*60-(a[3]-a[1])-a[4])

Submission status: Wrong Answer

Solution code:
h = list(map(int, input().split()))

if h[1] > h[3]:
    print((h[2]-h[0])*60+h[3]-h[1]-h[4])
else:
    print((h[2]-h[0]-1)*60+60-h[3]+h[1]-h[4])

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())

Minites = 0
if M1 < M2:
    Minites += 60 + M1 - M2
    H2 -= 1
else:
    Minites += M1 - M2

if H1 > H2:
    Minites += 60*(24 + H2 - H1)
else:
    Minites += 60*(H2 - H1)

print(Minites - K)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())


Minites = 0
if M1 < M2:
    Minites += 60 + M1 - M2
    H2 -= 1
Minites += 60*(H2 - H1)
print(Minites - K)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int, input().split())
print(max(h2*60+m2 - h1*60+m1 - k, 0))

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int, input().split())
print(h2*60+m2 - h1*60+m1 - k)

Submission status: Wrong Answer

Solution code:
def compute():
  import sys
  for aline in sys.stdin:
    aline = aline.strip()
    eles = aline.split(' ')
    eles = [int(ele) for ele in eles]
    # h1 m1 h2 m2 k
    res = 60*(h2-h1) + (m2-m1) -k
    return res

Submission status: Wrong Answer

Solution code:
def compute():
  import sys
  for aline in sys.stdin:
    # h1 m1 h2 m2 k
    eles = aline.strip()
    h1 = int(eles[0])
    m1 = int(eles[1])
    h2 = int(eles[2])
    m2 = int(eles[3])
    k = int(eles[4])
    res = 60*(h2-h1) + m2 - m1 -k
    return res

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = [int(_) for _ in input().split()]

x = (h2 - h1) * 60 + m2 - m1 - k
if m1 > m2:
    x -= 60

print(x)

Submission status: Wrong Answer

Solution code:
ip = [int(s) for s in input().split(' ')]

h = ip[2] - ip[0]
m = ip[3] - ip[1]

total = (h * 60) + m - ip[4]

if total >= ip[4]:
    print(str(total))
else:
    print(str(0))

Submission status: Wrong Answer

Solution code:
def resolve():
    T = input()
    S = ""
    for i in range(len(T)):
        if T[i] == "D" or T[i] == "?":
            S += "D"
        else:
            S += "P"
    print(S)
resolve()

Submission status: Wrong Answer

Solution code:
a,b,c,d,e = map(int,input().split())
x = abs(a - c) * 60 - e
if x < 0:
    print(0)
else:
    print(x)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e = map(int,input().split())
x = abs(a - c) * 60 - e
print(x)

Submission status: Wrong Answer

Solution code:
h1,h2,m1,m2,k = map(int, input().split())
print( 60*(h2-h1) + m2-m1 -k )

Submission status: Wrong Answer

Solution code:
h1,h2,m1,m2,k = map(int, input().split())
print( 60*(h2-h1) + (m2-m1) -k )

Submission status: Wrong Answer

Solution code:
h1, h2, m1, m2, k = map(int,input().split())
print (60 * (h1-h2) + m1 - m2 - k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
h = h2 - h1
if m1>m2:
	h-=1
	m = m2 - m1 + 60
else:
	m = m2 - m1
l = h*60 + m - k

Submission status: Wrong Answer

Solution code:
a,b,c,d,e=map(int, input().split())
print(60*c+a-60*d-c-e)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e=map(int, input().split())
print((60*(b-a))+(d-c)-e)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e=map(int, input().split())
print(((60*(b-a))+(d-c)-e))

Submission status: Wrong Answer

Solution code:
H1,H2,M1,M2,K=map(int, input().split())
print(((60*(H2-H1))+(M2-M1)-K))

Submission status: Wrong Answer

Solution code:
h1,h2,m1,m2,k = map(int,input().split())

a = 60*h2 + m2
b = 60+h1 + m1
print(a-b-k)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

h1, m1, h2, m2, k = map(int, input().split())

m = (h2 - h1)*60
a = m2 - m1 if m2 - m1 >= 0 else 60 + m2 - m1
if m + a - k >= 0:
    print(m + a - k)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

h1, m1, h2, m2, k = map(int, input().split())

m = (h2 - h1)*60
a = m2 - m1 if m2 - m1 >= 0 else 60 + m2 - m1

print(m + a - k)

Submission status: Wrong Answer

Solution code:
T = input()
ans = T.replace("?", 'D')
print(ans)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
l = (60 * h2 + m2) -(60 * h1 + m2)
ans = l - k
print(ans)

Submission status: Wrong Answer

Solution code:
import math

h1,m1,h2,m2,k=map(int,input().split())

tempm=m2-m1
temph=h2-h1
if tempm<0:
    temph-=1
    tempm=60-tempm

if tempm-k<0:
    temph-=1
    tempm=60-tempm-k

print(60*temph+tempm)
"""

a=[]
temp=input().split()
for i in range(n):
    a.append(int(temp[i])-1)

routetemp=[]
routetemp.append(0)
while True:
    if a[routetemp[-1]] in routetemp:
        roop=len(routetemp)-routetemp.index(a[routetemp[-1]])
        pre=routetemp.index(a[routetemp[-1]])
        break
    routetemp.append(a[routetemp[-1]])
#print(routetemp)
#print(a)
#print(roop)
#print(pre)
num=(k-pre)%roop
#print(num)
print(routetemp[pre+num]+1)
"""

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
h = h2-h1
m = m2-m1
a = h*60
m += a
b = k
if k != m:
    while k+b != m and k+b < m:
        if k+b == m:
            k = 0
            break
        k += b
else:
    k = 0
print(k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
if m1 > m2:
    m2 += 60
    h2 -= 1
m = abs(m2-m1)
h = abs(h1-h2)
a = h*60
m += a
b = k
print(m)
if k != m:
    while k+b != m and k+b < m:
        if k+b == m:
            k = 0
            break
        k += b
else:
    k = 0
print(k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
h = h2-h1
if m1 > m2:
    m2 += 60
m = m2-m1
a = h*60
m += a
b = k
print(m)
if k != m:
    while k+b != m and k+b < m:
        if k+b == m:
            k = 0
            break
        k += b
else:
    k = 0
print(k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
h = h2-h1
if m1 > m2:
    m2 += 60
m = m2-m1
a = h*60
m += a
b = k
if k != m:
    while k+b != m and k < m:
        if k+b == m:
            k = 0
            break
        k += b
else:
    k = 0
print(k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
h = h2-h1
m = m2-m1
a = h*60
m += a
b = k
for i in range(1, a):
    if k != m:
        k += b
    if k == m:
        k -= b
        break
print(k)

Submission status: Wrong Answer

Solution code:
t = list(input())
a = 0
b = 0

for i in range(len(t)):
    if i == 0 and t[i] == '?':
        t[i] = 'D'
    
    if 0 < i < len(t) - 1 and t[i] == '?':
        if t[i-1] == 'P':
            t[i] = 'D'
        else:
            t[i] = 'P'

    if i == len(t) -1 and t[i] == '?':
        t[i] = 'D'

print(''.join(t))

Submission status: Wrong Answer

Solution code:
i = list(map(int, input().split()))
print((i[2]-i[0])*60-(i[3]-i[1])-i[4])

Submission status: Wrong Answer

Solution code:
h_1 , m_1, h_2, m_2 , k = map(int, input().split())
# study_time = ((h_2*60 + m_2) - (h_1*60 + m_1))
if h_2 < h_1:
  h_2 += 24
study_time = ((h_2*60 + m_2) - (h_1*60 + m_1))
print(k*((study_time//k) - 1))

Submission status: Wrong Answer

Solution code:
h_1 , m_1, h_2, m_2 , k = map(int, input().split())
study_time = abs((h_2*60 + m_2) - (h_1*60 + m_1))
print(k*((study_time//k) - 1))

Submission status: Wrong Answer

Solution code:
h_1 , m_1, h_2, m_2 , k = map(int, input().split())
study_time = (h_2*60 + m_2) - (h_1*60 + m_1)
print(k*(study_time//k) - k)

Submission status: Wrong Answer

Solution code:
def resolve():
    h1,m1,h2,m2,k = map(int,input().split())
    T = h2*60 + m2 - (h1*60 - m1)
    print(T-k)

resolve()

Submission status: Wrong Answer

Solution code:
string = input()
nums = string.split(' ')

hour = int(nums[2]) - int(nums[0])
minute = int(nums[1]) - int(nums[3])
time = hour * 60 + minute - int(nums[4])

print(time)

Submission status: Wrong Answer

Solution code:
import datetime
h1, m1, h2, m2, k = map(int, input().split())
ans = 0

deltaH = h2 - h1
deltaM = m2 -m1
delta = deltaH * 60 + deltaM -1

if delta // k >= 1:
    ans = (delta // k) * k

print(ans)

Submission status: Wrong Answer

Solution code:
string = input()
nums = string.split(' ')

hour = int(nums[2]) - int(nums[0])
minute = int(nums[1]) - int(nums[3])
time = hour * 60 + minute - int(nums[4])

if time > 0:
    print(time)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
def solve():
    H1, M1, H2, M2, K = map(int, input().split())
    print((H2*60 + M2) - (H1*60 + M2) - K)

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
h, m, H, M, k = map(int, input().split())

mini = (60-m)+M
if h < H:
    hour = (H-h-1)*60
else:
    hour = (24-(h-H)-1)*60

print(hour+mini-k)

Submission status: Wrong Answer

Solution code:
HM = list(map(int, input().split()))
hours = HM[2]-HM[0]
minutes = HM[3]-HM[1]
K = HM[4]
totalTimes = hours*60+minutes
minusCount = 0
while totalTimes > K:
  totalTimes = totalTimes-K
  minusCount+=1
print(K*minusCount)

Submission status: Wrong Answer

Solution code:
HM = list(map(int, input().split()))
hours = HM[2]-HM[0]
minutes = HM[3]-HM[1]
K = HM[4]
totalTimes = hours*60+minutes
minusCount = 0
if totalTimes%K == 0:
  print(totalTimes-K)
else:
  while totalTimes > K:
    totalTimes = totalTimes-K
    minusCount+=1
  print(K*minusCount)

Submission status: Wrong Answer

Solution code:
h = list(map(int, input().split()))
tmp = 0
if h[0] > h[2]:
    tmp = (24 - abs(h[0] - h[2])) * 60
else:
    tmp = (h[2] - h[0]) * 60

if h[1] > h[3]:
    tmp += (60 - abs(h[1] - h[3]) - 30)
else:
    tmp += h[3] - h[1]

ans = 0
while tmp > 0:
    tmp -= h[4]
    if tmp > 0:
        ans += h[4]

print(ans)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())

# 時間を、0時0分からの経過時間に変換する。
start = (60 * h1) + m1
end = (60 * h2) + m2 - k

print(start-end)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())

start = H1*60 + M1
end = H2*60 + M2

print(start - (end - K))

Submission status: Wrong Answer

Solution code:
import re
import copy

wake_up_hour,wake_up_minute,sleep_hour,sleep_minute,study_time = map(int, input().split())
start_before_minute= ((sleep_hour*60 +  sleep_minute) - study_time) % 60
start_before_hour= ((sleep_hour*60 +  sleep_minute) - study_time) // 60 
print("Start before: ", start_before_hour, start_before_minute, )

Submission status: Wrong Answer

Solution code:
import math
import re
import copy

wake_up_hour,wake_up_minute,sleep_hour,sleep_minute,study_time = map(int, input().split())

Total_Minutes = (sleep_hour) *60 + (sleep_minute) - ((wake_up_hour) * 60 + (wake_up_minute))

start_before_minute= ((sleep_hour*60 +  sleep_minute) - study_time) % 60
start_before_hour= ((sleep_hour*60 +  sleep_minute) - study_time) // 60 
print("Start before: ", start_before_hour, start_before_minute, )

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())


if H2 > H1:
    print((H2 * 60) +  M2 - (H1 * 60) + M1 - K)
else:
    print(((H2 + 24) * 60) +  M2 - (H1 * 60) + M1 - K)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())

print((H2 * 60) +  M2 - (H1 * 60) + M1 - K)

Submission status: Wrong Answer

Solution code:
import math
import re
import copy

wake_up_hour,wake_up_minute,sleep_hour,sleep_minute,study_time = map(int, input().split())

Total_Minutes = (sleep_hour) *60 + (sleep_minute) - ((wake_up_hour) * 60 + (wake_up_minute))



if Total_Minutes > study_time:
    print("You can finish the study")
    start_before_minute= ((sleep_hour*60 +  sleep_minute) - study_time) % 60
    start_before_hour= ((sleep_hour*60 +  sleep_minute) - study_time) // 60 
    print("Start before: ", start_before_hour, start_before_minute, )
else:
    print("You are lazy!!!. wake up early")

Submission status: Wrong Answer

Solution code:
import math
import re
import copy

h1,m1,h2,m2,k = map(int,input().split())
w1 = h1*60 + m1
w2 = h2 * 60 + m2
w3 = (w2-w1+24*60)%(24*60)
p = w3//k
if w3%k == 0:
    p-=1
print(p*k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
hm1 = h1 + m1/60
hm2 = h2 + m2/60
diff = hm2 - hm1
if diff > k/60:
    ans = int((diff - k/60)*60)
else:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

list = input().split()

m1 = int(list[0])*60 + int(list[1])
m2 = int(list[2])*60 + int(list[3])
#print(m1,m2)
    
ans = m2 - m1
if ans%int(list[4]) == 0:
    print(ans-int(list[4]))
else:
    print(ans//int(list[4])*int(list[4]))

Submission status: Wrong Answer

Solution code:
print

Submission status: Wrong Answer

Solution code:
H1,M1,H2,M2,K=map(int,input().split())

t1=60*H1 + M1
t2=60*H2 + M2
ans=0
tmp=t1
while(1):
    tmp+=K
    if tmp>=t2:
        break
    ans+=K

print(ans)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k=map(int,input().split())
t=h2*60+m2-(h1*60+m1)
t-=0.5
g=t//k
print(int(g*k))

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k=map(int,input().split())
t=h2*60+m2-(h1*60+m1)
t-=0.5
g=t//k
print(g*k)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = list(map(int, input().split()))
time = H2*60+M1-H2*60-M2
print(time-K)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = list(map(int, input().split()))
time = H2*60+M1-H2*60-M2
print(time-K)

Submission status: Wrong Answer

Solution code:
H1,M1,H2,M2,K=map(int, input().split())

M1 += H1*60
M2 += H2*60
out = int((M2-M1-1)/K)
print(out*K)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, K = list(map(int, input().split()))
if abs(h1-h2)*60 + abs(m1-m2) < K:
    print('{}'.format(0))
else:
    print('{}'.format(abs(h1-h2)*60 + abs(m1-m2) - K))

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, K = list(map(int, input().split()))
print(h2-h1*60 + m2-m1 - K)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, K = list(map(int, input().split()))
if h2-h1*60 + m2-m1 <= K:
    print(0)
else:
    print(h2-h1*60 + m2-m1 - K)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, K = list(map(int, input().split()))
if abs(h1-h2)*60 + abs(m1-m2) <= K:
    print(0)
else:
    print(abs(h1-h2)*60 + abs(m1-m2) - K)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, K = list(map(int, input().split()))
if abs(h1-h2)*60 + abs(m1-m2) <= K:
    print('{}'.format(0))
else:
    print('{}'.format(abs(h1-h2)*60 + abs(m1-m2) - K))

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, K = list(map(int, input().split()))
if abs(h1-h2)*60 + abs(m1-m2) <= 120:
    print('{}'.format(0))
else:
    print('{}'.format(abs(h1-h2)*60 + abs(m1-m2) - K))

Submission status: Wrong Answer

Solution code:
def main():
    H1,M1,H2,M2,K = [int(x) for x in input().split()]
    diff = (H2-H1)*60 + abs(M2-M1)
    if diff <= 0:
        print(0)
    else:
        print((diff - 1) // K * K)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    H1,M1,H2,M2,K = [int(x) for x in input().split()]
    if M2 >= M1:
        print(((H2-H1)*60 + M2-M1 - 1) // K * K)
    else:
        print(((H2-H1)*60 + M1+M2-60 - 1) // K * K)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    H1,M1,H2,M2,K = [int(x) for x in input().split()]
    print(((H2-H1)*60 + abs(M2-M1) - 1) // K * K)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(float, input().split())
 
 

ans=(h2-h1)*60 + (m2-k-m1)
 
print(ans)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
print(min(0, (h2*60+m2) - (h1*60+m1) - k))

Submission status: Wrong Answer

Solution code:
S = input()
ans=""

for i in range(len(S)):
    if S[i] == "?":
        ans += "D"
    else:
        ans += S[i]

print(ans)

Submission status: Wrong Answer

Solution code:
h1, m1,h2, m2, k = map(float, input().split())
 
 
m3=k%60
h3=(k-m3)/60
ans=(h2-h3-h1)*60 + (m2-m3-m1)
 
print(ans)

Submission status: Wrong Answer

Solution code:
h1, m1,h2, m2, k = map(float, input().split())
 
 
m3=k%60
h3=(k-m2)/60
ans=(h2-h3-h1)*60 + (m2-m3-m1)
 
print(ans)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())

if k >= 60*(h2-h1)+(m2-m1)-k:
  print('0')
else:
  print(60*(h2-h1)+(m2-m1)-k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())

if k == 60*(h2-h1)+(m2-m1)-k:
  print('0')
else:
  print(60*(h2-h1)+(m2-m1)-k)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int,input().split())

total_time = (h2*60+m2)-(h1*60+m1)

if (total_time//k)*k == total_time:
  print((total_time//k-1)*k)
else:
  print((total_time//k)*k)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())

hk = K//60
mk = K%60

ans = (H2 - hk)*60 + (M2 - mk) - (H1*60 + M2)
print(max(ans, 0))

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k= map(int, input().split())

s = h1 * 60 + m1
e = h2 * 60 + m2

ans = s - e - k
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""
 
H1, M1, H2, M2, K = map(int, sys.stdin.read().split())
 
awake_time = H1 *60 + M1
sleep_time = H2 *60 + M1
start_limit_time = sleep_time - K
 
can_study_time = start_limit_time - awake_time
 
print(can_study_time)

Submission status: Wrong Answer

Solution code:
"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""
 
H1, M1, H2, M2, K = [int(i) for i in input().split(" ")]
 
awake_time = H1 *60 + M1
sleep_time = H2 *60 + M1
start_limit_time = sleep_time - K
can_study_time = start_limit_time - awake_time
 
print(can_study_time)

Submission status: Wrong Answer

Solution code:
"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""
 
H1, M1, H2, M2, K = [int(i) for i in input().split()]
 
awake_time = H1 *60 + M1
sleep_time = H2 *60 + M1
start_limit_time = sleep_time - K
 
can_study_time = start_limit_time - awake_time
 
print(can_study_time)

Submission status: Wrong Answer

Solution code:
"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""
 
H1, M1, H2, M2, K = [int(i) for i in input().split(" ")]

awake_time = H1 *60 + M1
sleep_time = H2 *60 + M1
start_limit_time = sleep_time - K
 
can_study_time = start_limit_time - awake_time
 
print(can_study_time)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
m = (H2 * 60 + M2) - (H1 * 60 - M1)
print(m - K)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

H1, M1, H2, M2, K = map(int, input().split())

ans = 0
if M1 <= M2:
    ans = (H2-H1) * 60 + M2 - M1 - K
else:
    ans = (H2-H1) * 60 + (60-M1) + M2 - K

if ans < 0:
    print(0)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, d, k = map(int, input().split());

x = 60*a + b
y = 60*c + b

if y>x:
    print(y-x-k);
else:
    print(1440+y-x-k);

Submission status: Wrong Answer

Solution code:
a, b, c, d, k = map(int, input().split());

x = 60*a + b
y = 60*c + b

print(y-x-k);

Submission status: Wrong Answer

Solution code:
time = list(map(int, input().split()))
h1,m1 = time[0],time[1]
h2,m2 = time[2],time[3]
k = time[4]
ans = 0
full = (h2*60+m2) - (h1*60+m1)
while full - k > 0:
    full-=k
    ans+=k
print(ans)

Submission status: Wrong Answer

Solution code:
t = input()
print(t.replace("?", "D"))

Submission status: Wrong Answer

Solution code:
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

h1,m1,h2,m2,k = map(int,input().split())
A = h1 * 60 + m1
B = h2 * 60 + m2
print((B-1-A)//k*k)

Submission status: Wrong Answer

Solution code:
def main():
    H1, M1, H2, M2, K = (int(i) for i in input().split())
    h = H2 - H1
    m = 0
    if H1 == H2:
        m = M2 - M1
    elif M1 != M2:
        m = (60 - M2) + M1
    ans = h*60 + m - K
    if ans > 0:
        print(ans)
    else:
        print(0)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    H1, M1, H2, M2, K = (int(i) for i in input().split())
    h = H2 - H1
    m = 0
    if M2 - M1 >= 0:
        m = M2 - M1
    elif H1 != H2:
        m = (60 - M2) + M1
    else:
        m = 0
    ans = h*60 + m - K
    if ans > 0:
        print(ans)
    else:
        print(0)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
ans = 60*H2+M2 - 60*H1+M1 - K
print(ans)

Submission status: Wrong Answer

Solution code:
H1,M1,H2,M2,K = map(int,input().split())
  
print(60 * (H1 - H2) + M2 - M1 - K)

Submission status: Wrong Answer

Solution code:
def main():
    H1, M1, H2, M2, K = (int(i) for i in input().split())
    h = H2 - H1
    m = 0
    if M2 - M1 >= 0:
        m = M2 - M1
    elif H1 != H2:
        m = (60 - M2) + M1
    ans = h*60 + m - K
    if ans > 0:
        print(ans)
    else:
        print(0)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import readline
import datetime
try:
    H1 = int(input())
    M1 = int(input())
    H2 = int(input())
    M2 = int(input())
    K = int(input())
    while not 0 <= H1 < 23 and 0 <= M1 < 59 and 0 <= H2 < 23 and 0 <= M2 < 59:
        H1 = int(input())
        M1 = int(input())
        H2 = int(input())
        M2 = int(input())
        K = int(input())
    if M2 > M1:
        a = (H2 - H1) * 60 + M2 - M1
        print(a - K)
    if M2 < M1:
        b = (H2 - H1) * 60 + M1 - M2
        print(b - K)
except:
    pass

Submission status: Wrong Answer

Solution code:
H1, H2, H3, H4, K = map(int, input().split())
up = H1*60 + H2
down = H3*60 - H4
print(down - up - K)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys
import datetime
readline = sys.stdin.buffer.readline
try:
    H1 = int(readline())
    M1 = int(readline())
    H2 = int(readline())
    M2 = int(readline())
    K = int(readline())
    while not (0 <= H1 < 23 and 0 <= M1 < 59 and 0 <= H2 < 23 and 0 <= M2 < 59):
        H1 = int(readline())
        M1 = int(readline())
        H2 = int(readline())
        M2 = int(readline())
        K = int(readline())
    if M2 >= M1:
        a = (H2 - H1) * 60 + M2 - M1
        print(a - K)
    if M2 < M1:
        b = (H2 - H1) * 60 + M1 - M2
        print(b - K)
except:
    print(1)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys
import datetime
readline = sys.stdin.buffer.readline
try:
    H1 = int(readline())
    M1 = int(readline())
    H2 = int(readline())
    M2 = int(readline())
    K = int(readline())
    while not (0 <= H1 < 23 and 0 <= M1 < 59 and 0 <= H2 < 23 and 0 <= M2 < 59):
        H1 = int(readline())
        M1 = int(readline())
        H2 = int(readline())
        M2 = int(readline())
        K = int(readline())
    if M2 > M1:
        a = (H2 - H1) * 60 + M2 - M1
        print(a - K)
    if M2 < M1:
        b = (H2 - H1) * 60 + M1 - M2
        print(b - K)
except:
    print(1)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
print((H2 - H1) * 60 + abs(M1 - M2) - K)

Submission status: Wrong Answer

Solution code:
H1, H2, H3, H4, K = map(int, input().split())
up = H1*60+H2
down = H3*60-H4
print(down-up-K)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
print((H2 - H1) * 60 - K)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2, k = [int(i) for i in input().split()]


if m2 >= m1:
    minute = m2-m1
else:
    minute = 60 - m1 +m2

time = abs(h2-h1)*60 + minute
if time%k==0:
    print(time - k)
else:
    print((time//k)*60)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int,input().split())

h = abs(h2-h1)
m = (m2-m1)
if m < 0:
    m+=60

ans = h*60+m
ans = ans-k

print(ans)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())

hour = h2 - h1
minute = m2 - m1
time = (hour * 60) - minute

print(time - k)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k=map(int,input().split())
ans2=h2*60+m2
ans1=h1*60+m1
print(ans2-ans1)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int,input().split())

h = (h2-h1)
if h < 0:
    h += 24
m = abs(m1-m2)

ans = h*60+m
ans = ans-k

print(ans)

Submission status: Wrong Answer

Solution code:
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

h1, m1, h2, m2, k = map(int, input().split())

minute = ((h2 * 60) + m2) - (h1 * 60) + m1

print(minute - k)

Submission status: Wrong Answer

Solution code:
T = input()
l = len(T)
ans_l = []

def getans(count,ans):
    if count == l:
        ans_l.append([ans.count('D')+ans.count('PD'),ans])
        return
    if T[count] == '?':
        getans(count+1, ans + 'P')
        getans(count+1, ans + 'D')
    else:
        getans(count+1, ans + T[count])
getans(0,'')
ans_l.sort(reverse=True)
print(ans_l[0][1])

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = [int(i) for i in input().split()]

awake = 60*h2+m2 - (60*h1+m1) - k
print(k)

Submission status: Wrong Answer

Solution code:
def main():
    H1, M1, H2, M2, K = (int(i) for i in input().split())
    h = H2 - H1
    m = max(M2 - M1, 0)
    ans = h*60 + m - K
    if ans > 0:
        print(ans)
    else:
        print(0)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys
import datetime

try:
	H1 = int(sys.stdin.readline())
	M1 = int(sys.stdin.readline())
	H2 = int(sys.stdin.readline())
	M2 = int(sys.stdin.readline())
	K = int(sys.stdin.readline())

	while not (0 <= H1 < 23 and 0 <= H2 < 23 and 0 <= M1 < 59 and 0 <= M2 < 59):
		H1 = int(sys.stdin.readline())
		M1 = int(sys.stdin.readline())
		H2 = int(sys.stdin.readline())
		M2 = int(sys.stdin.readline())
		K = int(sys.stdin.readline())
	else:
		if M2 >= M1:
			a = (H2 - H1) * 60 + (M2 - M1)
			print(a - K)
		if M2 < M1:
			b = (H2 - H1) * 60 + (M1 - M2)
			print(b - K)
except:
    print("")

Submission status: Wrong Answer

Solution code:
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

h1, m1, h2, m2, k = map(int, input().split())

minute = ((h2 * 60) + m2) - (h1 * 60) + m1

print(max(0, (minute - k)))

Submission status: Wrong Answer

Solution code:
print(-1)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys
import datetime

try:
    H1 = int(sys.stdin.readline())
    M1 = int(sys.stdin.readline())
    H2 = int(sys.stdin.readline())
    M2 = int(sys.stdin.readline())
    K = int(sys.stdin.readline())
    
    a = 0 <= H1 < 23
    b = 0 <= H2 < 23
    c = 0 <= M1 < 59
    d = 0 <= M2 < 59

    while not (a or b or c or d):
        H1 = int(sys.stdin.readline())
        M1 = int(sys.stdin.readline())
        H2 = int(sys.stdin.readline())
        M2 = int(sys.stdin.readline())
        K = int(sys.stdin.readline())
    else:
        if M2 >= M1:
            a = (H2 - H1) * 60 + (M2 - M1)
            print(a - K)
        if M2 < M1:
            b = (H2 - H1) * 60 + (M1 - M2)
            print(b - K)
except:
    print("")