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:
import time
import datetime
from datetime import timedelta
H1,M1,H2,M2,K=map(int,input().split())


delta1=timedelta(minutes=M1,hours=H1)
delta2=timedelta(minutes=M2,hours=H2)

delta=delta2-delta1
delta_minutes=delta.total_seconds()/60
if delta_minutes>30:
  print(delta_minutes-30)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

latest = H2*60+M2-K  #[min]
earliest = H1*60

study = abs(latest-earliest)
print(study)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


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

h = H2 - H1
m = M2 - M1
s = 0
if h > 0:
    s = h * 60 + m
else:
    s = (24 + h) * 60 + m

s -= K
print(s)

Submission status: Wrong Answer

Solution code:
H = input().split()
sdy =0
sdy = int(H[2])*60 +int(H[3])-int(H[0])*60 +int(H[1]) - int(H[4])
print(sdy)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2-H_1<0:
    print((H_2-H_1+24)*60+M_2+M_1-K)
else:
    print(H_2*60+M_2-H_1*60+M_1-K)

Submission status: Wrong Answer

Solution code:
H_1, M_1, H_2, M_2, K = map(int, input().split())

time =(H_2 * 60 + M_2 )-(H_1 * 60 + M_1)

a = time // K

if time % K == 0:
    a = a-1

print(a*K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

list = input().split()

h = int(list[2])-int(list[0])
if int(list[1]) < int(list[3]) or int(list[1]) == int(list[3]):
    m = int(list[3])-int(list[1])
    ans_m = h*60 + m
else:
    m  = int(list[1])-int(list[3])
    h = h-1 
    ans_m = h*60 + 60-m
    
#print(h)
#print(m)


#print(ans_m)

ans = int(ans_m/int(list[4]))
#print(ans)
if ans_m%int(list[4])==0:
    print(int(ans-1)*int(list[4]))
else:
    print(ans*int(list[4]))

Submission status: Wrong Answer

Solution code:
from sys import stdin

h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()]

allMin1 = h1 * 60
allMin2 = h2 * 60

diff = (allMin2 + m2 - allMin1 + m1)

if diff < 0 :
	diff += 24 * 60

ans = diff - k

if ans >= 0 :
	if ans > k :
		print(ans)
	else :
		print(k)
else :
	print(0)

Submission status: Wrong Answer

Solution code:
H_1,M_1,H_2,M_2,K = map(int,input().split())
print(H_2*60+M_2-H_1*60+M_1-K)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int,input().split())
 
#print(h1,m1,h2,m2,k)
t = 0
if m1 > m2:
    t =(h2-h1-1)*60+m2-m1-k
else:
    t =(h2-h1)*60+m2-m1-k

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

Submission status: Wrong Answer

Solution code:
h,m,a,b,k=map(int,input().split())
m_to_hour = m /60
b_to_hour = b /60
h_hour = 12.00 - ( h + m_to_hour )
a_hour = (a + b_to_hour) - 12.00
to_min =( h_hour + a_hour )*60
print(int(to_min-k))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e=(int(x)for x in input().split())
x=(c-a)*60
y=x-e

if y<e: 
    print("0")
else:
    print(y)

Submission status: Wrong Answer

Solution code:

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

h = H2 - H1
m = M2 - M1
s = 0
if h > 0:
    s = h * 60 + m
elif h == 0:
    s = 24 * 60 + m
elif h < 0:
    s = (24 + h) * 60 + m

# print(s)
if s - K > 0:
    s = s - K
else:
    s = 0
print(s)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2 ,k = map(int, input().split())
t1 = h1*60 + m2
t2 = h2*60 + m2
ans = t2 - t1 - k if t2 > t1 else t2 + 1440 - t1 - k 
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import datetime

