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())
if M2-M1>=0:
  X=(H2-H1)*60+(M2-M1)
else:
  X=(H2-1-H1)*60+(M2+60-M1)
print(min(0,X-K))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

h = h2 - h1
m = abs(m1-m2)

print(h*60+m-k)

Submission status: Wrong Answer

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

Hsa = (H2 - H1)*60
Msa = (M2 - M1)

ans = Hsa - Msa - K

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(x)

Submission status: Wrong Answer

Solution code:
h1,m1,h2,m2,k= map(int, input().split())
h1 *= 60
h2 *= 60
sa = h2 + m2 - h1 - m1
syo = sa // k
if sa%k == 0:
    syo -= 1
print(syo * k)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
H1, M1, H2, M2, K = [int(x) for x in input().split()]

M = 60 - M1 + 60 * ((H2 - (H1 + 1)) % 24) + M2
print(max(0, M - K))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

H = H2 - H1
M = abs(M2 - M1)

answer = H*60 + M - K
print(answer)

Submission status: Wrong Answer

Solution code:
from math import *
from sys import stdin,stdout
input=stdin.buffer.readline

ip=[int(x) for x in input().split()]
h1=ip[0]
m1=ip[1]
h2=ip[2]
m2=ip[3]
k=ip[4]

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
m = m2-m1
m %= 60
m += 60*(h2-h1)
ans = max(0, m-k)
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 = 60+5-M1
else:
    H = H2-H1
    M = M2-M1
time = H*60+M
if time>=K:
    print(time-K)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
