#Java 8, 54 bytes (h,m,H,M)->Math.min(((H+24-h)%24)+((M+60-m)%60),2+H+M) Port of [*@KamilDrakari*'s C# answer](https://codegolf.stackexchange.com/a/138293/52210) (after I golfed 2 bytes). [Try it here.](https://tio.run/##jZKxasMwEIb3PsUtAQnLjiRbaUxoZy/OkrF0UB23dhrLJlYCpeTZ3ZPtQOggAroDSff995/QQV902HalOey/h@Ko@x5yXZvfJ4Da2PL0qYsStm47HkBBXK6Yy82YszHndIM1VwxcvdW2LmALBl5gIBVrWMZyGr7m2lZRUxtCSBbIJKzoQiY0ICQPVjxs6GLFKZNBFuR02Exa3fnjiFqz5KWt99CgQbKzp9p8vb2DppO73U9vyyZqzzbq8MoeDTFRQUTMQCgGXDKIOaUbWC5Brn0IR0StEUkcNiPKR0gUV66JwLg1ib09xkq05nqlM/EsvAifkClmhHtnxyGU@EdIL5FMQ8j4nlAPI2JGUi/hXivF2eUd4beF@orPxM2WEOOPuw5/)