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:
ip = [int(s) for s in input().split(' ')]

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

total = (h * 60) + m - ip[4]

if total >= 0:
    print(str(total))
else:
    print(str(0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

h1, m1, h2, m2, k = map(int, input().split())
print(solve(h1, m1, h2, m2, 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,k=map(int,input().split())
print((c-a)*60-b+d-k)

Submission status: Accepted

Solution code:
from datetime import*
a,b,c,d,k=map(int,input().split())
f=datetime
print((f(1,1,1,c,d)-f(1,1,1,a,b)).seconds//60-k)

Submission status: Accepted

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

h = ((H2-1)-H1)*60
m = (M2+60)-M1
print((h+m)-k)

Submission status: Accepted

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

Submission status: Accepted

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

h1 = input[0]
m1 = input[1]
h2 = input[2]
m2 = input[3]
k = input[4]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline

H, M, h, m, K = map(int, read().split())

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

answer = h * 60 + m - K
print(answer)

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    H1, M1, H2, M2, K = input_number_list()
    t1 = H1 * 60 + M1
    t2 = H2 * 60 + M2
    print(t2 - t1 - K)


if __name__ == '__main__':
    main()

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())
print(max(0,(60*c+d - 60*a-b)-K))

Submission status: Accepted

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

m = 0
m += 60 - h[1]
if m != 0: h[0] += 1
m += h[3] + (h[2]-h[0]) * 60
print(m-h[-1])

Submission status: Accepted

Solution code:
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

h1, m1, h2, m2, k = map(int, input().split())
ans = (h2-h1)*60
ans += m2-m1
ans -= k
print(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:
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

h,m,H,M,k=MI()
l=(M-m)+60*(H-h)
print(l-k)

Submission status: Accepted

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

Submission status: Accepted

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

time1 = h1*60 + m1
time2 = h2*60 + m2
print(max(0, time2-time1-k))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x1,y1,x2,y2,t=map(int,input().split())
print((x2-x1)*60+(y2-y1)-t)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
h1,h2,h3,h4,k = map(int,input().split())
h11 = h1 * 60 + h2
h22 = h3 * 60 + h4
print(h22-h11-k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
"""NOMURA プログラミングコンテスト 2020: A - Study Scheduling
https://atcoder.jp/contests/nomura2020/tasks/nomura2020_a
"""


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:
h1, m1, h2, m2, k = list(map(int, input().split()))

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

Submission status: Accepted

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

print((A[2]*60+A[3])-(A[0]*60+A[1])-A[4])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = lambda: sys.stdin.readline().rstrip()

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

    m = 60 - m1
    h1 += 1
    m += (h2 - h1)*60 + m2
    print(max(0, m - k))
main()

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

m = 60 - m1
h1 += 1
m += (h2 - h1)*60 + m2
print(max(0, m - k))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

ans = min2-min1-k
ans = max(0,ans)
print(ans)

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

Submission status: Accepted

Solution code:
import math

h1,m1,h2,m2,k=map(int,input().split())
start=60*h1+m1
end=60*h2+m2


print(end-start-k)
"""

a=[]
temp=input().split()
for i in range(n):
    a.append(int(temp[i])-1)

routetemp=[]
routetemp.append(0)
while True:
    if a[routetemp[-1]] in routetemp:
        roop=len(routetemp)-routetemp.index(a[routetemp[-1]])
        pre=routetemp.index(a[routetemp[-1]])
        break
    routetemp.append(a[routetemp[-1]])
#print(routetemp)
#print(a)
#print(roop)
#print(pre)
num=(k-pre)%roop
#print(num)
print(routetemp[pre+num]+1)
"""

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

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 = list(map(int, input().strip().split()))
ans = H2 * 60 + M2 - H1 * 60 - M1
if ans <= 0:
  ans += 24 * 60
print(ans - K)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=list(map(int, input().split(' ')))
# 起きてる時間（分）の計算
h=a[2]-a[0]
m=a[3]-a[1]
mt=h*60+m
# 時間の表示
print(mt-a[4])

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
string = input()
nums = string.split(' ')

hour = int(nums[2]) - int(nums[0])
minute = int(nums[3]) - int(nums[1])
time = hour * 60 + minute - int(nums[4])

print(time)

Submission status: Accepted

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

deltaH = h2 - h1
deltaM = m2 - m1
delta = deltaH * 60 + deltaM - k

print(delta)

Submission status: Accepted

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

difh = h2 - h1
difm = m2 - m1

t = 60 * difh + difm

print(max(0, t - k))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

hour = (c-a) * 60
min = d - b
ans = hour + min - K
print(ans)

Submission status: Accepted

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

h_dif = h2 - h1
m_dif = m2 - m1

time = 60*h_dif + m_dif
print(time - k)

Submission status: Accepted

Solution code:
def calc_blank_minute(H1, M1, H2, M2, K):
  return (H2 * 60) + M2 - (H1 * 60) - M1 - K

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

Submission status: Accepted

Solution code:
import datetime
h1,m1,h2,m2,k = map(int,input().split())
end = datetime.datetime(2020,6,6,h2,m2)
start = datetime.datetime(2020,6,6,h1,m1)
#print(start,end)
sub = end-start-datetime.timedelta(minutes=k)
print(sub.seconds//60)

Submission status: Accepted

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


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline

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

ans= H2*60+M2 - (H1 * 60 + M1)
if(ans < 0):
    ans=ans+24*60

print(ans-K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

S = list(map(int, input().split()))
a = (S[2]-S[0])*60+(S[3]-S[1])
b = a - S[4]
if(b>0):
  print(b)
else:
  print(0)

Submission status: Accepted

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

Submission status: Accepted

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

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

DisposableTime = goToBed - getUpTime
if K > DisposableTime:
    print(0)
else:
    print(DisposableTime - K)

Submission status: Accepted

Solution code:

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

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

print(tz-k)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

dh = h2 - h1
dm = m2 - m1

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

wm = dh*60 + dm
ans = wm - k

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def find(H1,M1,H2,M2,K):
    left = H1*60+M1
    right = H2*60+M2
    remain = right-left-K
    return max(remain,0)
H1,M1,H2,M2,K = list(map(int,input().strip().split()))
print(find(H1,M1,H2,M2,K))

Submission status: Accepted

Solution code:
import math
h_one,m_one,h_two,m_two,k = map(int,input().split())

hour = h_two - (h_one + 1)
minute = (60 - m_one) + m_two

print(60*hour + minute - k)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if M_all <= 0:
    print('0')
else:
    print(M_all)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 = T2 + 24 * 60
print(T2-T1-K)

Submission status: Accepted

Solution code:
h1,m1,h2,m2,k=map(int,raw_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())
H_min = (h2-h1)*60
M_min = m2-m1
time = H_min + M_min
ans = time - k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

 
list = input().split()
 
m1 = int(list[0])*60 + int(list[1])
m2 = int(list[2])*60 + int(list[3])
#print(m1,m2)
    
ans = m2 - m1
print(ans-int(list[4]))

Submission status: Accepted

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

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

Submission status: Accepted

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

s = h1*60+m1
t = h2*60+m2
ans = t-s-k
print (max(ans,0))

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())
 
# 時間を、0時0分からの経過時間に変換する。
start = (60 * h1) + m1
end = (60 * h2) + m2 - k
 
print(end - start)

Submission status: Accepted

Solution code:
import datetime
h,m,eh,em,k = map(int,input().split())
start = h*60 + m
end = eh*60 + em
if end - start > k:
    print(end - k - start)
else:
    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:
a, b, c, d, e = map(int, input().split())
start = a*60 + b
end = c*60 + d

print(end - e - start)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


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


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    H1, M1, H2, M2, K = map(int, input().split())
    if M2 >= M1:
        time = (H2 - H1) * 60 + M2 - M1
    else:
        time = (H2 - H1 - 1) * 60 + M2 + 60 - M1
    answer = max(time - K, 0)

    print(answer)


if __name__ == "__main__":
    main()

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:
h,m,H,M,K = map(int, input().split()) 

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import re
import copy

h1,m1,h2,m2,k = map(int,input().split())
w1 = h1*60 + m1
w2 = h2 * 60 + m2
w3 = (w2-w1+24*60)%(24*60)
w3 = w3 - k
print(w3)

Submission status: Accepted

Solution code:
import math
import re
import copy

h1,m1,h2,m2,k = map(int,input().split())
w1 = h1*60 + m1
w2 = h2 * 60 + m2
w3 = (w2-w1+24*60)%(24*60)
w3 = w3 - k
print(w3)

Submission status: Accepted

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

# A - Study Scheduling
h1, m1, h2, m2, k = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


def main():
    import sys
    input = sys.stdin.readline

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a, b, c, d, e= map(int, input().split()) # split()で空白区切りでリスト化、その際map()でint型にキャストし変数に代入。
print((c-a)*60+d-e-b)

Submission status: Accepted

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

a = h1*60 + m1
b = h2*60 + m2

print(b-a-k)

Submission status: Accepted

Solution code:
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())
st = h1*60 + m1
end = h2*60 + m2
print(end-st-k)

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:
import sys
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    #n = int(stdin.readline().rstrip())
    h1,m1,h2,m2,k = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    wake = (h2-h1)*60 + m2-m1
    ans = wake - k
    print(ans)

main()

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

t1=60*H1 + M1
t2=60*H2 + M2
t=t2 - K
ans=t-t1
print(max(0,ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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:
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    # N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    H1, M1, H2, M2, K = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # h_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)]
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([]))

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


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10 0 15 0 30"""
        output = """270"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10 0 12 0 120"""
        output = """0"""
        self.assertIO(input, output)