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=map(int,input().split())
t=0
if m2>m1:
    t=m2-m1+(h2-h1)*60-k
else:
    t=60+m2-m1+(h2-1-h1)*60-k
print(t)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


def main():
    H1, M1, H2, M2, K = map(int, input().split())
    if H1 <= H2:
        mi = H2 * 60 + M2 - (H1 * 60 + M1)
        ans = mi - K
        print(ans)
    else:
        mi = (H2 + 24) * 60 + M2 - (H1 * 60 + M1)
        ans = mi - K
        print(ans)


if __name__ == "__main__":
    main()

Solution (Python):


import re
import math
from collections import defaultdict
from collections import deque
import collections
from fractions import Fraction
from queue import PriorityQueue
import itertools
from copy import deepcopy
import random
import time
import os
import sys
import datetime
from functools import lru_cache
from functools import reduce
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
alphabet="abcdefghijklmnopqrstuvwxyz"
numbers="0123456789"
mod=int(10**9+7)
inf=int(10**19)
class Edge():
    def __init__(self,x,y,val=1):
        self.x=x
        self.y=y
        self.val=val
class unionfind():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(n)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):
            self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def yn(b):
    if b:print("yes")
    else:print("no")
def Yn(b):
    if b:print("Yes")
    else:print("No")
def YN(b):
    if b:print("YES")
    else:print("NO")
def ispow(a,b):
    now=b
    while now<a:
        now*=b
    return now==a
def getbin(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def getfacs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def nextcomb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def getprimes(n):
    if n==0:return []
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    ret=[]
    for a in range(n+1):
        if(A[a]):ret.append(a)
    return ret
def isprime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(bbool,ret1,ret2):
    if bbool:return ret1
    else:return  ret2
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n):
    b = 2
    ret=defaultdict(int)
    while b * b <= n:
        while n % b == 0:
            n //= b
            ret[b]+=1
        b+=1
    if n > 1:ret[n]+=1
    return ret
def pm(x):
    return x//abs(x)
def inputintlist(): 
    return list(map(int,input().split()))