def main():
    H1, M1, H2, M2, K = input().split()
    dt1 = datetime.datetime.strptime(H1+M1, '%H%M')
    dt2 = datetime.datetime.strptime(H2+M2, '%H%M')
    if dt1 < dt2:
        ans = int((dt2-dt1).total_seconds() // 60)
    else:
        ans = 24 * 60 - int(abs((dt2-dt1).total_seconds()) // 60)
    if ans - int(K) < 0:
        print(ans - int(K) + 24 * 60)
    else:
        print(ans - int(K))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if a==c:
    t=d-b
    if e<=t:
        print(t-e)
    else:
        print(0)
    
if c>a:
    if b>d:
        t=60-b+d
        if e<=t:
            print(t-e)
        else:
            print(0)
        
        
    if b<=d:
        t=(c-a)*60+d-b
        if e<=t:
            print(t-e)
        else:
            print(0)

Submission status: Wrong Answer

Solution code:
t=input(str())
t=list(t)
for i in range(len(t)-1):
    if t[i]=='?':
        if t[i+1]=='D' :
            t[i]='P'
        elif t[i + 1] == '?':
            if t[i-1]=='P':
                t[i]='D'
            else:
                t[i]='P'
        else:
            t[i]='D'
    if t[-1]=='?':
        t[-1]='D'
print(''.join(t))

Submission status: Wrong Answer

Solution code:
a, b, c, d, e = map(int, input().split())
# get a string
#s = raw_input()
# output
start = a*60+b
end = c*60+d
result = end - start - 30
print(result)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k = map(int,input().split())
 
#print(h1,m1,h2,m2,k)
t = 0
if m1 > m2:
    t =(h2-h1-1)*60+m1-m2-k
else:
    t =(h2-h1)*60+m1-m2-k

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

Submission status: Wrong Answer

Solution code:
#スペース区切りの整数の入力
h1, m1, h2, m2, k = map(int, input().split())

asa = h1 * 60 + m1 + 1
yoru = h2 * 60 + m2 -1




ans = int((yoru - asa )/k)

print(ans* k)

Submission status: Wrong Answer

Solution code:
from sys import stdin

h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()]

allMin1 = h1 * 60

allMin2 = h2 * 60

diff = (allMin2 + m2 - allMin1 + m1)
# if diff < 0 :
	# diff += 24 * 60

ans = diff - k

if ans >= 0 :
	print(ans)
else :
	print(0)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
if h1 <= 12 and h2 >= 12:
    h1 = 12 - h1
    h2 = h2 -12
    x = (h2 + h1) * 60 + m1 + m2 - k
    
elif h1 < 12 and h2 < 12 or h1 >= 12 and h2 >= 12:
    x = abs(h2 - h1) * 60 + m1 + m2 - k
    
else:
    h1 = h1 -12
    h2 = 12 - h2
    x = h2 + h1 * 60 + m1 + m2 - k
  
print(x)

Submission status: Wrong Answer

Solution code:
T = input() #ここで標準入力

trade = T.replace('?','D')
print(trade)

Submission status: Wrong Answer

Solution code:
import sys

H1,M1,H2,M2,K = map(int, sys.stdin.readline().split())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if (M1 < M2):
  H = H2 - H1 - 1
  M = M1 - M2
  if M < 0:
    M = 60 - M
    
else:
  H = H2 - H1
  M = M2 - M1

T = H * 60 + M

print(T)

if T > K:
  print(T - K)
else:
  print("0")

Submission status: Wrong Answer

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


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

if k > h*60 + m:
    print(0)
else:
    print(h*60 + m - k)

Submission status: Wrong Answer

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

if a==c:
    t=d-b
    if e<=t:
        print(t-e)
    else:
        print(0)
    
if c>a:
    if b>d:
        t=60-b+d
        if e<=t:
            print(t-e)
        else:
            print(0)
        
        
    if b<=d:
        t=(c-a)*60+d-b
        if e<=t:
            print(t-e)
        else:
            print(0)

Submission status: Wrong Answer

Solution code:
from sys import stdin

h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()]

