Problem:


Score : 100 points

Problem Statement

In this problem, we use the 24-hour clock.

Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.)
He has decided to study for K consecutive minutes while he is up.
What is the length of the period in which he can start studying?

Constraints

0 \le H_1, H_2 \le 23

0 \le M_1, M_2 \le 59

The time H_1 : M_1 comes before the time H_2 : M_2.

K \ge 1

Takahashi is up for at least K minutes.

All values in input are integers (without leading zeros).

Input

Input is given from Standard Input in the following format:

H_1 M_1 H_2 M_2 K

Output

Print the length of the period in which he can start studying, as an integer.

Sample Input 1

10 0 15 0 30

Sample Output 1

270

Takahashi gets up at exactly ten in the morning and goes to bed at exactly three in the afternoon.
It takes 30 minutes to do the study, so he can start it in the period between ten o'clock and half-past two. The length of this period is 270 minutes, so we should print 270.

Sample Input 2

10 0 12 0 120

Sample Output 2

0

Takahashi gets up at exactly ten in the morning and goes to bed at exactly noon. It takes 120 minutes to do the study, so he has to start it at exactly ten o'clock. Thus, we should print 0.



Sample input:
10 0 15 0 30


Sample output:
270

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1,m1,h2,m2,k=[int(x) for x in input().split()]
t2=h2*60+m2
t1=h1*60+m1
rem=t2-t1
print(rem-k)

Submission status: Accepted

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

if M2 - M1 >= 0:
  M = M2 - M1
else:
  M = M2 - M1 + 60
  H -= 1
  
ans = H*60 + M - K

print(ans)

Submission status: Accepted

Solution code:
a, b, c, d, e = [int(i) for i in input().split()]
time = ((c * 60 + d)-(a * 60 +b)) #活動時間（分）
#print(time)
print(time-e)

Submission status: Accepted

Solution code:
from sys import stdin
import math
a=stdin.readline().split()
H1=int(a[0])
M1=int(a[1])
H2=int(a[2])
M2=int(a[3])
K=int(a[4])

if M2>=M1:
    min=M2-M1
    if H2>=H1:
        hour=H2-H1
    else:
        hour=H2+24-H1
else:
    min=M2+60-M1
    if H2-1>=H1:
        hour=H2-1-H1
    else:
        hour=H2+24-1-H1

elapsed=hour*60+min

print(elapsed-K)

Submission status: Accepted

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

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

Submission status: Accepted

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

if limit - getup <= 0:
  print(0)
else:
  print(limit - getup)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    
    (h1, m1, h2, m2, k) = [int(e) for e in lines[0].split(' ')]

    return (h1, m1, h2, m2, k)

def solve(h1, m1, h2, m2, k):
 
    mins = (h2 * 60 + m2) - (h1 * 60 + m1)

    result = max(mins - k, 0)


    return result

def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
h1,m1,h2,m2,x=map(int,input().split())
#a=list(map(int,input().split()))
a=h2-h1 
b=60-m1+m2 
a-=1
t=a*60+b-x
print(t)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
st = input()

l = st.split()
h1, m1, h2, m2, k = int(l[0]), int(l[1]), int(l[2]), int(l[3]), int(l[4])

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

print(time2-time1-k)

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


aa = (h2 + m2 - k) - h1 - m1
print(aa)

Submission status: Accepted

Solution code:
import sys
data = input().split()
start_hour = int(data[0])
start_min = int(data[1])
end_hour = int(data[2])
end_min = int(data[3])
study_min = int(data[4])
bit_min = (end_hour - start_hour) * 60 + end_min - start_min
ans = bit_min - study_min
print(ans)

Submission status: Accepted

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

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

print(sleep - wake - k)

Submission status: Accepted

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

if M_2 >= M_1:
    H = H_2 - H_1
    M = M_2 - M_1
else:
    H = H_2 - H_1 - 1
    M = 60 - M_1 + M_2

time = 60 * H + M
ans = time - K

print(str(ans))

Submission status: Accepted

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

S = int(h1*60+m1)
E = int(h2*60+m2)
print(E-S-k)