def istanchouzouka(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>=a:
            f=False
        prev=a
    return f
def istanchouhigensyou(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>a:
            f=False
        prev=a
    return f
def getallsum(A):
    s=sum(A)
    dp=defaultdict(int)
    dp[0]=1
    for a in range(0,len(A)):
        for b in range(s,-1,-1):
            if b-A[a]>=0:
                dp[b]+=dp[b-A[a]]
    return dp
def yuukoutomukou(edges):
    ret=deepcopy(edges)
    for edge in edges:
        if not edge.x==edge.y:
            ret.append(Edge(edge.y,edge.x,edge.val))
    return ret
def dijkstra(edges,V,start):
    mincost=[inf]*V
    G=[[] for a in range(V)]
    for edge in edges:
        G[edge.x].append([edge.val,edge.y])
    Q=PriorityQueue()
    Q.put([0,start])
    while not Q.empty():
        nowcost,nowx=Q.get()
        if mincost[nowx]==inf:
            mincost[nowx]=nowcost
            for cost,y in G[nowx]:
                newcost=nowcost+cost
                Q.put([newcost,y])
    return mincost
def warshallfloyd(edges,V):
    mincost=[[inf for b in range(V)] for a in range(V)]
    for a in range(V):mincost[a][a]=0
    for edge in edges:
        mincost[edge.x][edge.y]=min(mincost[edge.x][edge.y],edge.val)
    for k in range(V):
        for s in range(V):
            for t in range(V):
                if mincost[s][k]==inf or mincost[k][t]==inf:continue
                mincost[s][t]=min(mincost[s][t],mincost[s][k]+mincost[k][t])
    return mincost
def bellemanford(edges,V,start):
    mincost=[inf]*V
    mincost[start]=0
    for _ in range(V):
        for edge in edges:
            if mincost[edge.x]==inf:continue
            mincost[edge.y]=min(mincost[edge.y],mincost[edge.x]+edge.val)
    return mincost
def ruisekiwa(A):
    ret=[0]*(len(A)+1)
    for a in range(len(A)):
        ret[a+1]=ret[a]+A[a]
    return ret
def getmd(x1,y1,x2,y2):
    return abs(x1-x2)+abs(y1-y2)
def geted(x1,y1,x2,y2):
    return math.sqrt((x1-x2)**2+(y1-y2)**2)
class fordfulkerson():
    def __init__(self,edges,V,s,t):
        self.V=V
        self.used=[False]*V
        self.G=[[] for a in range(V)]
        self.s=s
        self.t=t
        for edge in edges:
            self.G[edge.x].append({"x":edge.x,"y":edge.y,"cap":edge.val,"rev":len(self.G[edge.y])})
            self.G[edge.y].append({"x":edge.y,"y":edge.x,"cap":0,"rev":len(self.G[edge.x])-1})
    def dfs(self,v,t,f=inf):
        if v==t:return f
        self.used[v]=True
        for a in range(len(self.G[v])):
            x=self.G[v][a]["x"]
            y=self.G[v][a]["y"]
            cap=self.G[v][a]["cap"]
            rev=self.G[y][self.G[x][a]["rev"]]
            if self.used[y] or cap==0:continue
            f2=self.dfs(y,t,min(f,cap))
            if f2>0:
                self.G[v][a]["cap"]-=f2
                rev["cap"]+=f2
                return f2
        return 0
    def maxflow(self):
        flow=0
        while True:
            self.used=[False]*V
            zouka=self.dfs(self.s,self.t)
            if zouka==0:break
            flow+=zouka
        return flow










H,M,HH,MM,K=inputintlist()
M+=H*60
MM+=HH*60-K

print(MM-M)

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

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

print(result)

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

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

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

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

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


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

print(end - K - start)

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

Solution (Python):
a,b,c,x,y= map(int, input().split())


ans = c*60 + x - a*60 -b 

print(ans - y)

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

t = (h - H)*60 + m - M

print(t - k)

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

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

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

get = h_1 * 60 + m_1
sleep = h_2 * 60 + m_2


print(max(sleep-get - k,0))

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

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

if h2<h1:
    h2=24+h2

hours=h2-h1

if m2<m1:
    m2+=60
    hours-=1
min=m2-m1

time= min+ 60*hours

print(time-k)

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

Solution (Python):

import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement


from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter





j=0
k=0
n=3
r=1
a=[0]






"1行1つの整数を入力を取得し、整数と取得する"




"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for i in number_list:
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''



"正方行列にstr型の値を入力"
'''




'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''











'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''




"aという変数に入っているものを大文字にして出力"

















'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''


'''
def cmb(n,r):
    
    r= min(n-r,r)
    
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    
    
    

    under = reduce(mul, range(1, r+1))
    
    
    
    

    return over // under
    
    
    
    
a = cmb(n, r)

'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD
combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''




for i in a.most_common(n):print(i)





 


'''









'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        
        if n % k == 0:
            return False
            
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  

'''

def factorial(x, mod=10**9+7):
    
    
    
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''
"
def gcd(a, b):
    while b:
        
        
        a, b = b, a % b
    return a

"
def lcm(a, b):
    return a * b // gcd (a, b)

"
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table











'''
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv...\xaf\xb0...
lowercase = 'abcdefghijklmnopqrstuvwxyz'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace = '\t\n\x0b\x0c\r '
'''
'''
引数endに任意の文字列を指定すると、その文字列が改行の代わりに最後に挿入される。例えば連続するprint()の出力を改行なしで単純に連結したい場合は空文字列''を指定すればよい。

print('abc', end='---')
print('xyz')


print('abc', end='')
print('xyz')

source: print_basic.py
なお、デフォルトで改行されるのは引数endのデフォルト値が改行文字'\n'に設定されているから。
'''

def main():
    n=3
    steps=0
    state=0
    w=1
    j=0
    k=0
    
    
    
    h1,m1,h2,m2,k=map(int, input().split(" "))
    sh=60*h1+m1
    enh=60*h2+m2
    print(enh-sh-k)
    
    
    
    
    
    
    


    
    
     

    l = ['aaa', 'bbb', 'ccc']
    x=l.index('aaa')
    
    
    
    

    
        
    
    

    
    
    
    
    DP = np.zeros(w+1, dtype=int)
    exdp=np.zeros((3,4)) 
    
    
    
        
        
    
    
        
        
    


    
    



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]
    

    ls = ["a", "b", "c", "d", "e"]


    
    

    
    

    
    
    
    
    
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

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

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

print(time - k)

Solution (Python):
n,m,nn,mm,k=map(int,input().split())
start=n*60+m
end=nn*60+mm
if end-start > k:
    print(end-start-k)
else:
    print(0)

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

""" Input
S = input().rstrip()
N = int(input())
A = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""

H, M, H_2, M_2, K = map(int, input().split())

mae = H * 60 + M
ato = H_2 * 60 + M_2

print(ato - mae - K)

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

hour = (h2 - h1) if m2 >= m1 else (h2-h1-1)
minute = m2 - m1 if m2 >= m1 else 60 + (m2 - m1)

ans = 60 * hour + minute - k

print(ans)

Solution (Python):
h_1, m_1, h_2, m_2, k = map(int, input().split())
time = (h_2-h_1)*60 + m_2-m_1
time -= k
if time < 0:
    time = 0
print(time)

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

awake = (H2 * 60 + M2) - (H1 * 60 + M1)
start = awake - K

print(start)

Solution (Python):




import sys
input = sys.stdin.readline



def main():
    HMK = list(map(int,input().split()))

    atime = HMK[2] * 60 + HMK[3] - HMK[0] * 60 - HMK[1]

    res = atime - HMK[4]

    print(res)



main()

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-k
print(ans)

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

Solution (Python):

H1,M1,H2,M2,K = map(int, input().split())
H=(H2-H1)*60
M=(M2-M1)
ans = K-(H+M)
print(abs(ans))

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

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

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

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

ans = ans -k
print(ans)

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

h=h2-h1
m=m2-m1

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

print(time-k)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    H1, M1, H2, M2, K = map(int, rl().split())
    
    t1 = H1 * 60 + M1
    t2 = H2 * 60 + M2
    ans = t2 - K - t1
    print(ans)


if __name__ == '__main__':
    solve()

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

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

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

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

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

Solution (Python):


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

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

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

Solution (Python):
def main():
    h1,m1,h2,m2,k = map(int,input().split())
    start = 60*h1+m1
    end = 60*h2+m2
    
    total = 0
    for i in range(start,end+1):
        if i+k < end:
            total += 1

    print(total)

main()

Solution (Python):
import sys
import math

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

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

ans=max(m-K,0)

print(ans)

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

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

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

print(ans)

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

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

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

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

st = H_1*60 + M_1
end = H_2*60 + M_2

tmp = end - K

print(tmp - st)

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

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

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

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

ans = f-s-k

print(ans)

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

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

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

print( max(0, 60*(h-H) + m - M - K) )

Solution (Python):


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

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

ans = n2 - n1 -k

print(ans)

Solution (Python):

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

mae = 60 * H1 + M1
ato = 60 * H2 + M2

zen = ato - mae

print(zen - K)

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

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

print(b-K-a)

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

if v1 <= v2:
    ans = v2 - v1 - K
else:
    v1 += 24 * 60
    ans = v2 - v1 - K
print(ans)

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

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

Solution (Python):


import math
import re
import numpy as np

line = input().split(" ")

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


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

diff = sleep - wake_up
ans = diff - k

print(ans)

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

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

if t <= 0:
    print('0')
else:
    print(t)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6) 
import math
from copy import copy, deepcopy
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque 


from collections import Counter

from itertools import accumulate

from heapq import heapify,heappop,heappush




def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N=len(v)
    size=len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def main():
    mod = 10**9+7
    

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

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






if __name__ == "__main__":
    main()

Solution (Python):















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

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

waketime = end - start

if waketime >= k:
    print(waketime - k)
else:
    print(0)

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

Solution (Python):
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


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


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    h1 , m1, h2, m2, k = MAP()
    time = 60 * (h2 - h1) + (m2 - m1)
    print(max(0, time-k))



if __name__ == '__main__':
    main()

Solution (Python):



from collections import defaultdict

import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange



	
def print_case_iterable(case_num, iterable):
	print("Case 

def print_case_number(case_num, iterable):
	print("Case 

def print_iterable(A):
	print (' '.join(A))

def read_int():
	return int(f.readline().strip())
def read_int_array():
	return [int(x) for x in f.readline().strip().split(" ")]
def rns():
	a =  [x for x in f.readline().split(" ")]
	return int(a[0]), a[1].strip()
def read_string():
	return list(f.readline().strip())
def bi(x):
	return bin(x)[2:]





from collections import deque
import math


def solution(h1,m1,h2,m2,k):
	return 60*(h2-h1) + (m2-m1) - k
	
			


def main():
	T = 1
	for i in range(T):
		h1,m1,h2,m2,k = read_int_array()
	
		x = solution(h1,m1,h2,m2,k)

		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			print >>output,str(x)
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()

if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()




if __name__ == '__main__':
	main()

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

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

print(t)

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

FT = H1 * 60 + M1
LT = H2 * 60 + M2

T = LT - FT
if T > K:
    print(T - K)
else:
    print(0)

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

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

print(hm2-hm1-k)

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

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

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


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

can_last = sleep_minute -k
print(can_last-wake_minute)

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

Solution (Python):

import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

H1, M1, H2, M2, K = map(int, read().split())
start = H1 * 60 + M1
end = H2 * 60 + M2

gap = end - start

res = gap - K

print(res)

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

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

Solution (Python):
start_h, start_m, end_h, end_m, K = [int(s) for s in input().split()]

time = (end_h - start_h) * 60 + end_m - start_m
print(time - K)

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



def main():
    H1, M1, H2, M2, K = [int(i) for i in input().strip().split()]
    return (H2*60 + M2) - (H1*60 + M1) - K


if __name__ == "__main__":
    print(main())

Solution (Python):
H,M,K,T,S = map(int,input().split())
print(max(((K*60+T-H*60-M-S)+1440)%1440,0))

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

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

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

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

print(ans)

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

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

print(x2-x1-K)

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

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

Solution (Python):

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

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

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

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

Solution (Python):


a,b,c,d,e = map(int,input().split())
p = a * 60 + b
q = c * 60 + d
x = q - p
print(x - e)

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

Solution (Python):
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
def Yes(x):print("Yes")if x==True else print("No")
h1,m1,h2,m2,k=NM()
x=h1*60+m1
y=h2*60+m2
if y>x:
    print(y-x-k)
else:
    print(y+60*24-x-k)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    H,M,H2,M2,K=MI()
    B = H2*60 + M2
    A = H*60+M
    print(max(0, B-K-A))
if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
import math
from collections import deque
import heapq
import itertools
MAX_INT = int(10e25)
MIN_INT = -MAX_INT
mod = 998244353
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

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

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

print(total- k)

Solution (Python):

import sys


def solve(H: "List[int]", M: "List[int]", K: int):
    assert H[0] <= H[1]
    t1 = 60 * H[0] + M[0]
    t2 = 60 * H[1] + M[1]
    
    return max(0, t2 - t1 - K)


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))  
    print(solve(H, M, K))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

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

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

dh = H2 - H1
dm = M2 - M1

d = dh * 60 + dm
print(d - K)