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:
(wake_h, wake_m, sleep_h, sleep_m, k) = list(map(int, input().split()))

wake_m_all = wake_h * 60 + wake_m
sleep_m_all = sleep_h * 60 + sleep_m
sleep_m_all -= k
print(sleep_m_all - wake_m_all)

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 = list(map(int, input().split()))
time = (H2-H1)*60+M2-M1
print(time-K)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

##### 割り算の切り上げ #####
# tmp = -(-4 // 3)

##### dict の for文 #####
# for k, v in d.items():
#     print(k, v)

##### 進数の変換 #####
# bin_str = bin(i)[2:]
# oct_str = oct(i)[2:]
# hex_str = hex(i)[2:]

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	H1, M1, H2, M2, K = inputMap()

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

	ans = tmp2 - tmp1 - K

	print(max(0,ans))



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# 2分検索のリバース
def bisect_left_reverse(a, x):
    if a[0] <= x:
        return 0
    if x < a[-1]:
        return len(a)
    # 二分探索
    ok = len(a) - 1
    ng = 0
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if a[mid] <= x:
            ok = mid
        else:
            ng = mid
    return ok

def bisect_right_reverse(a, x):
    if a[0] < x:
        return 0
    if x <= a[-1]:
        return len(a)
    # 二分探索
    ok = len(a) - 1
    ng = 0
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if a[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# 2分検索
# 存在しない場合: None 存在する場合: その値
def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            return mid
        if guess > item:
            high = mid -1
        else:
            low = mid + 1
    return None

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# N 個のボールを K グループに分ける場合のパターン数
def sunuke(N, K, mod=10**9+7):
	if N < K or K-1 < 0:
		return 0
	else:
		return combination(N-1, K-1, mod)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# dfs のサンプル
def dfs(graph,parent,counter,edge):
    stk = []
    stk.append(edge)
    while len(stk) > 0:
        p = stk.pop()
        for e in graph[p]:
            if parent[p] == e:
                continue
            else:
                parent[e] = p
                counter[e] += counter[p]
                stk.append(e)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()

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:
H1, M1, H2, M2, K = map(int, input().split())
T1, T2 = (H1 * 60 + M1), (H2 * 60 + M2)
print("{}".format((T2 - K) - T1))

Submission status: Accepted

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

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

Submission status: Accepted

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

if a==c:
    t=d-b
    if e<=t:
        print(t-e)
    else:
        print(0)
    
if c>a:
    if b>d:
        t=60*(c-a)-b+d
        if e<=t:
            print(t-e)
        else:
            print(0)
        
        
    if b<=d:
        t=(c-a)*60+d-b
        if e<=t:
            print(t-e)
        else:
            print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h1, m1, h2, m2, K = list(map(int, input().split()))
if (h2 - h1)*60 + (m2-m1) < K:
    print('{}'.format(0))
else:
    print('{}'.format((h2 - h1)*60 + (m2-m1) - K))

Submission status: Accepted

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

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

print(time)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

print(((abs(h1-h2)*60)-(m1-m2)) - K)

Submission status: Accepted

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

print(time-k)

Submission status: Accepted

Solution code:
h1, m1, h2, m2, k = map(int, input().split())
t1, t2 = h1*60+m1, h2*60+m2
if t1 > t2:
    t2 += 60*24
ans = t2-t1-k
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:
def main():
    H1,M1,H2,M2,K = [int(x) for x in input().split()]
    if M2 >= M1:
        diff = (H2-H1)*60 + M2-M1
    else:
        diff = (H2-H1)*60 + 60-M1+M2 -60
    if diff <= 0:
        print(0)
    else:
        print(diff - K)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    h1, m1, h2, m2, k = rli()
    mins = (h2-h1)*60+m2-m1
    print(mins-k)


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:
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

def resolve():
    h1,m1,h2,m2,k = mi()
    res = convert(h2,m2) - convert(h1,m1) - k
    print(res)

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

if c*60+d-a*60-b<k:
    print(0)
else:
    print(c*60+d-a*60-b-k)

Submission status: Accepted

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

# from collections import deque

def linput(_t=int):
    return list(map(_t, input().split()))

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    # N = int(input())
    # vA = [int(input()) for _ in [0,]*N]
    h,m,H,M,K = linput()

    res = 60*H + M - 60*h - m - K

    print(res)
    # print(("No","Yes")[res%2])
    # print(*vR, sep="\n")

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

a1 = h1*60+m1
a2 = h2*60+m2

print(a2-a1-k)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

fin = h2 * 60 + m2

st = h1 * 60 + m1

ans = fin - st - k 

print(max(0,ans))

Submission status: Accepted

Solution code:
from datetime import datetime,timedelta

a=input().split()
a=[int(_) for _ in a]

t1=datetime(2000,1,1,a[0],a[1],0)
t2=datetime(2000,1,1,a[2],a[3],0)

delta=t2-t1
total_seconds=delta.seconds

ans=(total_seconds-a[4]*60)/60
print(int(ans))

Submission status: Accepted

Solution code:
# Problem A - Study Scheduling

# input
h_1, m_1, h_2, m_2, k = map(int, input().split())

# initialization
if m_2-k>=0:
    m_2 -= k
else:
    tmp = k - m_2
    m_2 = 60 - tmp
    h_2 -= 1
tmp_1 = h_1 * 60 + m_1
tmp_2 = h_2 * 60 + m_2

# calc
ans = tmp_2 - tmp_1

# output
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

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

Submission status: Accepted

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

Submission status: Accepted

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

L = (C - A) * 60 + (D - B)

print(L - E)

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


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

Submission status: Accepted

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

print(t2-t1-K)

Submission status: Accepted

Solution code:
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


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

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


def main():
    print(solve())


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sh,sm,eh,em,k = map(int,input().split())

print(60*(eh-sh) + em-sm-k)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    h1,m1,h2,m2,k = LI()
    m1 += h1 * 60
    m2 += h2 * 60

    return m2 - m1 - k

print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

print(total_time-k)

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    h1,m1,h2,m2,k=map(int,readline().split())
    print(max(0,(h2-h1)*60+(m2-m1)-k))
    
if __name__=="__main__":
    main()

Submission status: Accepted

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

hk = K//60
mk = K%60

ans = (H2 - hk)*60 + (M2 - mk) - (H1*60 + M1)
print(max(ans, 0))

Submission status: Accepted

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

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

ans = s - e - k
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


def solve(h1, m1, h2, m2, k):
    sleep_at = h2 * 60 + m2
    wake_at = h1 * 60 + m1
    return sleep_at - wake_at - k


if __name__ == "__main__":
    h1, m1, h2, m2, k = arr_in()
    out(solve(h1, m1, h2, m2, k))

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
h1,m1,h2,m2,k=[int (x) for x in input().split()]
h3=h1*60
h4=h2*60
a=m1+h3
b=m2+h4
c=b-a
if k>c:
  print(0)
else:
  print(c-k)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
from math import floor,ceil,sqrt,factorial,log
from heapq import heapify, heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from decimal import Decimal
inf = float('inf')
mod = 1000000007

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

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

if t2 > t1:
    ans = t2 - t1 - k
    if ans < 0:
        ans = 0
    print(ans)
else:
    ans = 24 - t1 + t1
    if ans < 0:
        ans = 0
    print(ans)

Submission status: Accepted

Solution code:
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import bisect
import sys
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())z
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



