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):
import bisect
import sys
import math
from collections import deque
from heapq import heappush, heappop

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29

DIV = (10**9) + 7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost


def main():
    H1,M1,H2,M2,K = isRaw()
    D = (H2*60+M2)-(H1*60+M1)
    print(max(0,D-K))

main()

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())
t1 = h1 * 60 + m1
t2 = h2 * 60 + m2

if t2 > t1:
	awake = t2 - t1
else:
    awake = 24 * 60 - t1 + t2

print(awake - k)

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

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

print(time - k)

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

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

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

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

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

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

print(max(0, en - st - k))

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

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

print(max(0,-60*A-B+(60*C+D))-E)

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

Solution (Python):
Hs,Ms,He,Me,K=map(int,input().split())
print(str((He-Hs)*60+Me-Ms-K))

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

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

print(time - k)

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

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

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

print(ans)

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

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

print(time - k)

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

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

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

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

Solution (Python):
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

hr = (H2- H1) * 60 
if M2 >= M1:
    _min = M2 - M1
    hr = (H2- H1) * 60 
    ans = hr + _min
else:
    _min = (M2 + 60) - M1
    hr = (H2- H1 -1) * 60 
    ans = hr + _min

print(ans - K)

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

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

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

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

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

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

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

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

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

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

Solution (Python):

import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

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

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

print(minute - k)

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):


import sys
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

h1, m1, h2, m2, k = map(int, rl().split())
m = h2*60 + m2 - h1*60 - m1
print(m-k)

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy


from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush
from fractions import gcd

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    a,b,c,d,e = inpm()
    print((c-a)*60+(d-b)-e)
    
if __name__ == "__main__":
    main()

Solution (Python):
from datetime import datetime
h1, m1, h2, m2, k = list(map(int, input().split()))
t1 = datetime(2000, 1, 1, h1, m1, 0)
t2 = datetime(2000, 1, 1, h2, m2, 0)
t = (t2 - t1).seconds // 60
ans = t - k
print(ans)

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

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

if t1 > t2:
    print(720 - t1 + t2 - k)
else:
    print(t2 - t1 - k)

Solution (Python):


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

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

Solution (Python):
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);

Solution (Python):
from math import ceil, floor

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

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

print('%d' % max(0, diff-k))

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

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

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

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

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

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

print(time - k)

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

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

Solution (Python):
hour1,min1,hour2,min2,ben = map(int,input().split())
ans=(hour2-hour1)*60+min2-min1-ben
print(ans)

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

Solution (Python):
m = list(map(int,input().split()))
l = m[0]*60
n = m[2]*60
s = l + m[1]
k = n + m[3]
a = k - s
print(a-m[4])

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

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

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

Solution (Python):
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-k
elif h == 0:
    if m1 < m2:
        du = m2-m1-k
    else:
        du = 24*60 +(m2-m1)-k
else:
    du = h*60+(m2-m1)-k
        
print(du)

Solution (Python):

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

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

print(minutes - k)

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

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

h = c-a
m = d-b
if m < 0 :
    h = h-1
    m = 60 + m

print(h * 60 + m - e)

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

Solution (Python):
H = input().split()
sdy =0
if int(H[2]) >= int(H[0]):
  sdy = int(H[2])*60 +int(H[3])-int(H[0])*60 -int(H[1]) - int(H[4])
else:
  H[2] = (int(H[2])+24)
  sdy = int(H[2])*60 +int(H[3])-int(H[0])*60 -int(H[1]) - int(H[4])
if int(sdy) < 0:
  sdy = 0
print(sdy)

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())
awake_mins = (h2 * 60 + m2) - (h1 * 60 + m1)
print(max(awake_mins - k, 0))

Solution (Python):
HMK = list(map(int, input().split()))
H1 = HMK[0]
M1 = HMK[1]
H2 = HMK[2]
M2 = HMK[3]
K = HMK[4]
if H2 < H1:
	H2 += 24
ans = ((H2 - H1) * 60 + (M2 - M1)) - K
print(ans)

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

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

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










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


ans = total - k
print(ans)

Solution (Python):

string = str(input())
X = 0
li = []
for a in range(len(string)):
    if string[a] == " ":
        li.append(string[X:a])
        X = a+1
li.append(string[X:])
for aa in range(len(li)):
    li[aa] = int(li[aa])
h1 = li[0]
m1 = li[1]
h2 = li[2]
m2 = li[3]
k = li[4]
Time = (h2 * 60 + m2) - (h1 * 60 + m1) - k
print(int(Time))

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

Solution (Python):
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

import sys
sys.setrecursionlimit(4100000)
rl = sys.stdin.readline

H1,M1,H2,M2,K = Ints()

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

print(S-K)

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

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

print(WAKEUP - K)

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

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

print(max(awake - k, 0))

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

h = 60 * (s[2]-s[0])
m = s[3] - s[1]
k = s[4]
print(h+m-k)

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

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

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

