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 .

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

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

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

get_up = H1*60 + M1
bed_in = H2*60 + M2

time = bed_in - get_up
ans = time - K
print(ans)

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

oki = (H_2 - H_1) * 60

if M_1 <= M_2:
  oki += M_2 - M_1
else:
  oki -= M_1 - M_2
  
print(oki-K)

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

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

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

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

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

h3 = h2 - h1
m3 = m2 - m1
if m3 < 0:
    h3 = h3 - 1
    m3 = 60 - m1 + m2

a = h3 * 60 + m3
ans = a - k

print(ans)

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

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

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

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

print(max(0, int(okiteiru - k)))

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

time = 0
if H1 != H2:
  time = (H2-1-H1)*60 + M2+60-M1 - K
else:
  time = M2-M1-K

print(time)

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

Solution (Python):
H1,M1,H2,M2,K=input().split()
H1=int(H1)
M1=int(M1)
H2=int(H2)
M2=int(M2)
K=int(K)
H=(H2-H1)*60
M=M2-M1
G=H+M
S=G-K
print(S)

Solution (Python):


import sys

def main():
    h1,m1,h2,m2,k = map(int,input().split())
    start=h2*60+m2
    end=h1*60+m1
    time=start-end
    if time > 0:
        print(time-k)
    else:
        print(0)

if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np
H1,M1,H2,M2,K=map(int,input().split())
a1=H1*60+M1
a2=H2*60+M2
if a1>a2:
    a2+=24*60
print(abs(a2-a1)-K)

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

if m2>=k%60:
  m_limit=m2-k%60
  h_limit=h2-int(k/60)
elif m2<k%60:
  m_limit=m2+60-k%60
  h_limit=h2-1-int(k/60)


if m_limit>=m1:
  ans=(m_limit-m1)+(h_limit-h1)*60
elif m_limit<m1:
  ans=(m_limit+60-m1)+(h_limit-h1-1)*60
print(ans)

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

Solution (Python):
import sys


MODE = 1


DIMENSION = 1


INT_TYPE = 1

if not (MODE):
    with open("input.txt", "r") as f:
        s = f.read()
else:
    s = sys.stdin.read()

if DIMENSION == 0:
    if INT_TYPE == 1:
        s = int(s)
elif DIMENSION == 1:
    if INT_TYPE == 0:
        s = s.split()
    elif INT_TYPE == 1:
        s = [int(x) for x in s.split()]
elif DIMENSION == 2:
    if INT_TYPE == 0:
        s = [x.split() for x in s.splitlines()]
    elif INT_TYPE == 1:
        s = [[int(y) for y in x.split()] for x in s.splitlines()]

time1 = (s[2] - s[0]) * 60 + (s[3] - s[1])
time2 = time1 - s[4]
if time2 > 0:
    print(time2)
else:
    print(0)

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

hour = K // 60
min = K % 60

min1 = H1*60+M1
min2 = H2*60+M2

print(min2 - min1 - K)

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

Solution (Python):

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

if k >= 60:
    k_h = k // 60
    k_m = k % 60
else:
    k_h = 0
    k_m = k

h3 = h2 - k_h
m3 = m2 - k_m

start = 60 * h1 + m1
end = 60 * h3 + m3

print(end - start)

Solution (Python):

import sys
import math
import itertools
import collections

H1,M1,H2,M2,K = map(int,input().split())
H2 -= K//60
M2 -= K % 60

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

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

def time(h,m):
  return 60*h + m

print(time(h2,m2)-time(h1,m1)-k)

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

    h_diff = h2 - h1
    m_diff = m2 - m1

    if h_diff == 0:
        if m_diff >= 0:
            ans = m_diff - k
        else:
            ans = 24 * 60 + m_diff - k
    elif h_diff > 0:
        ans = h_diff * 60 + m_diff - k
    else:
        ans = 24 + h_diff + m_diff - k

    print(ans)