allMin1 = h1 * 60

allMin2 = h2 * 60

diff = (allMin2 + m2 - allMin1 + m1)
if diff < 0 :
	diff += 24 * 60

ans = diff - k

if ans >= 0 :
	print(ans)
else :
	print(0)

Submission status: Wrong Answer

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

import math

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

if m1 < m2:
    h2 -= 1
    m2 = 60

if h1 > h2:
    h2 += 24

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

res = allMin - k
if res < 0:
    res = 0

print(res)

Submission status: Wrong Answer

Solution code:
from math import ceil, floor

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

diff = (int)(h2-h1)*60 + (m2-m1)

if diff % k == 0:
    print('%d' % max(0, k*(ceil(diff/k)-1)))
else:
    print('%d' % max(0, k*(floor(diff/k))))

Submission status: Wrong Answer

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

list = input().split()

h = int(list[2])-int(list[0])
if int(list[1]) < int(list[3]) or int(list[1]) == int(list[3]):
    m = int(list[3])-int(list[1])
else:
    m  = int(list[1])-int(list[3])
    h = h-1 
    
#print(h)
#print(m)

ans_m = h*60 + m
#print(ans_m)

ans = int(ans_m/int(list[4]))
#print(ans)
if ans_m%int(list[4])==0:
    print(int(ans-1)*int(list[4]))
else:
    print(ans*int(list[4]))

Submission status: Wrong Answer

Solution code:
L=list(map(int,input().split()))
A=60*L[0]+L[1]
B=60*L[2]+L[3]
if B-A <= L[4]:
	print("0")
elif (B-A)%L[4]==0:
	print(str(((B-A)-L[4])))