if h1 > h2:
  h2 += 24
  
h = h2 - h1
hm = h * 60

print(hm - m1 + m2 - k)

Solution (Python):


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    

    
    

    a,b,c,d,e = map(int, input().split())
    if d >= b:
        res = (c-a)*60 + d-b
        print(res-e)
    else:
        res = (c-a-1)*60 + d-b+60
        print(res-e)

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
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(0 if mm - k <= 0 else mm - k)

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

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

if(a>k):
  print(a-k)
else :
  print(0)

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

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

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

print(jikan-k)

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

if H2 < H1:
    H2 = H2 + 24
if H1 == H2 and H2 < H1:
    H2 = H2 + 24


time2m = H2 * 60 + M2
time1m = H1 * 60 + M1

study_time = time2m - K - time1m

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

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

input_nums=[]

for i in range(5):
    input_nums.append(int(input_str[i]))


diff_hour = input_nums[2] - input_nums[0]
diff_hour_to_min = diff_hour * 60
 
diff_min = input_nums[3] - input_nums[1]

total_wake_min = diff_hour_to_min + diff_min

print(total_wake_min - input_nums[4])

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

h = H2 - H1
m = M2 - M1
s = 0

s = h * 60 + m


s = s - K

print(s)

Solution (Python):


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

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

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

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

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

Solution (Python):
h1, m1, h2, m2, t = (int(x) for x in input().split())
s1 = h1 * 60 + m1
s2 = h2 * 60 + m2
ans = s2 - s1 - t
print(ans)

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

h1, m1, h2, m2, k = map(int, rl().split())
m = h2*60 + m2 - h1*60 - m1
print(m-k)

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

Solution (Python):
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')

Solution (Python):
x = list(map(int, input().split(" ")))
h1 = x[0]
m1 = x[1]
h2 = x[2]
m2 = x[3]
s = x[4]
h = (h2-h1)*60
m = m2-m1
print((h+m)-s)

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

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

Solution (Python):
import datetime
from sys import stdin
h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()]

d1 = datetime.datetime(year=2018, month=1, day=7, hour=h1, minute=m1, second=0, microsecond=0)
d2 = datetime.datetime(year=2018, month=1, day=7, hour=h2, minute=m2, second=0, microsecond=0)

delta = d2 - d1

dt2 = delta.seconds / 60

dt2 -= k

if dt2 < 0 :
	dt2 = 0

print(int(dt2))

Solution (Python):
h1,m1,h2,m2,lens = [int(x) for x in input().split()]
available = (h2 * 60 + m2) - (h1 * 60 + m1)
answer = available - lens if available > lens else 0
print(answer)

Solution (Python):
h,m,a,b,k=map(int,input().split())
h_to_min = h * 60
a_to_min = a * 60
re1 = a_to_min - h_to_min
re2 = b - m
re = re1 + re2
print(re-k)

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

time1=H1*60+M1
time2=H2*60+M2
a=time2-K
if a<=0:
    print(0)
    exit()

if time1<=a:
    print(a-time1)
else:
    print(0)

Solution (Python):
import sys
def I(): return int(sys.stdin.readline().rstrip())
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 = map(int,S().split())

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

print(y-x-K)

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

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

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

if finish - start >= 0:
  print(finish - start)
else:
  print(0)

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

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

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

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

pre=60*h+m
post=60*H+M

print(post-pre-K)

Solution (Python):
H1,M1,H2,M2,K = (int(x) for x in input().split())
Wake  = 60*H1+M1
Sleep = 60*H2+M2

Activate = Sleep - Wake
CanStudy = Activate - K
print(int(CanStudy))

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

Solution (Python):


import math

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

if h2 < h1:
    h2 += 24

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

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

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

print(res)

Solution (Python):
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")
else:
	print(str(B-A-L[4]))

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

Solution (Python):


def submit():
    h1, m1, h2, m2, k = map(int, input().split())
    
    time1 = h1 * 60 + m1
    time2 = h2 * 60 + m2

    if time1 > time2:
        time2 += 24 * 60

    print(time2 - time1 - k)


submit()

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

if time <= K:
    print(0)
    exit(0)
else :
    print(time-K)

Solution (Python):
start_hour,start_min,end_hour,end_min,study_min =  list(map(int, input().split()))
day_time = (end_hour * 60 + end_min) - (start_hour*60 + start_min)
able_time = day_time - study_min
print(able_time)

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

H = H2 - H1
M = M2 - M1

t = H * 60 + M - K

print(t)

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

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

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

Solution (Python):
l=input().split()
h1=int(l[0])
m1=int(l[1])
h2=int(l[2])
m2=int(l[3])
k=int(l[4])
print(60*h2+m2-60*h1-m1-k)

Solution (Python):
data = [int(x) for x in input().split()]
result1 = data[2]*60 +data[3]-data[0]*60-data[1]-data[4]
print(result1)

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

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