Submission status: Accepted

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

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

print(ans - k)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(max(time-K, 0))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(end-start-num[4])

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

if(m2>=m1):

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

modh = 24
modm = 60

h1,m1,h2,m2,k = map(int,readline().split())
ans = 0
m1 += k
while True:
    if h1+(m1//modm) < h2:
        ans += 1
    elif h1+(m1//modm) == h2 and m1%modm < m2:
        ans += 1
    else:
        break
    m1 += 1
print(ans)

Submission status: Accepted

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

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

res = h*60 + m - k
res = max(0,res)
print(res)

Submission status: Accepted

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

if m2 < m1:
    mm = m2 - m1
else:
    mm = m2 - m1

t = (h2 - h1) * 60 + mm

if t < m:
    print(0)
else:
    print(t - m)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(remain)

Submission status: Accepted

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

Submission status: Accepted

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

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

a=h2*60+m2-k

print(a-h1*60-m1)

Submission status: Accepted

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

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

diff = end - start

if diff < k:
    print(0)
else:
    ss = end - k
    print(ss-start)

Submission status: Accepted

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

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

Submission status: Accepted

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

H1_min = H1*60
H2_min = H2*60
HM1 = H1_min+M1
HM2 = H2_min+M2

HM = HM2 - HM1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":

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

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

Submission status: Accepted

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

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

run_time = active_time-k

print(run_time)

Submission status: Accepted

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

hour=h2-h1
minute=m2-m1
if minute<0:
  hour -= 1
  minute=60-m1+m2

ans = hour*60+minute-k
print(ans)

Submission status: Accepted

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

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

# print(h1, m1, h2, m2, k)

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

# print(start_m)
# print(end_m)
# print(okiteiru)

print(okiteiru - k)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def readInt():
    return list(map(int, input().split()))
    
h_1, m_1, h_2, m_2, k = readInt()
t_1 = h_1*60 + m_1
t_2 = h_2*60 + m_2
# print(t_1, t_2)
w_t = t_2 - t_1
print(w_t-k)

Submission status: Accepted

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

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

if j1 > j2:
    j1 += 24*60

ans = j2 - j1 - k

print(ans)

Submission status: Accepted

Solution code:
h1, m1, h2, m2, k = [int(i) for i in input().split()]
t1 = 60 * h1 + m1
t2 = 60 * h2 + m2
ans = t2 - t1 - k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if M1>M2:
    H = H2-H1-1
    M = 60+M2-M1
else:
    H = H2-H1
    M = M2-M1
time = H*60+M
if time>=K:
    print(time-K)
else:
    print(0)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力

if __name__ == "__main__":
    
    INPUT = list(map(int, input().split()))

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


    output = 0
    a1 = h1 * 60 + m1
    a2 = h2 * 60 + m2

    c = a2 - a1 - k


    print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = time[0] * 60 + time[1]
b = time[2] * 60 + time[3]
ans = b - time[4] - a

print(ans)

Submission status: Accepted

Solution code:
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        #または、quit(),os.exit()をして止める。

b = (listA[0][2]*60 + listA[0][3]) - (listA[0][0]*60 + listA[0][1]) - listA[0][4]
print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os, sys

str = input()

a, b, c, d, e = str.split(" ")

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

print(res)

Submission status: Accepted

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

time1=H1*60+M1
time2=H2*60+M2
dif=time2-time1

ans=dif-K
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ANS)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
H1,M1,H2,M2,K = list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

h1, m1, h2, m2, K = MAP()

hm1 = h1*60 + m1
hm2 = h2*60 + m2
diff = hm2 - hm1
ans = diff - K
print(ans)

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,d,k=map(int,input().split())
h=c-a
if d>=b:
  m=d-b
else:
  h-=1
  m=60+d-b
ans=60*h+m-k
if ans<0:
  ans=0
print(ans)

Submission status: Accepted

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

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

ans = Hsa + Msa - K

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

Submission status: Accepted

Solution code:
s = input().split()
s = [int(i) for i in s]

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections

h1,m1,h2,m2,k = map(int,sys.stdin.readline().split())

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""


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

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

if time <= K:
    print("0")

else:
    print(time-K)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

if result_time <= 0:
    print("0")
else:
    print(result_time)

Submission status: Accepted

Solution code:
def main ():
  hs, ms, he, me, sm = map(int, input().split())
  
  return (((he - hs) * 60) - ms + me) - sm


print(main())

Submission status: Accepted

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

Submission status: Accepted

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

print((h_2*60+m_2)-(h_1*60+m_1)-k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input()
a0=a.split()
h1=int(a0[0])
m1=int(a0[1])
h2=int(a0[2])
m2=int(a0[3])
k=int(a0[4])
t1=60*h1+m1
t2=60*h2+m2
t=t2-t1
print(t-k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

H1,M1,H2,M2,K=(int(x) for x in input().rstrip('\n').split())
sta = H1*60+M1
end = H2*60+M2
print(end-sta-K)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(x-k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print( (C-A)*60 -(B-D) -E )

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(L - S - K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMOD = 998244353;

if __name__ == "__main__":
    # sys.stdin = open("input.txt","r")  # <<<  ^o^  Comment this line  ^_^  >>>
    h1, m1, h2, m2, k = get_ints()
    if h2 < h1:
        h2 = 24 + h2
    min1 = h1 * 60 + m1
    min2 = h2 * 60 + m2
    print(min2 - min1 - k)


# #############################################################################
'''
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
>>> DO NOT PLAGIARISE.
TESTCASES:
'''

Submission status: Accepted

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

h = h2 - h1
m = m2 - m1

t = h*60 + m

print(t - k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

res = f*60 + g - a*60 - b
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


if h2 >= h1:
    mins = (h2 - h1) * 60 + m2 - m1
    ans = mins - k

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
import numpy as np
#n = int(input())
#n, m = map(int, input().split())
#for i in range(n):

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

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

t = time2-k
print(t-time1)

Submission status: Accepted

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

H = H2-H1
M = M2-M1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    H = (H2 - H1)*60
    M = (M2 - M1)

    if H + M - K > 0:
        print(H + M - K)
    else:
        print(0)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:

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

start = h1*60+m1
end = h2*60+m2
total = end - start - k

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

end = h2*60+m2
stt = h*60+m

print(end-stt-k)

Submission status: Accepted

Solution code:
import sys

def calcLength(H1, M1, H2, M2):
    return (H2-H1)* 60 + (M2-M1)


if(__name__ == "__main__"):
    HMKList = input().strip().split()
    H1 = int(HMKList[0])
    M1 = int(HMKList[1])
    H2 = int(HMKList[2])
    M2 = int(HMKList[3])
    K = int(HMKList[4])
    Time = calcLength(H1, M1, H2, M2)
    StudyTime = Time-K
    print(StudyTime)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from functools import lru_cache
 
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())

h1,m1,h2,m2,k=reads()
limit=(h2-h1)*60+m2-m1
res=0
if limit-k>=0:
    limit-=k
else:limit=0
print(limit)

Submission status: Accepted

Solution code:
def resolve():
    h1, m1, h2, m2, k = map(int, input().split())
    h = h2 - h1
    if h < 0:
        h += 24
    m = m2 - m1
    if m < 0:
        m += 60
        h -= 1

    print(h * 60 + m - k)

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
temp = input()
[h1, m1, h2, m2, k] = [int(comp) for comp in temp.split()]
t1 = h1 * 60 + m1
t2 = h2 * 60 + m2
print(t2-t1-k)

Submission status: Accepted

Solution code:
import string
import itertools as it
import math
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))


def sum_comb(n):
    result = []
    data = range(1,n+1)
    for i in range(len(data)):
        for j in range(i, len(data)):
            for k in range(j, len(data)):
                result.append([data[i], data[j], data[k]])
    return result

H1,M1,H2,M2 ,K = nums()
start = H1 * 60 + M1
end = H2 * 60 + M2
t = end - start
print(t - K)

Submission status: Accepted

Solution code:
[[h1, m1, h2, m2, k]] = [[*map(int, t.split())] for t in open(0)]

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


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