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:
#include <CodeforcesSolutions.h>
#include <ONLINE_JUDGE <solution.cf(contestID = "1359",problemID = "C",method = "GET")>.h>
"""
    Author : thekushalghosh
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################
    
def solve():
    a,b,c,d,k = invr()
    print(c * 60 + d - a * 60 - b - k)
        
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
    sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))

#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
fH, fM, sH, sM, K = map(int, input().split())

print(60 *(sH - fH) + sM -fM -K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
H1,M1,H2,M2,K = LI()
print(60*(H2-H1)+(M2-M1)-K)

Submission status: Accepted

Solution code:
#n=int(input())
h1,m1,h2,m2,k=map(int,input().split())
#a=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
#l=[list(input().split()) for i in range(n)]

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

Submission status: Accepted

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

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

print(end - front-k)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

a,b,c,d,h = map(int,input().split())
wake_up = 60*a+b
start_time = 60*c+d - h
print(start_time-wake_up)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
length = (h2 - h1) * 60 + m2 - m1
print(length - 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())
ans = (H2 - H1) * 60 + (M2 - M1) - K
print(ans)

Submission status: Accepted

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

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:
h_1,m_1,h_2,m_2,k = map(int,input().split())

time1 = h_1 * 60 +m_1

time2 = h_2 * 60 +m_2

time_dif = time2 - time1

print(time_dif-k)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

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())
diff = 60 * H2 + M2 - (60 * H1 + M1)
print(max(0, diff - K))

Submission status: Accepted

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

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

ans = abs((y-x)-k)
if ans < 0:
    ans = 0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
if h2 < h1:
    h2 += 24
x1 = h1 * 60 + m1
x2 = h2 * 60 + m2
print(x2 - x1 - 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:
h1,m1,h2,m2,k=map(int, input().split())
m1=60-m1
h1=h1+1
ans=(h2-h1)*60
ans=ans+m1+m2
print(ans-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())
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())
getup = 60*h1 + m1
gotobed = 60*h2 + m2
print(gotobed-getup-k)

Submission status: Accepted

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

resolve()

Submission status: Accepted

Solution code:
import sys, random, math
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
    inf = 10 ** 20

#    t = int(input())
#    t, a, b = map(int, input().split())
    t = 1
    
    for _ in range(1, t+1):
    #    print("Case #{}: ".format(_), end = '')
        
        h1, m1, h2, m2, k = map(int, input().split())
        m1 += h1*60
        m2 += h2*60
        print(m2-m1-k)
        
        
main()

Submission status: Accepted

Solution code:
def mips():
    return map(int,input().split())
def ii():
    return int(input())

H1,M1,H2,M2,K = mips()
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 = m2 + (h2 - h1) * 60 - m1 - k
print(max(0, ans))

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    H1, M1, H2, M2, K = [int(item) for item in input().split()]
 
    H = H2 -H1
    M = M2 -M1
    print(H*60 + M - K)
if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def solve():
  h1, m1, h2, m2, k = list(map(lambda x: int(x), input().split()))
  total_time = (h2 - h1) * 60 + m2 - m1
  return total_time - k

print(solve())

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

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

Submission status: Accepted

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

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

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

print(min - K)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

hour = h_2 - h_1

answer = hour * 60 + m_2 - m_1 - k

print(answer)

Submission status: Accepted

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

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

print((HM2 - HM1)-K)

Submission status: Accepted

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

Submission status: Accepted

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

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

M3 = M2 - M1
if M3 <= 0:
    M3 += 24 * 60

print(M3 - K)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
h1, m1, h2, m2, k = map(int, input().split())
print((h2 * 60 + m2) - (h1 * 60 + m1) - k)

Submission status: Accepted

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

if b < d:
    m = (c-a)*60 + (d-b)
else:
    m = (c-a-1)*60 + (60 - (b-d))

print(m-e)

Submission status: Accepted

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

Submission status: Accepted

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

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main(): 
    a,b,c,d,K = map(int,input().split())
    ans = 0
    if a == c:
        ans = (d - b - K)
    else:
        a += 1
        ans += 60 - b
        ans += (c - a) * 60 + d
        ans -= K
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
[HS,MS,HE,ME,T]=[int(i) for i in input().split()]
print(max(HE*60+ME-HS*60-MS-T,0))

Submission status: Accepted

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

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

naga -= k

print(naga)

Submission status: Accepted

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

Submission status: Accepted

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

H1,H2 = 60*H1,60*H2

AM = H1+M1
PM = H2+M2
ans = PM-AM-K
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

print(max(0,T-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:
h1, m1, h2, m2, k = map(int, input().split())
h = h2 - h1
if m2 >= m1:
    m = m2 - m1
else:
    m = m2 + 60 - m1
    h -= 1
ans = h * 60 + m - k
if ans <= 0 :
    ans = 0
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

S = 60 * H1 + M1
E = 60 * H2 + M2
print(E-S-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:
import sys
input = lambda: sys.stdin.readline().rstrip()

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


if M2 - M1 >= 0:
    tmp = (H2-H1) * 60 + (M2-M1)
else:
    tmp = (H2-H1-1) * 60 + 60+M2-M1

print(tmp - K)

Submission status: Accepted

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

if m1 > m2:
    x = (h2 - h1 - 1)*60 + m2 - m1 + 60 - k

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

print(x)

Submission status: Accepted

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

    start_min = H1 * 60 + M1
    end_min = H2 * 60 + M2 - K


    possible_min = end_min - start_min
    print(possible_min)

main()

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

#処理内容
def main():
	H1, M1, H2, M2, K = getlist()
	X = H2 * 60 + M2 - (H1 * 60 + M1)
	print(X - K)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
b0=input().split()
h1=int(b0[0])
m1=int(b0[1])
h2=int(b0[2])
m2=int(b0[3])
k=int(b0[4])

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

Submission status: Accepted

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

# h=k//60
# m=k%60

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = (H2 - H1 - 1) * 60

tmp = 60 - M1 + M2

print(ans + tmp - 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 = input().split()

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

Submission status: Accepted

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

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

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(max(0, t2 - K - t1))

Submission status: Accepted

Solution code:
#K = int(input())
HMK = list(map(int, input().split()))
#s = input().split()

#S = input()

st = HMK[0] * 60 + HMK[1]
et = HMK[2] * 60 + HMK[3]

print(et - st - HMK[4])

Submission status: Accepted

Solution code:
def task(h1, m1, h2, m2, k):
    t1 = h1 * 60 + m1
    t2 = h2 * 60 + m2
    t = t2 - t1
    print(max(0, t - k))
    #print(h1, m1, h2, m2, k)


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

Submission status: Accepted

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

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

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
def solve(h1, m1, h2, m2, k):
    res = (h2 - h1) * 60 + (m2 - m1) - k
    return res


def main():
    h1, m1, h2, m2, k = map(int, input().split())
    res = solve(h1, m1, h2, m2, k)
    print(res)


def test():
    assert solve(10, 0, 15, 0, 30) == 270
    assert solve(10, 0, 12, 0, 120) == 0


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

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

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

print(max(t2-t1-K, 0))

Submission status: Accepted

Solution code:
H_s, M_s, H_e, M_e, K = map(int, input().split())

time = (H_e - H_s) * 60 + (M_e - M_s) - K
print(time)

Submission status: Accepted

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

Submission status: Accepted

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

s=60*h1+m1
t=60*h2+m2-k

print(t-s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
inf = 10 ** 15
mod = 10 ** 9 + 7
h1,m1,h2,m2,k = map(int, input().split())
ans = ((h2-h1)*60+(m2-m1))-k
print(ans)

Submission status: Accepted

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

p=C-A
q=D-B

ren=p*60+q
if ren>=K:
  print(ren-K)
else:
  print(0)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t1, m1, t2, m2, study = map(int, input().split())

startz = t1*60+m1
endz = t2*60+m2

res = endz - startz - study
if res < 0: res = 0
print(res)

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

Submission status: Accepted

Solution code:
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# a, b = list(map(int, input().split()))
# s = input()

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

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

t = t2-t1
ans = max(0, t-K)
print(ans)

Submission status: Accepted

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

def input_one_number():
    return int(input())

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

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


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

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

print(m-k)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    h,m,H,M,K = list(map(int,input().split()))
    A = 60*H+M - (60*h+m)
    B = A - K
    print(B)
    
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())

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

    ans = time - K
    print(ans)


if __name__ == "__main__":
    main()

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 = map(int,input().split())

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

print(max(dt-K,0))

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())
#一行で入力された数値をそれぞれの変数に
#3つ以上も可

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

print(t2-t1-k)

Submission status: Accepted

Solution code:
ho,mo,ht,mt,k=map(int,input().split())
m=0
if mt<mo:
  ht=ht-1
  m+=mt+60-mo
else:
  m+=mt-mo
m+=(ht-ho)*60
print(m-k)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): 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 LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

h1,m1,h2,m2,k = MI()
res = (h2-h1)*60
res += m2-m1
print(res-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:
H1, M1, H2, M2, K = list(map(int, input().split()))

H1_m = H1 * 60
H2_m = H2 * 60

print((H2_m + M2) - (H1_m + M1) - K)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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())
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:
x = input().split()

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

print((h2-h1)*60+m2-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:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    h,m,hh,mm,k=map(int,input().split())
    val=(hh-1-h)*60+(mm+60-m)
    print(val-k)
    
resolve()

Submission status: Accepted

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

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

print(min - k)

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


data = inpl()
begin = data[0] * 60 + data[1]
end = data[2] * 60 + data[3]
print(max(0, end - begin - data[-1]))

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 = list(map(int , input().split()))
ans1 = (C*60 + D) - (A*60 +B) - E
if ans1 > 0:
    print(ans1)
else:
    print(0)

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

print((y - x) % (24 * 60) - k)

Submission status: Accepted

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

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62



def solve(H: "List[int]", M: "List[int]", K: int):
    start = H[0] * 60 + M[0]
    end = H[1] * 60 + M[1]
    print(end - start - K)
    return


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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
inputs = input().split(' ')
h1 = int(inputs[0])
m1 = int(inputs[1])
h2 = int(inputs[2])
m2 = int(inputs[3])
k = int(inputs[4])

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# 2020/05/30
# NOMURA プログラミングコンテスト 2020 - A

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

# Calc
hm1 = h1 * 60 + m1
hm2 = h2 * 60 + m2
ans = hm2 - hm1 - k

# Output
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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