Problem:


Score : 100 points

Problem Statement

In this problem, we use the 24-hour clock.

Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.)
He has decided to study for K consecutive minutes while he is up.
What is the length of the period in which he can start studying?

Constraints

0 \le H_1, H_2 \le 23

0 \le M_1, M_2 \le 59

The time H_1 : M_1 comes before the time H_2 : M_2.

K \ge 1

Takahashi is up for at least K minutes.

All values in input are integers (without leading zeros).

Input

Input is given from Standard Input in the following format:

H_1 M_1 H_2 M_2 K

Output

Print the length of the period in which he can start studying, as an integer.

Sample Input 1

10 0 15 0 30

Sample Output 1

270

Takahashi gets up at exactly ten in the morning and goes to bed at exactly three in the afternoon.
It takes 30 minutes to do the study, so he can start it in the period between ten o'clock and half-past two. The length of this period is 270 minutes, so we should print 270.

Sample Input 2

10 0 12 0 120

Sample Output 2

0

Takahashi gets up at exactly ten in the morning and goes to bed at exactly noon. It takes 120 minutes to do the study, so he has to start it at exactly ten o'clock. Thus, we should print 0.



Sample input:
10 0 15 0 30


Sample output:
270

Submission status: Accepted

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

def solve(H: "List[int]", M: "List[int]", K: int):
    d_start = datetime.datetime(year=2000, month=1, day=1,hour=H[0], minute=M[0])
    d_end = datetime.datetime(year=2000, month=1, day=1,hour=H[1], minute=M[1])

    study_end = d_end - datetime.timedelta(minutes=K)

    ans = study_end - d_start
    print(ans.seconds // 60)
    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:
a, b, c, d, k = map(int, input().split())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10**7)

ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

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

m1 += k
if m1 // 60 != 0:
    h1 += m1 // 60
    m1 %= 60

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

print(t2 - t1)

Submission status: Accepted

Solution code:
# s = input()
# n = int(input())
h1, m1, h2, m2, k = map(int, input().split())
# l = list(map(int, input().split()))
if m1 <= m2:
    t = (h2 - h1)*60 + m2 - m1
else:
    t = (h2 - h1 - 1)*60 + (60 - abs(m1 - m2))
# if t <= k:
#     print(0)
# elif t%k == 0:
#     print(t - k)
# else:
#     print(t - t%k)

print(max(0, t-k))

Submission status: Accepted

Solution code:

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

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

R=A2-K-A1
print(R)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K = map(int,input().split())
hh1 = H1*60 + M1
hh2 = H2*60 + M2
if hh1 < hh2:
  sl = hh1 + 60*24 - hh2
else:
  sl = hh1 - hh2

time = 24*60 - sl - K
print(time)

Submission status: Accepted

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

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

Submission status: Accepted

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

hour = (C - A) * 60
min = D - B
cnt = hour + min - E

print(cnt)

Submission status: Accepted

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

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

h = h2_m-h1_m
h = h - k
print(h)

Submission status: Accepted

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

import datetime
dt1 = datetime.datetime(year=2020, month=5, day=29, hour=H1, minute=M1)
dt2 = datetime.datetime(year=2020, month=5, day=29, hour=H2, minute=M2)

tmp = dt2 - datetime.timedelta(minutes=K)
tmp2 = dt2 - dt1
ans = (tmp - dt1).total_seconds() / 60

if (tmp2.total_seconds()) <= 0:
        print(0)
        exit()
else:
        print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    standing=sleep-stand

    res=standing-K
    print(res)

if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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:
from datetime import datetime, timedelta
h1, m1, h2, m2, k = [int(i) for i in input().split()]

