[Question]
  [
I have a stupid old alarm clock with two buttons: `hour` and `minute`. The `hour` button increments the hour of a set alarm, and `minute` increments the minute time of a set alarm. However, some smart designers realized that pressing both buttons at the same time should have a meaning, and decided that pressing `hour` and `minute` simultaneously would cause the alarm to be set to `12:00 am`/`0:00`. Your task is to simulate this behavior.
# Task
Given a start time and a sequence of button states, figure out the end time.
Starting from the start time, increment the hour for each occurrence of `(1,0)`, increment the minute for each occurrence of `(0,1)`, and set the time to `0:00` for each occurrence of `(1,1)`. The states `(0,0)` should be ignored because they correspond to neither button being pressed.
When adding to minutes and hours, if the minute/hour goes above the maximum, set it to `0`, i.e. incrementing a minute value of `59` should set the minute value to `0` and incrementing an hour value of `23` should set the hour value to `0`. Incrementing minute/hour values above their limits do not affect the other value, for example incrementing the minute of `10:59` yields `10:00`, not `11:00`.
# Example
Given the input time `13:58` and steps `[(0,1),(0,1),(0,1),(0,0),(1,1),(1,0)]`,
1. `(0,1)`. This corresponds to `minute` being pressed. The time is now `13:59`.
2. `(0,1)`. This corresponds to `minute` being pressed. The time is now `13:00`.
3. `(0,1)`. This corresponds to `minute` being pressed. The time is now `13:01`.
4. `(0,0)`. This corresponds to neither button being pressed. The time,unaffected, is now `13:01`
5. `(1,1)`. This corresponds to both buttons being pressed. The time is now `0:00`.
6. `(1,0)` This corresponds to `hour` being pressed. The time is now `1:00`.
Since we end with `1:00`, it is the output.
# I/O
The input will consist of a time and a sequence of button states.
The output is a single time.
The input time and output time may be
* a 2-tuple of `(hour, minute)` or `(minute, hour)` in `24`-hour time such as `(13, 30)` (`hour` ranges from `0` to `23` and `minute` ranges from `0` to `59`)
* same as the previous but in `12`-hour time and a Boolean `am`/`pm` switch (`hour` ranges from `0` to `11` or `12` and `1` to `11` with `minute` from `0` to `59`).
* a number of minutes since `0:00` such as 810 (from 0 to 1439, inclusive)
* any other format which encodes the same information
The sequence of button states is a representation of a list of Boolean 2-tuples, for example:
* a list of tuples: `[(0,1),(1,0),(0,0),(1,1)]`
* a space-delimited string: `"01 10 00 11"`
* a string: `"01100011"`
* in Quaternary: `[1,2,0,3]`
* converted to an integer: `99`
* any other format which encodes the same information
# Test Cases
```
time,steps -> output
06:49,[(0, 1)] -> 06:50
12:23,[(1, 0)] -> 13:23
02:23,[(0, 1), (1, 0)] -> 03:24
21:40,[(0, 1), (0, 1), (0, 1), (0, 1)] -> 21:44
13:10,[(0, 1), (0, 1), (0, 1), (0, 1), (1, 0), (1, 1), (0, 1), (0, 1)] -> 00:02
21:33,[(1, 0), (0, 1), (1, 0), (0, 1)] -> 23:35
14:21,[(0, 1), (0, 1), (0, 1)] -> 14:24
02:39,[(0, 0), (0, 1)] -> 02:40
16:07,[(0, 1), (0, 1), (0, 1), (0, 1), (1, 0), (1, 0), (0, 1), (0, 1), (1, 0), (0, 1), (0, 1), (0, 1)] -> 19:16
17:55,[(0, 1), (1, 0), (0, 1)] -> 18:57
15:55,[(1, 0), (1, 0), (1, 0), (0, 1), (0, 1), (0, 1), (1, 0), (1, 0), (0, 1), (1, 0), (1, 0), (0, 1), (1, 0)] -> 23:00
22:11,[(0, 1), (1, 0), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (0, 1)] -> 00:19
03:58,[(1, 0), (0, 0), (0, 0), (0, 1), (0, 1), (1, 0), (1, 0), (0, 1), (0, 1), (1, 0), (0, 1)] -> 07:03
13:02,[(0, 1), (1, 0), (0, 1), (1, 0), (0, 1), (0, 1), (1, 0)] -> 16:06
04:37,[(1, 0), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (1, 0), (0, 1), (1, 0)] -> 08:47
00:01,[(0, 1), (1, 0), (1, 0), (0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (0, 1), (0, 1)] -> 03:08
02:58,[(1, 0), (1, 0), (0, 1)] -> 04:59
01:43,[(0, 1), (0, 1), (1, 0), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (1, 0), (0, 1)] -> 04:52
07:54,[(1, 0), (0, 1), (1, 0), (1, 0), (1, 1)] -> 00:00
09:33,[(0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (0, 1)] -> 10:38
09:01,[(0, 1), (0, 1)] -> 09:03
19:04,[(0, 1), (1, 0), (0, 1), (1, 0)] -> 21:06
11:17,[(0, 1), (1, 0), (0, 1), (0, 1), (1, 0), (0, 1), (0, 1), (1, 1), (0, 1), (0, 1)] -> 00:02
19:32,[(0, 1), (1, 0), (0, 1), (1, 0), (1, 0), (1, 0)] -> 23:34
17:31,[(0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (1, 0), (0, 1), (0, 0), (1, 1), (0, 1)] -> 00:01
06:46,[(0, 1), (0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (0, 1), (1, 0), (1, 0), (0, 1), (0, 1), (0, 1), (1, 0), (1, 0), (0, 1), (0, 1), (0, 1), (1, 0), (0, 1), (1, 0), (0, 1), (0, 1), (1, 0), (0, 1), (0, 1), (0, 1), (1, 0), (1, 0), (0, 1), (1, 0), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1)] -> 18:16
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 13 bytes
```
_`+Ạ}?/%24,60
```
[Try it online!](https://tio.run/##y0rNyan8/z8@QfvhrgW19vqqRiY6Zgb///@PjjY01lEwNIjVUYg2ADLw0YY6CgZQGlM@FgA "Jelly – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~84~~ 75 bytes
```
lambda c,a:reduce(lambda(h,m),(d,e):(d&e)and(0,0)or((h+d)%24,(m+e)%60),a,c)
```
[Try it online!](https://tio.run/##VYvBCsIwEAXv/YpcKrv0HZKiQgt@Se1hzaZEMGkJ9eDXR8WTp2EGZnvtcc19XS7X@pB0UzEeMpagTx/oVygiMUgReCQ9BJasZGF5LUSxU277Iyh1gduzZQg8163c824WmtyA0zBj@gzGMQw5GPvln8/cNPUN "Python 2 – Try It Online")
Function that takes time as a tuple (hour,minute); outputs same way.
[Answer]
# C, ~~89~~ 87 bytes
*Thanks to @Jonathan Frech for saving two bytes!*
```
f(h,m,s)char*s;{for(;*s;++s)*s++&1?*s&1?h=m=0:++h:*s&1&&++m;printf("%d %d",h%24,m%60);}
```
[Try it online!](https://tio.run/##fVPRjoMgEHzvVzQkGpW9hBXUs6a5b2lsPPtg20jvqem3eyAlKnAnBpWZHXaHtf34bttp6pIeBpBp25/GTDbP7jYmjXqhVKaZpDTGr0yqqT8OR3agtD/ozzimdGju4@X66BISnffRmUAf5QKGqGRp85oUsh9Ol2uS7p67LilB1EAYkrS5/zxkQtSLWsYccg4EmbNulhn6AIJgGjHDleOAK9TcHktp8HlTDfsaAhSBBPVz4LqKQFAJ1WZfZp7hLCsoClOdjxUzZoTWanZ2M8oB0Wot@wd25VB8zkXry0nStzG3mpbkUATwyli4HTbEC2DwTnMp6w@LTZqhtEBwY7JbbICsPBb2jDXLgeu5Bf6xq4Z3E7hJ1CAWb1wQAavlNN4zhmX4ymM9/C7huE5xVpvJDlP9W@W6@dzz2Lq@9n/bprbFlmit/5p@AQ)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~21~~ (17?) 19 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
17 bytes? -- If the input format: `[[initHour, initMinute], [a1, b1], [a2, b2], ...]` is acceptable we'd have a monadic link and may remove `W;` from the beginning of the second line.
Note: This is now converging towards [Erik the Outgolfers Jelly answer](https://codegolf.stackexchange.com/a/142983/53748), so I wont bother golfing more (I had not seen it)...
```
N⁹⁹Ạ¤?+⁸
W;ç/%24,60
```
A dyadic link taking a list of the initial time as integers `[hour, minute]` (24-hour) on the left and a list of button states `[[hourPressed, minPressed], ...]` on the right  
which returns a list of the end result time as integers, again `[hour, minute]` (24-hour).
**[Try it online!](https://tio.run/##y0rNyan8/9/vUeNOIHq4a8GhJfbajxp3cIVbH16ur2pkomNm8P///2hLHWPj2P/R0QY6hrE6KKShjgGKSCwA "Jelly – Try It Online")** or see the [test-suite](https://tio.run/##lVS9TsQwDN55iluYMKL5aUuFBG/AyhB1ZKnuBdiuPAITA0gMSCzMJw4hhqJ7kMuLhLRpr0nkNmkVOaljf7bjn@p@vX5Q6lbWO70O32/N@82ZrL9O7q7@Pi5OKYcsUfsffZaPn/unw@5Z73pV7bZ5WZ1fr@TmtZL1b7NttkoJITLgRQlCJEDKsj0QCpR1B0gMZ2C0ImCxCfBk5PvUgDEgMzIGraWIrsZnR0dc@RGfAyUYfu8462NzlTLIY3xKUD4eZw5p6r6RfZv2tzYyjobd4hwTIQVCMLsQiM7zn0F6aT@1TZc8zJB0ivuEq3ZKHFjuJzueThk5wpvfQBzBNFPnmfywgTO/rJYmxIPUVcXxDhj7phMs@laJTHcBXtOYAArg03kzItpiPldvGAfrF@3wbI2MdOgvRsIButbdydLh6GmXhVt/acXFV1VMzcUOnulRMee5/v4B "Jelly – Try It Online")
### How?
```
N⁹⁹Ạ¤?+⁸ - Link 1, nextState: list, currentState [cH, cM]; list, presses [pH, pM]
     ?   - if:
    ¤    - ...condition: nilad followed by link(s) as a nilad:
  ⁹      -   chain's right argument, presses
   Ạ     -   all truthy? (1 for [1,1] 0 otherwise)
N        - ...then: negate (the left argument, currentState, i.e. [-cH, -cM])
 ⁹       - ...else: chain's right argument, presses
       ⁸ - chain's left argument, currentState
      +  - add
           i.e.: if presses was [1,1] then [cH+-cH,cM+-cM]=[0,0]
                 otherwise [cH+pH,cM+cM]
W;ç/%24,60
     24,60 - literal list of integers [24,60]
    %      - modulo by (vectorises)
```
[Answer]
# [Retina](https://github.com/m-ender/retina), 75 bytes
```
.*,1:1
:
\d+
$*
O`\D1*
,
1>`:
+`1{24}:|:1{60}
:
(?<=^|:)1*
$.&
\b\d\b
0$&
```
[Try it online!](https://tio.run/##hVPLboMwELzvd9AoJSjatQ2UVR@XSj32B6yKRumhlx6i3JJ8O11bkGCwycGSdz2eGcbL4ef4@/fdPaw/2m6bF8QEDHa/gSyHz9a@Uw4FAL22DLBp6aTMhc9MpwovAly/Pb98nflRUNl2BXZn93YHmK26Dis2TYHCR4qVFmYE9Dvp@UoRG/TVaAFpplnX4Z23K0ruas95PfV3DauQTRS1c9GfV4x1ghuDOnBUc1mGOqXrDPcm@KA32YNSTFGVmDqg5vKp7wxr0bNLD1XAM0EBGtZ1Uj3mZOwfxUTcQSw5Sb/3P/hDeXOdwqeUAeUFzCxTN6vYuDlI5tcMbn02UpnZF5HQ1LGkRvsbh8jN4@2XGxS9HCHexhjcD1ItPf/i2b3BSzuguwMb0f4H "Retina – Try It Online") Link includes test cases. Explanation:
```
.*,1:1
:
```
Delete everything up to and including the last double button press, replacing it with an empty time (in case that's the last button press).
```
\d+
$*
```
Convert to unary.
```
O`\D1*
```
Sort the minutes to the end.
```
,
```
Add the hours together.
```
1>`:
```
Add the minutes together, but keeping the hours separate.
```
+`1{24}:|:1{60}
:
```
Reduce the hours and minute modulo 24 or 60 as appropriate.
```
(?<=^|:)1*
$.&
```
Convert to decimal.
```
\b\d\b
0$&
```
Format to two digits.
[Answer]
# Python 3, ~~135~~ ~~117~~ 115 bytes
-20 bytes thanks to Jonathan Frech
```
def a(m,f):
 for b,c in f:
  if b&c:m=[0,0]
  elif b:m[0]=-~m[0]*(m[0]<23)
  elif c:m[1]=-~m[1]*(m[1]<59)
 return m
```
[Try it online!](https://tio.run/##pVbNjpswEL77KVwOFaxINYPNn7XpsU/QG@WQTYkaKWGjkFTJpa@ejnFgISEOyXLAYr7PM2PPD7M57v68l@J0@l0s@Mxd@wtPMb543/I3f86XJV/QJ18u@NvXuVpPM/AhJ0Gx0iK1ziCfTv7p5cXV79dAeA1M/AwNjDWM@WuYErwtdvttyden@awqKj7ljuNApGTqZy74HL2cT75zkoTAMFCBIDn6HIwcBUkYnOU13@cdHAiXLEAloYMPrjVfMyUjrXiX39gx6w19AAoCbV@0fg/s79gXSoQMpQrwln1zbqnPRecW53u60EOIpPuKFMSPnQNsuMWfVGHEMFZheBmHPi9RYcwwNLxLu1Y7Fp5V3twrAAsChXjLvxHrIL@JM6aMsi1M@nG@XJ@/d2MnViB0fkJgOYdVn4kDZUbEQCoRD@Tls@s9Pzp1mSgZM10dQ/EYmwe385EiAYmuj148Bu5TqpDiRlUvBurks/kxbC9gFMVQWvpBr6@0fQQYpKaPPJ6fCEokej9c9RWjP63zit7yXl41fZLyB1FhPKKeLHJr3yR/xJg8761tH5W6Hwl84L4G/Lzu761/yPR/Knqgv362np6tk0fr6an/wIj@POrczX8CI5oEvlWb1XLnOr9Kx2PNhJAdGrGmOl49oRz0fFIz8g@ie6AxpCH7jjFzoNnDtsfNluXOPXQoR9LSUaQcL/d58Xe2cmuE1JHagV3Y22KgY8dmtZ/Pi0pb/bndF0zDGmkZetriNCFV@9WOSDP3RYvJpFcDm602eUuEPZFRci3h0ynv0WlWOyNfWsT4oZ8Pj3/MVlXRUedMmociZURnsnf6Dw)
Takes the time as a list in the form `[hour, minute]`.
[Answer]
# [Haskell](https://www.haskell.org/), 58 bytes
```
foldl(#)
_#(1,1)=(0,0)
(h,m)#(x,y)=(mod(h+x)24,mod(m+y)60)
```
[Try it online!](https://tio.run/##LcxBCsIwEIXhfU8xEBczdIRJ1eImJ1GR0BpTTNpgXbSXN0bo5uPxFr@38@sRQnbmmt0U@oCKqrtCzZoMCgtV6DmSwoXX8sSpR18v1Bz5P2O9UiuUox1GMJDew/iBHTjA5sCnM8GlNDRx6UlRNvXmLX87F@xzzvsupR8 "Haskell – Try It Online") Example usage: `foldl(#) (23,58) [(0,1),(1,0),(0,0),(0,1),(0,1)]`.
[Answer]
# JavaScript (ES6), 55 bytes
```
t=>a=>a.map(x=>x>2?t=[0,0]:t[x-1]++)&&[t[0]%60,t[1]%24]
```
Takes input in currying syntax, with the starting time in the array form `[min, hour]` and the steps as a Quaternary array. Output time is in the same format as the input time.
## Test Cases
```
let f=
t=>a=>a.map(x=>x>2?t=[0,0]:t[x-1]++)&&[t[0]%60,t[1]%24]
;[[[49, 06], [1]], [[23, 12], [2]], [[23, 02], [2, 1]], [[40, 21], [1, 1, 1, 1]], [[10, 13], [1, 1, 1, 1, 2, 3, 1, 1]], [[33, 21], [2, 1, 2, 1]], [[21, 14], [1, 1, 1]], [[39, 02], [1, 0]], [[07, 16], [1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1]], [[55, 17], [1, 2, 1]], [[55, 15], [2, 2, 2, 1, 1, 1, 2, 2, 1, 2, 2, 1, 2]], [[11, 22], [1, 2, 1, 1, 1, 1, 1, 2, 1, 1]], [[58, 03], [2, 0, 0, 1, 1, 2, 2, 1, 1, 2, 1]], [[02, 13], [1, 2, 1, 2, 1, 1, 2]], [[37, 04], [2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2]], [[01, 00], [1, 2, 2, 1, 1, 1, 2, 1, 1, 1]], [[58, 02], [2, 2, 1]], [[43, 01], [1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1]], [[54, 07], [2, 1, 2, 2, 3]], [[33, 09], [1, 1, 1, 2, 1, 1]], [[01, 09], [1, 1]], [[04, 19], [1, 2, 1, 2]], [[17, 11], [1, 2, 1, 1, 2, 1, 1, 3, 1, 1]], [[32, 19], [1, 2, 1, 2, 2, 2]], [[31, 17], [1, 1, 1, 2, 1, 2, 1, 0, 3, 1]], [[46, 06], [1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1]]]
.forEach(([time,steps])=>{
  let res = f([...time])(steps)
  console.log(JSON.stringify(time)+" -> "+JSON.stringify(res))
})
```
```
.as-console-wrapper{max-height:100%!important}
```
[Answer]
# [Perl 6](https://perl6.org), 40 bytes
```
{.reduce({(@^a Z+@^b)X*[[email protected]](/cdn-cgi/l/email-protection)})Z%24,60}
```
[Try it online!](https://tio.run/##pVVLT8JAED7bXzFoye5qbWa7S1uGiPViYjTxajiQgJQEIz5ADwb57bitBQQqbfU0053H9@08ti/x5NFfjD/AHsLZYuZO4sH7fcxnPOr2oHMSdfvi7rgW9d3x6GkuOnVPOz7OF0eg0TJR0RucAbc4Q0WNkDnAuXQAhVFwV8qfcuknC@zpt1EYBoSKCcegSUXopWi53kVZk2zSJ/S/s6EmFWxzl/@RRWxWLDAkHWQskFDm3qmI1V57imLKFWYo3nafduusqdHMvCVptcGpFGbViixRvQw1oIbO7cc2Z7mKNsXDLLpJKp/zXu7pTCCpcJVlqxtrps31HBpVF89hEuXJ1bxJSTLYG1Xi/JdOY7IYS26q3I5syJSrIqWzLAEpWamaOZxxh/OSq8yq7ZP296L8de7KVrjsjlXdxaqdLcKrdP90pkOS6dyJljV8niQv9mkbuD11IOo7YMcCZtZB8gOYmKfcHnJjcqcvj6M3zsjEwWfUF6Lddodjc1JHb8CE@/A8ekrNLetg2vuAQxNsxzBLksSviXp@Duz2mkGtBuzy4uqGwfywZc0XXw "Perl 6 – Try It Online")
Takes a list containing the start time followed by the button presses. Returns the end time. Times and buttons are `(hour, minute)` pairs. 24-hour time.
[Answer]
# [Perl 5](https://www.perl.org/), 70 bytes
69 bytes of code + 1 for `-n` flag
```
s/.*d/0:0/;/(.*):(\d+)/;printf"%02d:%02d",($1+y/c//)%24,($2+y/b//)%60
```
[Try it online!](https://tio.run/##FcdbCoMwEEDRvYhC4iMzCR0/kjV0B/7koSCUGNSfbr7TCJcLp6znh5gvUH0CtAgOhOqlFUsaJLhy7vnemg5Nss@aUbR6@EIEkJ15VZmq8GhGZk2WaIwxeu/rauF3lHs/8sXTmxRq5Cn/AQ "Perl 5 – Try It Online")
**Input Format**
`hh:mm,abcdabcdabcdaddccbbaa`
*where:*
```
hh=start hour
mm=start minute
 a = (0, 0) = no buttons pressed
 b = (0, 1) = minute button pressed
 c = (1, 0) = hour button pressed
 d = (1, 1) = both buttons pressed
```
Spaces or other separators between the presses are insignificant.
**Explanation**
```
s/.*d/0:0/;    # If both buttons were ever pressed, previous presses
               # don't matter.  Get rid of them and set start time to midnight.
/(.*):(\d+)/;  # Extract start hour and minute
printf"%02d:%02d",            # Output numbers with leading 0
($1+y/c//)%24,                # Take starting hour, add number of presses, remainder 24
($2+y/b//)%60                 # Take starting minute, add number of presses, remainder 24
```
[Answer]
# [Swift](https://developer.apple.com/documentation/swift), ~~106~~ 96 bytes
-10, thanks to Xcoder
```
func x(m:(Int,Int),n:[(Int,Int)]){let i=n.reduce(m){($0.0+$1.0,$0.1+$1.1)};print(i.0%24,i.1%60)}
```
[Try it on ideone!](https://ideone.com/I3OoRy)
function will take initial value and array of tuples and returns final time.
[Answer]
# Terrapin Logo, 304 bytes
Not optimized; lots of spaces.
```
MAKE "M :B MAKE "H :A LABEL "L IF EMPTY? :I OP LIST :H :M MAKE "C FIRST :I IF AND ((ITEM 2 :C)=1) ((ITEM 1 :C) = 0) MAKE "M :M+1 IF :M=60 MAKE "M 0 IF AND ((ITEM 1 :C) = 1) ((ITEM 2 :C)=1 MAKE "M 0 MAKE "H 0 IF AND ((ITEM 1 :C)-1) ((ITEM 2 :C) = 0) MAKE "H :H + 1 IF :H = 23 MAKE "H 0 MAKE "I BF :I GO "L
```
Takes a list as its first input and the starting hour+minute (seperate inputs) as second and third, respectively.
I can't copy+paste from Terrapin Logo as it's a trial version so that's that :(
[Answer]
# Mathematica, 54 bytes
```
Switch[#2,a={0,0},#,a+1,a,_,Mod[+##,{24,60}]]&~Fold~#&
```
Anonymous function. Takes a list of 2-tuples as input and returns a 2-tuple as output.
[Answer]
# [R](https://www.r-project.org/), 61 bytes
```
function(I,B){for(b in B)I=I+"if"(sum(b)>1,-I,b)
I%%c(24,60)}
```
Takes `I` as a length-2 vector `c(H,M)` and `B` as a list of length-2 vectors for the buttons, `c(H,M)`. Iterates through `B`, setting `I` to `c(0,0)` if the sum is `2`. Then it mods down at the end. There's also a function in the header to translate the button presses into the right R format if you'd like to test them all; it takes the array `[(H,M),...]` as a string.
[Try it online!](https://tio.run/##lZAxC8IwEIV3f0U4EO7whESlLurgllXc1MEUI4XaSpO6iL@9pqBWECVmyOUdefe9pGpM7X1ZuHW5ErOhsHWR@qws0NHhss/xvK/cAf386GqDsN3ugIGAn3ITZJ45j10rHCENm6N29WyY2rymal7S1ZYVGpEVYkl6rgeQWUBXn9DQQvFQs6Ge7vdTHE04kXRrLKaopjxWxF1YhA1KFqEnPqpiIX9p@dDq3beDNm1AJTxJYkk/CFH1m091CWWMP/ZeLPdf3l/vb3@6uQM "R – Try It Online")
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 93 bytes
```
(n,l)=>{for(int i=0,x;i<n.Length;){x=n[i++];if(x>1)l[0]=l[1]=0;else{l[x]=++l[x]%(24+36*x);}}}
```
[Try it online!](https://tio.run/##VY5BS8QwEIXv/RVhYSExcWl3xYPZFMTrehAPHkoOpWa7A3ECTVxrQn57bSseZIZ5j5kP3nT@tnODmT49YE9ev30wH7LobOs9eUmFD22AjlwdvJPnFpCyVDx2ARweAUOjxTrrXk0UhWWqTmc30HlJQJVilHDE3clgHy6SpVFhA5xrCWc61hWzTamVbSqtSmmsN8k2o1acL7Kl@zt@uL8Zmcw5T7IgZO5rO5Co0HyRNTdV4rdKsV80yz/mH3QQVbmeehpFjGyxTw69s2b3NkAwJ0BDY5zf4ZuHDZ9dpVcqF3n6AQ "C# (.NET Core) – Try It Online")
Takes input as in trinary, with 0==(1,0),1==(0,1),2==(1,1), and the time in an array with index 0 being hours and 1 being minutes. Modifies the time array in place.
[Answer]
# Pyth, 22 bytes
```
%Vu?.AH,00+VGHEQ,24 60
```
[Try it here.](http://pyth.herokuapp.com/?code=%25Vu%3F.AH%2C00%2BVGHEQ%2C24+60&input=%5B13%2C+10%5D%0A%5B%5B0%2C+1%5D%2C+%5B0%2C+1%5D%2C+%5B0%2C+1%5D%2C+%5B0%2C+1%5D%2C+%5B1%2C+0%5D%2C+%5B1%2C+1%5D%2C+%5B0%2C+1%5D%2C+%5B0%2C+1%5D%5D&debug=0)
[Answer]
# [Scala](http://www.scala-lang.org/), 116 bytes
So I just take the start time as two first parameters of my func (`h` and `m`), and I take the input sequence as an Array[Tuple2].
```
var x=h
var y=m
for(u<-a)u match{case (0,1)=>y=(y+1)%60
case (1,0)=>x=(x+1)%24
case (1,1)=>{x=0;y=0}
case _=>}
(x,y)
```
I wonder ... should I count the func declaration (`def time(h:Int,m:Int,a:Array[Tuple2[Int,Int]]):Tuple2[Int,Int]={` plus the ending `}`) in byte count?
[Try it online!](https://tio.run/##jVDRasMgFH33K3wZKLsDTUJhWS30cQ9721spw6WWpDRpMGYoId@exYSOYMs2QS@cc889x9tk8iyHy@dJZQa/yaLCyhpVHRq8resOoYM6YlOUiuTpa2WgnF6ZbrWWbvfe1mcV7Tw03v2epgEiuuFLamxFjnx1okTHiybt@knSFpfSZHmXyUZhwoBTsXGCuEdOH1YMzTAHNsJWEOvhKPmBfXdnBXtxgvUz@iE2PSIWHB16VOuiMmRKvoLkGabAZLIZz5LmEUTxlfd@Ab@kGWBOwfvj2z4OCQsb79YwQAz8f8Kr81z/HDwmihc/m4XhoLuJEhi1vyW62VG8WHEwGPXDNw "Scala – Try It Online")
]