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

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

print(tmp)

Submission status: Accepted

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

Submission status: Accepted

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

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

if (wake > k):
    ans = wake - k
else:
    ans = 0

print(ans)

Submission status: Accepted

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

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

if x<0:
    x=x+1440
print(x)

Submission status: Accepted

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

available_time = all_time - K
print(available_time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sh,sm,fh,fm,k = map(int,input().split())
h = 0
m = 0
ans = 0

if sm > fm:
    h = 60*(fh-sh)
    m = sm -fm
    ans = h - m - k
else:
    h = 60*(fh-sh)
    m = fm -sm
    ans = h + m - k  

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

if s < 0:
    s = 0

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

study_time = (h_time * 60 + m_time) - k
if study_time <= 0:
    print(0)
else:
    print(study_time)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    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())
print(60*(h_2-h_1)+m_2-m_1-k)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
z=list(map(int,input().split(" ")))
h1=z[0]
t1=z[1]
h2=z[2]
t2=z[3]
m=z[4]
p=h1*60+t1
q=h2*60+t2
print(q-p-m)

Submission status: Accepted

Solution code:
h,m,e_h,e_m,k = list(map(int,input().split()))
h = h*60
e_h = e_h*60

print((e_h+e_m)-(h+m)-k)

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    H1, M1, H2, M2, K = iim()

    hm1 = H1 * 60 + M1
    hm2 = H2 * 60 + M2

    if hm1 > hm2:
        hm2 += 24 * 60
    diff = hm2 - hm1


    print(diff -K)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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:
from sys import stdin, stdout  
  
def main(): 
	#N = int(stdin.readline().rstrip())
	#for tc in range(N):
	h1, m1, h2, m2, k  = [int(x) for x in stdin.readline().split()]
	
	totalMin = (((h2 - h1) * 60 ) - m1) + m2
	ans = totalMin - k
	stdout.write(str(ans)+'\n')

if __name__ == "__main__": 
	main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(study_time)

Submission status: Accepted

Solution code:
import datetime

if __name__ == "__main__":
    H1, M1, H2, M2, K = [int(a) for a in input().split()]
    dt_start = datetime.datetime(year=2020, month=5, day=30, hour=H1, minute=M1, second=00)
    dt_end= datetime.datetime(year=2020, month=5, day=30, hour=H2, minute=M2, second=00)
    up_time = dt_end - dt_start
    sec = up_time.total_seconds()  - K * 60
    print(int(sec/60))

Submission status: Accepted

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

print(res - k)

Submission status: Accepted

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

h = h2 - h1

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

working_time = h*60 + m

print(working_time - k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest


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

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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10 0 15 0 30"""
        output = """270"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10 0 12 0 120"""
        output = """0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

oki = (H_2 - H_1) * 60

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

print(time)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import sys

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

# 実行環境(0:vscode, 1:atcoder)
MODE = 1

# 入力の次元
DIMENSION = 1

# int型に変換
INT_TYPE = 1

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

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

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

Submission status: Accepted

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

hour = K // 60
min = K % 60

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

print(min2 - min1 - K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8
h1, m1, h2, m2, k = map(int, input().split())

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

h3 = h2 - k_h
m3 = m2 - k_m

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

print(end - start)

Submission status: Accepted

Solution code:

import sys
import math
import itertools
import collections

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

    h_diff = h2 - h1
    m_diff = m2 - m1

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

    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

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


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

Submission status: Accepted

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

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

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

t = t - k

print(t)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(m-K)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(t-X[4])

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K=map(int,input().split())
x=(H2-H1-1)*60
y=(60-M1)+M2
summ=x+y
print(summ-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())
s = (h2 * 60 + m2) - (h1 * 60 + m1)
if s > k:
    print(s - k)
else:
    print(0)

Submission status: Accepted

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
A = 60*H1 + M1
B = 60*H2 + M2
print(max(B-A-K, 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)
print(ans-k)

Submission status: Accepted

Solution code:
a = input()

a=a.split()

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

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

print(av_m)

Submission status: Accepted

Solution code:
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#ans = [0]*n
h1, m1, h2, m2, k = map(int, input().split())

h = h2 - h1

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

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

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

needHour = k//60
needMin = k%60

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Fall 7, Stand 8...
# !/ankit_SM/bin/env python

from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

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

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


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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

##############################################################################################################
BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

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

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

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

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


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


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



if __name__ == "__main__":
    main()

Submission status: Accepted

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

h = c - a
m = d - b

print(h*60+m-k)

Submission status: Accepted

Solution code:
import datetime

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

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

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

study = datetime.timedelta(minutes=k)

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

print(result)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque
from collections import defaultdict

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

z = y - x

r = z - a[4]

print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

#N = int(input())
h1,m1,h2,m2, k = map(int,input().split())
#al = list(map(int,input().split()))



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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

##main#######################################

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

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

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

last=h2-k

#ans=int(oki/k)*k
#print(str(int(last/60)) + ':' + str(last%60))
if last<=h1:
	print(0)
else:
	print(last - h1)

Submission status: Accepted

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

Submission status: Accepted

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

h = h2 - h1
m = m2 - m1

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

h1 , m1 , h2 , m2 , k = map(int , input().split())
hr = h2-h1
m = m2-m1
#print(hr,m)
diff = hr*60+m
ans = diff - k
#print(diff1,diff2,diff,ans)
if ans <=0:
	print(0)
else:
	print(ans)

Submission status: Accepted

Solution code:
from datetime import datetime
from sys import stdin


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

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


main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

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:
lst = list(map(int,input().split()))
time1 = lst[0:2]
time2 = lst[2:4]

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

ans = time3 - lst[-1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

answer = A2 - A1 - K

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(endTime - startTime - studyTime)

Submission status: Accepted

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

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

Submission status: Accepted

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