h1, m1, h2, m2, k = [int(i) for i in input().split()]
a = h1 * 60 + m1
b = h2 * 60 + m2
print((b - a - 1) // k * k)

Submission status: Wrong Answer

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

h1,m1,h2,m2,k=getNM()


a=h2*60+m2-h1*60-m1
if a%k==0:
    print(k*(a//k-1))
else:
    print(k*(a//k))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(time - k)

Submission status: Wrong Answer

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

minutes = (h2-h1)*60 - (m2-m1)
print(max(0,minutes-k))

Submission status: Wrong Answer

Solution code:
H, M, h, m, K = map(int, input().split())
print(((60*h + m - 60*H - M)//K - 1)*K)

Submission status: Wrong Answer

Solution code:
def main():
    hs,ms,he,me,k = map(int,input().split())
    h = he - hs
    m = me - ms
    h *= 60
    if m >= 0:
        h += m
    else:
        h += -m - 60
    print(h - k)
if __name__=='__main__':
    main()

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:
h1, m1, h2, m2, k = map(int,input().split())

if m1 < m2:
    m1 += 60
    h1 -=1
    ans_m = m1 - m2
else:
    ans_m = m1 - m2

ans_h = h2 - h1
ans = 60 * ans_h + ans_m

print(ans-k)

Submission status: Wrong Answer

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

if H1==H2:
    x=M2-M1
    ms=x-K
else:
    ms=(60-M1)+(H2-H1-1)*60-K
print(max(0, ms))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
h_1,m_1,h_2,m_2,k = map(int,input().split())

judge = h_2*60+m_2 - (h_1*60+m_2)
print(judge-k)

Submission status: Wrong Answer

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

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

T1 = H1 * 60 + M1
T2 = H2 * 60 + M2
A = T2 - T1
print((A // K - 1) * K)

Submission status: Wrong Answer

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

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-K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


print(min(0, (h2 * 60 + m2 - k) - (h1 * 60 + m1)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
FH, FM, TH, TM, K = map(int, input().split())
M = (TH-FH)*60+(TM-FM)
ans = M // K-(1 if M%K == 0 else 0)
print(ans*K)

Submission status: Wrong Answer

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

start_mins = h1 * 60 + m1
end_min = h2 * 60 + m1

is_up = end_min - start_mins
can_start = is_up - k
print(can_start)

Submission status: Wrong Answer

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

ans=(h*60+m)-(H*60+m)-K

print(ans)

Submission status: Wrong Answer

Solution code:
h, m, H, M, k = map(int, input().split())
h = h*60
H = H*60
print(abs((h+m) - (H-M)) - k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, C ,D, K = map(int,input().split())

ans = (C-A)* 60 + B - D - K

print(ans)

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:
a,b,c,d,e= map(int, input().split())

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

if ans>=0:
    print(ans)
else:
    print(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:



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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
h,m,h2,m2,k = map(int,input().split())

print((h2-h)*60-(m2-m)-k)

Submission status: Wrong Answer

Solution code:
h, m, x, y, k = map(int, input().split())
mi = x*60 + y - h*60+m - k
print(mi)

Submission status: Wrong Answer

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

if H1==H2:
    x=M2-M1
    print(x-K)
else:
    ms=(60-M1)+(H2-H1-1)*60-K
    print(ms)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
h1, m1, h2, m2, k = np.array(list(map(int, input().split())))
h = h2 - h1
m = m2-m1
t = h*60 + m
print(t)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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:
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())

H=(H2-H1)*60
m=H-K
print(m)

Submission status: Wrong Answer

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

h = abs(H1 - H2)
m = abs(M1 - M2)

s = h * 60 + m
print(s - K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
H, M, h, m, K = map(int, input().split())
print(((60*h + m - 60*H - M)//K)*K)

Submission status: Wrong Answer

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


def solve(H: "List[int]", M: "List[int]", K: int):
    print(M[0]*60+M[1]-H[0]*60-H[1]-K)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = [int()] * (2)  # type: "List[int]"
    M = [int()] * (2)  # type: "List[int]"
    for i in range(2):
        H[i] = int(next(tokens))
        M[i] = int(next(tokens))
    K = int(next(tokens))  # type: int
    solve(H, M, K)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
h, m, h2, m2, k = map(int, input().split())
print(12*h2+m2-(12*h+m+k))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(c * 60 + d - a * 60 - d - k)

Submission status: Wrong Answer

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

start = m2 + 60*h1
end = m2 + 60*h2

print(end-start-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())

    print((h2 - h1) * 60 + (m2 - m2) - 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:
H, M, h, m, K = map(int, input().split())
print((60*h + m - 60*H - M)//K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**9+10


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

    
main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

start = h1 * 60 + m1
end = h2 * 60 + m1
print(max(end - start - k, 0))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

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:
        if k+b == m:
            k = 0
            break
        k += b
else:
    k = 0
print(k)

Submission status: Time Limit Exceeded

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: Accepted

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

length=(H2*60+M2)-(H1*60+M1)

ans=length-K

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main() -> None:
    h1, m1, h2, m2, k = map(int, input().split())

    if h1 > h2:
        h2 += 24
    length = (h2*60+m2) - (h1*60+m1)
    print(max(0, length - k))

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# NOMURA プログラミングコンテスト 2020-A

import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


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

Submission status: Accepted

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

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

print(minute)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

m -= K

print(m)

Submission status: Accepted

Solution code:
def main():
    H1,M1,H2,M2,K = map(int,input().split())
    time1 = H1*60 + M1
    time2 = H2*60 + M2
    time = time2-time1
    ans = time-K
    return ans

print(main())

Submission status: Accepted

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
    H -= 1
print(H*60 + M - k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

H1, M1, H2, M2, K = mapint()
if M2>=M1:
    minutes = (H2-H1)*60
    minutes += M2-M1
else:
    minutes = (H2-H1-1)*60
    minutes += M2-M1+60
print(max(0, minutes-K))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
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()))

h1,m1,h2,m2,k = inpl()
if m1 > m2:
    m2 += 60
    h2 -= 1
print((h2-h1)*60+(m2-m1)-k)

Submission status: Accepted

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

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

h = h2 - h1
m = m2 - m1
m += 60 * h

print(m - k)

Submission status: Accepted

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 += 60 * h

print(m - k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h1, m1, h2, m2, k = map(int,input().split())
    print(h2*60+m2-h1*60-m1-k)

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

print((H_2-H_1)*60+(M_2-M_1)-K)

Submission status: Accepted

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

print((H2-H1)*60+(M2-M1)-K if (M2-M1) >= 0 else (H2-H1)*60+(M2-M1)-K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,m,hh,mm,k = map(int,input().split())
x = hh*60-h*60+mm-m
print(x-k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x,d,y,r,k=map(int,input().split())
s=x*60+d
ss=y*60+r
print(ss-s-k)

Submission status: Accepted

Solution code:
import datetime

lst = input().split()

h1 = int(lst[0])
m1 = int(lst[1])
h2 = int(lst[2])
m2 = int(lst[3])
k = int(lst[4])

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

print(int(d - k))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

h1, m1, h2, m2, k = map(int, input().split())
time1 = h1 * 60 + m1
time2 = h2 * 60 + m2
print(time2 - k - time1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

H=h2-h1
M=m2-m1

if(M<0):
  M += 60
  H -= 1
if(H<0):
  H += 24

M += H*60

ans =M - K
print(ans)

Submission status: Accepted

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

    t1 = 60*H1 + M1
    t2 = 60*H2 + M2

    d = 0
    if t1 <= t2:
        d = t2 - t1
    else:
        d = 60*24 - t1 + t2

    print(max(0, d - K))
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

m = 0
if m1 == m2:
  m = 24 * 60
elif m1 < m2:
  m = m2 - m1
else:
  m = 24 * 60 - (m1 - m2)

print(m - k)

Submission status: Accepted

Solution code:

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

a = 60*(h2-h1)
b = m2-m1
##起きている合計時間
c = a+b
##勉強開始時間の最遅時間
d = c-k
print(d)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, m, h2, m2, k = map(int, input().split())

g = h2 * 60 + m2
s = h * 60 + m

ans = g - k - s
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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[1]+h[3]-h[4])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sh,sm,eh,em,t=map(int,input().split())
print((eh-sh)*60+em-sm-t)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(e-s-k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

H1 *= 60
H2 *= 60

start = H1 + M1
end = H2 + M2

time = end - start
ans = time - K

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, d, e = [int(_) for _ in input().split()]
print(c * 60 + d - a * 60 - b - e)

Submission status: Accepted

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

Submission status: Accepted

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

a = 60*(h2-h1)
b = m2-m1
##起きている合計時間
c = a+b
##勉強開始時間の最遅時間
d = c-k
print(d)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    print(a[2]*60 + a[3] -a[0]*60 - a[1] -a[4] )

Submission status: Accepted

Solution code:
import sys
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

x = H1*60+M1
y = H2*60+M2

print(y-x-K)

Submission status: Accepted

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

Submission status: Accepted

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

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