[Question]
  [
"Talk" is a baroquified accumulator-based language that is created in response to Dennis's [quote](https://chat.stackexchange.com/transcript/message/31809962#31809962) on talk.tryitonline.net.
```
Waiting for someone to create an esolang called talk. 
```
. The "Talk" language has 4 commands:
* `00` If the accumulator is 0, set the accumulator to 0.
* `01` If the accumulator is 0, set the accumulator to 1.
* `10` If the accumulator is 1, set the accumulator to 0.
* `11` If the accumulator is 1, set the accumulator to 1.
## Input:
* The input can be taken via any acceptable input method by our standard I/O rules.
* There are two inputs, the initial accumulator value and the program. You can merge these two inputs into one input or split your input into valid commands (e.g. taking them as a list; e.g. `[00, 01, 00]`) if you like.
## Output:
* On the end of a command execution, the accumulator is outputted implicitly.
## Rules:
* The input *can* be a single string or character list.
* As this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the shortest answer, in bytes, wins.
* We take digits or strings/characters.
## Test cases:
```
0 0001111101 -> 1
0 000100 -> 1
0 11001000 -> 0
```
## Leaderboards
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
```
# Language Name, N bytes
```
where `N` is the size of your submission. If you improve your score, you *can* keep old scores in the headline, by striking them through. For instance:
```
# Ruby, <s>104</s> <s>101</s> 96 bytes
```
If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the *last* number in the header:
```
# Perl, 43 + 2 (-p flag) = 45 bytes
```
You can also make the language name a link which will then show up in the leaderboard snippet:
```
# [><>](http://esolangs.org/wiki/Fish), 121 bytes
```
```
var QUESTION_ID=190819;
var OVERRIDE_USER=8478;
var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;function answersUrl(d){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+d+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(d,e){return"https://api.stackexchange.com/2.2/answers/"+e.join(";")+"/comments?page="+d+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(d){answers.push.apply(answers,d.items),answers_hash=[],answer_ids=[],d.items.forEach(function(e){e.comments=[];var f=+e.share_link.match(/\d+/);answer_ids.push(f),answers_hash[f]=e}),d.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(d){d.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),d.has_more?getComments():more_answers?getAnswers():process()}})}getAnswers();var SCORE_REG=function(){var d=String.raw`h\d`,e=String.raw`\-?\d+\.?\d*`,f=String.raw`[^\n<>]*`,g=String.raw`<s>${f}</s>|<strike>${f}</strike>|<del>${f}</del>`,h=String.raw`[^\n\d<>]*`,j=String.raw`<[^\n<>]+>`;return new RegExp(String.raw`<${d}>`+String.raw`\s*([^\n,]*[^\s,]),.*?`+String.raw`(${e})`+String.raw`(?=`+String.raw`${h}`+String.raw`(?:(?:${g}|${j})${h})*`+String.raw`</${d}>`+String.raw`)`)}(),OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(d){return d.owner.display_name}function process(){var d=[];answers.forEach(function(n){var o=n.body;n.comments.forEach(function(q){OVERRIDE_REG.test(q.body)&&(o="<h1>"+q.body.replace(OVERRIDE_REG,"")+"</h1>")});var p=o.match(SCORE_REG);p&&d.push({user:getAuthorName(n),size:+p[2],language:p[1],link:n.share_link})}),d.sort(function(n,o){var p=n.size,q=o.size;return p-q});var e={},f=1,g=null,h=1;d.forEach(function(n){n.size!=g&&(h=f),g=n.size,++f;var o=jQuery("#answer-template").html();o=o.replace("{{PLACE}}",h+".").replace("{{NAME}}",n.user).replace("{{LANGUAGE}}",n.language).replace("{{SIZE}}",n.size).replace("{{LINK}}",n.link),o=jQuery(o),jQuery("#answers").append(o);var p=n.language;p=jQuery("<i>"+n.language+"</i>").text().toLowerCase(),e[p]=e[p]||{lang:n.language,user:n.user,size:n.size,link:n.link,uniq:p}});var j=[];for(var k in e)e.hasOwnProperty(k)&&j.push(e[k]);j.sort(function(n,o){return n.uniq>o.uniq?1:n.uniq<o.uniq?-1:0});for(var l=0;l<j.length;++l){var m=jQuery("#language-template").html(),k=j[l];m=m.replace("{{LANGUAGE}}",k.lang).replace("{{NAME}}",k.user).replace("{{SIZE}}",k.size).replace("{{LINK}}",k.link),m=jQuery(m),jQuery("#languages").append(m)}}
```
```
body{text-align:left!important}#answer-list{padding:10px;float:left}#language-list{padding:10px;float:left}table thead{font-weight:700}table td{padding:5px}
```
```
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654"> <div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> 
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
y@/
```
Input is a single list: the accumulator, followed by the pairs.
[Try it online!](https://tio.run/##y0rNyan8/7/SQf//4fZHTWsi//@P5uKMNtBRAGKDWDBlCKIMUSiQYKwOVoUgHlzKECEG5hkgqYgFAA "Jelly – Try It Online")
### How it works
The `y` atom performs transliteration; **[a,b]**`y`**c** replaces **a** with **b**, so it returns **b** if **a=c** and **c** if **a≠c**.
`y@/` folds/reduces the input by `y` with swapped arguments, performing one transliteration per pair.
[Answer]
# [Python 3](https://docs.python.org/3/), 43 bytes
```
lambda s:re.sub("00|11","",s)[-1]
import re
```
[Try it online!](https://tio.run/##VY3LCsIwEEX3/YohqwajTHBXyJfUImmbasA8yGMh@O8xEbF4l2fOYfwz3Z09l01cykOaeZUQh6BOMc89QXxxThghLNLxyKdOG@9CgqBKUjFdFxlVBAFjVauGiLwNW8MJZTtG/EPVaexzJXTqNhfABX1jsDhjpF0jA5eTzwm0hf3X0EGdD9qmfutbAYdfQkGIb0XLGw "Python 3 – Try It Online")
The function takes a single string as input, where the first character is the initial state and the rest of the string represents the commands. This solution can be easily ported to other languages that have better support for regular expressions.
The difficult part is to prove the solution yields the correct outcome. To see this, we need a deep analysis of the commands. Firstly, we can see the commands have the following properties: 
* **Property (1)**: commands `00` and `11` retain the accumulator state.
* **Property (2)**: commands `01` and `10` make the accumulator state the same as the second bit regardless of its original state.
Therefore, the final accumulator state is:
* **Case 1**: If no `01` or `10` command exists, the final state is the same as the initial state.
* **Case 2**: Otherwise, the last bit of the last `10` or `01` command.
Next we will show the solution yields the correct outcome in both cases. We will prove the statement for the final state `0` and the final state of `1` can be proved analogously. If the final state is `0` the input is in either of the following forms:
* `^0{2k+1}11(11|00)*`
For **Case 1**, the input string `s` must start with `2k+1` 0s, followed by `11` and `00` commands. Eliminating `00`s and `11`s yields a single `0`, which is the final state.
* `.+10{2k+1}11(11|00)*`
For **Case 2**, the input string ends with a `10` command, followed by zero or more `00` and `11` s. This pattern is equivalent to a `1` followed by `2k+1` 0s, and then zero or more `11`s and `00`s. Eliminating `00`s and `11`s leaves behind the last one of the `2k+1` 0s at the end of the string, which represents the final state.
Based on all the above, after eliminating `00`s and `11`s **simultaneously in one single pass** (`01001` is a counter-example if `00` is eliminated in one pass and then `11` in another pass) from the input `s`, the last character is the final state. Hence the correctness of the solution is proved.
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 17 bytes
```
{m/.)>[(.)$0]*$/}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwvzpXX0/TLlpDT1PFIFZLRb/2vzVXWn6RgkZOZl5qsaZCNRdnrlW6fkyKtr41F2dxYqVCXZqGikGdiqEmV@1/AwUDAwNDEDAwVNC1UzDkgogYGMB4QBkQF8w34DJUQMhAxQA "Perl 6 – Try It Online")
Takes advantage of "You can merge these two inputs into one input if you like" by taking input as the accumulator value concatenated with the commands e.g. `1,[00,11]` is `10011`. If this isn't okay, than it's only 5 extra bytes to take it as [`f(accumulator, commands)`](https://tio.run/##K0gtyjH7n1upoJamYKvwvzpXX0/TLlpDT1PFIFZLRb82Xy26Lva/NVdafpGCRk5mXmqxpkI1F2euVbp@TIq2vjUXZ3FipUJdmoaKgY6KoSZX7X8DBQMDA0MQMDBU0LVTMOSCiBgYwHhAGRAXzDfgMlRAyEDFAA). Returns a match object that can be coerced to a string.
### Explanation:
```
{                }  # Anonymous code block
 m/             /   # Find the first match from the input
   .)>              # Capture a number
      [     ]*      # Followed by any number of
       (.)$0        # Pairs of identical characters
              $     # Ending the string
```
Basically this works because the `00` and `11` commands do literally nothing, while the `01` and `10` commands just set the accumulator to the second digit of the command. If there are no commands, then it takes the initial value of the accumulator instead.
[Answer]
# [Zsh](https://www.zsh.org/), 33 bytes
The character list is passed as arguments, the initial value of the accumulator is passed as stdin.
```
read a
for x y;a=$[x^a?a:y]
<<<$a
```
[Try it online!](https://tio.run/##dYvBCsIwEETv@xUDBqqHQuKxTdX/EIWFJrQQGmhFW0u/PVqt8SDOwDLsm7l3VbDrzRhawyWYrG/RY8i5EMf@zHvOhhNprQWHiW5V7QxeTVc3JkfpyVzZoTMXpCnE/CULMR6y7YTnDEJR6RsTJN5W0XNeodhB0RfO96MI1QLUUotQkkKS4Edx@RdKegA "Zsh – Try It Online")
---
**39 bytes**: If the commands must be a single string
Input is `accumulator` `commands` as arguments.
```
for x y (${(s::)2})1=$[x^$1?$1:y]
<<<$1
```
[Try it online!](https://tio.run/##VcrBCsIwEITh@z7FgAttbrsea0TfQxQKSWihtNCItpY@ezQWD/7Hb@YVmxRKs6QwjJgwo@SljFVl9qvRI1@mG@uJtZqvZK1lTSs9m7bzGH3t0LW9P8AN5B91h@jv4EwUwGdyQ@@TQEQ0J4odlDYQQW6Dz5ZFviCkKAr82h5/IPQG "Zsh – Try It Online")
---
For fun, here's a **50 byte** recursive one-liner ([TIO](https://tio.run/##JcxBCsIwEIXhfU7xwFkoEpjJMhY8SIm0kJQWQgtWFAw5e0zsW/18A/Pd5zKdL6l0XUeJkrkOE6gnedTuxeU7iW1pXHaoYU0estUkuWT1mZcY8AyjR1zWcIPfVHiPEXt4QWtQU1UfCsgov62hMJhZ2lhwgqgDmNF2QL014T@w@gE "Zsh – Try It Online")):
```
<<<${${2+`f $[$1^${2[1]}?$1:${2[2]}] ${2:2}`}:-$1}
```
[Answer]
# [Python 3](https://docs.python.org/3/), 52 bytes
```
f=lambda a,s:s and f([s[1],a][s[0]==s[1]],s[2:])or a
```
[Try it online!](https://tio.run/##K6gsycjPM/7/P802JzE3KSVRIVGn2KpYITEvRSFNI7o42jBWJzEWSBvE2tqCeLE6xdFGVrGa@UUKif8LijLzSjTSNJQMlHQUlAwMDAxBwMBQSVOTC1POwABTHKgaJIEkg6TCEKwTqARFH1gUpA2LKBRgswcu8x8A "Python 3 – Try It Online")
*Fixed inconsistent return type thanks to Chas Brown*
Takes input as two strings; the accumulator and the code.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~11~~ 9 bytes
```
tġ₂≠ˢtt|h
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6Ompoe7Omsfbp3wv@TIQiDvUeeC04tKSmoy/v@PjlYyUNJRMjAwMAQBA0OlWB2EkIEBnAuUA/GBArEA "Brachylog – Try It Online")
Since it's been long enough that I've been able to forget the notion of [printing the accumulator after each command](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6Ompkcdyx/u2vFwV2ftw60T/h9ZCBR6uHV6@qkNydXVJRl1GfYlJTUZteVA4drTC///j45WMlDSUTIwMDAEAQNDpVgdhJCBAZwLlAPxgQKxAA), I've formulated a significantly less naïve solution with some inspiration from Jo King's Perl answer.
```
       |     The output is
     tt      the last element of the last element of
t            the last element of the input
 ġ₂          split into length-2 slices
   ≠ˢ        with equal pairs removed.
       |     If there is no such element, the input
        h    's first element is the output.
```
Old solution:
# [Brachylog](https://github.com/JCumin/Brachylog), ~~18~~ 16 bytes
```
ġ₂ᵗc{th~h?tt|h}ˡ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6Ompoe7Omsfbp3w/8hCEGfr9OTqkoy6DPuSkpqM2tML//@Pjo5WMlCK1VEyMDAwBAEDQyAPWdDAAEkAKA8SAbJjAQ "Brachylog – Try It Online")
-2 bytes from changing the input format.
[Answer]
# JavaScript (ES6), 27 bytes
Takes input as `(a)(code)`, where *code* is a is list of 2-bit integers.
```
a=>c=>c.map(x=>a^=x==a+1)|a
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1i4ZiPRyEws0KmztEuNsK2xtE7UNNWsS/yfn5xXn56Tq5eSna6RpGGhqRBskGRjoAAlDIGEIJwwMYzU1FfT1FQy58GsxMAApRACcWiDGgvQZGqDqA2ox@A8A "JavaScript (Node.js) – Try It Online")
---
# JavaScript (ES6), ~~47~~ 40 bytes
Takes input as `(a)(code)`, where *code* is a string.
```
a=>c=>c.replace(/../g,x=>a^=x%4==a+1)&&a
```
[Try it online!](https://tio.run/##dcxBCoAgEIXhfaeIoFAqHaHtdJRgMItCMjKi25tCy/p5y4@30kVeH8t@tpsbTZgwEPY6Thxmt6QNk0LIubmxpwHvskOkWvGqoqDd5p01wrqZTQw4KwBApUAVnOdS5ir7RgAJpH5Q/EjqZRFBeAA "JavaScript (Node.js) – Try It Online")
### How?
All possible cases are summarized below. The only two cases where we need to toggle the accumulator are \$(a=0,x=01\_2)\$ and \$(a=1,x=10\_2)\$.
```
  a | x (bin) | int(x) % 4 | a + 1 | equal?
----+---------+------------+-------+--------
  0 |   "00"  |  0 % 4 = 0 |   1   |   N
  1 |   "00"  |  0 % 4 = 0 |   2   |   N
  0 |   "01"  |  1 % 4 = 1 |   1   |   Y
  1 |   "01"  |  1 % 4 = 1 |   2   |   N
  0 |   "10"  | 10 % 4 = 2 |   1   |   N
  1 |   "10"  | 10 % 4 = 2 |   2   |   Y
  0 |   "11"  | 11 % 4 = 3 |   1   |   N
  1 |   "11"  | 11 % 4 = 3 |   2   |   N
```
[Answer]
# [sed](https://www.gnu.org/software/sed/) -E, ~~26~~ 19 bytes
*A whopping **-7 bytes** from @Cowsquack by realizing removing all pairs works as well.*
```
s/(.)\1//g
s/.*\B//
```
Takes input concatenated together on stdin. Inspired by [Jo King's Perl answer](https://codegolf.stackexchange.com/a/190830/86147).
~~Strip trailing pairs~~ Remove all pairs, then get last digit.
~~[Try it online!](https://tio.run/##K05N0U3PK/3/v1hfw8CgxtBQU0tFX5@rWF9PS0NPU0U/xlD//38DIDAEAQNDLjDbwIALKABmGHABxbj@5ReUZObnFf/XdQUA "sed – Try It Online")~~
[Try it online!](https://tio.run/##K05N0U3PK/3/v1hfQ08zxlBfP52rWF9PK8ZJX///fwMgMAQBA0MuMNvAgAsoAGYYcAHFuEAsw3/5BSWZ@XnF/3VdAQ "sed – Try It Online")
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), ~~18~~ 11 bytes
```
(.)\1
!`.$
```
[Try it online!](https://tio.run/##K0otycxL/K@q4Z7wX0NPM8aQi0sxQU/l/38DIDAEAQNDLjDbwIALKABmGHDhlzWEqAAA "Retina 0.8.2 – Try It Online") Link includes test cases. Takes input concatenated. Saved 6 bytes thanks to @CowsQuack for pointing out that removing all doubled characters and then taking the last remaining character works, although in fact the port of @JoKing's original answer could have been golfed by 3 bytes even without that trick.
[Answer]
# [Haskell](https://www.haskell.org/), 29 bytes
Defines an unnamed function on the first line with type `(Foldable t, Eq b) => b -> t [b] -> b`. For the purposes of this code golf, we can instantiate it as `Char -> [String] -> Char` where the first argument is the accumulator and the second is a list of string with each string being a single command. 
```
foldl(#)
a#[x,y]|a==x=y|1>0=a
```
[Try it online!](https://tio.run/##y0gszk7NyfmfZvtfIS0/JyVHQ1mTK1E5ukKnMrYm0da2wrayxtDOwDbxf25iZp6CrUJKPpeCQkFRZl6JgopCmoK6gbpCtJKBgZKOgpKBIYg0RCKBIrEElAPZ2JQYwiRBZhnAFf4HAA "Haskell – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 38 bytes
```
lambda l:[y for*x,y in l if[y]!=x][-1]
```
[Try it online!](https://tio.run/##bYzBDoIwAEPvfEXlMqYz2eKNZF8yd5gCsmRsC4LC1yMkaNB4aZr2tXHs6uBPUyXPkzPNpTBwuRpRhXY/sBHWw8FWatQ7OWh1FHp61taVEHmC0NobwzU0jfHFnSH0Xew7yPJhXGb97DNKk/kjQkIttMbhwyeIrfVdVi0ohZTrnk4Z4YRBpZynDCkXi4qNzolmIILQ5B86@99avIvlg28g/g2t0Qs "Python 3 – Try It Online")
Based on [Joel's solution](https://codegolf.stackexchange.com/a/190840/20260). Takes input as a list of the initial accumulator value (length-one string) followed by the commands (length-two strings). Finds the last command with two unequal values, and outputs its second character.
To make this fall through to the initial accumulator value when there are no such commands, we make it so that the single-char initial value string passes the test. We do so by checking if a singleton list with the last character is unequal to a list of all preceding characters, which is passed by any length-one string or length-two string with two different characters.
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, ~~37~~ 33 bytes
```
$\=<>;s/(.)(.)/$\=$2if$\==$1/ge}{
```
[Try it online!](https://tio.run/##K0gtyjH9/18lxtbGzrpYX0NPE4j0gVwVo8w0IGWrYqifnlpb/f@/gYGBIQgYGHIZ/MsvKMnMzyv@r1uQAwA "Perl 5 – Try It Online")
Input is two lines: first line is the command sequence, second is the accumulator.
[Answer]
# [Python 2](https://docs.python.org/2/), 56 bytes
```
f=lambda a,c:f([a,1,0,a][int(c[:2],2)],c[2:])if c else a
```
[Try it online!](https://tio.run/##Xcq7DoAgDIXh3afoJiQdWkYSn4QwVJRo4i3q4tNjGVw843f@47mnfXOl5G6RtR8EBJPPJggyEkoM83abFLyL6GzEFJyPds6QYFyuEaQcpxaQDWNLxMTc2qb5kBBUFXVUn/9B9EPtqiqXFw "Python 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~8~~ 6 bytes
```
EÐḟṪṪo
```
[Try it online!](https://tio.run/##y0rNyan8/9/18ISHO@Y/3LkKiPL/FxsdXs51ePmxuY@a1kT@/x8drWRgYGAIAgaGSjpKBkqxOhAhAwM4FygH4qMJQFQYKsXGAgA "Jelly – Try It Online")
-2 bytes thanks to Nick Kennedy informing me of a rules change. (His proposed golf, `EÐḟFȯṪ`, seems somewhat more clever but has the same length as my previous solution minus `s2`.) The input format now takes the commands as a list of two-character strings, but the testing footer translates from the old format for convenience.
Translated from my newer Brachylog solution.
Old version:
# [Jelly](https://github.com/DennisMitchell/jelly), 13 bytes
```
ḢẎ⁼⁹a⁸o
s2ç@ƒ
```
[Try it online!](https://tio.run/##y0rNyan8///hjkUPd/U9atzzqHFn4qPGHflcxUaHlzscm/T/8PJjcx81rYn8/z86WsnAwMAQBAwMlXSUDJRidSBCBgZwLlAOxIcKxAIA "Jelly – Try It Online")
I'm not 100% sure this is correct, but it succeeds on all three test cases. Takes the commands as the left argument and the initial accumulator as the right argument.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 16 bytes
```
(+⌷13⍴0 1,9/⊢)/⌽
```
A tacit function which takes initial accumulator value and the program as a single integer list.
Maps the relevant sums of instruction and accumulator to an array.
Table: `(a→accumulator, i→instruction)`
```
a  i a+i result
00 0 0   0
01 0 1   1
10 1 11  0
11 1 12  1
```
All other cases return the same value, so they are assigned to the preexisting value of `a`.
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qG@qp/@jtgkG/zW0H/VsNzR@1LvFQMFQx1L/UdciTf1HPXv/pwGlH/X2PepqPrTe@FHbRKCW4CBnIBni4Rn8P03BQMEAiAwVDMHIwJALIWRgAOaAhIGkAZxvAAA "APL (Dyalog Unicode) – Try It Online")
### Explanation
```
(+⌷13⍴0 1,9/⊢)/⌽ accumulator→a
              /⌽ reduce the reversed array using th following function: (reducing happens from the right)
          9/⊢)   replicate a 9 times
   13⍴0 1,       concatenate with (0,1) and expand to 13 elements → (0 1 a a a a a a a a a 0 1)
(+⌷              sum first two elements and find element at that index in the array
```
### Solution which accepts a string
```
{{(13⍴0 1,9/⍺)[⍺+⍵]}/⌽(⍎¨((⍴⍵)⍴1 0)⊂('0',⍵))}
```
It was pretty ambiguous how the input was supposed to be taken, so I decided I'd leave this one in as well.
This was the original dfn, which was golfed down using Adám and Bubbler's advice.
[Answer]
# Regex (JS flavor), 32 bytes
```
^(0(..)*01|1((..)*01)?)(00|11)*$
```
[Try it online!](https://regexr.com/6nmi7)
Matches if output is 1, doesn't if output is 0. Global and multiline flags enabled in link to verify multiple test cases at once, but not necessary for solution. Did I format this submission correctly?
[Answer]
# Python, 111 bytes
```
def f(a,b):
    c=a
    for i in range(0,len(b)-1,2):
        c=(not b[i])*(c or b[i] or b[i+1]) or c*b[i]*b[i+1]
    return c
```
Ungolfed. EDIT: AHHH Someone beat me to it!
[Answer]
# [Haskell](https://www.haskell.org/), 36 bytes
```
f(x:y:s)=f s.last.(:[y|x/=y])
f _=id
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P02jwqrSqljTNk2hWC8nsbhET8MqurKmQt@2MlaTK00h3jYz5X9uYmaegq1CQVFmXomCikKagpKBgYEhCBgYKimoG6j/BwA "Haskell – Try It Online")
Takes input as `f(string)(char)` where the character is the accumulator and the string is the list of commands.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 3 bytes
```
ø`:
```
[Try it online!](https://tio.run/##yy9OTMpM/f//8I4Eq///o6MNdAxidRSAlCGIMkSh4IJYlED1geRiuQwA "05AB1E – Try It Online")
Zip, dump on the stack, replace.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 3 bytes
```
F|t
```
[Run and debug it](https://staxlang.xyz/#c=F%7Ct&i=%220%22+[%2200%22+%2201%22+%2211%22+%2211%22+%2201%22]%0A%220%22+[%2200%22+%2201%22+%2200%22]%0A%220%22+[%2211%22+%2200%22+%2210%22+%2200%22]%0A&a=1&m=2)
For each instruction, perform character translation.
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), `-ir`, 16 bytes
```
"(!;½|':"=['_"|_
```
[Try it online!](https://tio.run/##y05N//9fSUPR@tDeGnUrJdto9Xilmvj//w0MDQ0MgMjgv25mEQA "Keg – Try It Online")
## Explained:
1. Takes the implicit input and right shifts the accumulators value to the bottom
2. Repeat the following (length of stack - 1 divided by 2) times
2.1. Shift the accumulator back to the top
2.2. Compare for equality with the first part of the command
2.2.1. If true, replace the accumulator, otherwise pop the replacement 
Input is taken as the initial acc value concatenated with the source. E.g.
```
010011000
```
* First char is acc value
* Rest is program
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 8 bytes
```
{{)er}/}
```
[Try it online!](https://tio.run/##S85KzP1fWPe/uloztahWv/Z/3X8lAyWFaCUDIKlkYAgkDOEEkBsLAA "CJam – Try It Online")
Takes input on the stack in the form of `"0" ["00" "01" "11" "11" "01"]`. Does string replacement using every command.
[Answer]
# [Headass](https://esolangs.org/wiki/Headass), 22 bytes
```
U[{N-()]PNE:U(])U[:U;}
```
[Try It Online!](https://dso.surge.sh/#@WyJoZWFkYXNzIixudWxsLCJVW3tOLSgpXVBORTpVKF0pVVs6VTt9IiwiIiwiMFxuMFxuMFxuMFxuMVxuMVxuMVxuMVxuMVxuMFxuMSIsIiJd)
```
U[{N-()]PNE:U(])U[:U;} full program
U[                     save initial state of accumulator to storage register
  {        :         } while
   N-()                input remains
            U(])    ;    if input == accumulator state
                U[         set accumulator to next input
                  :      else
                   U       discard next input
       ]P              print final state of accumulator
         NE            go to code block 1
                       block does not exist, exits with error
```
There is room for golfing maybe if I can avoid storing anything in the comparison register (i.e. having it remain 0 for the entirety of the program and never using `(`), but it might not be possible.
[Answer]
# Regex (any flavor), 15 bytes
```
(^|0)1(00|11)*$
```
[Try it on regex101!](https://regex101.com/r/ySrh84/1)
It was pointed out before that the problem can be simplified:
* `00` and `11` are no-ops. `01` unconditionally sets the value to 1 while `10` sets to 0.
* The output is 1 if and only if the input is 1 and the entire code is no-op or the last non-no-op command is `01`.
The regex precisely does the job: `(00|11)*$` after discarding no-ops at the end, the last thing found is `(^|0)1` the input 1 or a `01` command.
`1(00|11)*$` does not work because the 1 may be part of another no-op command `11`.
[Answer]
# [Bash](https://www.gnu.org/software/bash/), ~~58~~ 40 bytes
Add one byte for a full program: change `f` to `$0`.
```
(($1=$2-a?a:$3,1))&&f $1 ${@:4}||echo $1
```
~~[58 bytes](https://tio.run/##VcxBCsIwEIXh/ZzigYEqUpjpMiIeRJRGO6WF0oIVXZScPWYsLnyrP99AbmHuUrvdLSkc3VLt6xbu7OSa27OXeHLirSX3BVZVrCPpvZvyK/jSSUyR3l0/KB4aGgz9qAc0E@krDJj1ibKEM6X8t8BV1EyjJgYzi40FGwitwAzbCvlmwl/gDEWB3wzkH4Q@ "Bash – Try It Online")~~
[Try it online!](https://tio.run/##dYtRC4JAEITf91cMdKgHCW71ZFj@lStXFA4PMupB/e2Xkl0P0Qwsu/vNXEzf@DrRg08SxYXapeZscrXfstZRVEMx1FDmh2kc5dq4@fYTPZvWCm5iKti2kyMqR/IwFr3ckaZQy5fmckmV68RneJuDl32D4gSmL1zmRwHyCniNBZgRI47xo9D8CzN6AQ "Bash – Try It Online")
The ternary will return false when `$1` is set to `0`, but the `,1` at the end ensures the whole `((expression))` will return true, *except* a syntax error.
When all the arguments are consumed, a syntax error happens and the recursion ends.
---
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 16 bytes
```
Ｆ⪪η²Ｆ⁼θ§ι⁰≔§ι¹θθ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z8tv0hBI7ggJ7NEI0NHwUhTUwEs4lpYmphTrFGoo@BY4pmXklqhkamjYKAJlHYsLs5Mz9NAEjbU1FEo1LTmCijKzCvRALL@/zdQMDAwMAQBA8P/umU5AA "Charcoal – Try It Online") Link is to verbose version of code. Takes separate arguments. Explanation:
```
Ｆ⪪η²
```
Split the instructions into pairs of digits and loop over them.
```
Ｆ⁼θ§ι⁰
```
If the accumulator is equal to the first digit...
```
≔§ι¹θ
```
... then assign the second digit to it.
```
θ
```
Print the accumulator at the end of the loop.
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~13~~ 12 bytes
```
!dh2Ol4$Ys0)
```
Takes the input as a 2-column matrix where each row is a command, and a number
[Try it online!](https://tio.run/##y00syfn/XzElw8g/x0QlsthA8///aAMFA2sFAwVDawVDOAHkxnIZAAA) Or [verify all test cases](https://tio.run/##y00syfmf8F8xJcPIP8dEJbLYQPO/S8j/aAMFA2sFAwVDawVDOAHkxnIZcCHJAVlgEai0AUihAVTYEAA)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
fØ½Ḃ⁹;Ṫ
```
A dyadic Link accepting the program as a list of integers on the left and the initial accumulator on the right which yields an integer.
**[Try it online!](https://tio.run/##ASQA2/9qZWxsef//ZsOYwr3huILigbk74bmq////WzMsMCwyLDBd/zA "Jelly – Try It Online")** Or see a [test-suite](https://tio.run/##y0rNyan8/z/t8IxDex/uaHrUuNP64c5V/w8vd9B/1LTm///oaAMdIDLUMQZCw9hYLh2YgAGMY6xjoGME5RrqRMOEYXwDhEoDhCqgcQj9xjBRIx0jGNMQwTQCWxwLAA "Jelly – Try It Online")
[Answer]
# [PHP](https://php.net/), 38 bytes
```
<?=strtr($argn,['00'=>'',11=>''])[-1];
```
[Try it online!](https://tio.run/##K8go@P/fxt62uKSopEhDJbEoPU8nWt3AQN3WTl1dx9AQRMVqRusaxlr//28ABIYgYGD4L7@gJDM/r/i/rhsA "PHP – Try It Online")
Basically port of [Jo King's idea](https://codegolf.stackexchange.com/a/190830/81663).
[Answer]
# [Runic Enchantments](https://github.com/Draco18s/RunicEnchantments/tree/Console), 28 bytes
```
/~@/i~/i<
/=?/~iR:l}i{l1-=?!
```
[Try it online!](https://tio.run/##KyrNy0z@/1@/zkE/s04/04ZL39Zevy4zyCqnNrM6x1DX1l7x/38DBUMgNFAwgJIGAA "Runic Enchantments – Try It Online")
Takes input as a series of space separated bytes (Runic does not understand lists). The first byte is the initial state and every other byte is the program. No validation is performed (i.e. it assumes only valid programs are given as input and it doesn't care what value is used to represent `0` and `1`).
]