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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

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

sa = (C-A) * 60 + D-B

print (sa - E)

Submission status: Accepted

Solution code:
"""    Arnab Chanda    """

from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
import heapq

int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline().split()
multi_int_input =lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input=lambda : list(map(int,stdin.readline().split()))
string_list_input=lambda: list(string_input())
MOD = pow(10,9)+7


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

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

print(start - k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b,c,d,k = map(int,stdin.readline().rstrip().split())

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

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

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

Submission status: Accepted

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


def solve(H: "List[int]", M: "List[int]", K: int):
    okiru=H[0]*60+M[0]
    neru=H[1]*60+M[1]
    print(neru-okiru-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,M,h,m,K=map(int,input().split())
print((h-H)*60+m-M-K)

Submission status: Accepted

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

Submission status: Accepted

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


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


def solve():
    h1, m1, h2, m2, k = IL(int)
    all_time = (h2 * 60 + m2) - (h1 * 60 + m1)
    print(all_time - k)


solve()

Submission status: Accepted

Solution code:
h,m,H,M,K = [int(i) for i in input().split()]
T = 60*(H-h) + (M-m) - K
print(T)

Submission status: Accepted

Solution code:

import collections


def solve(h1, m1, h2, m2, k):
    mins1 = h1*60 + m1
    mins2 = h2*60 + m2

    return mins2-mins1-k


[h1, m1, h2, m2, k] = list(map(int, input().strip().split()))

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

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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] = [int(n) for n in input().split()]
D1 = H1 * 60 + M1
D2 = H2 * 60 + M2

print(D2 - K - D1)

Submission status: Accepted

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

wakeup = (hh-h)*60 + mm - m

print(wakeup-k)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())[:-1]
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [list(input())[:-1] for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
H1,M1,H2,M2,K = map(int,input().split())
num = 0
num += 60 - M1
H1 += 1
num += M2
num += (H2-H1)*60
print(num-K)

Submission status: Accepted

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

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

print(gg-ss-k)

Submission status: Accepted

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

Submission status: Accepted

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


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

if(m2 - m1):
    time = m2 - m1
else:
    time = 1440 - m1 + m2

ans = max(time - k, 0)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(max(0, ans))

Submission status: Accepted

Solution code:
from sys import exit

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

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

print(max(0,(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())

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

Submission status: Accepted

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

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

print(hm2 - hm1 - k)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    H1, M1, H2, M2, K = map(int, input().split())
    a = M1 + H1 * 60
    b = M2 + H2 * 60
    if b-a < K:
        print(0)
    else:
        print(b-a-K)
    


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

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

po = h2-h1
poo = m2-m1

if poo < 0:
	po -= 1
	poo += 60


print(po*60+poo-k)

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
Hs, Ms, He, Me, K = [int(x) for x in input().split()]
M = He * 60 + Me - (Hs * 60 + Ms) - K
print(M)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(t2-t1-k)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    H1,M1,H2,M2,K = map(int, input().split())
    if M2>=M1:
        print((H2-H1)*60+M2-M1-K)
    else:
        print((H2-H1-1)*60+60+M2-M1-K)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

# print('-----output-----')
print(ne - oki - 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:
H,M,h,m,K=map(int,input().split())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")

MOD = 1000000007

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def combination(m,n):
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def main():
    a, b, c, d, e = [int(x) for x in stdin.readline().rstrip().split()]
    start = a*60 + b
    end = c*60 + d
    print(end - start - e)

main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

T1 = H1 * 60 + M1
T2 = H2 * 60 + M2
T2_minus_K = T2 - K

print(max(T2_minus_K - T1, 0))

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:
A,B,C,D,E = map(int,input().split())

g = A*60+B
s = C*60+D

s -= E
ans = s-g
print(ans)

Submission status: Accepted

Solution code:
sh, sm, eh, em, k = map(int, input().split())
s = sh * 60 + sm
e = eh * 60 + em
e -= k
print(e-s)

Submission status: Accepted

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

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

    print(max([ans, 0]))


if __name__ == "__main__":
    main()

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())
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())
time = h_1 * 60 + m_1
print(h_2 * 60 + m_2 - time - k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K=list(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())

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

print(f-s-k)

Submission status: Accepted

Solution code:
Hs,Ms,He,Me,K = map(int,input().split())
print(((He*60 + Me) - (Hs*60 + Ms)) - K) if (((He*60 + Me) - (Hs*60 + Ms)) - K) > 0 else print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import math
#=input()
#=int(input())
h1,m1,h2,m2,k=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

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

ans = (t2 - t1) - k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

i = h2 * 60 + m2 - (h * 60 + m)

print(i-k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
print(max(0,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())
m_1_1 = h_1 * 60 + m_1
m_2_1 = h_2 * 60 + m_2
m = m_2_1 - m_1_1 - k
print(m)

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    H1,M1,H2,M2,K = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = max((H2*60+M2)-(H1*60+M1)-K,0)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
from math import gcd, ceil
from collections import deque
# queueとして使う場合 push, popleftを使う
from bisect import bisect_left, bisect_right
# bisect_left: 配列の順序関係が崩れない条件で挿入することができる一番左の点
# bisect_right: 配列の順序関係が崩れない条件で挿入することができる一番右の点
# A = [1, 1, 1, 2, 2, 2, 4]
# print(bisect_left(A, 2))  # 3
# print(bisect_right(A, 2))  # 6
# print(bisect_left(A, 3))  # 6
# print(bisect_right(A, 3))  # 6


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


if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:

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

h1 = 60*li[0]+li[1]
h2 = 60*li[2]+li[3]
print(h2-h1-li[-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3

LI = lambda: list(map(int, input().split()))

# input
H1, M1, H2, M2, K = LI()


def main():
    x = H1 * 60 + M1
    y = H2 * 60 + M2
    ans = y - x - K
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

if H1>H2:
    H2+=24

ans=H2*60+M2-(H1*60+M1)
ans-=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())
start = h2 * 60 + m2 - k
time = h1 * 60 + m1
ans = start - time
print(ans)

Submission status: Accepted

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
from fractions import gcd
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

from itertools import permutations
from math import factorial, hypot

#############
# Main Code #
#############

H1, M1, H2, M2, K = getNM()
opt1 = H1 * 60 + M1
opt2 = H2 * 60 + M2
print(abs(opt2 - opt1) - K)

Submission status: Accepted

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

Submission status: Accepted

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

t1 = h*60 + m
t2 = h2*60 + m2

ret = t2 - t1 - k
print(ret)

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

def solve():
    input = sys.stdin.readline
    A, B, C, D, K = map(int, input().split())
    f = A * 60 + B
    s = C * 60 + D
    print(s - f - K)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion
h1, m1, h2, m2, k = ri_()
a1 = h1 * 60 + m1
a2 = h2 * 60 + m2
print(a2 - a1 - k)

Submission status: Accepted

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

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

h1,m1,h2,m2,k = ip()
t2 = h2*60 + m2
t1 = h1*60 + m1
print(t2-t1-k)

Submission status: Accepted

Solution code:
import math

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

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

m2 -= k

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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


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



if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

h1,m1,h2,m2,k = mp()
hun1 = h1*60+m1
hun2 = h2*60+m2
print(hun2-hun1-k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    Hs, Ms, He, Me, K = map(int, readline().split())
    ans = (He-Hs)*60 + (Me-Ms) -K
    print(max(ans,0))
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

ti = ni - mo - k
print(ti)

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

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

val = 0
val += (h2 - h1) * 60
val += m2 - m1

print(val - k)

Submission status: Accepted

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

T1 = H1*60+M1
T2 = H2*60+M2

if T2-T1>=K:
    print(T2-T1-K)
else:
    print(0)

Submission status: Accepted

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

diff = ((H2 - H1) * 60 + (M2 - M1)) % (24 * 60)
print(diff - K)