#n=int(input())
#n,m=input_list()
a=input_list()

s=a[0]*60+a[1]
e=a[2]*60+a[3]
print(e-s-a[4])

Submission status: Accepted

Solution code:
#! /usr/bin/env python3
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

H1, M1, H2, M2, K = map(int, read().split())
start = H1 * 60 + M1
end = H2 * 60 + M2

gap = end - start

res = gap - K

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""
 
H1, M1, H2, M2, K = map(int, sys.stdin.read().split())
 
awake_time = H1 *60 + M1
sleep_time = H2 *60 + M2
start_limit_time = sleep_time - K
can_study_time = start_limit_time - awake_time
 
print(can_study_time)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
h1, m1, h2, m2, k = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

import datetime as dt
dt1 = dt.datetime.strptime(f'{h1}:{m1}', '%H:%M')
dt2 = dt.datetime.strptime(f'{h2}:{m2}', '%H:%M')
td = dt2 - dt1
print(td.seconds // 60 - k)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print((end - K) - start)

Submission status: Accepted

Solution code:
n = [int(s) for s in input().split()]

import datetime

time1 = datetime.datetime(2020,5,5,n[0],n[1])
time2 = datetime.datetime(2020,5,5,n[2],n[3])

time3 = time2 - time1

time3=int(time3.seconds)

result=int(time3/60)
summary = result - n[4]

print(summary)

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

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 datetime

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

x = (h2 - h1) * 60 + (m2 - m1)  # 起きている時間の長さ（分）
print(x - k)

Submission status: Accepted

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

if __name__ == '__main__':
    solve()

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

a1 = h1 * 60 + m1
a2 = h2 * 60 + m2

print(a2 - a1 - k)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(TIME-K)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x = 60*a + b
y = 60*c + d

print(y-x-k);

Submission status: Accepted

Solution code:
from datetime import datetime

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

t1=datetime(2020,5,30,H1,M1,0)
t2=datetime(2020,5,30,H2,M2,0)
d=t2-t1
print(d.seconds//60-K)

Submission status: Accepted

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

x = 60*a + b
y = 60*c + d

if y>x:
    print(y-x-k);
else:
    print(1440+y-x-k);

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s = 60 * H1 + M1
e = 60 * H2 + M2
ans = max(0, e - s - K)
print(ans)

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:
def study_time(h1, m1, h2, m2, k):
    result = (h2 - h1) * 60 + m2 - m1 - k
    return result

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

if __name__ == '__main__':
    print(study_time(h1, m1, h2, m2, k))

Submission status: Accepted

Solution code:
def main():
    H1, M1, H2, M2, K = (int(i) for i in input().split())
    h = H2 - H1
    m = M2 - M1
    ans = h*60 + m - K
    if ans > 0:
        print(ans)
    else:
        print(0)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

    ans = sleep - K - wakeup
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    H1, M1, H2, M2, K = map(int, input().split())
    h = H2 - H1
    m = M2 - M1
    print(max(0, h * 60 + m - K))
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import bisect
import sys
import math
from collections import deque
from heapq import heappush, heappop

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29

DIV = (10**9) + 7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost


def main():
    H1,M1,H2,M2,K = isRaw()
    D = (H2*60+M2)-(H1*60+M1)
    print(max(0,D-K))

main()

Submission status: Accepted

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

Submission status: Accepted

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

if t2 > t1:
	awake = t2 - t1
else:
    awake = 24 * 60 - t1 + t2

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

print(time - k)

Submission status: Accepted

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