Problem:


Score : 100 points

Problem Statement

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

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

Constraints

0 \le H_1, H_2 \le 23

0 \le M_1, M_2 \le 59

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

K \ge 1

Takahashi is up for at least K minutes.

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

Input

Input is given from Standard Input in the following format:

H_1 M_1 H_2 M_2 K

Output

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

Sample Input 1

10 0 15 0 30

Sample Output 1

270

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

Sample Input 2

10 0 12 0 120

Sample Output 2

0

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



Sample input:
10 0 15 0 30


Sample output:
270

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K=map(int,input().split())
H=H2-H1
M=M2-M1
min=H*60+M
print(min-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:
  t2 += 24 * 60
#
print(t2-t1-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);
d1=60*H1+M1;
d2=60*H2+M2-K;
print(d2-d1);

Submission status: Accepted

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

Submission status: Accepted

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


delta1=timedelta(minutes=M1,hours=H1)
delta2=timedelta(minutes=M2,hours=H2)

delta=delta2-delta1
delta_minutes=delta.total_seconds()/60
if delta_minutes>=K:
  print(round(delta_minutes-K))
else:
  print(0)

Submission status: Accepted

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

if h2 < h1:
    h2 += 24
h3 = h2 - h1
if m2 < m1:
    m3 =  m2 + (60 - m1)
    h3 -= 1
else:
    m3 = m2 - m1

ans = (h3 * 60) + m3 - k
if ans <= 0:
    print(0)
else:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

latest = H2*60+M2-K  #[min]
earliest = H1*60+M1
study = latest-earliest
print(study)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import datetime

def input():
    return sys.stdin.readline()


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

    dt1 = datetime.datetime(2020, 5, 30, h1, m1)
    dt2 = datetime.datetime(2020, 5, 30, h2, m2)

    mean_t = dt2 - dt1

    k_second = k * 60

    ans_second = mean_t.seconds - k_second

    if ans_second <= 0:
        print(0)
    else:
        print(int(ans_second / 60))

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math
#import random
#sys.setrecursionlimit(100000000)
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

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

h=h2-h1
m=m2-m1

if m<0:
	m+=60
	h-=1

ans=h*60+m-k

print(ans)

Submission status: Accepted

Solution code:
li = list(map(int,input().split()))
h1, m1, h2, m2, k = li
life_time = (h2 - h1)*60 + (m2 - m1)
time = life_time - k # 分
print(time)

Submission status: Accepted

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

hour1 = (H1 * 60) + M1
hour2 = (H2 * 60) + M2
hour = hour2 - hour1
minute = hour - K
print(minute)

Submission status: Accepted

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

wakeup = 60 * H1 + M1
gotobed = 60 * H2 + M2
 
wake = gotobed - wakeup
 
answer = wake - K
 
print(answer)

Submission status: Accepted

Solution code:

def main():
    H1,M1,H2,M2,K = list(map(int, input().split()))
    from datetime import datetime, timedelta
    time1 = datetime(2019,1,1,H1,M1,0)
    time2 = datetime(2019,1,1,H2,M2,0)
    kmin = timedelta(minutes=K)

    ans = (time2 - kmin) - time1

    print(ans.seconds//60)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
H_1, M_1, H_2, M_2, K = map(int,input().split())
bef = H_1 * 60 + M_1
aft = H_2 * 60 + M_2
min = aft - bef
if min >  K:
    print(min - K)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#まとめ
import datetime
H1,M1,H2,M2,K=map(int,input().split())

dt1=datetime.datetime(year=1,month=1,day=1,hour=H1,minute=M1)
dt2=datetime.datetime(year=1,month=1,day=1,hour=H2,minute=M2)

dt_diff=dt2-dt1

def timedelta_to_HM(td):
    sec = td.total_seconds()
    return (sec//60)

time=timedelta_to_HM(dt_diff)

A=time-K
A=int(A)

print(A)

Submission status: Accepted

Solution code:
Ha,Ma,Hb,Mb,K = list(map(int,input().split()))

tmp = (Hb*60 + Mb) - (Ha*60 + Ma)

print(tmp-K)

Submission status: Accepted

Solution code:
import datetime

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

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

    print(abs(sleep - start - K))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

start  = (timer[0]*60) + timer[1]
finish = (timer[2]*60) + timer[3]
study  = finish - start - timer[4]

print(study)

Submission status: Accepted

Solution code:
def main():
    array = list(map(int, input().split()))

    now = array[0]*60+array[1]
    finish = array[2]*60+array[3]

    sa = finish - now
    K = array[4]
    ans = 0
    for _ in range(int(1e15)):
        if now + K < finish:
            ans += 1
        else:
            break
        now += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = input().split()
b = len(a)
c = int(a[0])
d = int(a[1])
e = int(a[2])
f = int(a[3])
g = int(a[4])

if g >= 60:
    h = g//60
    i = g%60
    if f>=i:
        A = e-h
        B = f-i
    else:
        A = e-h-1
        B = 60-(i-f)
else:
    if g<=f:
        A = e
        B = f-g
    else:
        A = e-1
        B = 60-(g-f)
if B>=d:
    C = A-c
    D = B-d
else:
    C = A-c-1
    D = 60-(d-B)
E = C*60
F = E+D
print(F)

Submission status: Accepted

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

startTime = (H1*60)+M1
endTime = (H2*60)+M2
time = endTime - startTime
posTime = time - K
if (posTime < 0):
  print(0)
else:
  print(posTime)

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

h1 = H1 * 60
m1 = M1
h2 = H2 * 60
m2 = M2

ans = (h2 + m2) - (h1 + m1) - K if (h2 + m2) > (h1 + m1) else (h2 + m2) - (h1 + m1) - K + 24 * 60

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import datetime
h1,m1,h2,m2,k = map(int,input().split(' '))
dt1 = datetime.datetime(year=2020, month=5, day=30, hour=h1,minute=m1)
dt2 = datetime.datetime(year=2020, month=5, day=30, hour=h2,minute=m2)
dt3 = int((dt2-dt1).seconds/60-k)
print(dt3 if dt3 >=0 else 0)

Submission status: Accepted

Solution code:
inputs = input()

H1, M1, H2, M2, K = [int(f) for f in inputs.split(" ")]

elapsedHour = H2 - H1
elapsedMin = M2 - M1

maxStudyStartTimeLength = elapsedHour * 60 + elapsedMin - K

print(maxStudyStartTimeLength)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#スペース区切りの整数の入力
h1, m1, h2, m2, k = map(int, input().split())

asa = h1 * 60 + m1
yoru = h2 * 60 + m2 - k


if(yoru<=asa):
  print("0")
else:
  print(yoru-asa)

Submission status: Accepted

Solution code:
str = input()
arr = str.split(" ")
h_st = int(arr[0])
m_st = int(arr[1])
h_ed = int(arr[2])
m_ed = int(arr[3])
k = int(arr[4])
time_st = (h_st * 60)+m_st
time_ed = (h_ed * 60)+m_ed
result = time_ed - time_st - k
if result >= 0:
	print(result)
else:
    print("0")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

a,b,c,d,k = imap()

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

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

lh = h2 - h1
if lh < 0:
    lh = lh + 24
lm = m2 - m1

if lh == 0 and lm < 0:
    lm = lm + 24*60

l = lh * 60 + lm - k
    

print(l)

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

Submission status: Accepted

Solution code:
mylist=list(map(int, input().split()))
H1=mylist[0]
M1=mylist[1]
H2=mylist[2]
M2=mylist[3]
K=mylist[4]
time=60*H2+M2-60*H1-M1
ptime=time-K
print(ptime)

Submission status: Accepted

Solution code:
hmk = input('')

h1 = int(hmk.split(' ')[0])
m1 = int(hmk.split(' ')[1])
h2 = int(hmk.split(' ')[2])
m2 = int(hmk.split(' ')[3])
k = int(hmk.split(' ')[4])

min1 = h1*60 + m1
min2 = h2*60 + m2

if min1 > min2:
    min2+=60*24

a = min2 - min1 - k
print(a)

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
h1, m1, h2, m2, k = map(int, input().rstrip().split())
print((h2 - h1) * 60 + (m2 - m1) - k)

Submission status: Accepted

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

Submission status: Accepted

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


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

if k > h*60 + m:
    print(0)
else:
    print(h*60 + 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(str(end - start - k))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b, c, d, e = map(int, input().split())
# get a string
#s = raw_input()
# output
start = a*60+b
end = c*60+d
result = end - start - e
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

time1 = h1*60 + m1
time2 = h2*60 + m2

ans = time2 - k - time1
print(ans)

Submission status: Accepted

Solution code:
import sys

H1,M1,H2,M2,K = map(int, sys.stdin.readline().split())

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

Submission status: Accepted

Solution code:
from math import cos, pi

value = input().split()
for i in range(len(value)):
    value[i] = int(value[i])

if 0 <= value[0] <= 23 and 0 <= value[2] <= 23 and 0 <= value[1] <= 59 and 0 <= value[3] <= 59 and value[4] >= 1:
    W = (value[2] - value[0])*60 + value[3] - value[1] - value[4]
    print(W)
else:
    print("you enter value not in the valid range")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
dH = H2 - H1
dH_ = dH * 60
dM = M2 - M1
d = dH_ + dM
ans = d - 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())

def hourToMinute(H,M):
  ret = H*60 +M  
  return ret

start = hourToMinute(H1,M1)
fin = hourToMinute(H2,M2)

ans = fin - K

ans = ans- start

print(ans)

Submission status: Accepted

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

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

print(y)

Submission status: Accepted

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

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

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:
(hs,ms,he,me,k) =map(int,input().split())
hour = (he - hs)*60
minute = me - ms - k
print(hour +minute)

Submission status: Accepted

Solution code:
import sys
a = []
for l in sys.stdin:
    a.append(l)
h1, m1, h2, m2, k  = a[0].split()
H1, M1, H2, M2, K = int(h1), int(m1), int(h2), int(m2), int(k)
time = 60 * H2 + M2 - (60*H1 + M1) - K
print(time)

Submission status: Accepted

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

from datetime import timedelta
import datetime

s_h, s_m, e_h, e_m, k = map(int, input().split())

start = datetime.datetime.combine(datetime.date.today(), datetime.time(s_h, s_m))
end = datetime.datetime.combine(datetime.date.today(), datetime.time(e_h, e_m))

total = end - start

study = timedelta(minutes = k)

print(int((total - study).seconds / 60))

Submission status: Accepted

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

h3, m3 = divmod(k, 60)

dh = h2 - h3
dm = m2 - m3
if dm < 0:
    dh -= 1
    dm = 60 + dm



ah = dh - h1
am = dm - m1
if am < 0:
    ah -= 1
    am = 60 + am

ans = ah * 60 + am
print(ans)

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
a = input().split()
H1 = int(a[0])
M1 = int(a[1])
H2 = int(a[2])
M2 = int(a[3])
K = int(a[4])
time = (H2 * 60 + M2) - K
okiru = 60 * H1 + M1
print(time - okiru)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
num_list = list(map(int, input().split())) 

a=num_list[2]-num_list[0]
b=num_list[3]-num_list[1]
if b<0:
    a=a-1
    b=b+60
a=a*60
c=b+a-num_list[4]
if c<0:
    c=0
print(c)

Submission status: Accepted

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

h=(c-a)*60
h=h+(d-b)

h=h-e

print(h)

Submission status: Accepted

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

wake = H1 * 60 + M1
sleep = H2 * 60 + M2 - K
ans = 0
if wake <= sleep:
    ans = sleep - wake
else:
    time = 24 * 60
    ans = time - wake + sleep

print(ans)

Submission status: Accepted

Solution code:
h1,m1,h2,m2,k= list(map(int,input().split()))
t2 = h2*60+m2
t1 = h1*60+m1
owari = t2 - k
benkyou = owari - t1
if benkyou ==0 :
    print("0")
else:
    print(benkyou)

Submission status: Accepted

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

Submission status: Accepted

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

minutes1 = 60*h1 + m1
minutes2 = 60*h2 + m2

rest = minutes2 - minutes1
print(rest-k)

Submission status: Accepted

Solution code:
w_h, w_m, s_h, s_m,t = map(int,input().split())
s_t = s_h*60 + s_m -t
ans = s_t - w_h*60 - w_m
print(ans)

Submission status: Accepted

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

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

print(d - k)

Submission status: Accepted

Solution code:
import sys
def main():
    H1, M1, H2, M2, K = map(int, input().split())
    
    h = H2 - H1 
    m = M2 - M1
    tot_minutes = h * 60 + m - K
    
    if tot_minutes <= 0:
        out = 0
    else:
        out = tot_minutes
    print(out)
main()

Submission status: Accepted

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

def main():
    time = (60*H2 + M2) - (60*H1 + M1) - K
    print(time)
        
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
time1 = h1 * 60 + m1
time2 = h2 * 60 + m2
ans = time2 - (time1 + k)
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:
n = list(map(int,input().split()))

start = n[0]*60 + n[1]
end = n[2]*60 + n[3]

zikan = (end - start) - n[4]
print(zikan)

Submission status: Accepted

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

time1 = H1 * 60 + M1
time2 = H2 * 60 + M2
time3 = time2 - K

if time3 < time1: print(0)
else: print(time3 - time1)

Submission status: Accepted

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

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

if m < 0:
  h = h - 60
  m = 60 + m

total = h + m

print(total-k)

Submission status: Accepted

Solution code:
H_1,M_1,H_2,M_2,K=input().split()
H_1=int(H_1)
M_1=int(M_1)
H_2=int(H_2)
M_2=int(M_2)
K=int(K)
H1=H_1*60+M_1
H2=H_2*60+M_2
answer=H2-H1-K
print(answer)

Submission status: Accepted

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

if H1 > H2:
  hour = H2+(24-H1)
else:
  hour = H2-H1

if M1 > M2:
  hour -= 1
  minutes = M2+(60-M1)
else:
  minutes = M2-M1
print(hour*60+minutes-K)

Submission status: Accepted

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

Submission status: Accepted

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

time = c*60+d-a*60-b

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

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K=map(int,input().split())
if H1>H2:H2+=24
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())
if h_1>h_2 and m_1>m_2:
  a=((h_2+12)-h_1)*60
  a=a-60
  b=60-(m_1-m_2)
elif h_1<h_2 and m_1>m_2:
  a=(h_2-h_1)*60
  a=a-60
  b=60-(m_1-m_2)

elif h_1>h_2 and m_1<m_2:
  a=((h_2+12)-h_1)*60
  b=m_2-m_1
else :
  a=(h_2-h_1)*60
  b=m_2-m_1
culc=b+a
result=culc-k

print(result)

Submission status: Accepted

Solution code:
import datetime

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

dt1 = datetime.datetime.strptime(str(h1) + ':' + str(m1) + ':00', '%H:%M:%S')
dt2 = datetime.datetime.strptime(str(h2) + ':' + str(m2) + ':00', '%H:%M:%S')

se = (dt2 - dt1).seconds
mi = se / 60 - k
print(str(int(mi)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,m,h2,m2,k=map(int,input().split())
a=h*60+m
b=h2*60+m2
if a>b:
    b+=60*24
#print(b)

print(((b-a)-k))

Submission status: Accepted

Solution code:
H1, M1, H2, M2, K = (int(x) for x in input().split())
if H1 > H2: 
    H1 -= 24

before = H1 * 60 + M1
after = H2 * 60 + M2
after -= K

time = after - before
print(time)

Submission status: Accepted

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

Submission status: Accepted

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

# 10:00->15:00
# 10:00->12:00

# 起きている時間を計算する（単位分

import datetime

def get_waking_time(H,I,J,K):
    d1 = datetime.datetime(year=2020, month=5, day=30, hour=H, minute=I, microsecond=0)
    d2 = datetime.datetime(year=2020, month=5, day=30, hour=J, minute=K, microsecond=0)
    delta = d2 -d1
    return delta.seconds/60


print(int(get_waking_time(H1,M1,H2,M2)-K))

Submission status: Accepted

Solution code:
import math

if __name__ == '__main__':
    s = input().rstrip().split(' ')
    H1, M1, H2, M2, K = int(s[0]),int(s[1]),int(s[2]),int(s[3]),int(s[4])
    if (H1, M1) > (H2, M2):
        H2 += 24

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

    print(min2 - min1 - K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import datetime

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

end_time = datetime.time(H_2, M_2, 00)

limit_time = datetime.datetime.combine(datetime.date(year=2017, month=10, day=10), end_time) - datetime.timedelta(minutes=K)

start_time = datetime.time(H_1, M_1, 00)

dif = limit_time - datetime.datetime.combine(datetime.date(year=2017, month=10, day=10), start_time)

print(dif.seconds//60)

Submission status: Accepted

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

bt = h1*60 + m1
at = h2*60 + m2

time = at - bt

print(time-k)

Submission status: Accepted

Solution code:
a,b,c,d,e =map(int ,input().split())
g=0
h=0
if d-b<0:
  g=60+d-b
  c-=1
else:
  g=d-b
f=c-a
g+=f*60
if g<e :
  h=0
else:
  h=g-e
print(h)

Submission status: Accepted

Solution code:
import datetime

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

GetUpTime=datetime.datetime(2020, 5, 30, H1, M1)
GoToBedTime=datetime.datetime(2020, 5, 30, H2, M2)

DayTime=GoToBedTime-GetUpTime

TimeRange = int(DayTime.seconds)/60 - K
print(int(TimeRange))

Submission status: Accepted

Solution code:
o1, o2, n1, n2, k = map(int, input().split())


o_all = o1*60 + o2
n_all = n1*60 + n2

print(n_all-o_all-k)

Submission status: Accepted

Solution code:
import datetime

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

starttime = 60 * h1 + m1
endtime = 60 * h2 + m2 -k

td = endtime - starttime
if td <= 0:
    td = 0
print(td)

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 datetime
year=2000
month=10
day=10
h1,m1,h2,m2,K = map(int,input().split())

dt1 = datetime.datetime(year=year,month=month,day=day,hour=h1,minute=m1)
dt2 = datetime.datetime(year=year,month=month,day=day,hour=h2,minute=m2)
dt2_bef = dt2 - datetime.timedelta(minutes=K)

td = dt1 - dt2_bef

if td.days<0:
    td = dt2_bef - dt1
print(int(td.total_seconds()//60))

Submission status: Accepted

Solution code:
x = list(map(int, input().split()))
h = (x[2] - x[0])*60
m = x[3] - x[1]
if m < 0:
    h -= 60
    m = 60 - x[1] + x[3]
ans = max(m+h-x[-1], 0)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

#d1 = datetime.datetime(hour=H1, minute=M1)
#d2 = datetime.datetime(hour=H2, minute=M2)

#d1 = datetime.datetime(year=2020, month=5, day=30, hour=H1, minute=M1, second=0, microsecond=0)
#d2 = datetime.datetime(year=2020, month=5, day=30, hour=H2, minute=M2, second=0, microsecond=0)

d1 = datetime.datetime(year=2020, month=5, day=30, hour=H1, minute=M1)
d2 = datetime.datetime(year=2020, month=5, day=30, hour=H2, minute=M2)

#print(d2-d1)

min = d2 - d1

#print(min)
#print(type(min))
#print(min.seconds)
print(min.seconds // 60 - K)
#h = (H2 - H1)*60
#m = (M2 - M1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

def main():
    H1, M1, H2, M2, K = [int(value) for value in input().split(" ")]

    # K(min)-> Time min
    H = K // 60
    M = K % 60
    
    
    NH = H2 - H
    NM = M2 - M
    if NM < 0:
        NH -= 1
        NM = 60 + NM
    if NM - M1 < 0:
        RM = (NH - H1-1)*60 + 60+(NM-M1)
    else:
        RM = (NH - H1)*60 + (NM-M1)

    if RM < 0:
        RM = 0
    print(RM)

if __name__=="__main__":
    main()

Submission status: Accepted

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

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 datetime

#intの場合
H1,M1,H2,M2,K = map(int,input().split())

wakeup = datetime.datetime(2020,5,30,H1,M1,0)
sleep = datetime.datetime(2020,5,30,H2,M2,0)

active = sleep - wakeup
delta = int((active.seconds)/60)

ans = delta - K
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

h1, m1, h2, m2, k = nm()
wu = h1*60 + m1
gb = h2*60 + m2
print(gb - wu - k)

Submission status: Accepted

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

hour = e // 60
min = e % 60

a += hour
b += min

if b >= 60:
    a += b // 60
    b %= 60

ans = 0
if b > d:
    c -= 1
    ans += 60 - (b - d)
else:
    ans += (d - b)

if c >= a:
    ans += 60 * (c - a)
else:
    print(0)
    exit()

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

start = h2 * 60 + m2 - k
time = start - h1 * 60 - m1

print(time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import datetime

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

a = datetime.datetime(2020, 5, 30, H2, M2)
b = datetime.datetime(2020, 5, 30, H1, M1)
delta = a - b
minute = delta.seconds // 60
print(minute - K)

Submission status: Accepted

Solution code:
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**9+10


    h1,m1,h2,m2,k = LMIIS()
    wake = h1*60+m1
    sleep = h2*60+m2
    if wake > sleep:
        sleep += 24*60
    print((sleep-wake-k)%(24*60))

    
main()

Submission status: Accepted

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

time_time = (H2 - (H1 + 1)) * 60
time_minitue = (60- M1) + M2

cost_time =   (time_time + time_minitue) - K

print(cost_time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import datetime

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

dt1 = datetime.datetime(year=2017, month=10, day=10, hour=h1, minute=m1)
dt2 = datetime.datetime(year=2017, month=10, day=10, hour=h2, minute=m2)

t = abs(dt2 - dt1)
print((t.seconds - k*60) // 60)