if __name__ == '__main__':
    main()

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

min1 = H1*60 + M1
min2 = H2*60 + M2
min = min2 - min1


if min > 0:
  print(min-K)
else:
  print(0)

Solution (Python):
s = input().split()

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

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

t = t - k

print(t)

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

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

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

Solution (Python):
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2 < H_1:
    H_2 += 24
MaxH = abs(H_2 - H_1)
if M_1 >= M_2:
    MaxM = M_2 - M_1
if M_1 < M_2:
    MaxM = abs(M_1 - M_2)
useTime = MaxH*60 + MaxM
useTime -= K
print(useTime)

Solution (Python):
h1, m1, h2, m2, k = list(map(int, input().split()))
a = h2 - h1
b = m2 - m1
c = a * 60 + b - k
print(c)

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

print(m-K)

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

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

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

Solution (Python):
X = list(map(int,input().split()))

t = (60*X[2] + X[3]) - (X[0]*60 + X[1]) 

print(t-X[4])

Solution (Python):
H1,M1,H2,M2,K=map(int,input().split())
x=(H2-H1-1)*60
y=(60-M1)+M2
summ=x+y
print(summ-K)

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

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

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())
A = 60*H1 + M1
B = 60*H2 + M2
print(max(B-A-K, 0))

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

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

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

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

Solution (Python):
a = input()

a=a.split()

h=(int(a[2])-int(a[0]))*60
m=(int(a[3])-int(a[1]))

m_sum=h+m
av_m=m_sum-int(a[4])

print(av_m)

Solution (Python):






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

h = h2 - h1

if m1 > m2 :
    m = 60 - (m1 - m2)
    h -= 1
else:
    m = m2 - m1

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

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

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

needHour = k//60
needMin = k%60

remitHour = 0
remitMin = 0
if m2 > m1:
    remitHour = h2 - h1 -1
    remitMin = m2+60 - m1
else:
    remitHour = h2 - h1
    remitMin = m2 - m1

if remitHour - needHour <= 0 and remitMin - needMin <= 0:
    print(0)
else:
    ansHour = 0
    ansMin = 0
    if remitMin >= needMin:
        ansHour = remitHour - needHour
        ansMin = remitMin - needMin
    else:
        ansHour = remitHour - needHour -1
        ansMin = remitMin+60 - needMin
    print(ansHour*60 + ansMin)

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

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

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

Solution (Python):
def resolve():
    H1, M1, H2, M2, K = map(int, input().split())
    import datetime
    AwakeTime = (H2*60 + M2)-(H1*60 + M1)
    ans = AwakeTime -K
    print(ans)
resolve()

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

Solution (Python):



from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    tinn=1; 
    for tin in range(tinn):
        h1,m1,h2,m2,k=map(int,input().split())
        x=(h2-h1)*60;
        y=m2-m1
        print(x+y-k)



BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()

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

sabunh = h2 - h1
sabunm = m2 - m1 
zikantai = sabunh * 60 + sabunm
ans = 0
zikantai -= k
print(zikantai)

Solution (Python):
guh, gum, gbh, gbm, st = map(int, input().split())
if gbm < gum:
  gbh -= 1
  gbm += 60
tmp = (gbh-guh)*60+(gbm-gum)
ans = tmp-st
print(ans)

Solution (Python):

import os
import sys
from io import BytesIO, IOBase
def main():
    startHour, startMin, endHour, endMin, studyTime = map(int, input().rstrip().split())
    diff = (endHour-startHour)*60 - startMin + endMin
    if diff <= studyTime:
        print(0)
    else:
        print(diff-studyTime)


BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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

h = c - a
m = d - b

print(h*60+m-k)

Solution (Python):
import datetime

data = input().split(' ')
data = map(lambda x: int(x), data)

h1, m1, h2, m2, k = list(data)

wakeup = datetime.datetime(2000, 1, 1, hour=h1, minute=m1)
gotobed = datetime.datetime(2000, 1, 1, hour=h2, minute=m2)