else:
	print(str(round((B-A)//L[4])))

Submission status: Wrong Answer

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


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

print(h*60 + m - k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    array = list(map(int, input().split()))

    now = array[0]*60+array[1]
    finish = array[2]*60+array[3]
    if now > finish:
        finish += 24*60
    K = array[4]
    ans = 0
    for _ in range(int(1e15)):
        if now + K < finish:
            ans += K
            now += K
        else:
            break

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if a==c:
    t=d-b
    if e<=t:
        print(t-e)
    else:
        print('0')
    
if c>a:
    if b>d:
        t=60-b+d
        if e<=t:
            print(t-e)
        else:
            print('0')
        
        
    if b<=d:
        t=(c-a)*60+d-b
        if e<=t:
            print(t-e)
        else:
            print('0')

Submission status: Wrong Answer

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

hrtom= (h2-h1)

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

Submission status: Wrong Answer

Solution code:
import datetime

def main():
    H1, M1, H2, M2, K = input().split()
    dt1 = datetime.datetime.strptime(H1+M1, '%H%M')
    dt2 = datetime.datetime.strptime(H2+M2, '%H%M')
    if dt1 < dt2:
        ans = int((dt2-dt1).total_seconds() // 60)
    else:
        ans = 24 * 60 - int(abs((dt2-dt1).total_seconds()) // 60)
    print(ans - int(K))



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
h,m,a,b,k=map(int,input().split())
h1 = 12 - h
a1 = a - 12
sub =( h1 + a1 )*60
print(sub-k)

Submission status: Wrong Answer

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

import math

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

if m1 < m2:
    h2 -= 1
    m2 = 60

if h1 > h2:
    h2 += 24

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

print(allMin - k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = list(map(int, input().split()))
if m1 < m2:
    h1 -= m2/60
    m1 += m2/60
tm = m1 - m2
th = h2 - h1
print(th*60 + tm - k)

Submission status: Wrong Answer

Solution code:
def main():
    array = list(map(int, input().split()))

    now = array[0]*60+array[1]
    finish = array[2]*60+array[3]
    K = array[4]
    ans = 0
    for _ in range(int(1e15)):
        if now + K < finish:
            ans += K
            now += K
        else:
            break

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
h1 , m1 , h2 , m2 , k = map(int, input().split())
a1 = abs(h2-h1)*60
a2 = abs(m1-m2)
a  = a1 - a2
if a == k:
    print(0)
else:
    b = a - k
    print(b)

Submission status: Wrong Answer

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

time1 = h1*60 + m1
time2 = h2*60 - m2

ans = time2 - k - time1
print(ans)

Submission status: Wrong Answer

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

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


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

Submission status: Wrong Answer

Solution code:
A,B,C,D,E = map(int, input().split())
print((C*60+D)-(A*60+D)-E)

Submission status: Wrong Answer

Solution code:
w_h, w_m, s_h, s_m,t = map(int,input().split())
s_t = s_h*60 + s_m -t
ans = s_t - w_h*60
print(ans)

Submission status: Wrong Answer

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

if (M1 < M2):
  H = H2 - H1 - 1
  M = M1 - M2
else:
  H = H2 - H1
  M = M2 - M1

T = H * 60 + M

if T > K:
  print(T - K)
else:
  print("0")

Submission status: Wrong Answer

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

h = (h2 - h1)*60
m = m2 - m1

if m < 0:
  h = h - 1
  m = 60 - m

total = h + m

print(total-k)

Submission status: Wrong Answer

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

time = (h2 - h1) * 60 + (m2 - m1) - 1

import math

try:
    print(math.floor(time // k) * k)
except ZeroDivisionError:
    print(0)

Submission status: Wrong Answer

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

if x%k == 0:
    print(x - k)
else:
    print((x//k-1)*k)

Submission status: Wrong Answer

Solution code:
#a = input()
a, b, c, d, e = map(int, input().split())
# get a string
#s = raw_input()
# output
start = a*60+b
end = c*60+d
result = end - start
print(result)

Submission status: Wrong Answer

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

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

du=h*60+m-0.1

print(int((du//k)*k))

Submission status: Wrong Answer

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

if (M1 < M2):
  H = H2 - H1 - 1
  M = M1 - M2
else:
  H = H2 - H1
  M = M2 - M1

T = H * 60 + M

print(T - K)

Submission status: Wrong Answer

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

list = input().split()

h = int(list[2])-int(list[0])
if int(list[1]) < int(list[3]) or int(list[1]) == int(list[3]):
    m = int(list[3])-int(list[1])
else:
    m  = int(list[1])-int(list[3])
    h = h-1 
    
#print(h)
#print(m)

ans_m = h*60 + m
#print(ans_m)

ans = ans_m/int(list[4])
if ans_m%int(list[4])==0:
    print(int(ans-1)*int(list[4]))
else:
    print(ans*int(list[4]))

Submission status: Wrong Answer

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

h3, m3 = divmod(k, 60)

dh = h2 - h3
dm = m2 - m3
if dm < 0:
    dh -= 1
    dm *= -1



ah = dh - h1
am = dm - m1
if am < 0:
    ah -= 1
    am *= -1

ans = ah * 60 + am
print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
number = 12 - 10
print(number * 60 + ( 0 - 0) )

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = m2 - m1
if a < 0:
    mm = (h2 - h1 - 1) * 60 + (60 + a)
else:
    mm = (h2 - h1) * 60 + a

print((mm // k - 1) * k if mm % k == 0 else (mm // k) * k)

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = [int(s) for s in input().split()]
if H2 < H1:
    H2 += 24
elif H2 == H1 and M1 > M2:
    H2 += 24
print(H2 * 60 + M2 - H1 * 60 + M1 - K)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

a=num_list[2]-num_list[0]
b=num_list[3]-num_list[1]
if b<0:
    a=a-1
a=a*60
c=b+a-num_list[4]
if c<0:
    c=0
print(c)

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

Solution code:
h,m,h2,m2,k=map(int,input().split())
a=h*60+m
b=h2*60+m2
if a>b:
    b+=60*24
#print(b)
if (b-a)%k==0:
    print(((b-a)//k-1)*k)
else:
    print(((b-a)//k)*k)

Submission status: Wrong Answer

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

h = h2 - h1
m = m2 - m1

if m < 0:
  h = h - 1
  m = 60 - m
  
total = h + m

print(total - k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = list(map(int, input().split()))
if m1 < m2:
    h1 -= m2/60
    m1 += m2/60
tm = m1 - m2
th = h2 - h1
if tm < k and th > 0:
    h1 -= k/60
    m1 += k/60
elif tm < k and th < 0:
  th, th = 0, 0 
tm -= k
print(th*60 + tm)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = input().split()
H1, M1, H2, M2, K = int(H1), int(M1), int(H2), int(M2), int(K)
allm1 = H1*60+M1
allm2 = H2*60+M2
 
m = allm2 - allm1
 
if m == K:
    print('0')
    exit()
 
i = 0
while True:
    m = m - K
    if m <= 0:
        break
    else:
    	i = i + 1
 
print(i*K)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e = map(int, input().split())
if 0<= a <= 23 and 0<= c<= 23 and 0 <= b <= 59 and 0 <= d<= 23 and e>=1:
    f = abs(c-a)*60
    print(abs(f-e))

Submission status: Wrong Answer

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

if H1 > H2:
  hour = H2+(24-H1)
else:
  hour = H2-H1

if M1 > M2:
  hour -= 1
  minutes = abs(M2-M1)
else:
  minutes = M2-M1

print(hour*60+minutes-K)

Submission status: Wrong Answer

Solution code:
hmk = input('')

h1 = int(hmk.split(' ')[0])
m1 = int(hmk.split(' ')[1])
h2 = int(hmk.split(' ')[2])
m2 = int(hmk.split(' ')[3])
k = int(hmk.split(' ')[4])

h = h2 - h1
m = m2 - m1
if h < 0:
    h = 24 - h1 + h2
if m < 0:
    m = m1 - m2
    h-=1

a = h*60 + m - k
print(a)

Submission status: Wrong Answer

Solution code:
H1,M1,H2,M2,K=map(int,input().split())
if H2-H1<0:
    print(0)
else:
    if M2-M1<0:
        print(0)
    else:
        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 = input().split()
import datetime

h1 = int(h1)
m1 = int(m1)
h2 = int(h2)
m2 = int(m2)
k = int(k)

dt1 = datetime.datetime(year=2020, month=5, day=30, hour=h1, minute=m1)
dt2 = datetime.datetime(year=2020, month=5, day=30, hour=h2, minute=m2)

dt3 = dt2 - dt1
dt3 = dt3.seconds / 60 - 1
print(int(dt3 / k) * k)

Submission status: Wrong Answer

Solution code:
x = list(map(int, input().split()))
h = (x[2] - x[0])*60
m = x[3] - x[1]
if m < 0:
    h -= 1
    m = 60 - x[1] + x[3]
ans = max(m+h-x[-1], 0)
print(ans)

Submission status: Wrong Answer

Solution code:
import datetime

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

starttime = datetime.datetime(2020, 1, 1, h1, m1)
endtime = datetime.datetime(2020, 1, 1, h2, m2) - datetime.timedelta(minutes = k)

td = endtime-starttime
ans = td.seconds / 60
if ans <= 0:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e=(int(x)for x in input().split())
x=(c-a)*60
y=x-30
print(y)

Submission status: Wrong Answer

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

start = n[0]*60 + n[1]
end = n[2]*60 + n[3]

zikan = end - start -2
kai = zikan // n[4] * n[4]
print(kai)

Submission status: Wrong Answer

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

time = (h2 - h1) * 60 + (m2 - m1) - 1

import math

print(math.floor(time // k) * k)

Submission status: Wrong Answer

Solution code:
import datetime

H_1, M_1, H_2, M_2, K = map(int, input().split())

req_H = K // 60
req_M = K % 60

end_time = datetime.time(H_2, M_2, 00)

limit_time = datetime.datetime.combine(datetime.date(year=2017, month=10, day=10), end_time) - datetime.timedelta(minutes=K)

start_time = datetime.time(H_1, M_2, 00)

dif = limit_time - datetime.datetime.combine(datetime.date(year=2017, month=10, day=10), start_time)

print(dif.seconds//60)

Submission status: Wrong Answer

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

print(time - k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

list = input().split()

h = int(list[2])-int(list[0])
if list[1] < list[3]:
    m = int(list[3])-int(list[1])
else:
    m  = int(list[1])-int(list[3])
    
#print(h)
#print(m)

ans_m = h*60 + m
#print(ans_m)

ans = ans_m/int(list[4])
if ans_m%int(list[4])==0:
    print(int(ans-1)*int(list[4]))
else:
    print(ans*int(list[4]))

Submission status: Wrong Answer

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

# 10:00->15:00
# 10:00->12:00

# 起きている時間を計算する（単位分

import datetime

def get_waking_time(H,I,J,K):
    d1 = datetime.datetime(year=2020, month=5, day=30, hour=H, minute=I, microsecond=0)
    d2 = datetime.datetime(year=2020, month=5, day=30, hour=J, minute=K, microsecond=0)
    delta = d2 -d1
    return delta.seconds/60


print(int(K*((get_waking_time(H1, M2, H2, M2)-1)//K)))

Submission status: Wrong Answer

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

if a==c:
    t=d-b
    print(t-e)
    
if c>a:
    if b>d:
        t=60-b+d
        print(t-e)
        
    if b<=d:
        t=(c-a)*60+d-b
        print(t-e)

Submission status: Wrong Answer

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

x=((c*60-d)-(a*60+b))-e

if x<0:
    x=x+1440
print(x)

Submission status: Wrong Answer

Solution code:
x = list(map(int, input().split()))
h = (x[2] - x[0])*60
m = x[3] - x[1]
if m < 0:
    h -= 1
    m = 60 - x[0] + x[3]
ans = max(m+h-x[-1], 0)
print(ans)

Submission status: Wrong Answer

Solution code:
sh,sm,eh,em,k = map(int,input().split())

if eh == 0:
    eh = 24
if em == 0:
    em = 60

h = eh - sh
m = em - sm

if h < 0:
    h += 24
if m < 0:
    m = m + 60
    h -= 1

totalm = 60*h + m
ans = totalm - k
print(abs(ans))

Submission status: Wrong Answer

Solution code:
from math import ceil

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

diff = int((h2-h1)*60 + (m2-m1))

print(max(0, int(k*(ceil(diff/k)-1))))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

du=h*60+m 

print(int((du//k)*k))

Submission status: Wrong Answer

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

h = H2 - H1
m = M2 - M1
s = 0
if h > 0:
    s = h * 60 + m
elif h == 0:
    s = 24 * 60 + m
elif h < 0:
    s = (24 + h) * 60 + m


# if s - K > 0:
s -= K
# else:
#     s = 0
print(s)

Submission status: Wrong Answer

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

time1 = h1*60 + m1
time2 = h2*60 - m2

a = (time2 - time1 -2) // k
b = (time2 - time1 -2) % k

if a == 0:
    ans = 0
else:
    ans = a * k

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from io import StringIO
import unittest


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

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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10 0 15 0 30"""
        output = """270"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10 0 12 0 120"""
        output = """0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

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

wake_time = h2*60 + m2 - h1 *60 + m1;

if wake_time > k:
    print(wake_time - k);
else:
    print(0);

Submission status: Wrong Answer

Solution code:
a,b,c,d,e =map(int ,input().split())
g=0
h=0
if d-b<0:
  g=60+d-b
  c-=1
f=c-a
g+=f*60
if g<e :
  h=0
else:
  h=g-e
print(h)

Submission status: Wrong Answer

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

latest = H2*60+M2-K  #[min]
earliest = H1*60

study = latest-earliest
print(study)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
H1,M1,H2,M2,K=map(int,input().split())
if H2-H1<0:
    print(0)
else:
    if M2-M1<0:
        print(0)
    else:
        if M2>=M1:
            print(((H2-H1)*60+(M2-M1))-K)
        else:
            print(((H2-H1-1)*60+(M1-M2))-K)

Submission status: Wrong Answer

Solution code:
def main():
    h1,m1,h2,m2,k = map(int, input().split())
    x = 60*abs(h2-h1)+abs(m2-m1)-1
    print(int(k*int(x/k)))

main()

Submission status: Wrong Answer

Solution code:
#スペース区切りの整数の入力
h1, m1, h2, m2, k = map(int, input().split())

if(h1>h2):
  h2 = h2 + 24

asa = h1 * 60 + m1
yoru = h2 * 60 + m2




if(((yoru - asa )%k) == 0):
  ans = int((yoru - asa )/k)-1
else:
  ans = int((yoru - asa )/k)
  

print(ans* k)

Submission status: Wrong Answer

Solution code:
H_1, M_1, H_2, M_2, K = map(int, input().split())

H = ((H_2-H_1)*60+M_1+M_2)-K

print(H)

Submission status: Wrong Answer

Solution code:
sh,sm,eh,em,k = map(int,input().split())

if eh == 0:
    eh = 24
if em == 0:
    em = 60

h = eh - sh
m = em - sm

if m < 0:
    m = m + 60
    h -= 1

totalm = 60*h + m
ans = totalm - k
print(abs(ans))

Submission status: Wrong Answer

Solution code:

def main():
    H1, M1, H2, M2, K = [int(value) for value in input().split(" ")]

    # K(min)-> Time min
    H = K // 60
    M = K % 60
    
    
    NH = H2 - H
    NM = M2 - M
    if NM < 0:
        NH -= 1
        NM = 60 + NM

    RM = (NH - H1)*60 + NM
    print(RM)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k=list(map(int,input().split()))
if m1==m2:
    m=0
    h=h2-h1
elif m2-m1>0:
    m=m2-m1
    h=h2-h1
else:
    m=60-m1+m2
    h=h2-h1-1
ans=k-m+h*60
if ans<=0:
    print(0)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
x = list(map(int, input().split()))
h = (x[2] - x[0])*60
m = x[3] - x[1]
if m < 0:
    m = 60 - x[0] + x[3]
ans = max(m+h-x[-1], 0)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

a = m2 - m1
if a < 0:
    mm = (h2 - h1 - 1) * 60 + abs(a)
else:
    mm = (h2 - h1) * 60 + a

print((mm // k - 1) * k if mm % k == 0 else (mm // k) * k)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
h_time = h2 - h1
if m1 < m2:
    h_time -= 1
    m_time = 60 - m2 + m1
else:
    m_time = m2 - m1

study_time = (h_time * 60 + m_time) - k
if study_time <= 0:
    print(0)
else:
    print(study_time)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import math

def input():
    return sys.stdin.readline()


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

    limit_time_m = m2 - k
    if limit_time_m < 0:
        hour_num = limit_time_m // 60
        h2 += hour_num
        limit_time_m = 60 + limit_time_m

    mean_h = h2 - h1
    if limit_time_m >= m1:
        mean_m = limit_time_m - m1
    else:
        mean_h -= 1
        mean_m = limit_time_m + 60 - m1

    ans = mean_h * 60 + mean_m
    if ans < 0:
        print(0)
    else:
        print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = [int(s) for s in input().split()]
print(H2*60 + M2 - H1*60 + M1 - K)