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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(max(0, en - st - k))

Submission status: Accepted

Solution code:
H1, H2, H3, H4, K = map(int, input().split())
up = H1*60 + H2
down = H3*60 + H4
print(down - up - K)

Submission status: Accepted

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

print(max(0,-60*A-B+(60*C+D))-E)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(time - k)

Submission status: Accepted

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

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

ans = h*60+m
ans = ans-k

print(ans)

Submission status: Accepted

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

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

print(time - k)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
h1, m1, h2, m2, k=map(int, input().split())
hun=(h2-h1)*60-m1+m2
print(hun-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:
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

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

print(ans - K)

Submission status: Accepted

Solution code:
H1, M1, H2, M2, K = map(int, input().split())
s = H1*60 + M1
e = H2*60 + M2
print(e - 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:
import sys
readline = sys.stdin.buffer.readline
h1, m1, h2, m2, k = map(int, readline().split())
print(60 * (h2 - h1) + m2 - m1 - k)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

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

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

print(minute - k)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

h1, m1, h2, m2, k = map(int, readline().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:
a,b,c,d,e=map(int,input().split())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#AAAAAAAAAAA

import sys
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    a,b,c,d,e = inpm()
    print((c-a)*60+(d-b)-e)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from datetime import datetime
h1, m1, h2, m2, k = list(map(int, input().split()))
t1 = datetime(2000, 1, 1, h1, m1, 0)
t2 = datetime(2000, 1, 1, h2, m2, 0)
t = (t2 - t1).seconds // 60
ans = t - k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if t1 > t2:
    print(720 - t1 + t2 - k)
else:
    print(t2 - t1 - k)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

wake_time = h2*60 + m2 - (h1 *60 + m1);

if wake_time > k:
    print(wake_time - k);
else:
    print(0);

Submission status: Accepted

Solution code:
from math import ceil, floor

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

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

print('%d' % max(0, diff-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:
a, b, c, d, k = map(int, input().split())
p = a*60 + b
q = c*60 + d
ans = q-p-k
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
hour1,min1,hour2,min2,ben = map(int,input().split())
ans=(hour2-hour1)*60+min2-min1-ben
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

print(minutes - k)

Submission status: Accepted

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

Submission status: Accepted

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

h = c-a
m = d-b
if m < 0 :
    h = h-1
    m = 60 + m

print(h * 60 + m - e)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H = input().split()
sdy =0
if int(H[2]) >= int(H[0]):
  sdy = int(H[2])*60 +int(H[3])-int(H[0])*60 -int(H[1]) - int(H[4])
else:
  H[2] = (int(H[2])+24)
  sdy = int(H[2])*60 +int(H[3])-int(H[0])*60 -int(H[1]) - int(H[4])
if int(sdy) < 0:
  sdy = 0
print(sdy)

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

Submission status: Accepted

Solution code:
HMK = list(map(int, input().split()))
H1 = HMK[0]
M1 = HMK[1]
H2 = HMK[2]
M2 = HMK[3]
K = HMK[4]
if H2 < H1:
	H2 += 24
ans = ((H2 - H1) * 60 + (M2 - M1)) - K
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1, m1, h2, m2, k = list(map(int, input().split()))
#n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# k = int(input())
# a = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
#py = [list(map(int, input().split())) for i in range(m)]
# b = list(map(int, input().split()))


total = (h2-h1)*60
if m1 <= m2:
    total += (m2-m1)
else:
    if m2 == 0:
        total += 60-m1
        total -= 60
    else:
        #total += (m1-m2)
        total -= (m1-m2)


ans = total - k
print(ans)

Submission status: Accepted

Solution code:
#coding: utf-8
string = str(input())
X = 0
li = []
for a in range(len(string)):
    if string[a] == " ":
        li.append(string[X:a])
        X = a+1
li.append(string[X:])
for aa in range(len(li)):
    li[aa] = int(li[aa])
h1 = li[0]
m1 = li[1]
h2 = li[2]
m2 = li[3]
k = li[4]
Time = (h2 * 60 + m2) - (h1 * 60 + m1) - k
print(int(Time))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

import sys
sys.setrecursionlimit(4100000)
rl = sys.stdin.readline

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

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

print(S-K)

Submission status: Accepted

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

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

print(WAKEUP - K)

Submission status: Accepted

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

awake = h2 * 60 + m2 - h1 * 60 - m1

print(max(awake - k, 0))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

h1 = int(h1)
m1 = int(m1)
h2 = int(h2)
m2 = int(m2)
k = int(k)

if h1 > h2:
  h2 += 24
  
h = h2 - h1
hm = h * 60

print(hm - m1 + m2 - k)

Submission status: Accepted

Solution code:


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    a,b,c,d,e = map(int, input().split())
    if d >= b:
        res = (c-a)*60 + d-b
        print(res-e)
    else:
        res = (c-a-1)*60 + d-b+60
        print(res-e)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

start_mins = h1 * 60 + m1
end_min = h2 * 60 + m2

is_up = end_min - start_mins
can_start = is_up - k
print(can_start)

Submission status: Accepted

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

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


print(0 if mm - k <= 0 else mm - k)

Submission status: Accepted

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

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

if(a>k):
  print(a-k)
else :
  print(0)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(jikan-k)

Submission status: Accepted

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

if H2 < H1:
    H2 = H2 + 24
if H1 == H2 and H2 < H1:
    H2 = H2 + 24


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

study_time = time2m - K - time1m

if study_time <= 0:
    print(0)
else:
    print(study_time)

Submission status: Accepted

Solution code:
input_str = input().split()

input_nums=[]

for i in range(5):
    input_nums.append(int(input_str[i]))


diff_hour = input_nums[2] - input_nums[0]
diff_hour_to_min = diff_hour * 60
 
diff_min = input_nums[3] - input_nums[1]

total_wake_min = diff_hour_to_min + diff_min

print(total_wake_min - input_nums[4])

Submission status: Accepted

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

h = H2 - H1
m = M2 - M1
s = 0

s = h * 60 + m


s = s - K

print(s)

Submission status: Accepted

Solution code:


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

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

Submission status: Accepted

Solution code:
h1, m1, h2, m2, k = map(int,input().split())
s = -60*h1-m1+60*h2+m2
print(s-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, t = (int(x) for x in input().split())
s1 = h1 * 60 + m1
s2 = h2 * 60 + m2
ans = s2 - s1 - t
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1,m1,h2,m2,k =(int(x) for x in input().split())  
 
hrtom= (h2-h1)
 
if (m2-m1 < 0) and (h2-h1 >=0) : 
    min = (h2-h1)*60 + (m2-m1) - k
    print(min)
    
elif (m2-m1 >= 0) and (h2-h1 >=0 ):
    min = (h2-h1)*60 + (m2-m1) - k 
    print(min)

    

else:
    print('0')

Submission status: Accepted

Solution code:
x = list(map(int, input().split(" ")))
h1 = x[0]
m1 = x[1]
h2 = x[2]
m2 = x[3]
s = x[4]
h = (h2-h1)*60
m = m2-m1
print((h+m)-s)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import datetime
from sys import stdin
h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()]

d1 = datetime.datetime(year=2018, month=1, day=7, hour=h1, minute=m1, second=0, microsecond=0)
d2 = datetime.datetime(year=2018, month=1, day=7, hour=h2, minute=m2, second=0, microsecond=0)

delta = d2 - d1

dt2 = delta.seconds / 60

dt2 -= k

if dt2 < 0 :
	dt2 = 0

print(int(dt2))

Submission status: Accepted

Solution code:
h1,m1,h2,m2,lens = [int(x) for x in input().split()]
available = (h2 * 60 + m2) - (h1 * 60 + m1)
answer = available - lens if available > lens else 0
print(answer)

Submission status: Accepted

Solution code:
h,m,a,b,k=map(int,input().split())
h_to_min = h * 60
a_to_min = a * 60
re1 = a_to_min - h_to_min
re2 = b - m
re = re1 + re2
print(re-k)

Submission status: Accepted

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

time1=H1*60+M1
time2=H2*60+M2
a=time2-K
if a<=0:
    print(0)
    exit()

if time1<=a:
    print(a-time1)
else:
    print(0)

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

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

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

print(y-x-K)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if finish - start >= 0:
  print(finish - start)
else:
  print(0)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

pre=60*h+m
post=60*H+M

print(post-pre-K)

Submission status: Accepted

Solution code:
H1,M1,H2,M2,K = (int(x) for x in input().split())
Wake  = 60*H1+M1
Sleep = 60*H2+M2

Activate = Sleep - Wake
CanStudy = Activate - K
print(int(CanStudy))

Submission status: Accepted

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

Submission status: Accepted

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

import math

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

if h2 < h1:
    h2 += 24

if m2 < m1:
    h2 -= 1
    m2 += 60

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

res = allMin - k
if res < 0:
    res = 0

print(res)

Submission status: Accepted

Solution code:
L=list(map(int,input().split()))
A=60*L[0]+L[1]
B=60*L[2]+L[3]
if B-A <= L[4]:
	print("0")
else:
	print(str(B-A-L[4]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def submit():
    h1, m1, h2, m2, k = map(int, input().split())
    
    time1 = h1 * 60 + m1
    time2 = h2 * 60 + m2

    if time1 > time2:
        time2 += 24 * 60

    print(time2 - time1 - k)


submit()

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)

if time <= K:
    print(0)
    exit(0)
else :
    print(time-K)

Submission status: Accepted

Solution code:
start_hour,start_min,end_hour,end_min,study_min =  list(map(int, input().split()))
day_time = (end_hour * 60 + end_min) - (start_hour*60 + start_min)
able_time = day_time - study_min
print(able_time)

Submission status: Accepted

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

H = H2 - H1
M = M2 - M1

t = H * 60 + M - K

print(t)

Submission status: Accepted

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

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

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:
l=input().split()
h1=int(l[0])
m1=int(l[1])
h2=int(l[2])
m2=int(l[3])
k=int(l[4])
print(60*h2+m2-60*h1-m1-k)

Submission status: Accepted

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

Submission status: Accepted

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

h = H[2]-H[0]
m = H[3]-H[1]

if h < 0:
    h = h + 24

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

mini = h*60 + m - H[4]

if mini < 0:
    mini = 24*60 + mini

print(mini)

Submission status: Accepted

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

wake = a * 60 + b
gobed = c * 60 + d

time = gobed - wake

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

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

Submission status: Accepted

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

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

if E - S >= K:
  print(E-S-K)
else:
  print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
okiji,okihun,neji,nehun,benji=map(int,input().split())
print((neji*60+nehun)-(okiji*60+okihun)-benji)

Submission status: Accepted

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

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

print(W)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum


def çözmek():
    h, m, H, M, K = map(int, input().split(" "))
    if H != 0:
        H = H * 60
    if h != 0:
        h = h * 60
    res = H + M - K - h - m
    print(res)
if __name__ == "__main__":
    çözmek()

Submission status: Accepted

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

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

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

rest_time = (h_time + m_time) - k
print(rest_time)

Submission status: Accepted

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

from datetime import datetime

diff_time = datetime(2020, 5, 20, h2, m2) - datetime(2020, 5, 20, h1, m1)
print((diff_time.seconds // 60) - k)

Submission status: Accepted

Solution code:

import datetime
h1, m1, h2, m2, k = map(int, input().split())
one = datetime.timedelta(hours=h1, minutes=m1)
two = datetime.timedelta(hours=h2, minutes=m2)
study = datetime.timedelta(minutes=k)

diff_one_two_seconds = (two.total_seconds() - one.total_seconds()) / 60
study_seconds = study.total_seconds()/60
print(int(diff_one_two_seconds - study_seconds))

Submission status: Accepted

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

min_before = H1*60+M1
min_after = H2*60+M2
if(min_before < min_after):
    print(min_after-min_before-K)
else:
    print(1440-min_before+min_after-K)

Submission status: Accepted

Solution code:
import datetime

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

t1 = datetime.datetime(year=2020, month=1, day=1, hour=a, minute=b)
t2 = datetime.datetime(year=2020, month=1, day=1, hour=c, minute=d)

delta = t2 - t1
m = int(delta.seconds / 60)
print(m - e)

Submission status: Accepted

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


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

print(t2-t1-x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
string = input()
H1, M1, H2, M2, K = [int(digit) for digit in string.split(" ")]
hour2minutes = lambda H1, H2 : (H2 - H1) * 60
total_minutes = hour2minutes(H1, H2) + (M2 - M1)
ans = total_minutes - K
print(ans)

Submission status: Accepted

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

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:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    H1, M1, H2, M2, K = read_values()
    m1 = H1 * 60 + M1
    m2 = H2 * 60 + M2
    print(m2 - m1 - K)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1, M1, h2, M2, K = map(int, input().split(" "))
wakeup = h1 * 60 + M1
sleep = h2 * 60 + M2
limit = sleep - K
study_t = limit - wakeup
print(study_t)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    h, m, g, m2, k = LI()
    hm = h * 60 + m
    gm = g * 60 + m2
    print(max(0, gm - hm - k))
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
H1, M1, H2, M2, K = [int(s) for s in input().split()]
if H2 < H1:
    H2 += 24
elif H2 == H1 and M1 > M2:
    H2 += 24
print(int(H2 * 60 + M2 - (H1 * 60 + M1) - K))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def a():
    h1, m1, h2, m2, k = map(int, input().split())
    t1 = h1 * 60 + m1
    t2 = h2 * 60 + m2

    if t1 < t2:
        print(t2 - t1 - k)
    else:
        print(1440 - (t1 - t2) - k)


def b():
    print('')



def c():
    print('')



def d():
    print('')


a()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

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


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

# K分勉強したいだけであって開始地点はいつでもいい

print((minu - K))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

ans = m2-m1-K

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

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:
H1, M1, H2, M2, K = [int(i) for i in input().split(' ')]
H = H2 - H1
M = M2 - M1
print(H * 60 + M - K)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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