fork download
  1. # your code goes here
  2. H, M = map(int, input().split())
  3.  
  4. H = 23 if H == 0 else H - 1 if M < 45 else H
  5. M = (M + 15) % 60 if M < 45 else M - 45
  6.  
  7. print(H, M)
Success #stdin #stdout 0.04s 9764KB
stdin
0 45
stdout
23 0