study = datetime.timedelta(minutes=k)

result = gotobed  - wakeup - study
result = result.total_seconds() / 60
result = int(result)

print(result)

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

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

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

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

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

time = t - f - k
if time < 0:
  print(0)
else:
  print(time)

Solution (Python):
import sys
import math
from collections import deque
from collections import defaultdict

def main():
    h1, m1, h2, m2, k = list(map(int,sys.stdin.readline().split()))
    h_v = h2 - h1 - 1
    m_v = (60 - m1) + m2
    time = h_v * 60 + m_v
    ans = time - k
    print(ans)
    return 0

if __name__ == "__main__":
    main()

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

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

ans = max(0, dm)
print(ans)

Solution (Python):
a = list(map(int,input().split()))

x = a[0]*60 + a[1]
y = a[2]*60 + a[3]

z = y - x

r = z - a[4]

print(r)

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

Solution (Python):


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




if m2 >= m1:
    hd = (h2 -h1) * 60
    md = m2 -m1
    timed = hd + md
else:
    hd = (h2 -h1) * 60
    md = 60 - m1 + m2
    timed = md + hd -60
print(timed - k)

Solution (Python):
i_l_s = input().split()
i_l = list(map(int, i_l_s))
 
hour = i_l[4]//60
min = i_l[4]%60
 
before = [i_l[0]+hour, i_l[1]+min]
after = [i_l[2], i_l[3]]
 
if(after[0]-before[0] ==0):
    print(after[1]-before[1])
else:
  result = after[1]-before[1] + 60*(after[0]-before[0])
  print(result)

Solution (Python):



arr = list(map(int,list(input().split())))

h1=arr[0]
m1=arr[1]
h2=arr[2]
m2=arr[3]
k=arr[4]

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

last=h2-k



if last<=h1:
	print(0)
else:
	print(last - h1)

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

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

h = h2 - h1
m = m2 - m1

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

ans = 60*h + m - k
if ans < 0:
    ans = 0
print(ans)

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

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

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

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

a = 60 * H1 + M1
b = 60 * H2 + M2
ans = b - a

print(max(0, b - K - a))

Solution (Python):




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

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

ans = max(m2 - m1 - k, 0)

print(ans)

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

Solution (Python):
import sys
input = sys.stdin.readline

a,b,c,d,e = map(int,input().split())
minites = c*60+d - (a*60 + b) 
if minites < 0:
  print(60*24 +minites -e)
else:
  print(minites -e)

Solution (Python):

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

diff = hr*60+m
ans = diff - k

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

Solution (Python):
from datetime import datetime
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    H1, M1, H2, M2, K = input().split()

    t1 = datetime.strptime(H1 + ':' + M1, '%H:%M')
    t2 = datetime.strptime(H2 + ':' + M2, '%H:%M')
    ans = int((t2 - t1).total_seconds()) // 60 - int(K)
    print(ans)


main()

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
if h1 > h2:
	h2 += 24

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

if t - k <= 0:
	print(0)
else:
	print(t - k)

Solution (Python):
h1, m1, h2, m2, k = [int(arg) for arg in input().split()]
print((h2-h1)*60 + (m2-m1) - k)

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

k3 =h2*60+m2
k2 =h*60+m
print(k3-k2-k)

Solution (Python):
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)-k
print(time)

Solution (Python):
st_h,st_m,en_h,en_m,k=map(int,input().split())
all_m = (en_h - st_h) * 60 + (en_m - st_m)
print(all_m - k)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split(" "))
if h1>h2:
  h2=h2+24
if m2>=m1:
  mk=m2-m1
  T=mk+(h2-h1)*60
else:
  mk=m2+60-m1
  T=mk+(h2-h1-1)*60
print(T-k)

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

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

ans = H2*60+M2-H1*60-M1-K

print(ans)

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

Solution (Python):
import sys