t1 = datetime(year=1, month=1, day=1, hour=h1, minute=m1)
t2 = datetime(year=1, month=1, day=1, hour=h2, minute=m2)
if h2 > h1:
    print((t2-t1-timedelta(minutes=k)).seconds//60)
elif h1 == h2 and m2 > m1:
    print((t2-t1-timedelta(minutes=k)).seconds//60)
else:
    t2 = t2.replace(day=2)
    print((t2-t1-timedelta(minutes=k)).seconds//60)

Submission status: Accepted

Solution code:
import datetime

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

dt1 = h1 * 60 + m1

dt2 = h2 * 60 + m2

#dt1 = datetime.timedelta(hours = h1, minutes=m1)
#dt2 = datetime.timedelta(hours = h2, minutes=m2)

#m = datetime.timedelta(minutes=k)

dt3 = dt2 - k

dt4 = dt3 - dt1

print(dt4)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(duration)

Submission status: Accepted

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

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

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

if mm2 > mm1:
    mmm = mm2-mm1
else:
    mmm = mm2+24*60 - mm1

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

Submission status: Accepted

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

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

a=s-f


if k>a:
  print(0)
else:
  b=s-k
  print(b-f)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a,b,c,d,e=map(int,input().split())

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

Submission status: Accepted

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

t=s-e

print(t)

Submission status: Accepted

Solution code:
time = map(int, input().split())
list1=[]
for i in time:
    list1.append(i)
time1 = (list1[2]*60+list1[3])-(list1[0]*60+list1[1])
minute = time1  - list1[4]
print(minute)

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=map(int,input().split())
#d=list(map(int,input().split()))
#n=int(input())
#d,x=map(int,input().split())
#a=[int(input()) for i in range(n)]

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

HOUR = H2 - H1
MINUTE = M2 - M1

After_H = HOUR *60
After_M = After_H + MINUTE
Ans = After_M - K

print(Ans)

Submission status: Accepted

Solution code:
def difference(h1, m1, h2, m2, k): 
    t1 = h1 * 60 + m1 
    t2 = h2 * 60 + m2  
    diff = t2-t1
    print(diff - k)

L = input().split()
H1 = int(L[0])
M1 = int(L[1])
H2 = int(L[2])
M2 = int(L[3])
K = int(L[4])

difference(H1, M1, H2, M2, K)

Submission status: Accepted

Solution code:
import time

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

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

st_studytime = sp_time - k

ans = st_studytime - gu_time

print(ans)

Submission status: Accepted

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

end_time = H2*60 + M2
start_time = H1*60 + M1
diff_time =  end_time - start_time

print(diff_time - K)

Submission status: Accepted

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

h = int(h1) - int(h2)
m = 0
if int(m1) >= int(m2):
    m = int(m1) - int(m2)
else:
    h = h -1
    m = 60 + int(m1) - int(m2)
    
t = abs(h * 60 + m) - int(k)

print(t)

Submission status: Accepted

Solution code:
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
# read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines
input = sys.stdin.readline

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

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

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

Submission status: Accepted

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

houre = h2 - h1
minute = m2 - m1

print(houre * 60 + minute - 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,e = map(int,input().split())

f = c - a
g = d - b
if g < 0:
  g = 60 + g
  f -=1
total = 60 * f + g
if total - e <= 0:
  print('0')
else:
    total -= e 
    print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase
def main():
    h1,m1,h2,m2,k=map(int,input().split())
    ht=h2-h1
    ht*=60
    if(m2>=m1):
        ht+=m2-m1
    else:
        ht+=(m2-m1)
    print(ht-k)

# fast-io region

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

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

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

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

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


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


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def input():
    return sys.stdin.readline().rstrip("\r\n")


def write(*args, end="\n"):
    for x in args[:-1]:
        sys.stdout.write(str(x) + " ")
    sys.stdout.write(str(args[-1]))
    sys.stdout.write(end)


def r_array():
    return [int(x) for x in input().split()]


def r_int():
    return int(input())


if __name__ == "__main__":
    main()

Submission status: Accepted

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

if m1+mk >=60:
    h1 += 1
    m1 = m1 + mk -60
else:
    m1 = m1 + mk
h1 += hk

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

Submission status: Accepted

Solution code:
H1, M1, H2, M2, K = [int(n) for n in input().split()]
H = (H2-H1)*60
if M1<=M2:
    M = (M2-M1)
else:
    H -= 60
    M = M2+60-M1
print((H+M)-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:
h1,m1,h2,m2,k=map(int,input().split())
h_d=h2-h1
m_d=m2-m1
if m_d<0:
    h_d-=1
    m_d=60+m2-m1
    
sum=60*h_d+m_d
sum-=k
 
if sum<0:
    print(0)
else:
    print(sum)

Submission status: Accepted

Solution code:
from sys import stdin
H1,M1,H2,M2,K = [int(x) for x in stdin.readline().rstrip().split()]
ans = (H2-(H1+1))*60
ans += (60-M1)
ans += M2
ans -= K
print(ans)

Submission status: Accepted

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

main = (data[2] - data[0]) * 60 + data[3] - data[1] - data[4]

print(main)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1,m1,h2,m2,k=input().split()
h1=int(h1)
h2=int(h2)
m1=int(m1)
m2=int(m2)
k=int(k)
#print(h1,end=":")
#print(m1)
#print(h2,end=":")
#print(m2)
#print(k)
h3=0
m3=0
m3=m2-m1
h3=h2-h1


#print(h3*60,end="+")
#print(m3*60)
print(h3*60+m3-k)

Submission status: Accepted

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

Submission status: Accepted

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

H = (H2 - H1) * 60
M = M2 - M1

res = (H+M)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

dm = m2 - m1
if h2 < h1:
    h2 +=24

if dm < 0:
    h2 -= 1
    dm = 60 + dm

print((h2 - h1)*60 + dm - k)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
FH, FM, TH, TM, K = map(int, input().split())
M = (TH*60+TM)-(FH*60+FM)
print(M-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:
score=0
h1,m1,h2,m2,k = map(int,input().split())
score=h2*60-h1*60+m2-m1
print(score-k)

Submission status: Accepted

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

Submission status: Accepted

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

H1 = H1 * 60
H2 = H2 * 60

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

Submission status: Accepted

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

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

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

hm=h*60
ans=hm+m

print(ans-k)

Submission status: Accepted

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

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

Submission status: Accepted

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

if b>d:
    h = c-a-1
    m = d+60-b
    print(h*60+m-e)
else:
    h = c-a
    m = d-b
    print(h*60+m-e)

Submission status: Accepted

Solution code:
import datetime

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

wake_up = datetime.timedelta(hours=h1, minutes=m1)
go_to_bed = datetime.timedelta(hours=h2, minutes=m2)
study_time = datetime.timedelta(minutes=k)

ans = (go_to_bed - study_time) - wake_up
print(ans.seconds // 60)

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

Submission status: Accepted

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

if(0<=r):
  print(r)
else:
  print("0")

Submission status: Accepted

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

h1, m1, h2, m2, k = (int(x) for x in input().split())

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

print(end - start - k)

Submission status: Accepted

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

Submission status: Accepted

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

if H1 > H2 or (H1 == H2 and M1 >= M2):
    H2 += 24
    
diff_min = H2*60 + M2 - (H1*60 + M1)
if diff_min - K < 0:
    print(0)
else:
    print(diff_min - K)

Submission status: Accepted

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

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

print(t-k)

Submission status: Accepted

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

import datetime
h1 = h1.zfill(2)
h2 = h2.zfill(2)
m1 = m1.zfill(2)
m2 = m2.zfill(2)

o1 = h1+":"+m1+":00"
o2 = h2+":"+m2+":00"

dt1 = datetime.datetime.strptime(o1, '%H:%M:%S')
input_time1 = dt1.time()
dt2 = datetime.datetime.strptime(o2, '%H:%M:%S')
input_time2 = dt2.time()

total =int((dt2-dt1).total_seconds())/60

ans = int(total-int(k))
if ans >=0:
    print(ans)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(end-start-k)

Submission status: Accepted

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

ans = rem - K
print(ans)

Submission status: Accepted

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

time = (H_2*60 + M_2) - (H_1*60 + M_1)
ans = time - K

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

time = h*60+mn
ans = time-k
print(ans)

Submission status: Accepted

Solution code:

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
"""AtCoder nomura 2020: A - Study Scheduling - 
https://atcoder.jp/contests/nomura2020/tasks/nomura2020_a
"""

__author__ = 'bugttle <bugttle@gmail.com>'

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

kisho = 60-m1
kisho += 60*(h2-h1-1) 
kisho += m2

ans = kisho-k

print(ans)

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:
t = [list(map(int, s.split())) for s in open(0)][0]
print((t[2]*60 + t[3]) - (t[0]*60 + t[1]) - t[4])

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

h=int(H2)-int(H1)
study=h*60+(int(M2)-int(M1))-int(K)

print(study)

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

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

Submission status: Accepted

Solution code:
a,b,c,d,e=map(int,input().split())
#a時b分、c,d,e分
time=(c-a)*60+d-b
ans=time-e
print(ans)

Submission status: Accepted

Solution code:
h1, n1, h2, n2, k = map(int,input().split())
h = h2-h1
n = n2-n1
wake = 60*h + n
ans = wake-k
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K=map(int,input().split())
p1=H1*60+M1
p2=H2*60+M2
if p2>p1:print(p2-p1-K)
else:print(p1-p2-K)

Submission status: Accepted

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

if M2>K:
  M2 = M2 - K
else:
  K = K - M2
  M2 = 0
  H2 = H2 - K//60 - 1
  K = K - (K//60) * 60
  M2 = 60 - K

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

Submission status: Accepted

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

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

ans = HM2 - HM1 - K

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

Submission status: Accepted

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

hour = (H2-H1)*60
mini = M2-M1
sum = hour + mini

ans = sum-K

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
#sys.stdin=open("input1.in","r")
#sys.stdout=open("outpul.out","w")
# for _ in range(int(input())):
H1,M1,H2,M2,K=map(int,input().split())
mins=H2*60+M2-(H1*60+M1)
mins=mins-K
if(mins<=0):
    print(0)
else:
    print(mins)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

nums = list(map(int, input().split()))
H = nums[0]
M = nums[1]
h = nums[2]
m = nums[3]
k = nums[4]


wake = H * 60 + M

bed = h * 60 + m

available = bed - wake

print(available - k)

Submission status: Accepted

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

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

print(max(time-k, 0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

wake = get_minites(h1,m1)
sleep = get_minites(h2,m2)
ans = sleep - k - wake
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

J = H2 - H1
if (M1 > M2):
  J -= 1
  F = 60 + M2 - M1
else:
  F = M2 - M1

F = J * 60 + F

print(F - K)

Submission status: Accepted

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

import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache   #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
def input(): return sys.stdin.readline()
def mapi(arg=0): return map(int if arg==0 else str,input().split())
#------------------------------------------------------------------

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

Submission status: Accepted

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

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

print(t)

Submission status: Accepted

Solution code:
h1,m1,h2,m2,x = map(int, input().split(" "))
start = h1*60+m1
end = h2*60+m2
ans = end-start -x
if ans <= 0 :
  print(0)
else:
  print(ans)

Submission status: Accepted

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

h1, m1, h2, m2, t = map(int, input().split())
if h1 < h2:
	diff = (h2 - h1 - 1) * 60 + (60 - m1) + m2
else:
	diff = m2 - m1
print(max(diff - t, 0))

Submission status: Accepted

Solution code:
import sys,bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
rep=range
def Golf():n,*t=map(int,open(0).read().split())
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def RA():return map(int,open(0).read().split())
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:
            a,b=inp;c=1
        else:
            a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def accum(ls):
    rt=[0]
    for i in ls:rt+=[rt[-1]+i]
    return rt
def bit_combination(n,base=2):
    rt=[]
    for tb in range(base**n):s=[tb//(base**bt)%base for bt in range(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
 
YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
input=lambda: sys.stdin.readline().rstrip()


show_flg=False
show_flg=True
ans=0


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

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

print(ans)