if h < 0:
    h = h + 24

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

mini = h*60 + m - H[4]

if mini < 0:
    mini = 24*60 + mini

print(mini)

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

wake = a * 60 + b
gobed = c * 60 + d

time = gobed - wake

if time > e:
  print(time - e)
elif time == e:
  print(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())
print(m2-m1+(h2-h1)*60-k)

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

S = H1 * 60 + M1
E = H2 * 60 + M2

if E - S >= K:
  print(E-S-K)
else:
  print(0)

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

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

Solution (Python):
okiji,okihun,neji,nehun,benji=map(int,input().split())
print((neji*60+nehun)-(okiji*60+okihun)-benji)

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

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

print(W)

Solution (Python):






def çözmek():
    h, m, H, M, K = map(int, input().split(" "))
    if H != 0:
        H = H * 60
    if h != 0:
        h = h * 60
    res = H + M - K - h - m
    print(res)
if __name__ == "__main__":
    çözmek()

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

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

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

rest_time = (h_time + m_time) - k
print(rest_time)

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

from datetime import datetime

diff_time = datetime(2020, 5, 20, h2, m2) - datetime(2020, 5, 20, h1, m1)
print((diff_time.seconds // 60) - k)

Solution (Python):

import datetime
h1, m1, h2, m2, k = map(int, input().split())
one = datetime.timedelta(hours=h1, minutes=m1)
two = datetime.timedelta(hours=h2, minutes=m2)
study = datetime.timedelta(minutes=k)

diff_one_two_seconds = (two.total_seconds() - one.total_seconds()) / 60
study_seconds = study.total_seconds()/60
print(int(diff_one_two_seconds - study_seconds))

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

min_before = H1*60+M1
min_after = H2*60+M2
if(min_before < min_after):
    print(min_after-min_before-K)
else:
    print(1440-min_before+min_after-K)

Solution (Python):
import datetime

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

t1 = datetime.datetime(year=2020, month=1, day=1, hour=a, minute=b)
t2 = datetime.datetime(year=2020, month=1, day=1, hour=c, minute=d)

delta = t2 - t1
m = int(delta.seconds / 60)
print(m - e)

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


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

print(t2-t1-x)

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

Solution (Python):
string = input()
H1, M1, H2, M2, K = [int(digit) for digit in string.split(" ")]
hour2minutes = lambda H1, H2 : (H2 - H1) * 60
total_minutes = hour2minutes(H1, H2) + (M2 - M1)
ans = total_minutes - K
print(ans)

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

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

Solution (Python):
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    H1, M1, H2, M2, K = read_values()
    m1 = H1 * 60 + M1
    m2 = H2 * 60 + M2
    print(m2 - m1 - K)


if __name__ == "__main__":
    main()

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

Solution (Python):
h1, M1, h2, M2, K = map(int, input().split(" "))
wakeup = h1 * 60 + M1
sleep = h2 * 60 + M2
limit = sleep - K
study_t = limit - wakeup
print(study_t)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def solve():
    h, m, g, m2, k = LI()
    hm = h * 60 + m
    gm = g * 60 + m2
    print(max(0, gm - hm - k))
    return



if __name__ == '__main__':
    solve()

Solution (Python):
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(int(H2 * 60 + M2 - (H1 * 60 + M1) - K))

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

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

Solution (Python):
import math

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

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


def b():
    print('')



def c():
    print('')



def d():
    print('')


a()

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

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  

H1, M1, H2, M2, K = read_ints()


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



print((minu - K))

Solution (Python):
H1, M1,H2,M2,K= map(int,input().split())
a = H1*60
b = H2*60
result = b -a 
c = M2 - M1
d = result + c
result2 = d - K
print(result2)

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

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

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

m1=H1*60+M1
m2=H2*60+M2

ans = m2-m1-K

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

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

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

print(min-K)

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

Solution (Python):
H, M, h, m, K = map(int, input().split())
wake = H * 60 + M
sleep = h * 60 + m
spinner = sleep - wake
oops = spinner - K
print(oops)

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

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

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

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

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

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

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

if t2 <= t1:
  t2 += 24 * 60

print(t2-t1-K)

Solution (Python):
[H1,M1,H2,M2,K]=input().split();
H1=int(H1);
H2=int(H2);
M1=int(M1);
M2=int(M2);
K=int(K);
d1=60*H1+M1;
d2=60*H2+M2-K;
print(d2-d1);

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

Solution (Python):
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>=K:
  print(round(delta_minutes-K))
else:
  print(0)

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

if h2 < h1:
    h2 += 24
h3 = h2 - h1
if m2 < m1:
    m3 =  m2 + (60 - m1)
    h3 -= 1
else:
    m3 = m2 - m1

ans = (h3 * 60) + m3 - k
if ans <= 0:
    print(0)
else:
    print(ans)

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

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

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

latest = H2*60+M2-K  
earliest = H1*60+M1
study = latest-earliest
print(study)