if __name__ == "__main__":
    h1, m1, h2, m2, k = map(int, input().split(" "))
    time_awake = (m2 - m1) + (h2 - h1) * 60 - k
    print(0 if time_awake < 0 else time_awake)

Solution (Python):
h1, m1, h2, m2, param_k = list(map(lambda x: int(x), input().split(' ')))
start_at = h1 * 60 + m1
end_at = h2 * 60 + m2
print(end_at - param_k - start_at)

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

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

print(ans)

Solution (Python):
lst = list(map(int,input().split()))
time1 = lst[0:2]
time2 = lst[2:4]

time3 = (time2[0] - time1[0]) * 60 + (time2[1] - time1[1])

ans = time3 - lst[-1]

print(ans)

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

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
l1 = 60*h1 + m1
l2 = 60*h2 + m2
if(l1 > l2):
  l2 += 24*60
dl = l2 - l1
print(dl - k)

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

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

A1 = H1*60+M1
A2 = H2*60+M2

answer = A2 - A1 - K

print(answer)

Solution (Python):
H,M,h,m,K = map(int,input().split())
A = H*60 + M
B = h*60 + m
X = B - A - K
print(X)

Solution (Python):
list1 = input().split()
list1 = [int(x) for x in list1]

startHour = list1[0]
startMinute = list1[1]
endHour = list1[2]
endMinute = list1[3]
studyTime = list1[4]

startTime = startHour * 60 + startMinute
endTime = endHour * 60 + endMinute

print(endTime - startTime - studyTime)

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

if t1<t2:
    print(t2-t1-k)

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

Solution (Python):

import sys
import datetime

def solve(H: "List[int]", M: "List[int]", K: int):
    d_start = datetime.datetime(year=2000, month=1, day=1,hour=H[0], minute=M[0])
    d_end = datetime.datetime(year=2000, month=1, day=1,hour=H[1], minute=M[1])

    study_end = d_end - datetime.timedelta(minutes=K)

    ans = study_end - d_start
    print(ans.seconds // 60)
    return



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

if __name__ == '__main__':
    main()

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

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

print(ans)

Solution (Python):
h,m,i,n,k = map(int, input().split())
time = (i-h)*60-m+n
print(time-k)

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10**7)

ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

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

m1 += k
if m1 // 60 != 0:
    h1 += m1 // 60
    m1 %= 60

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

print(t2 - t1)

Solution (Python):


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

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







print(max(0, t-k))

Solution (Python):

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

A1=H1*60+M1
A2=H2*60+M2

R=A2-K-A1
print(R)

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

print(h3-k)

Solution (Python):
H1,M1,H2,M2,K = map(int,input().split())
hh1 = H1*60 + M1
hh2 = H2*60 + M2
if hh1 < hh2:
  sl = hh1 + 60*24 - hh2
else:
  sl = hh1 - hh2

time = 24*60 - sl - K
print(time)

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

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

Solution (Python):
import math
A, B, C, D, E = map(int, input().split())

hour = (C - A) * 60
min = D - B
cnt = hour + min - E

print(cnt)

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

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

h = h2_m-h1_m
h = h - k
print(h)

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

import datetime
dt1 = datetime.datetime(year=2020, month=5, day=29, hour=H1, minute=M1)
dt2 = datetime.datetime(year=2020, month=5, day=29, hour=H2, minute=M2)

tmp = dt2 - datetime.timedelta(minutes=K)
tmp2 = dt2 - dt1
ans = (tmp - dt1).total_seconds() / 60

if (tmp2.total_seconds()) <= 0:
        print(0)
        exit()
else:
        print(int(ans))

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

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

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

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

    standing=sleep-stand

    res=standing-K
    print(res)

if __name__=="__main__":
    main()

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

Solution (Python):
H1, M1, H2, M2, K = map(int, input().rstrip().split())
minutes = M2 - M1
hours = 0
if minutes < 0:
    minutes += 60
    hours -= 1
