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:
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import os
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from io import BytesIO, IOBase
from typing import Dict, List, Optional, Set, Tuple


def solve(values: List[int]) -> int:
    h1, m1, h2, m2, k = values
    wake_time = h1 * 60 + m1
    sleep_time = h2 * 60 + m2
    return sleep_time - k - wake_time


def do_job(stdin, stdout):
    "Do the work"
    LOG.debug("Start working")
    # first line is number of test cases
    values = list(map(int, stdin.readline().split()))
    # values = []
    # for _ in range(N):
    #     values.append(stdin.readline().split())
    result = solve(values)
    print(result, file=stdout)


def print_output(testcase: int, result, stdout) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result), file=stdout)
    # 6 digits float precision {:.6f} (6 is the default value)
    # print("Case #{}: {:f}".format(testcase + 1, result), file=stdout)


BUFSIZE = 8192


class FastIO(IOBase):
    # pylint: disable=super-init-not-called, expression-not-assigned
    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):
    # pylint: disable=super-init-not-called
    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 configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("L%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(IOWrapper(sys.stderr))
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None
# for interactive call: do not add multiple times the handler
if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    stdin = IOWrapper(sys.stdin)
    stdout = IOWrapper(sys.stdout)
    do_job(stdin, stdout)
    stdout.flush()
    for h in LOG.handlers:
        h.flush()
    return 0


if __name__ == "__main__":
    sys.exit(main())

Submission status: Accepted

Solution code:
a,s,d,f,g=map(int,input().split())
ans=0
ans=(d-a)*60+(f-s)-g
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
max_int = 1000000001  # 10^9+1
min_int = -max_int

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

diff = (h2 - h1) * 60 + m2 - m1
if diff < 0:
    diff += 60 * 24

print(max(diff - k, 0))

Submission status: Accepted

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

inval=(h2-h1)*60+(m2-m1)
print(inval-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:
h_1, m_1, h_2, m_2, k = map(int, input().split())
neru = 60 * h_2 + m_2
okiru = 60 * h_1 + m_1
okiteru = neru - okiru
print(okiteru - k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def time_to_min(H, M):
  return H * 60 + M


def resolve():
  H1, M1, H2, M2, K= map(int, input().split(" "))
  start = time_to_min(H1, M1)
  end = time_to_min(H2, M2)
  print(end - start - K)

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

f = (a*60)+b
g = (c*60)+d

print((g-f)-e)

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:
row = [int(i) for i in input().split()]
h1,m1,h2,m2,k = row[0],row[1],row[2],row[3],row[4]
waketime = (h2 - h1) * 60 + (m2 - m1) - k
print(waketime)

Submission status: Accepted

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

if d >= b:
    s = 60*(c-a) + d - b
else:
    s = 60*(c-a)  - (b -d) 
ans = s-k
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    h1, m1, h2, m2, k = geta(int)

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

    print(diff if diff > 0 else 0)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

s = int(n[0])*60+int(n[1])
e = int(n[2])*60+int(n[3])
t = e-s

print(t - int(n[4]))

Submission status: Accepted

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

if k <= m2:
    m2 -= k
else:
    h2 -= 1
    m2 += 60 - k

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

print(ans)

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:
i = list(map(int, input().split()))
H1 = i[0]
M1 = i[1]
H2 = i[2]
M2 = i[3]
studyM = i[4]

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

print(minute -studyM)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

# import sys
# import math
# sys.setrecursionlimit(10**8)
# INF = float('inf')
# PI = math.pi()
# from functools import lru_cache
# @lru_cache(maxsize=None)

# n = int(input())
h1, m1, h2, m2, k = map(int, input().split())
# c = list(map(int, input().split()))
# s = [list(map(int,list(input()))) for i in range(h)]

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

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())
print((h2-h1)*60+(m2-m1)-k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

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

Submission status: Accepted

Solution code:
hn = [int(i) for i in  input().split()]
hs = hn[0]
ms = hn[1]
he = hn[2]
me = hn[3]
k = hn[4]

sta = hs * 60 + ms
end = he * 60 + me

print(end-sta-k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if m_2 >= m_1:
    min = m_2 - m_1
else:
    min = 60 + m_2 - m_1
    h_2 -= 1

hour = h_2 - h_1

print(hour*60 + min - k)

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K=(int(x) for x in input().split())
H=H2-1-H1
M=M2+60-M1
T=H*60+M
ans=T-K
print(ans)

Submission status: Accepted

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

T1 = H1 * 60 + M1
T2 = H2 * 60 + M2
A = T2 - T1
print(A - K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def main():
    input = sys.stdin.buffer.readline
    h_1, m_1, h_2, m_2, k = map(int, input().split())
    min = h_2 * 60 + m_2 - (h_1 * 60 + m_1)
    print(min - k)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

def resolve():

    sh, sm, gh, gm , k = map(int,input().split())

    team = (gh*60 + gm) - (sh*60 + sm)

    print(team - k)



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
ans = ans + m2 - m1
print(ans - k)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    A,B,C,D,K = MAP()
    print(C*60+D-A*60-B-K)

    

if __name__ == '__main__':
    main()

Submission status: Accepted

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

h = h * 60 + m

h2 = h2 * 60 + m2

print(h2 - h - k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(t2 - t1 - k)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

h,m,hh,mm,k = map(int, input().split())

ss = h*60+m

ff = hh*60+mm

if ff-ss < 0:
    tmp = ff-ss + 24*60
else:
    tmp = ff-ss

ans = tmp - k

print(max(0,ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(H: "List[int]", M: "List[int]", K: int):
    hi = 0
    m = M[1] - M[0]
    
    if m < 0:
        hi = 1
        m = m+60

    h = H[1] - H[0] - hi
    if h < 0:
        h+=24
    
    print(h*60+m-K)


    return



# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = [int()] * (2)  # type: "List[int]"
    M = [int()] * (2)  # type: "List[int]"
    for i in range(2):
        H[i] = int(next(tokens))
        M[i] = int(next(tokens))
    K = int(next(tokens))  # type: int
    solve(H, M, K)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
h_1, m_1, h_2, m_2, k = map(int,input().split())
t_1 = 60 * h_1 + m_1
t_2 = 60 * h_2 + m_2
t = t_2 - t_1
print(t - k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

time1 = 60*H1 + M1
time2 = 60*H2 + M2
time = time2-time1
ans = time - K
if ans < 0:
  print(0)
else:
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

h_1_m=h_1*60+m_1
h_2_m=h_2*60+m_2
min=h_2_m-h_1_m-k
print(min)

Submission status: Accepted

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

st = h1*60 + m1
en = h2*60 + m2
t = (en-k)-st
print(t, end="")

Submission status: Accepted

Solution code:
line = input().rstrip().split()

start = 60*(int(line[0])) + int(line[1])
end = 60*(int(line[2])) + int(line[3])
range = end - start

rag = int(line[4])

answer = end - start -rag
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
	h1,m1,h2,m2,k = [int(x) for x in input().split()]
	o1 = h1 * 60 + m1
	o2 = h2 * 60 + m2
	print(max(0, (o2-o1-k)))

main()

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
H1,M1,H2,M2,K = (int(x) for x in input().split())
m1 =60*H1 +M1
m2 =60*H2 +M2
ans =m2 -K -m1
print(ans)

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K = map(int,input().split())
start=H1*60+M1
end=H2*60+M2
print(end-start-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:
a,b,c,d,e = map(int, input().split())
print(60*c + d - e - 60*a - b)

Submission status: Accepted

Solution code:
hw,mw,hs,ms,k=map(int,input().split())
waking=(hs*60+ms)-(hw*60+mw)-k
print(max(0,waking))

Submission status: Accepted

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

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

print(mins - K)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

#print(H1,M1,H2,M2,K)

# 開始時刻から終了時刻までの長さを分に変換し、勉強時間を減産する

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

#print("{0}分から{1}分まで勉強する".format(start, end))

goal = end - start - K

print(goal)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import string
import collections
from collections import Counter
from collections import deque


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
h1, m1, h2, m2, k = map(int, input().split())
h = (h2-h1)*60
m = (m2-m1)
sum = h+m
print(sum-k)

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 = map(int,input().split())
print(((h2-h1+24)%24)*60+m2-m1-k)

Submission status: Accepted

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

oki = H1*60 + M1
ne = H2*60 + M2

ans = 0
for i in range(oki, ne):
    if i + K < ne:
        ans += 1
print(ans)

Submission status: Accepted

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

h = h2 - h1
m = m2 - m1

minutes = h*60 + m

print(minutes-k)

Submission status: Accepted

Solution code:
def main():
    hs,ms,he,me,k = map(int,input().split())
    h = he - hs
    m = me - ms
    h *= 60
    if m >= 0:
        h += m
    else:
        h += m
    print(h - k)
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
H,M,HH,MM,K=map(int, input().split())

ans=(HH*60+MM)-(H*60+M)-K
print(ans)

Submission status: Accepted

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

former = 60 * inputs[0] + inputs[1]
latter = 60 * inputs[2] + inputs[3]

study_time = latter - inputs[4] - former

print(study_time)

Submission status: Accepted

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

if m1 <= m2:
    dh = h2 - h1
    dm = m2 - m1
else:
    dh = h2 - h1 -1
    dm = (60-m1) + m2

print(dh * 60 + dm - k)

Submission status: Accepted

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

A=a*60+b
C = c*60+d

print(C-A-k)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
ah, am, bh, bm, k = map(int, input().split())

ans = int((bh - ah)*60 + (bm - am))
ans -= k;

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from  collections import defaultdict

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

def solve(test):
	h1, m1, h2, m2, k = map(int, input().split())
	r1 = h1 * 60 + m1
	r2 = h2 * 60 + m2
	ans = max(0, r2 - r1 - k)
	print(ans)

if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)

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:
a,b,c,d,e = map(int,(input().split()))
s = a*60+b
g = c*60+d
print(g-s-e)

Submission status: Accepted

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

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

print(end- start - k)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if m1 > m2:
    m2 += 60
    h2 -=1
    ans_m = m2 - m1
else:
    ans_m = m2 - m1

ans_h = h2 - h1
ans = 60 * ans_h + ans_m

print(ans-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:
H, M, h, m, K = map(int, input().split())
print(60*h + m - 60*H - M - K)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

ans = time2 - K - time1
if ans < 0:
    ans = 0

print(ans)

Submission status: Accepted

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

print(min - K)

Submission status: Accepted

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

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

T = t2 - t1 - K
if T < 0:
  T += 24 * 60

print(T)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    h1, m1, h2, m2, k = map(int, args[0].split())
    return str((h2-h1)*60 + (m2-m1) - k)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    hs, ms, he, me, k = [int(i) for i in input().split()]
    h = he - hs
    m = 0
    if me >= ms:
        m = me - ms
    else:
        h -= 1
        m = 60 + me - ms
    print(h * 60 + m - k)


resolve()

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())
if m2<m1:
  ans=60*(h2-h1-1)+60-(m1-m2)-k
else:
  ans=60*(h2-h1)+m2-m1-k
if ans>=0:
  print(ans)
else:
  print(0)

Submission status: Accepted

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

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,S = map(int,input().split())
if M2 >= M1:
    h = H2 - H1
    m = M2 - M1
else:
    m = M2 + 60 -M1
    h = H2 -1 - H1
print(max(h*60+m-S,0))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(TL-K)

Submission status: Accepted

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

time = 0

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

print(end-K-start)

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:
#A
H,M,A,B,K=map(int,input().split())
C=0
C+=(A-H)*60
C+=B-M-K
print(C)

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

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

print(ans)

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

if t3 - t1 <= 0:
  print(0)
else:
  print(t3-t1)

Submission status: Accepted

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

h1,m1,h2,m2,k=map(int,input().split())
H=(h2-h1)*60
M=m2-m1
time=H+M


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

Submission status: Accepted

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

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

print(duration - K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(nagasa - k)

Submission status: Accepted

Solution code:
n,m,a,b,k=map(int,input().split())
if b < k:
    a-=1
    b+=60
ans = a-n
anss = ans*60+b-m-k
print(str(anss))

Submission status: Accepted

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

time1 = 60*H1 + M1
time2 = 60*H2 + M2
time = time2-time1
ans = time - K
if ans < 0:
  print(0)
else:
  print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

h = h2-h1
m = m2-m1

time = h*60 + m

print(time-k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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