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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a=LIST()
if a[1]<=a[3]:
    print((a[2]-a[0])*60+(a[3]-a[1])-a[-1])
else:
    print((a[2]-a[0]-1)*60+(a[3]-a[1]+60)-a[-1])

Submission status: Accepted

Solution code:
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))


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

Submission status: Accepted

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

term = sleep - wake

print(term-K)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


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

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

print(max(0, c2-c1-k))

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:
H1,M1,H2,M2,K=map(int,input().split())
t=(H2-H1)*60+(M2-M1)-K
print(t)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    H1, M1, H2, M2, K = Scanner.map_int()
    ans = (H2 - H1) * 60
    ans += (M2 - M1)
    ans = max(0, ans - K)
    print(ans)


def main():
    # sys.stdin = open("sample.txt")
    # print('YNEOS'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

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

Submission status: Accepted

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


def read():
    H1, M1, H2, M2, K = map(int, input().strip().split())
    return H1, M1, H2, M2, K


def solve(H1, M1, H2, M2, K):
    m1 = H1 * 60 + M1
    m2 = H2 * 60 + M2
    return m2 - m1 - K


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

print(end - st - k)

Submission status: Accepted

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
run = (H2 - H1) * 60 + (M2 - M1)
print(run - 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:
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:
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
def main():

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

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

    if b-a < K:
        return 0
    return b-a-K


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

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:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    h1, m1, h2, m2, k = mi()
    print((h2-h1)*60+(m2-m1) - k)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


mod=1000000007
def combinations_count_mod(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x,y: x*y%mod, range(n, n - r, -1), 1)
    denom = pow( reduce(lambda x,y: x*y%mod, range(1, r + 1), 1) , mod-2, mod)
    return numer * denom % mod


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



if __name__ == '__main__':
    main()

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

ans = time - K

print(max(ans, 0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

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


yes = "Yes"
no = "No"


def main():
    h1,m1,h2,m2,k = mi()
    ans = (h2-h1)*60+m2-m1-k
    print(ans)




main()

Submission status: Accepted

Solution code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

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

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

print(smin-K)

Submission status: Accepted

Solution code:
HA,MA,HB,MB,K=map(int,input().split())

result=60*HB+MB-(60*HA+MA)-K

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

# 2darray [[0] * 4 for i in range(3)]

Submission status: Accepted

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

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

a=e-s

print(a-k)

Submission status: Accepted

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

a1 = H1*60+M1
a2 = H2*60+M2

print(a2-a1-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())

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

print(ans)

Submission status: Accepted

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

A = 60 * H1 + M1
B = 60 * H2 + M2

ans = max(0, B - A - K)

print (ans)

Submission status: Accepted

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


h = H2- H1
m = M2 - M1

time = h*60 + m


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

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

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

print(a-K)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

    h,m,h1,m1,k = tuple([int(t)for t in input().split()])

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h1,m1,h2,m2,k=LI()
  a=(h2-h1)*60
  a+=m2-m1

  return max(0,a-k)

# main()
print(main())

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

MS1 = H1 * 60 + M1
MS2 = H2 * 60 + M2

print(MS2 - MS1 - K)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def examA():
    H1, M1, H2, M2, K = LI()
    T = (H2-H1)*60 + (M2-M1)
    ans = T-K
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict
    # from collections import deque
    # from collections import Counter
    # import numpy as np
    # import math
    # import random
    input = stdin.readline

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(H1, M1, H2, M2, K):
    d = (H2-H1) * 60
    d += (M2-M1)
    return d - K


def main():
    H1, M1, H2, M2, K = read_int_n()
    print(slv(H1, M1, H2, M2, K))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

H = H2 - H1
M = M2 - M1

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

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

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = max(t2 - k - t1, 0)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

Submission status: Accepted

Solution code:
def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))

def solve():
    h1, m1, h2, m2, k = mput()
    hoge = h1*60+m1
    huga = h2*60+m2-k
    piyo = huga - hoge
    print(piyo)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

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

print(m)

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:
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
#m = int(input())
h1, m1, h2, m2, k = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

a = h2 - h1
b = m2 - m1

print(60 * a + b - k)

Submission status: Accepted

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

Submission status: Accepted

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


def readstr():
    return input().strip()


def readint():
    return int(input())


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


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


def main():
    H1, M1, H2, M2, K = readnums()
    H2 -= 1
    M2 += 60
    print((H2 - H1) * 60 + (M2 - M1) - K)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    H1, M1, H2, M2, K = [int(x) for x in 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())

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

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
print(t2-t1-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:
import sys
input=sys.stdin.readline
h1,m1,h2,m2,k=map(int,input().split())
b=60*h1+m1
a=60*h2+m2
ans=a-b-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

print(max(0,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():
    h,M,h2,M2,K=map(int,input().split())
    left=(h2-h)*60+M2-M
    print(left-K)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

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

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

t = t2-t1

print(max(t-k,0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B, C, D, K = list(map(int,input().split()))
a = 60 * A + B
b = 60 * C + D
c = b - a
ans = c - K
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    h1,m1,h2,m2,k=MI()
    T=(h2-h1)*60+(m2-m1)
    print(T-k)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, d, K = map(int, input().split())
A = c * 60 + d - a * 60 - b
print(max(A - K, 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:
import sys
input = sys.stdin.readline

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

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