hours += H2 - H1
minutes += hours * 60
answer = minutes - K
if answer < 0:
    answer = 0
print(answer)

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

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

Solution (Python):
from datetime import datetime, timedelta
h1, m1, h2, m2, k = [int(i) for i in input().split()]

t1 = datetime(year=1, month=1, day=1, hour=h1, minute=m1)
t2 = datetime(year=1, month=1, day=1, hour=h2, minute=m2)
if h2 > h1:
    print((t2-t1-timedelta(minutes=k)).seconds//60)
elif h1 == h2 and m2 > m1:
    print((t2-t1-timedelta(minutes=k)).seconds//60)
else:
    t2 = t2.replace(day=2)
    print((t2-t1-timedelta(minutes=k)).seconds//60)

Solution (Python):
import datetime

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

dt1 = h1 * 60 + m1

dt2 = h2 * 60 + m2






dt3 = dt2 - k

dt4 = dt3 - dt1

print(dt4)

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

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

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

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

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

Solution (Python):
h1,m1,h2,m2,k = input().strip().split()
h1,m1,h2,m2,k = int(h1), int(m1), int(h2),int(m2),int(k)

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

print(duration)

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



mm1 = H1*60+M1
mm2 = H2*60+M2

if mm2 > mm1:
    mmm = mm2-mm1
else:
    mmm = mm2+24*60 - mm1

if mmm > K:
    print(mmm-K)
else:
    print(0)

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

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

a=s-f


if k>a:
  print(0)
else:
  b=s-k
  print(b-f)

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

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

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

Solution (Python):

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

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

Solution (Python):
a,b,c,d,e=map(int,input().split())
s=0
if b>c:
  c=c-1
  s=(c-a)*60+((60+d)-b)
else:
  s=(c-a)*60+(d-b)

t=s-e

print(t)

Solution (Python):
time = map(int, input().split())
list1=[]
for i in time:
    list1.append(i)
time1 = (list1[2]*60+list1[3])-(list1[0]*60+list1[1])
minute = time1  - list1[4]
print(minute)

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

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

Solution (Python):






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

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

print(t2-t1-k)

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

HOUR = H2 - H1
MINUTE = M2 - M1

After_H = HOUR *60
After_M = After_H + MINUTE
Ans = After_M - K

print(Ans)

Solution (Python):
def difference(h1, m1, h2, m2, k): 
    t1 = h1 * 60 + m1 
    t2 = h2 * 60 + m2  
    diff = t2-t1
    print(diff - k)

L = input().split()
H1 = int(L[0])
M1 = int(L[1])
H2 = int(L[2])
M2 = int(L[3])
K = int(L[4])

difference(H1, M1, H2, M2, K)

Solution (Python):
import time

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

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

st_studytime = sp_time - k

ans = st_studytime - gu_time

print(ans)

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

end_time = H2*60 + M2
start_time = H1*60 + M1
diff_time =  end_time - start_time

print(diff_time - K)

Solution (Python):
s = input()
h1, m1, h2, m2, k = s.split(' ')

h = int(h1) - int(h2)
m = 0
if int(m1) >= int(m2):
    m = int(m1) - int(m2)
else:
    h = h -1
    m = 60 + int(m1) - int(m2)
    
t = abs(h * 60 + m) - int(k)

print(t)

Solution (Python):
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math



input = sys.stdin.readline

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

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

if length > K:
    print(length-K)
else:
    print(0)

Solution (Python):
line = input()
h1, m1, h2, m2, k = line.split(" ")
h1, m1, h2, m2, k = int(h1), int(m1), int(h2), int(m2), int(k)

houre = h2 - h1
minute = m2 - m1

print(houre * 60 + minute - k)

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

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

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

f = c - a
g = d - b
if g < 0:
  g = 60 + g
  f -=1
total = 60 * f + g
if total - e <= 0:
  print('0')
else:
    total -= e 
    print(total)

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

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

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