text:
Topple some dominoes!

Thanks to this question for some inspiration

In this challenge we will represent a line of dominoes as a string of |, / and \.  You will be given a string of dominoes as input and you must determine what they look like when they have settled.  Here are the rules for how dominoes fall over

A standing domino, |, left of a left fallen domino, \, will become a left fallen domino as well.
A standing domino, |, right of a right fallen domino, /, will become a right fallen domino as well.
If a standing domino is between a left fallen \ and a right fallen / domino, it will remain standing.

These rules are applied repeatedly until the arrangement no longer changes.
Here is an example of how a single input might arrive at its conclusion
|||||||\/|||||||\||\|||/||||||\|||||

||||||\\//|||||\\|\\|||//||||\\|||||
|||||\\\///|||\\\\\\|||///||\\\|||||
||||\\\\////|\\\\\\\|||////\\\\|||||
|||\\\\\////|\\\\\\\|||////\\\\|||||
||\\\\\\////|\\\\\\\|||////\\\\|||||
|\\\\\\\////|\\\\\\\|||////\\\\|||||

\\\\\\\\////|\\\\\\\|||////\\\\|||||

Your task is to write code that finds and outputs the end result of a input.  You may assume that the input is always valid and contains at least 2 characters.
This is code-golf so answers will be scored in bytes with fewer bytes being better.
Test cases
|||/||||  -> |||/////
|||\||||  -> \\\\||||
|/||||\|  -> |///\\\|
||/|||\|  -> ||//|\\|
||\|||/|  -> \\\|||//

Backslash escaping ahoy! (May we use other symbols?)

@Arnauld No you should use the slashes.

I can't... figure out what to escape and what to not.

What happens in case of /\?

@EriktheOutgolfer Nothing.  Anything the rules don't tell us to change remains the same.

It bothers me more than it should that things like `////////|\ are considered stable.

Retina, 32 bytes
+`(/.\\)|(/)\||\|(\\)
$1$2$2$3$3

Try it online!
Explanation
The + tells Retina to run the replacement in a loop until it fails to change the string. Each replacement computes one step the falling dominoes. The replacement itself is really three replacements in one, but this ensures that they happen simultaneously:
(/.\\)...
$1

This just matches /|\ (as well as /\\ and /\\, but those don't matter) and reinserts it unchanged. The purpose of this is to skip over | with fallen dominoes on both sides, because this is shorter than ruling out those cases with separate lookarounds in the other two cases.
...(/)\|...
$2$2

This matches /| and turns it into //.
...\|(\\)
$3$3

This matches |\ and turns it into \\.

Can't say I didn't see that coming.  Retina is certainly a good tool for the job.

@WheatWizard It's easy to solve, but probably still too verbose with all the escaping and that $1$2$2$3$3 to beat the golfing languages.

Python 2, 115 114 111 108 98 95 bytes
-1 byte thanks to ovs
a=input()
for i in range(4)*len(a):a=a.replace('//|x||\ \\'[i::4],'/\/x|\/ \\'[3-i::4])
print a

Try it online!

114 bytes using r-strings.

You can remove b=0; and replace occurrences of b by id to save two bytes!

V, 23 bytes
òÓ¯À<!|¨Ü©ü¨¯©|ÜÀ!/±±²²

Try it online!
Really, this is very similar to the retina answer, just that it looks uglier. Uses regex compression.
Hexdump:
00000000: f2d3 afc0 3c21 7ca8 dca9 fca8 afa9 7cdc  ....<!|.......|.
00000010: c021 2fb1 b1b2 b2                        .!/....

Explanation:
ò tells V to run until the string doesn't change. The rest is a compressed regex. Let's convert it into the vim equivalent...
:s/\v\/@<!\|(\\)|(\/)\|\\@!/\1\1\2\2/g

:s/                                     " Substitute...
   \v                                   " Turn on magic (use less escaping)
          \|                            " A bar
            (\\)                        " Followed by a captured backslash
       @<!                              " That is not preceded by
     \/                                 " A forward slash
                |                       " OR...
                 (\/)                   " A captured forward slash
                     \|                 " Followed by a bar
                       \\@!             " That is not followed by a backslash
                           /            " Replace this with
                            \1\1        " Pattern 1 twice (will be empty if we matched the second path)
                                \2\2    " Pattern 2 twice (will be empty if we matched the first path)
                                    /g  " Replace every match on this line

SNOBOL4 (CSNOBOL4), 117 115 112 111  bytes
	D =INPUT
S	D '/|\' ='_'	:S(S)
	E =D
	D '/|' ='//'
	D '|\' ='\\'
	D E	:F(S)
R	D '_' ='/|\'	:S(R)
	OUTPUT =D
END

Try it online!
Credit to Rod's python answer for the idea for the stopping condition with a second variable to see changes rather than testing D '/|' | '|\'.
	D =INPUT		;* read input
S	D '/|\' ='_'	:S(S)	;* replace '/|\' with '_', recursively
	E =D			;* set E to D, this is the while loop
	D '/|' ='//'		;* topple right
	D '|\' ='\\'		;* topple left
	D E	:F(S)		;* if D doesn't match E, goto S
R	D '_' ='/|\'	:S(R)	;* replace '_' with '/|\' (inverse of statement S)
	OUTPUT =D		;* output
END

Perl 5, 39 + 1 (-p) = 40  bytes
s%(?<!/)\|(\\)|(/)\|(?!\\)%$+$+%g&&redo

Try it online!

Haskell, 114 107 bytes
until=<<((==)=<<)$g
g s=t<$>zip3('|':s)s(tail s++"|")
t(l,'|',r)|l<'0',r/='\\'=l|r=='\\',l>'/'=r
t(_,e,_)=e

Try it online! The first line defines an anonymous function.
Explanation:

until=<<((==)=<<)$g is a fix point function (see here for an explanation) which applies the function g to the input string until the result no longer changes.
zip3('|':s)s(tail s++"|") creates for each domino, that is character in the string s, a triple with the pre- and succeeding domino, padding with | at the edges. E.g. /\| becomes [(|,/,\),(/,\,|),(\,|,|)] (ignoring escaping).
Then the function t is applied to each of the triples to compute the new position of the centre piece of the triple.

Prolog (SWI), 132 bytes
+[]-->[].
+[47,124,92|T]-->"/|\\",+T.
+[47,47|T]-->"/|",+T.
+[92,92|T]-->"|\\",+T.
+[X|T]-->[X],+T.
X+Y:- +(N,X,[]),!,(X=N,Y=N;N+Y).

Try it online!
This program defines a predicate +/2 that is true if the second argument is the settled version of the first. Both arguments are lists of character codes.
Explanation
This solution uses a DCG to figure out what the next step is and then repeatedly calculates the next step until the next step is the same as the current step.
The DCG
+[]-->[].
+[47,124,92|T]-->"/|\\",+T.
+[47,47|T]-->"/|",+T.
+[92,92|T]-->"|\\",+T.
+[X|T]-->[X],+T.

These five lines of code define a DCG (Definite Clause Grammar) rule + that is used in the program to calculate a single step of dominoes toppling. DCGs in Prolog work by finding the first case of the rule whose right hand side matches the string and determining the argument of the rule on the left hand side through that process. If a case fails to match then it will backtrack and try a later case.
+[]-->[].

This line represents the base case of the + rule. It simply states that if there are no dominoes currently then in the next step there will still be no dominoes.
+[47,124,92|T]-->"/|\\",+T.

Since this program deals exclusively with lists of character codes it is important to note that the character codes for /, \, and | are 47, 92, and 124 respectively. This case of the + rule handles the /|\ string.
+[47,47|T]-->"/|",+T.

This case handles a right falling domino knocking over the domino the right of it. Since it comes after the case for handling /|\ it will not be used for that possibility.
+[92,92|T]-->"|\\",+T.

Handles the case for a left falling domino knocking over the domino to the left of it.
+[X|T]-->[X],+T.

This is the wildcard case. Since nothing else changes besides what is described above, so long as there is text left in the input string it will just copy it over to the output so long as it does not match any of the above cases.
The Predicate
X+Y:- +(N,X,[]),!,(X=N,Y=N;N+Y).

The main predicate takes two arguments, the first one is the initial domino setup, the second is the settled dominoes. Since this is Prolog the second can be undetermined and the program will calculate it. The predicate in and of itself is fairly simple +(N,X,[]) calls the DCG and calculates the next step of the dominoes storing it in N. (X=N,Y=N;N+Y) checks if the next step of the dominoes is the same as the current and if it is it sets Y to it since the dominoes must have settled and if it is not it recurses, calling the same predicate with the next step of the dominoes N instead of X.

APL (Dyalog), 36 bytes
({(↑∘1¨3 ¯3)⍳⊂⍵≠'/|\'}⊃'\/',2⊃⊢)⌺3⍣≡

Try it online!
-3 partially thanks to Cows Quack.
Feels so ungolfed...:(

Stencil equivalent.

Perl 5, 52+1(-p) = 53 bytes
-6 bytes thanks to mik
Probably not the best possible for Perl, but it's what I could come up with.
0while(s/(?<!\/)\|(?=(\\))|(?<=(\/))\|(?!\\)/$1$2/g)

Explanation
while(
  s/
    (?<!\/)\|(?=(//)) # If there's a | that precedes a \ but doesn't follow a /, capture /
      | # Or
    (?<=(\/))\|(?!//)/ # If there's a | that follows a / doesn't precede a \, capture /
  /$1$2/ # Replace all | with capture group 1 or 2, as one of the two will always be empty
  g # Repeat as much as possible for this string
)

Try it online!

-p instead of -a eliminates need for print;; using while as a suffix to a dummy expression (e.g. 0) will save another 2 bytes

Thank you @mik, I didn't know those tricks. I also realize I could delimit the regex with something else to save some bytes. Might get to that later.

Perl 5 -p, 44 bytes
1while s,(/)\|(?!\\)|(?<!/)\|(\\),$1$1$2$2,g

Try it online!
Explanation
1while s,                        ,        ,g   while anything found substitute globally
         (/)\|(?!\\)              $1$1         /| that is not followed by \ to //
                    |                          or
                     (?<!/)\|(\\)     $2$2     |\ that is not preceded by / to \\

face, 166 bytes
\|/,cm_/o>AvI[IIcP/+PP|m_/m*/Sl*Im1/11:~-_I|'|?_1-_P|?_1`I-III_|+II|'I.C:1-_I|?_C'|-_P|?_C_|'I-_I|`I?_!'I.C:!'|'|-III+II|'I:C_|-PPP+PPI'I?I~_I-PPP+PP|-**1?*~Sl*Iw*I*>

Takes input as a command line argument and outputs to STDOUT. This only works in commit 86494f6 and beyond due to a bugfix in that commit.
Wrapped for aesthetics:
\|/,cm_/o>AvI[IIcP/+PP|m_/m*/Sl*Im1/11:~-_I|'|?_1-_P|?_1`I
-III_|+II|'I.C:1-_I|?_C'|-_P|?_C_|'I-_I|`I?_!'I.C:!'|'|-III
+II|'I:C_|-PPP+PPI'I?I~_I-PPP+PP|-**1?*~Sl*Iw*I*>

And ungolfed / commented:
\|/,cm_/o>              ( setup )

AvI[II                  ( store input into I )
cP/+PP|m_/              ( store 92, ascii for \, into P, meaning prev char )
m*/Sl*Im1/11            ( store length of input into counter variable * )

( main loop: )
:~

    -_I|'|?_1           ( branch to 1 if the character is not \ )
    -_P|?_1             ( also branch to 1 if the previous character wasn't | )
    `I-III_|+II|'I      ( we have a sequence |\ so prev needs to be toppled )
    .C                  ( jump to C, the "continue" label at end of loop )

    :1
    -_I|?_C             ( branch to C if the character is not | )
    '|-_P|?_C           ( also branch to C if the previous character wasn't / )
    _|'I-_I|`I?_!       ( branch to ! if the next character isn't \ )
    'I.C:!              ( otherwise, skip the next \ and branch to continue )
    '|'|-III+II|'I      ( if all conditions hold we have /|| or /|/ so topple )

    :C
    _|                  ( reset pointer to source )
    -PPP+PPI            ( update prev variable )
    'I                  ( step through data )

?I~

_I-PPP+PP|-**1          ( reset input/prev and decrement counter )
?*~                     ( repeat main loop as many times as there are chars )

Sl*Iw*I*>               ( output final string to stdout )

There's a few subtle tricks in here that shave off a few extra bytes, such as

the naming of the variables | and /, whose ASCII values are accessed via introspection later in the code
the '| on the first line of the main loop, which is called there instead of on the second line in order to set the | pointer for use in the second section of the main loop

Clean, 98 bytes
import StdEnv
$['/|':t]=['//': $t]
$['|\\':t]=['\\\\': $t]
$[h:t]=[h: $t]
$e=e
f=until(\e=e== $e)$

Try it online!

Jelly, 32 bytes
i@€Ø2jḅ3ị“½jỊA!S’ḃ3¤Ɗ3ƤƊÐLịɗ“\|/

Try it online!
There's probably a much better way to do this.

Ruby, 83 bytes
Technically cheatable with 9.times, or even just 999.times but I don't feel like being cheap :)
Still has huge golfing potential. (Note: y while undone is far longer than x.size.times)
->x{x.size.times{x.gsub! /\/\|\\?|\|\\/,'/|\\'=>'/|\\','/|'=>'//','|\\'=>'\\\\'}
x}

Try it online!

R, 114 bytes
function(d){g=gsub
for(i in 1:nchar(d))d=g("/|","//",g("|\\","\\\\",g("/|\\","_",d,f=T),f=T),f=T)
g("_","/|\\",d)}

Try it online!
Returns an escaped string.

C (gcc), 183 bytes
D,i;f(char*S){char*s=malloc(-~strlen(S));for(D=1;D--;strcpy(S,s))for(strcpy(s,S),i=0;s[i];i++)s[i]>92&&(S[-~i]==92&&S[~-i]!=47&&(s[i]=92,D=1)||S[~-i]==47&&S[-~i]!=92&&(s[i]=47,D=1));}

Try it online!


text:
Traffic direction
Rules
Given an ISO3166-1-Alpha-2 country code your task is to decide on the traffic direction for that country:

Input will be a valid country code (valid as in it's an element of the two lists provided)
Input may be a list of two characters instead of a string if it helps
You may choose to take input in lowercase
You will choose one value, say for right (your choice) and will output that value iff the traffic in that country is right-handed and anything else in the other case
You only have to handle country codes that are contained in one of these lists:

These are all countries where traffic is left-handed:
['AI', 'AG', 'AU', 'BS', 'BD', 'BB', 'BM', 'BT', 'BW', 'VG', 'BN', 'KY', 'CX', 'CC', 'CK', 'CY', 'DM', 'FK', 'FJ', 'GD', 'GG', 'GY', 'HK', 'IN', 'ID', 'IE', 'IM', 'JM', 'JP', 'JE', 'KE', 'KI', 'LS', 'MO', 'MW', 'MY', 'MV', 'MT', 'MU', 'MS', 'MZ', 'NA', 'NR', 'NP', 'NZ', 'NU', 'NF', 'PK', 'PG', 'PN', 'SH', 'KN', 'LC', 'VC', 'WS', 'SC', 'SG', 'SB', 'SO', 'ZA', 'GS', 'LK', 'SR', 'SZ', 'TH', 'TL', 'TK', 'TO', 'TT', 'TC', 'TV', 'UG', 'GB', 'TZ', 'VI', 'ZM', 'ZW']

And here are all countries where traffic is right-handed:
['AF', 'AX', 'AL', 'DZ', 'AS', 'AD', 'AO', 'AQ', 'AR', 'AM', 'AW', 'AT', 'AZ', 'BH', 'BY', 'BE', 'BZ', 'BJ', 'BO', 'BA', 'BV', 'BR', 'IO', 'BG', 'BF', 'BI', 'CV', 'KH', 'CM', 'CA', 'CF', 'TD', 'CL', 'CN', 'CO', 'KM', 'CG', 'CR', 'CI', 'HR', 'CU', 'CW', 'CZ', 'KP', 'CD', 'DK', 'DJ', 'DO', 'EC', 'EG', 'SV', 'GQ', 'ER', 'EE', 'ET', 'FO', 'FI', 'FR', 'GF', 'PF', 'TF', 'GA', 'GM', 'GE', 'DE', 'GH', 'GI', 'GR', 'GL', 'GP', 'GU', 'GT', 'GW', 'GN', 'HT', 'HM', 'VA', 'HN', 'HU', 'IS', 'IR', 'IQ', 'IL', 'IT', 'JO', 'KZ', 'KW', 'KG', 'LA', 'LV', 'LB', 'LR', 'LY', 'LI', 'LT', 'LU', 'MG', 'ML', 'MH', 'MQ', 'MR', 'YT', 'MX', 'FM', 'MC', 'MN', 'ME', 'MA', 'MM', 'NL', 'NC', 'NI', 'NG', 'NE', 'MP', 'NO', 'OM', 'PW', 'PA', 'PY', 'PE', 'PH', 'PL', 'PT', 'PR', 'QA', 'KR', 'MD', 'RE', 'RO', 'RU', 'RW', 'BL', 'MF', 'PM', 'SM', 'ST', 'SA', 'SN', 'RS', 'SL', 'BQ', 'SX', 'SK', 'SI', 'SS', 'ES', 'PS', 'SD', 'SJ', 'SE', 'CH', 'SY', 'TW', 'TJ', 'MK', 'TG', 'TN', 'TR', 'TM', 'UA', 'AE', 'UM', 'US', 'UY', 'UZ', 'VU', 'VE', 'VN', 'WF', 'EH', 'YE']

For completeness sake, here's a CSV file that contains all the values along with the country names.
Testcases
Assuming you chose to output L for left-handed traffic, here are some valid test cases:
'PY' -> 'python'
'PN' -> 'L'
'CN' -> 33
'GY' -> 'L'

Note: There is a small chance that I missed a country or that there's a wrong classification and I will not change the specs because that might invalidate answers. If I made a mistake I sincerely apologize, please don't take offense!

Is it okay to output nothing if the country code doesn't match?

@SteveFest: I'd say that counts as anything else, yes.

may I output "left" for left case and anything else in right case?

@l4m2: Sorry for the late response, but yes (that's what's happening in the testcases).

I came here expecting to find a 10-byte Mathematica solution that was somehow built-in. I am sorely disappointed.

@SilvioMayolo CountryData can give the amount of paved and unpaved road and railroads etc in a country but not its traffic direction :(

Python 2, 145 136 112 109 bytes
'TTHSZWMSGSONPKNZMWVIDFKELSCYJPNFJMTVCXBNRBWSHKYAUGGYBTLCCKIMVGBSBBMZAINAGDMOBDIEJEMYMUNUPGSRLKTKTOTCTZ'.find

Try it online!
Outputs -1 for right-handed traffic. The string is autogenerated with this Retina script. Thanks to totallyhuman for the 9 bytes shorter lookup string. I was able to get 24 bytes more off through AdmBorkBork suggestion.
Got the lookup string 3 bytes shorter using a python script.

Since things like OT don't exist, can you get rid of some spaces like TO TC goes to TOTC?

@AdmBorkBork thanks a lot, I got all the spaces out.

Can you explain the string at all?

Jelly, 61 bytes
Many thanks to @Mr.Xcoder for helping me putting this together
Saved 1 byte thanks to @JonathanAllan
Returns 0 for right-handed or 1 for left-handed.
“ŒỴ¬Ʋ>r¤dị|®ædHẇ⁸ɗH^CŒ³ẇPḷgȤƲȥƓƑ®Ƭṅḅ4ṛḟṄ’ḃ⁴+\
Oḅ⁹×6%⁽£€%566e¢

Try it online!
How?
We convert each country code to an integer N by parsing it as base-256 and apply the following hash function, which is collision-free for left-handed vs right-handed traffic:
((N * 6) MOD 1513) MOD 566

This leads to the following list of values for left-handed traffic:
[   8,  14,  27,  37,  52,  60,  62,  68,  71,  84,  85,  88, 103, 105, 114, 119, 135,
  166, 167, 180, 187, 190, 195, 196, 202, 207, 208, 211, 214, 225, 226, 229, 232, 255,
  256, 262, 285, 301, 302, 303, 304, 309, 322, 325, 327, 337, 357, 369, 370, 381, 393,
  401, 408, 413, 420, 430, 453, 467, 473, 478, 492, 503, 509, 513, 516, 527, 528, 541,
  546, 547, 556, 562 ] (72 entries)

The average difference between two consecutive entries is close to 8. We delta-encode the list with increments in the range [1...16]. It means that whenever an increment is greater than 16, we need to insert an intermediate value on an unused slot (we have to make sure that it's not hit by right-handed traffic). But the hash function was chosen in such a way that we only have to do that for a few positions. This gives:
[  8,  6, 13, 10, 15,  8,  2,  6,  3, 13,  1,  3, 15,  2,  9,  5, 16, 15, 16,  1, 13,
   7,  3,  5,  1,  6,  5,  1,  3,  3, 11,  1,  3,  3, 16,  7,  1,  6, 16,  7, 16,  1,
   1,  1,  5, 13,  3,  2, 10, 16,  4, 12,  1, 11, 12,  8,  7,  5,  7, 10, 16,  7, 14,
   6,  5, 14, 11,  6,  4,  3, 11,  1, 13,  5,  1,  9,  6 ] (77 entries)

We convert this list from bijective base-16 to the following integer:
274705197430389746738026977757328941544772847257562272094076195694133371689429679543810871702

which becomes “ŒỴ¬Ʋ>r¤dị|®ædHẇ⁸ɗH^CŒ³ẇPḷgȤƲȥƓƑ®Ƭṅḅ4ṛḟṄ’ in Jelly's base-250 encoding.
The first link rebuilds the original list from this integer and the second one tests whether it contains the hash of the input.
“ŒỴ¬Ʋ>r¤dị|®ædHẇ⁸ɗH^CŒ³ẇPḷgȤƲȥƓƑ®Ƭṅḅ4ṛḟṄ’ḃ⁴+\      - 1st link: takes no input
“ŒỴ¬Ʋ>r¤dị|®ædHẇ⁸ɗH^CŒ³ẇPḷgȤƲȥƓƑ®Ƭṅḅ4ṛḟṄ’          - our big integer
                                         ḃ⁴        - convert it to bijective base-16
                                           +\      - apply delta-decoding

Oḅ⁹×6%⁽£€%566e¢                  - 2nd link: takes the country code  -> e.g. 'GB'
O                                - get ASCII codes                   -> [71, 66]
 ḅ⁹                              - convert from base-256 to integer  -> 18242
   ×6                            - multiply by 6                     -> 109452
     %⁽£€                        - modulo 1513                       -> 516
         %566                    - modulo 566                        -> 516
             e                   - look for it in the decoded list,
              ¢                  - using the first link as a nilad   -> 1

Save a byte by converting from an integer to bijective base 16: “ŒỴ¬Ʋ>r¤dị|®ædHẇ⁸ɗH^CŒ³ẇPḷgȤƲȥƓƑ®Ƭṅḅ4ṛḟṄ’ḃ⁴ (thus avoiding the increment) ...also (not a byte save, but) ¢ calls the last link as a nilad.

@JonathanAllan Nice! Thank you.

PowerShell, 161 148 bytes
"$args"-match'A[GIU]|B[BDMNSTW]|[CFHW][CJKSXY]|DM|G[BDGSY]|[IJ][DEMNP]|K[EINY]|L[CKS]|M[OS-WYZ]|N[AFP-Z]|P[GKN]|S[BCGHORZ]|T[CHKLOTVZ]|UG|V[CGI]|Z.'

Try it online!
Naïve regex pattern matching. Outputs True for left-handed and False for right-handed.
Saved 13 bytes thanks to mercator golfing the regex.

You can join the alternatives for first letters C, F, H and W into [CFHW][CJKSXY] (-5), I and J into [IJ][DEMNP] (-3), shorten N into N[AFP-Z] (-1), and Z into Z. (-4), for a total of -13 bytes. New regex = A[GIU]|B[BDMNSTW]|[CFHW][CJKSXY]|DM|G[BDGSY]|[IJ][DEMNP]|K[EINY]|L[CKS]|M[OS-WYZ]|N[AFP-Z]|P[GKN]|S[BCGHORZ]|T[CHKLOTVZ]|UG|V[CGI]|Z.

@mercator Thanks for the regex golfing!

Haskell, 137 bytes
-5 bytes thanks to ovs.
import Data.List
(`isInfixOf`"MSOBTVGBSBBMZAINAGDMOAUGGYBDBWSHKYBNRJPNFJMVCKIMTLCCXLSCYFKEVIDIEJELSGSOLKNZMWMYMUPKNPGSRNUTKTOTCTZSZWTTH")

Try it online!
Generated the original string by hand.

got the lookup string 3 bytes shorter again: TTHSZWMSGSONPKNZMWVIDFKELSCYJPNFJMTVCXBNRBWSHKYAUGGYBTLCCKIMVGBSBBMZAINAGDMOBDIEJEMYMUNUPGSRLKTKTOTCTZ

Another alternative -3: SZAINAGGDMOAUGBBSCCKIMWSHKYLSBMVGSGYBDBTHBWBNRMZMTLCXSRTVCYPNFKNPKEFJMYVIDIEJPGJEMUNZWMSONULKTKTOTTCTZ – Try it online!

05AB1E, 82 68 bytes
Outputs 1 for left-traffic and 0 for right-traffic.
.•6uγ)₅₄вwÔívtÎĆ–≠5βI·{!ÅÇΔ›íÕ(1.€ò“Ñ¦_£äß₂Ë‹ûÚм2±rrÇQ=ÅÔζ)B†š¢¡ε•så

Try it online!
or as a Test Suite
Uses the string generated by totallyhuman and improved by ovs

05AB1E, 76 bytes
.•B6L>õKвΩ~#ëΓnĀÿι–öß/çÄ¸’Û´äηÅÚ‚zÄ¨e÷ö#YʒƒʒjªêKΩoúö‰Öe¡₄Æ∞¤iY¥•#vySANèì})åZ

Try it online!

.•B6L>õKвΩ~#ëΓnĀÿι–öß/çÄ¸’Û´äηÅÚ‚zÄ¨e÷ö#YʒƒʒjªêKΩoúö‰Öe¡₄Æ∞¤iY¥•

Outputs the following string:
GIU BDMNSTW CKXY M  JK BDGSY K DEMN EMP EINY CKS OSTUVWYZA FPRUZ  GKN   BCGHORZ CHKLOTVZ G CGI S   AMW

If I split that on spaces, and interleave the alphabet into each string, it results in all the states that drive on the left side.

1 for left, 0 for right; Emigna's is better, but this felt different enough to post :).

Jelly, 69 bytes
ẇ“h¦¤$>Xø3¬I_°Ḷd⁺+ç*p¢7"FU]#x⁹ĿAxḷŻbCȦ]$ḣẒẓST¬ȥ¬ṆṠ®æ÷©#ḄS#MĠỤ4ɱ5’ṃØA¤

A monadic link taking a list of characters and returning 1 if left (0 if right).
Try it online!
How?
Uses the method as implemented totallyhuman / ovs.
ẇ“ ... ’ṃØA¤ - Link: list of characters
           ¤ - nilad followed by link(s) as a nilad:
 “ ... ’     -   base 250 number = 19752831477605543488091668410027486265612829758468833715947215534967455540194888181580207621675010690833131726534873382634884974263558670694315853304
         ØA  -   list of characters = "ABCDEFGHIJKLMNPQRSUVWXZ"
        ṃ    -   base decompress = "MSOBTVGBSBBNZAINAGDMOAUGGYBDBWSHKYBNRJPNFJMVCKIMTLCCXLSCYFKEVIDIEJELSGSOLKOZMWMYMUPKNPGSRNUTKTOTCUZTZWTTH"
ẇ            - is a sublist of?

Also, what I did independently came in at 72 bytes:
“¦w/ḳœBẒḂṡẏ,©ḷĿdẎq⁸4ṙ^|ṂỌʋ:vkɱF#ẊṠµd¤w,ḋhn|ȯ24ɦm|×ỵ’ṃ©ØAO0;I<0œṗ®ṭ€"ØAẎċ

Also a monadic link taking a list of characters and returning 1 if left (0 if right).
Try it online!
How?
“ ... ’ṃ©ØAO0;I<0œṗ®ṭ€"ØAẎċ - Link: list of characters
“ ... ’                     - base 250 number = 20449742094039418439524274048234013619715377161457577389098927787850535557806494274193349238496252074719534810320317229
         ØA                 - list of characters = "ABCDEFGHIJKLMNPQRSUVWXZ"
       ṃ                    - base decompress = "GIUBDMNSTWCKXYMKJKBDGSYKDEMNEMPEINYCKSOSTUVXZZAFPRVZHGKNDCBCGHOSZCHKLOTWZGCGIASCBAMW"
        ©                   - copy to register
           O                - cast to ordinals = [71,73,85,66,68,77,78,83,84,87,67,75,88,89,77,75,74,75,66,68,71,83,89,75,68,69,77,78,69,77,80,69,73,78,89,67,75,83,79,83,84,85,86,88,90,90,65,70,80,82,86,90,72,71,75,78,68,67,66,67,71,72,79,83,90,67,72,75,76,79,84,87,90,71,67,71,73,65,83,67,66,65,77,87]
            0               - literal zero
             ;              - concatenate = [0,71,73,85,66,68,77,78,83,84,87,67,75,88,89,77,75,74,75,66,68,71,83,89,75,68,69,77,78,69,77,80,69,73,78,89,67,75,83,79,83,84,85,86,88,90,90,65,70,80,82,86,90,72,71,75,78,68,67,66,67,71,72,79,83,90,67,72,75,76,79,84,87,90,71,67,71,73,65,83,67,66,65,77,87]
              I             - incremental differences = [71,2,12,-19,2,9,1,5,1,3,-20,8,13,1,-12,-2,-1,1,-9,2,3,12,6,-14,-7,1,8,1,-9,8,3,-11,4,5,11,-22,8,8,-4,4,1,1,1,2,2,0,-25,5,10,2,4,4,-18,-1,4,3,-10,-1,-1,1,4,1,7,4,7,-23,5,3,1,3,5,3,3,-19,-4,4,2,-8,18,-16,-1,-1,12,10]
                0           - literal zero
               <            - less than (vectorises) = [0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,1,1,1,0,0]
                   ®        - recall from register = "GIUBDMNSTWCKXYMKJKBDGSYKDEMNEMPEINYCKSOSTUVXZZAFPRVZHGKNDCBCGHOSZCHKLOTWZGCGIASCBAMW"
                 œṗ         - partition at truthy indexes = ["GIU","BDMNSTW","CKXY","M","K","JK","BDGSY","K","DEMN","EMP","EINY","CKS","OSTUVXZZ","AFPRVZ","H","GKN","D","C","BCGHOSZ","CHKLOTWZ","G","CGI","AS","C","B","AMW"]
                       ØA   - list of characters = "ABCDEFGHIJKLMNPQRSUVWXZ"
                      "     - zip with:
                    ṭ€      -   tack for €ach = [["AG","AI","AU"],["BB","BD","BM","BN","BS","BT","BW"],["CC","CK","CX","CY"],["DM"],["EK"],["FJ","FK"],["GB","GD","GG","GS","GY"],["HK"],["ID","IE","IM","IN"],["JE","JM","JP"],["KE","KI","KN","KY"],["LC","LK","LS"],["MO","MS","MT","MU","MV","MX","MZ","MZ"],["NA","NF","NP","NR","NV","NZ"],["OH"],["PG","PK","PN"],["QD"],["RC"],["SB","SC","SG","SH","SO","SS","SZ"],["TC","TH","TK","TL","TO","TT","TW","TZ"],["UG"],["VC","VG","VI"],["WA","WS"],["XC"],["YB"],["ZA","ZM","ZW"]]
                         Ẏ  - tighten = ["AG","AI","AU","BB","BD","BM","BN","BS","BT","BW","CC","CK","CX","CY","DM","EK","FJ","FK","GB","GD","GG","GS","GY","HK","ID","IE","IM","IN","JE","JM","JP","KE","KI","KN","KY","LC","LK","LS","MO","MS","MT","MU","MV","MX","MZ","MZ","NA","NF","NP","NR","NV","NZ","OH","PG","PK","PN","QD","RC","SB","SC","SG","SH","SO","SS","SZ","TC","TH","TK","TL","TO","TT","TW","TZ","UG","VC","VG","VI","WA","WS","XC","YB","ZA","ZM","ZW"]
                            - ...this is the left list plus EK, OH, QC, RC, WA, XC, and YB
                            -    (which are not in the right list)
                          ċ - count

Befunge, 155 152 147 146 bytes
~48*%10p~20pv
\"`"`"A"+61p>:2g:48*%10g-!20g61g-!#@*#,_\1+:"O"#@`#._
NzBSgCLVStBGiIJknAVGPSuStAKvfCFHPLttBDIJzBIPkMStJn{NsBLMWgBMtAMnMtBMzcKCGmMNSt

Try it online!
Outputs 80 for a right-handed country, and anything else indicates a left-handed country.
Explanation
The bottom line of the code contains a representation of all the left-handed countries. This is a list of the first characters of the country codes, grouped by their second character. The end of each group is marked by lowercasing the last character in the group.
So for example the first group, Nz, represents NA and ZA. The second group, BSg, represents BB, SB, and GB. There is one group for each letter in the alphabet, except for the letter Q (no left-hand country codes end in Q). That empty group is represented by the character {, since that obviously won't match any valid country code.
To determine whether a given country code matches one of these entries, we iterate through the list checking whether any of the characters in the list match the first character of our input (mod 32 to account for the case), and also that the corresponding group, matches the second character of the input. The group character start as A, and is incremented every time we encounter a lowercase letter in the list.
We exit when we find a match, outputting the last character value on the stack (which will be the first character of the country code - possibly lowercase). Otherwise we'll exit when we've iterated through the whole list, in which case we will output the last number on the stack, which is always 80.

Windows Batch, 289 279 199 193 181 130 118 bytes
@echo TTHSZWMSGSONPKNZMWVIDFKELSCYJPNFJMTVCXBNRBWSHKYAUGGYBTLCCKIMVGBSBBMZAINAGDMOBDIEJEMYMUNUPGSRLKTKTOTCTZ|find "%1"

Outputs the ovs' string for left-hand traffic, else outputs nothing.
Note: I noticed if the input contains any country code in the list above, it will still output L. However, this does not violate the challenge rule as OP mentioned only country codes need to be handled.

Explanation:
@echo TTHSZ...OTCTZ            :: List all country code.(compressed by ovs)
                   |           :: Pipe the result to the find command.

                    find "%1"  :: Find the first argument in the country code list,
                               :: and output the ovs string if found.

                               :: By default, FIND returns the piped string when
                               :: a match is found.

Excel VBA, 118 Bytes
Anonymous VBE immediate window function that takes input from cell [A1] and outputs 0 if the country is right-handed
?InStr(1,"TTHSZWMSGSONPKNZMWVIDFKELSCYJPNFJMTVCXBNRBWSHKYAUGGYBTLCCKIMVGBSBBMZAINAGDMOBDIEJEMYMUNUPGSRLKTKTOTCTZ",[A1])

uses ovs' string

C (gcc), 181 169 165 bytes
f(x){x=strstr("AIAUBSBDBBMBTBWVGBNKYCXCCKCYDMFKFJGDGGYHKINIDIEIMJMJPJEKELSMOMWMYMVMTMUMZNANRNPNZNUNFPKPGPNSHKNLCVCWSSCSGSOZAGSLKSRSZTHTLTKTOTTCTVUGTZVIZMZW",x)?:82;}

Try it online!

Could you use a single digit instead of 82 to save a byte? 9, for example, would output a tab character.

Retina, 150 117 bytes
$
MSOBTVGBSBBMZAINAGDMOAUGGYBDBWSHKYBNRJPNFJMVCKIMTLCCXLSCYFKEVIDIEJELSGSOLKNZMWMYMUPKNPGSRNUTKTOTCTZSZWTTH
^(..).*\1

Try it online!

Python 2, 144 bytes
lambda l:l[1]in'GIU,BDMNSTW,CKXY,M,,JK,BDGSY,K,DEMN,EMP,EINY,CKS,OSTUVWYZ,AFPRUZ,,GKN,,,BCGHORZ,CHKLOTVZ,G,CGI,S,,,AMW'.split(',')[ord(l[0])-65]

Try it online!
Prints True for left, False for right.

Japt, 126 100 97 bytes
Uses totallyhuman's ovs' lookup string. Takes input in lowercase and outputs false for RHD or true otherwise.
`tszwmsgspknzmwvidfkelscyjpnfjmtvcxbnrbw¢kyauggybtlc×Svgbsbbmzaagd¶b¹ejemymunupgsrlktktctz`øU

Try it
Everything between the backticks is the lookup string lowercased and compressed and ø checks if it contains the input, U.

ovs's string is much shorter now :-)

sed, 148+1 145+1 143+1 142+1 bytes
One extra byte for -r flag (POSIX extended regexes).
Outputs empty string for left-handed traffic, original country code for the right-handed traffic.
s/A[GIU]|B[BDMNSTW]|C[CXY]|DM|FJ|G[BDGSY]|I[DEMN]|J[^O]|K[EINY]|L[CS]|M[OS-WYZ]|N[AFP-Z]|P[GN]|S[BCGHORZ]|T[CHLOTVZ]|UG|V[CGI]|WS|Z.|[^DMS]K//

Example:
$ echo -e 'PY\nPN\nCN\nGY' | sed -re 's/A[GIU]|B[BDMNSTW]|C[CXY]|DM|FJ|G[BDGSY]|I[DEMN]|J[^O]|K[EINY]|L[CS]|M[OS-WYZ]|N[AFP-Z]|P[GN]|S[BCGHORZ]|T[CHLOTVZ]|UG|V[CGI]|WS|Z.|[^DMS]K//'
PY

CN

$

Explained edit history:
148 s/A[GIU]|B[BDMNSTW]|C[CKXY]|DM|F[JK]|G[BDGSY]|HK|I[DEMN]|J[EMP]|K[EINY]|L[CKS]|M[OSTUVWYZ]|N[AFPRUZ]|P[GKN]|S[BCGHORZ]|T[CHKLOTVZ]|UG|V[CGI]|WS|Z.//
    naïve regexp; the only optimization here is 'Z.'
145 s/A[GIU]|B[BDMNSTW]|C[CKXY]|DM|F[JK]|G[BDGSY]|HK|I[DEMN]|J[EMP]|K[EINY]|L[CKS]|M[OS-WYZ]|N[AFP-Z]|P[GKN]|S[BCGHORZ]|T[CHKLOTVZ]|UG|V[CGI]|WS|Z.//
    M[OSTUVWYZ] → M[OS-WYZ]
    N[AFPRUZ] → N[AFP-Z]
    the replacements can match inexistent coutries, which is totally fine
143 s/A[GIU]|B[BDMNSTW]|C[CXY]|DM|FJ|G[BDGSY]|I[DEMN]|J[EMP]|K[EINY]|L[CS]|M[OS-WYZ]|N[AFP-Z]|P[GN]|S[BCGHORZ]|T[CHLOTVZ]|UG|V[CGI]|WS|Z.|[^DMS]K//
    |[^DMS]K (which also matches impossible country codes) allows these changes:
    C[CKXY] → C[CXY]
    F[JK] → FJ
    |HK → ∅
    L[CKS] → L[CS]
    P[GKN] → P[GN]
    T[CHKLOTVZ] → T[CHLOTVZ]
142 s/A[GIU]|B[BDMNSTW]|C[CXY]|DM|FJ|G[BDGSY]|I[DEMN]|J[^O]|K[EINY]|L[CS]|M[OS-WYZ]|N[AFP-Z]|P[GN]|S[BCGHORZ]|T[CHLOTVZ]|UG|V[CGI]|WS|Z.|[^DMS]K//
    J[EMP] → J[^O] (thanks @Neil)

sed, 158+1 155+1 153+1 152+1 bytes, non-empty answer
Slight variation of the previous one. Returns L for left-handed traffic.
s/[GIU]|B[BDMNSTW]|C[CXY]|DM|FJ|G[BDGSY]|I[DEMN]|J[^O]|K[EINY]|L[CS]|M[OS-WYZ]|N[AFP-Z]|P[GN]|S[BCGHORZ]|T[CHLOTVZ]|UG|V[CGI]|WS|Z.|[^DMS]K/&L/;s/^..//

Can you use J[^O] instead of J[EMP]?

FYI I tried grouping by second letter but the best I could do was 3 bytes longer: [^L]B|[^EMN]C|GD|[I-K]E|[AGPSUV]G|[AKV]I|FJ|[^DMS]K|TL|JM|[KP]N|JP|SR|[BGLW]S|[BT]T|AU|TV|CX|[CGK]Y|M[OS-WYZ]|N[AFP-Z]|[BI][DMNW]|[ST][HOZ]|Z.

Huh, J[^O] was actually once on my list of smaller regexes, I wonder how I missed it. Thanks for pointing this out! As for grouping by the second letter: in addition to grouping by K you can just use |[AGPSUV]G or |[BGLW]S but it won't change total score at all.

Pyth, 60 57 55 50 47 46 44 bytes
00000000: 736d 406a 4322 579f 235e 804c c3eb 6f49  sm@jC"W.#^.L..oI
00000010: aee5 1f3d be3d 4e13 f326 1934 a181 a210  ...=.=N..&.4....
00000020: 7158 3f94 2232 2f43 5164 5336            qX?."2/CQdS6

Run online
Takes the input as an uppercase quoted string ('AI').  Returns 3 for left and non-3 for right.
How it works
sm@jC"…"2/CQdS6
 m           S6   map for d in [1, …, 6]:
     "…"            string literal
    C               convert to integer from base 256
   j    2           digits in base 2
  @                 wrapping index at:
           Q          input string
          C           convert to integer from base 256
         /  d         integer division by d
s                 sum

Generating the magic string
import binascii
import z3
n, k, c = 239, 6, 3
a = [z3.Bool('a{}'.format(i)) for i in range(n)]
def f(s0, s1):
    return z3.Sum([z3.If(a[(ord(s0) * 256 + ord(s1)) // j % n], 1, 0) for j in range(1, k + 1)]) == c
solver = z3.Solver()
solver.add(a[0])
for s0, s1 in ['AI', 'AG', 'AU', 'BS', 'BD', 'BB', 'BM', 'BT', 'BW', 'VG', 'BN', 'KY', 'CX', 'CC', 'CK', 'CY', 'DM', 'FK', 'FJ', 'GD', 'GG', 'GY', 'HK', 'IN', 'ID', 'IE', 'IM', 'JM', 'JP', 'JE', 'KE', 'KI', 'LS', 'MO', 'MW', 'MY', 'MV', 'MT', 'MU', 'MS', 'MZ', 'NA', 'NR', 'NP', 'NZ', 'NU', 'NF', 'PK', 'PG', 'PN', 'SH', 'KN', 'LC', 'VC', 'WS', 'SC', 'SG', 'SB', 'SO', 'ZA', 'GS', 'LK', 'SR', 'SZ', 'TH', 'TL', 'TK', 'TO', 'TT', 'TC', 'TV', 'UG', 'GB', 'TZ', 'VI', 'ZM', 'ZW']:
    solver.add(f(s0, s1))
for s0, s1 in ['AF', 'AX', 'AL', 'DZ', 'AS', 'AD', 'AO', 'AQ', 'AR', 'AM', 'AW', 'AT', 'AZ', 'BH', 'BY', 'BE', 'BZ', 'BJ', 'BO', 'BA', 'BV', 'BR', 'IO', 'BG', 'BF', 'BI', 'CV', 'KH', 'CM', 'CA', 'CF', 'TD', 'CL', 'CN', 'CO', 'KM', 'CG', 'CR', 'CI', 'HR', 'CU', 'CW', 'CZ', 'KP', 'CD', 'DK', 'DJ', 'DO', 'EC', 'EG', 'SV', 'GQ', 'ER', 'EE', 'ET', 'FO', 'FI', 'FR', 'GF', 'PF', 'TF', 'GA', 'GM', 'GE', 'DE', 'GH', 'GI', 'GR', 'GL', 'GP', 'GU', 'GT', 'GW', 'GN', 'HT', 'HM', 'VA', 'HN', 'HU', 'IS', 'IR', 'IQ', 'IL', 'IT', 'JO', 'KZ', 'KW', 'KG', 'LA', 'LV', 'LB', 'LR', 'LY', 'LI', 'LT', 'LU', 'MG', 'ML', 'MH', 'MQ', 'MR', 'YT', 'MX', 'FM', 'MC', 'MN', 'ME', 'MA', 'MM', 'NL', 'NC', 'NI', 'NG', 'NE', 'MP', 'NO', 'OM', 'PW', 'PA', 'PY', 'PE', 'PH', 'PL', 'PT', 'PR', 'QA', 'KR', 'MD', 'RE', 'RO', 'RU', 'RW', 'BL', 'MF', 'PM', 'SM', 'ST', 'SA', 'SN', 'RS', 'SL', 'BQ', 'SX', 'SK', 'SI', 'SS', 'ES', 'PS', 'SD', 'SJ', 'SE', 'CH', 'SY', 'TW', 'TJ', 'MK', 'TG', 'TN', 'TR', 'TM', 'UA', 'AE', 'UM', 'US', 'UY', 'UZ', 'VU', 'VE', 'VN', 'WF', 'EH', 'YE']:
    solver.add(z3.Not(f(s0, s1)))
res = solver.check()
print(res)
if res == z3.sat:
    m = solver.model()
    print('n={} k={} c={} a={!r}'.format(n, k, c, binascii.unhexlify('{:0{}x}'.format(
        int(''.join('01'[z3.is_true(m[x])] for x in a), 2), n // 8 * 2))))

APL (Dyalog), 108 bytes
1∊⍷∘'TTHSZWMSGSONPKNZMWVIDFKELSCYJPNFJMTVCXBNRBWSHKYAUGGYBTLCCKIMVGBSBBMZAINAGDMOBDIEJEMYMUNUPGSRLKTKTOTCTZ'

Try it online!
Using the lookup string by ovs.
Left-handed traffic = 1.
Right-handed traffic = 0.

Javascript (ES6), 118 116 bytes
Saved 2 bytes thanks to @Craig Ayre
s=>"SZAINAGGDMOAUGBBSCCKIMWSHKYLSBMVGSGYBDBTHBWBNRMZMTLCXSRTVCYPNFKNPKEFJMYVIDIEJPGJEMUNZWMSONULKTKTOTTCTZ".match(s)

Returns null for right-handed traffic
Test Cases

f=s=>"SZAINAGGDMOAUGBBSCCKIMWSHKYLSBMVGSGYBDBTHBWBNRMZMTLCXSRTVCYPNFKNPKEFJMYVIDIEJPGJEMUNZWMSONULKTKTOTTCTZ".match(s)

console.log("AI,AG,AU,BS,BD,BB,BM,BT,BW,VG,BN,KY,CX,CC,CK,CY,DM,FK,FJ,GD,GG,GY,HK,IN,ID,IE,IM,JM,JP,JE,KE,KI,LS,MO,MW,MY,MV,MT,MU,MS,MZ,NA,NR,NP,NZ,NU,NF,PK,PG,PN,SH,KN,LC,VC,WS,SC,SG,SB,SO,ZA,GS,LK,SR,SZ,TH,TL,TK,TO,TT,TC,TV,UG,GB,TZ,VI,ZM,ZW".split`,`.every(s=>f(s)!=null))
console.log("AF,AX,AL,DZ,AS,AD,AO,AQ,AR,AM,AW,AT,AZ,BH,BY,BE,BZ,BJ,BO,BA,BV,BR,IO,BG,BF,BI,CV,KH,CM,CA,CF,TD,CL,CN,CO,KM,CG,CR,CI,HR,CU,CW,CZ,KP,CD,DK,DJ,DO,EC,EG,SV,GQ,ER,EE,ET,FO,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GP,GU,GT,GW,GN,HT,HM,VA,HN,HU,IS,IR,IQ,IL,IT,JO,KZ,KW,KG,LA,LV,LB,LR,LY,LI,LT,LU,MG,ML,MH,MQ,MR,YT,MX,FM,MC,MN,ME,MA,MM,NL,NC,NI,NG,NE,MP,NO,OM,PW,PA,PY,PE,PH,PL,PT,PR,QA,KR,MD,RE,RO,RU,RW,BL,MF,PM,SM,ST,SA,SN,RS,SL,BQ,SX,SK,SI,SS,ES,PS,SD,SJ,SE,CH,SY,TW,TJ,MK,TG,TN,TR,TM,UA,AE,UM,US,UY,UZ,VU,VE,VN,WF,EH,YE".split`,`.every(s=>f(s)==null))

Could you use String.prototype.match() and have right-handed traffic denoted by null? Would save 2 bytes

K, 105 bytes
For information about K/Q languages see code.kx.com
Use: Country-code (2-char string, example "XY") after
in[;+\-48+5h$"62<729151368=1>a1A23<6<C181A83?45;488F411112115:235Q43r141738353135247F42Tl<:"]@26/:-65+5h$

Generates 1b (Left-handed traffic) or 0b (not Left-handed traffic)
Explanation:

5h$"XX" generates ascii codes for each char of the 2-char string (country-code), Example 5h$"TB" generates 84 66
-65+integerList substract 65 to each integer in the list. Example -65+5h$"TB" generates 19 1
26/:integerList computes integer equivalent to that list as digits in 26-base. Example 26/:-65+5h$"TB" generates 495 (country-code as integer)
in[;listOfCountryCodesAsIntegers]@x returns boolean value (1b = true, 0b = false). True if x is in the list
+\-48+5h$"62<729151368=1>a1A23<6<C181A83?45;488F411112115:235Q43r141738353135247F42Tl<:" calculates list of integers for each country code with Left-handed traffic

"62<729151368=1>a1A23<6<C181A83?45;488F411112115:235Q43r141738353135247F42Tl<:" is the 'distance string' (distance between each pair of integer-country-codes in ascending order, codified as char). Distance n is codified as ascii char 48+n
-48+5h$".." calculates ascii value of each char in string ".." and recover original distance as ascii-code - 48. The result is the list of distances
+\integerList calculates partial summation of items from the list -> absolute integer-country-codes from distances between codes.

NOTES.-

Returns 0b for any non-left-handed country-code, including not valid country codes
We can save a char reformatting the code, but requires to write country-code "XX" inside the code (i don't know if it's valid, but i'm quite sure it's not elegant)
in[26/:-65+5h$"XX";+\-48+5h$"..."]

Vim, 117 109 108 keystrokes
oSZAINAGGDMOAUGBBSCCKIMWSHKYLSBMVGSGYBDBTHBWBNRMZMTLCXSRTVCYPNFKNPKEFJMYVIDIEJPGJEMUNZWMSONULKTKTOTTCTZ␛kg*D

Try it online! (replace SE in the header with the country code)
␛ is the escape key. The program prints the following text for right-handed traffic:

SZAINAGGDMOAUGBBSCCKIMWSHKYLSBMVGSGYBDBTHBWBNRMZMTLCXSRTVCYPNFKNPKEFJMYVIDIEJPGJEMUNZWMSONULKTKTOTTCTZ

Explanation
oSZAINA...OTTCTZ␛ Input the lookup-string on a new line
kg*D              Delete the everything after the last occurence of the country code
                   on the same line

I appreciate that you're answering in my favourite text editor, clever use of choosing a value for right!

MY-BASIC, 162 bytes
Anonymous Function that takes input as an unwrapped string (that is, without parenthesis) and outputs to the console
Input"",x$,
For y=0 To 100
z=z+(Mid("TTHSZWMSGSONPKNZMWVIDFKELSCYJPNFJMTVCXBNRBWSHKYAUGGYBTLCCKIMVGBSBBMZAINAGDMOBDIEJEMYMUNUPGSRLKTKTOTCTZ",y,2)=x$)
Next
Print z

Returns 0 for right-handed and 1 for left-handed traffic, try it online!

Yabasic, 127 bytes
Anonymous function that takes input as an unwrapped string (no "...") and outputs 0 if the Country is right-handed and 1 if the country is left handed.
Input""A$
?InStr("TTHSZWMSGSONPKNZMWVIDFKELSCYJPNFJMTVCXBNRBWSHKYAUGGYBTLCCKIMVGBSBBMZAINAGDMOBDIEJEMYMUNUPGSRLKTKTOTCTZ",A$)>0

Try it online!

C (gcc), 115 107 bytes
f(short*x){x=!wcschr(L"䥁䝁啁卂䑂䉂䵂呂坂䝖乂奋塃䍃䭃奃䵄䭆䩆䑇䝇奇䭈义䑉䕉䵉䵊偊䕊䕋䥋卌位坍奍噍呍啍卍婍䅎剎偎婎啎䙎䭐䝐乐䡓之䍌䍖南䍓䝓䉓体䅚升䭌剓婓䡔䱔䭔佔呔䍔噔䝕䉇婔䥖䵚坚",*x);}

Try it online!
Returns 0 if left handed. -4 thanks to @JonathanFrech

Could you not define your function to take a short* as parameter?

Vyxal r, 65 bytes
⇩«°ǎ+₃∧M⋏⁼•¼¾E⇧M∪∵IḞ½ð∷⅛ḃxṀ⌊ż‹←∵o8ƒ₈£…₌⌈⋏L⟑₇₌±M…uġεƛǏ∆%zKɾ\@(L-«c

Try it Online!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Cribbage Scoring
My brothers and I like to play Cribbage.  Now,  the scoring rules for Cribbage are somewhat complicated, and I often worry that I'm not counting my score correctly. Therefore, your job is to write a program that will correctly score my hand.
Scoring
There are two ways to score points in Cribbage: during pegging, and while counting the hands. For the purpose of this challenge, we will only be counting a hand. However, there is also another card which is cut from the deck, and contributes to both players' scores; it is known as the "starter". The card combinations which score are:
Fifteens: Any combination of cards which adds to 15 is worth 2 points. All face cards are valued at 10, while aces are 1.
Pairs: A pair of two cards is worth 2 points. Three and four of a kinds are scored as multiple pairs; for example, since there are three ways to choose 2 from 3, a three of a kind scores 6.
Runs: A run of three or more cards is worth the number of cards in the run. Note that queen-king-ace is not a run, as aces are low.
Flush: A flush happens when all four cards in a hand are of the same suit, and is worth 4. If this also matches the suit of the starter, it is worth 5. Note that having, say, three hearts in hand and starter of hearts is not a flush: all four cards must be in the hand.
His Nobbs: A jack of the same suit as the starter is worth 1 point. Don't ask about the name.
For more information on scoring, see here: http://www.bicyclecards.com/how-to-play/cribbage/
I/O:
Cards can be represented as either a string or list/tuple, consisting of their value followed by their suit. Suits are "H" for hearts, "D" for diamonds, "C" for clubs, and "S" for spades. Face cards are "J", "Q", "K", "A", for jack, queen, king, and ace respectively. Therefore, two ways an ace of spades could be represented are "AS" and ['A', 'S'].
Your program or function should take two values: The hand and the starter. These can be any sane data type. It should return a single number, which can also be in any legible representation.
Examples:
 Input                            ==>   Output (notes)
["8H", "7D", "7H", "6H"], "2H"    ==>   16 (4 ways to make 15 makes 8, a pair makes 10, and two runs of three makes 16)
["JD", "5H", "5C", "5S"], "5D"    ==>   29 (Highest possible score: four of a kind makes 12, 8 ways to make 15 makes 28, and His Nobbs makes 29)
["9S", "10C", "5C", "8C"], "KH"   ==>    7 (two ways to make 15 makes 4, and a run of three makes 7)
["AS", "2H", "3C", "8S"], "AD"    ==>    7 (pair for 2, run of three makes 5, and one way to make fifteen (all five cards) makes 7)

Scoring:
This is code golf, shortest answer in bytes wins.
Standard loopholes are forbidden.

Can we replace 10 with T on the cards for the purpose of making each exactly 2 characters long?

This is a very nice first question! But unfortunately, this question has been asked before, so I'm voting to close it.

@ETHproductions Sure, go ahead.

I really love the game and thought about this question before but found it was a duplicate. I then thought about taking 2 hands and finding the winning hand from the pegging. Not had time to follow up but if you like the idea then put something together in the sandbox and I'll be happy to contribute.

Btw, very well written challenge with a good description of the scoring.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
A Dance of Many Dimensions
Challenge
Given a n-dimensional array of integers and a permutation of the first n natural numbers, permute the array dimensions accordingly.
Details
This challenge is inspired by MATLABs permute. demonstration
The permutation is given as a list of integers, e.g. [1,3,2] means 1 gets mapped to 1, 2 gets mapped to 3 and 3 gets mapped to 2 (here the ith entry is the value i gets mapped to). But you can use other formats that are convenient, for instance as cycles or as a function. If it is more convenient you can also use 0-based indexing.
The array can be assumed to be a full "rectangular" m1 x m2 x ... x mn-array (i.e. you can assume it is not ragged/jagged).
You can assume that n is not too large, as many languages have a limit of the number of dimensions in a nested array.
If your language does not support multidimensional arrays, you can also take a string that represents the array as input.
Examples

Any n-dimensional array with the identity permutation [1,2,3,...,n] will be unchanged.
The array [[10,20,30],[40,50,60]] with the permutation [2,1] gets mapped to [[10,40],[20,50],[30,60]].
The array [[[1,2],[3,4]],[[5,6],[7,8]]] with the permutation [2,3,1] gets mapped to [[[1,3],[5,7]],[[2,4],[6,8]]].

Languages with built-in solutions
based on this proposal by xnor
APL (Dyalog Unicode), 1 byte
⍉

Try it online!
J, 2 bytes
|:

Try it online!
R, 5 bytes
aperm

Try it online!
Octave/MATLAB, 8 bytes
@permute

Try it online!
Wolfram Language (Mathematica), 9 bytes
Transpose

Try it online!
Julia, 11 bytes
permutedims

Try it online!

Haskell, 168 bytes
p is a (type class polymorphic) function taking a permutation as a list of Ints, and a nested list representing a multidimensional array of Ints.
Call as p [2,1] [[10,20,30],[40,50,60]], however if type defaulting doesn't succeed, you may have to add a type annotation like :: [[Int]] (nested appropriately) giving the type of the result.
import Data.List
class P a where p::[Int]->[a]->[a]
instance P Int where p _=id
instance P a=>P[a]where p(x:r)m|n<-p r<$>m,y:z<-sort r=last$n:[p(x:z)<$>transpose n|x>y]

Try it online!
Golfing challenges with nested arrays of arbitrary depth are a bit awkward in Haskell, because the static typing tends to get in the way. While Haskell lists (with the exact same syntax as in the challenge description) can be nested just fine, lists of different nesting depth are of incompatible types. Also, standard Haskell parsing functions require knowing the type of the value you are trying to parse.
As a result, it seems inevitable that the program needs to include type-related declarations, which are relatively verbose. For the golfed part, I settled on defining a type class P, such that p can be polymorphic over the type of the array.
Meanwhile, the TIO's testing harness shows a way to get around the parsing problem.
How it works

To sum up the essence of this algorithm: It performs a bubble sort on the permutation list, transposing neighboring dimensions when the corresponding permutation indices are swapped.
As given by the class P a declaration, in any instance, p takes two arguments, a permutation (always of type [Int]) and an array.
The permutation can be given in the form in the challenge description, although the way the algorithm works, the choice of indices is arbitrary, except for their relative order. (So both 0- and 1- based work.)
The base instance P Int handles arrays of dimension 1, which p simply returns unchanged, since the one dimension can only be mapped to itself.
The other instance P a => P [a] is defined recursively, calling p with dimension n subarrays in order to define it for dimension n+1 arrays.

p(x:r)m first calls p r recursively on every element of m, giving a result array n in which all dimensions except the first have been permuted correctly relatively to each other.
The remaining permutation that needs to be performed on n is given by x:y:z = x:sort r.
If x<y then the first dimension of n is already correctly placed, and n is simply returned.
If x>y, then the first and second dimension of n need to be swapped, which is done with the transpose function. Finally p(x:z) is applied recursively to every element of the result, ensuring the original first dimension is transposed to the right position.

Python 2, 312 bytes
This uses 0-indexing for the permutation
from numpy import*
from itertools import*
z=range
def f(i,r):
	l=array(i).shape;R={b:a for a,b in enumerate(r)};r=len(r);m=eval('['*r+'0'+q('for k in z(l[R[%s]])]',r-1,-1,-1))
	for d in product(*[z(p) for p in l]):exec'm'+q('[d[R[%s]]]',r)+'=i'+q('[d[%s]]',r)
	return m
q=lambda s,*j:''.join(s%(j)for j in z(*j))

Try it online!
-2 bytes thanks to @Jonathan Frech.

You do not need parentheses for calling exec (saving two bytes), as it is a statement in Python 2.

There also is a superfluous space in z(p) for.

Used map(z,l), s%j and print for 301 bytes –– Try it online!

Python 2, 41 25 bytes
import numpy
numpy.einsum

Try it online!
The permutation vector p is given as a string of letters. So [2,3,1] can be be given as 'bca'.
Thanks to @EriktheOutgolfer saved 16 bytes!

Does this support more than 26 dimensions?

Actually no more than 52 dimensions: uppercase+lowercase.

JavaScript (ES6), 136 132 bytes
(a,p,v=[],r=[],g=(a,[d,...p],_,h=(r,[i,...v])=>1/v[0]?h(r[i]=r[i]||[],v):r[i]=a)=>1/d?a.map((e,i)=>g(e,p,v[d]=i)):h(r,v))=>g(a,p)&&r

0-indexed. Explanation: g recursively iterates over the array a building up an array v of indices reordered using the permutation p. Once p is exhausted, h then recursively inserts the element into the result array r using the permuted indices.


text:
Tips for golfing in Husk
Husk is a quite new golfing language, created by PPCG users Leo and Zgarb. It has begun being more and more competitive, often staying close or even beating languages known to be very terse, such as Jelly and 05AB1E.
Let's list some of the golfing techniques that are somewhat specific to Husk. As always, please post one tip per answer.

I wouldn't say it is new...

@totallyhuman first Husk answer Still not that new

Use the return value from predicates
In Husk, functions that test their inputs for some property will usually return a meaningful result in truthy cases, as any positive integer is truthy.
Examples:
≠  Numbers: Absolute difference
   Chars:   Absolute difference of code points
   Lists:   First Index where the differ

Comparisons <, >, ≤, ≥:

For strict comparisons:
Numbers,Chars:  max 0 (the appropriate difference¹)
Lists: The first index where the comparison between the two lists is true

For non-strict comparisons:
Numbers,Chars: max 0 (the appropriate difference + 1)
Lists: Either the result of the strict comparison or, if they are equal,
       the length of the list + 1

ṗ  Index into the list of prime numbers

V  The index of the first element for which the condition is true

€  The first index of that element/substring in the list

£  Works like €

&  Given two arguments of the same type will return the second argument if false,
   otherwise will return the first argument

|  Given two arguments of the same type will return the second argument if true,
   otherwise will return the first argument

¦  Return the quotient if divisibility holds

Λ,E,Ë  Will all return length+1 in truthy cases

Char predicates:
□,±,√,D,½  will each return the codepoint of its argument on truthy cases

¹ appropriate difference means difference of code points for chars. It also refers to the argument order. i.e For <x y, would be x-y

Use overflowing line labels
As you may already know,  [₀-₉]+|[₀-₉] is regex for the syntax to call a different line than the one you're currently in.
This tip is especially useful if you want a function defined on a specific line to be called as an argument of more than one of the functions in the table below, or as an argument to one or more of the functions below and by itself.
Function table:
+----------+----------+
|Index     |Function  |
+----------+----------+
|1         |´ (argdup)|
+----------+----------+
|2         |` (flip)  |
+----------+----------+
|3         |m (map)   |
+----------+----------+
|4         |z (zip)   |
+----------+----------+
|5         |S (hook)  |
+----------+----------+

Lines in your code are labeled with their respective 0-based indices, from top to bottom. If M < N, where M is the label and N is the number of lines in your code, the label just represents the function defined at line M. If N ≤ M < N * 6, it represents the function from the table above at index ⌊M ÷ N⌋ with the function defined at line M mod N as its first argument. If N * 6 ≤ M, an index error is raised.

Uses of Γ
The main use of the built-in Γ, known as pattern matching on lists or list deconstruction, is to split a list into a head and tail, and apply a binary function on them.
This corresponds to the Haskell pattern matching idiom
f (x : xs) = <something>
f [] = <something else>

where <something> is an expression containing x, xs and possibly f.
There are 4 overloadings of Γ, each of which works a little differently.
list
The first overloading, list, takes a value a and a binary function f.
It returns a new function that takes a list, returns a if it's empty, and calls f on the head and tail if it's nonempty.
For example, Γ_1€ takes a list, returns -1 if it's empty, and the index of first occurrence of the first element in the tail if not.
listN
The second overloading, listN, is similar to list, except that a is omitted and the default value of the return type is used instead.
For example, Γ€ is equivalent to Γ0€, since the default numeric value is 0.
In practice, listN is used more often than list, since the default value is either irrelevant or exactly what you need.
A common pattern is Γ~αβγ, where αβγ are three functions; this applies β to the first element and γ to the tail, and combines the results with α.
It was used e.g. in this answer.
Other patterns include Γo:α for applying α only to the first element, and Γ·:mα for applying α to all elements except the first.
The latter was used in this answer.
listF
The third overloading is a bit more involved.
Like list, it takes a value a and a function f, and returns a new function g that takes a list.
However, this time f takes an extra function argument, which is g itself, and can call it on any value (including, but not limited to, the tail of the input list).
This means that listF implements a general recursion scheme on lists.
listF is not used very often, since explicit recursion with list/listN is usually of the same length or shorter, as in this answer.
listNF
listNF is to listF what listN is to list: the input a is omitted, and the default value of the return type is used instead.
In rare circumstances, it can be shorter than a right fold, for example in this answer.
As an example of the recursive versions of Γ, the function Γλ·:o⁰↔ shuffles a list in the order first, last, second, second-to-last, third, third-to-last, and so on.
Try it online!
The function f is the explicit lambda λ·:o⁰↔, whose argument ⁰ is the entire function.
What f does is reverse the tail with ↔, then call the main function recursively with o⁰, and finally tack the head back with ·:.
Of course, Γ·:o₀↔ is a byte shorter, but doesn't work if the line contains something else than this function.

Lambdas can be shorter than new functions
As you probably know if you have a multi-line program, you can refer to the lines with the subscripts ₀…₉, for example in the case of
f
g

₁ will refer to the function g. Now if you always apply the inputs to the function g (and use it multiple times); something like this:
f₁⁰[...]g₁⁰[...]
h

You should introduce a lambda because it saves you 1 byte for each additional use:
λf⁰[...]g⁰[...])h

The reverse might be true as well
In the case of self-referential lambdas (φχψ), there's the special case where you apply the inputs directly to the recursive function, in these cases you're better off by using the subscript ₀ instead of defining a new lambda and using ⁰.

Combinators can be applied to higher order functions
Suppose you have a list of integers X, and you want to count the total number of elements of X that are larger than length(X).
Counting elements that satisfy a predicate is done with the higher order function #, but here the predicate (being larger than length(X)) depends on X.
The solution is to apply the combinator Ṡ to # and the function o>L that checks whether a list is shorter than a number.
In the function Ṡ#o>L, the list X is passed to o>L, the partially applied function is passed to #, and X is given to # as the second argument.
In general, if α is a higher-order function, β a binary function and γ a unary function, Ṡαβ is equivalent to the Haskell pseudocode
\x -> α (\y -> β x y) x

§αβγ is equivalent to
\x -> α (\y -> β x y) (γ x)

and ~αβγ is equivalent to
\x y -> α (\z -> β x z) (γ y)

as long as the types match.
As another concrete example, §►δṁ≠P finds a permutation of a list X that maximizes the sum of absolute differences to corresponding values of X (δṁ≠ zips two lists using absolute difference and takes the sum).

Husk's default values
Husk is not as strict as Haskell where you run into trouble when for example you try to get the last element of an empty list. To achieve this it uses predefined values, here's a list of the default values, maxima and minima:
.------------------------------------.---------------.----------.-------.
|   Type (X and Y are placeholders)  | default (def) |    max   |  min  |
|------------------------------------|---------------|----------|-------|
|       Character (C)                |      ' '      | \1114111 | \NUL  |
|       Numbers   (N)                |       0       |   Inf    | -Inf  |
|       List of X (LX)               |      []       |  ∞ max   |   []  | *
|       Function :: X -> Y           | const (def Y) |   n/a    |  n/a  |
'------------------------------------'---------------'----------'-------'

 * Here ∞ should represent an infinite list of the corresponding maximum (see below for an example)
 Note: For tuples (X,Y) it will use the values for each component separately.

When they are used
While the maxima and minima are only used for ▲▼ on empty lists (for example husk -u "▼" "[]:LLN" will return an infinite list of Inf) the default values are used in a few places:

folding over empty lists without providing a value yourself (F and Ḟ)
prepending default value (with Θ)
when read (r) fails
getting the first/last element (←→) or indexing into one (!)
pattern matching (Γ) on empty lists
using ► or ◄ on empty lists

Use , , e and ė to debug your functions
Since Husk is a functional programming language, a lot of times you'll find yourself in a situation where you have a function with two arguments passed to it, which returns an unexpected result.
You can replace any two argument function with e/ė, so long as it's arguments are homogeneous(have the same datatype)
,, on the other hand makes a pair. It can only be used for 2 argument functions, but it supports heterogeneous types.
For example,
S+ȯ□½→

returns the number added to itself incremented, halved then squared in that order (\$x + \frac{(x+1)^2}4\$)
Seȯ□½→

will return a two element list with the original element, and the result of the function composition.
For example,
1 → [1,1]
2 → [2,9/4]
3 → [3,4]

and so on.

, works too, and doesn't require equal types.

@Zgarb cool. Added it in.


text:
Help pannenkoek count A presses
pannenkoek2012 aims to complete Super Mario 64 with as few presses as possible of the A button, which makes Mario jump. Each "A press" consists of three parts:

Pressing the button
Holding it for any length of time
Releasing it

See this video (1:15 - 3:23) for a great explanation that includes the above image. (However, this challenge will not use the half-A-press terminology and will posit obstacles that require releasing A.)
Task:
Given a sequence of obstacles requiring pressing (P), holding (H), or releasing (R) the A button, output the smallest number of presses required to overcome them in the order given. The A button is initially not held.
Stated formally: given a string S of characters PHR, consider strings of form (PH*R)* that contain S as a subsequence, and output the smallest possible number of P's in such a string. Or, alternatively, find the smallest number of chunks of the form P?H*R? that S can be split into.
Example
Let's look at input RHRPHHHR. The A button starts not held, so overcoming the initial obstacle R requires the button be pressed and then released (press #1). Next we are required to hold the button H, which again requires it first be pressed (press #2). Then, it can then be released afterwards to satisfy the R after it. Finally, the remaining PHHHR can be satisfied by a single press (press #3) followed by holding HHH and releasing R. So, the output count is 3.
Another way to see it, is that we can split the input string into 3 parts of form PHH..HHR where letters may be omitted.
R
HR
PHHHR

Input format
The input will be a list or string of elements representing press, hold, and release as your choice of:

P, H, R
p, h, r
1, 2, 3
0, 1, 2

matched in the order given. The input will not be empty.
Test cases:
P 1
H 1
R 1
HP 2
RHP 3
HHR 1
PHRH 2
RHRPHHHR 3
HHHHHH 1
PPRRHHPP 6
HPPRHRPRHPPRHPPHRP 12
PRHRHPHHPRRRHPPRHHPPRRRHRHPRPHPRPRHHRPPPRHPRP 28

Leaderboard:

var QUESTION_ID=152701,OVERRIDE_USER=20260;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/152701/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&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(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.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(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

What about obstacles requiring the A button to not be held? There are four button states in the graph (I think that these might actually exist in the game, too)

In reality, there are 3 states: Press, Held, and Not-held. No state require an A button Release. The challenge is slightly wrong in comparison with the reality.

@Random832 This challenge is only based on reality, not an exact replicate.

@user202729 Makes sense, although I think an obstacle requiring an A button release is conceivable: consider an obstacle like a tunnel sloped downwards, which would require Mario to start off at top jump height and then release A at the exact right moment so he falls diagonally through the tunnel. Probable? No.

@11684 "as for the release, well, there is currently no cases where that's useful or important so don't worry about that part." (1:48 - 1:52)

Anyone want to do this in MIPS assembly? (the language used to program Super Mario 64)

@user202729 Wow, that’s one thorough pancake. Thanks!

@user202729 it's been 1.5 years since my last MIPS answer and I completely forget how to do string processing.

I'm just curious: did you find the video because of the recent Twitter/@SwiftOnSecurity discussion about collision in physics engines? EDIT: this thread

@user202729 I'm aware, I said the challenge "will posit obstacles that require releasing A" because I found it too be too simple without them.

@Nodon'tshownmyrealname No, I've been watching pannenkoek's videos for a while.

Debouncing needs to be caught?

Retina, 9 bytes
1>`P?H*R?

Try it online!

Pyth, 13 bytes
tl:z"P?H*R?"3

Try it here! or Verify all the test cases.
Note that 1 also works in place of 3.
How it works?

tl:z"P?H*R?"3 | Full program. Takes input from STDIN, outputs to STDOUT.

  :z        3 | Split the input string on matches of...
    "P?H*R?"  | The regular expression "P?H*R?".
 l            | Get the length.
t             | Decrement (because splitting includes the empty string).

More about the regex:

P?     | P – The literal character P, case sensitive.
       | ? – Quantifier. Matches either one or zero times the previous character.
  H*   | H – The literal character H, case sensitive.
       | * – Quantifier. Matches any number of occurrences of the previous character.
    R? | R – The literal character R, case sensitive.
       | ? – Quantifier. Matches either one or zero times the previous character.

Ah, feck, you beat me to it!

nice! Second to last line in the regexp description should say "Literal character R", right?

@vidstige Yes, thanks. Fixed

Jelly, 10 bytes
o5ḄƝ%⁵>4S‘

A monadic chain taking a list (the P,H,R : 0,1,2 option) and returning an integer, the count.
Try it online! or see the test-suite
How?
Effectively works by getting all adjacent pairs then counting any that are not "continuation pairs" (PR, PH, HR, or HH) and adding one.
o5ḄƝ%⁵>4S‘ - Link: list of integers (in [0,1,2])  e.g.: [0,0,1,0,2,1,1,2,2,0] (representing PPHPRHHRRP)
o5         - logical OR with 5                          [5,5,1,5,2,1,1,2,2,5]
   Ɲ       - for all adjacent pairs:              i.e.: [5,5],[5,1],[1,5],[5,2],[2,1],[1,1],[1,2],[2,2],[2,5]
  Ḅ        -   convert from binary                      [ 15 ,  11 ,  7  ,  12 ,  5  ,  3  ,  4  ,  6  ,  9 ]
     ⁵     - literal ten
    %      - modulo                                     [  5 ,   1 ,  7  ,   2,   5  ,  3  ,  4  ,  6  ,  9 ]
      >4   - greater than four?                         [  1 ,   0 ,  1  ,   0,   1  ,  0  ,  0  ,  1  ,  1 ]
        S  - sum                                        5
         ‘ - increment                                  6

Previous 11 byte solution:
ḅ3Ɲạ3ḟ1,2L‘

Try it online! or see the test-suite
How?
Works like the above, but in a completely different way...
ḅ3Ɲạ3ḟ1,2L‘ - Link: list of integers (in [0,1,2])  e.g.: [0,0,1,0,2,1,1,2,2,0] (representing PPHPRHHRRP)
  Ɲ         - for all adjacent pairs:              i.e.: [0,0],[0,1],[1,0],[0,2],[2,1],[1,1],[1,2],[2,2],[2,0]
ḅ3          -   convert from base three                  [ 0  ,  1  ,  3  ,  2  ,  7  ,  4  ,  5  ,  8  ,  6 ]
   ạ3       - absolute difference with three             [ 3  ,  2  ,  0  ,  1  ,  4  ,  1  ,  2  ,  5  ,  3 ]
     ḟ1,2   - filter discard if in [1,2]                 [ 3        ,  0        ,  4              ,  5  ,  3 ]
         L  - length                                     5
          ‘ - increment                                  6

and another, again quite different:
+19*Ɲ%13ḂS‘

(add 19 to each, then for adjacent pairs perform exponentiation, modulo by 13, modulo by 2, sum and add one).

New Jelly quick!

Batch, 69 bytes
@set/ab=2,n=0
@for %%b in (%*)do @set/an+=b/2^|!%%b,b=%%b
@echo %n%

Takes input as a list of 0-indexed command-line parameters, but you can use a list of letters p, h, r in either upper or lower case if you type set /a p=0, h=1, r=2 first. Explanation: b maintains the last input (defaulting to 2 for released) and n the count of presses. Each input adds a press if the last input was a release or the current input is a press.

Oh, set can set multiple variables at once? Useful to know.

@user202729 set /a is arithmetic evaluation, so as long as all the variables you want to set are numeric, you can simply use the comma operator to concatenate the assignment expressions.

Python 2, 44 bytes
Uses P->1 H->2 R->3
lambda a:sum(1/y|x/3for x,y in zip([3]+a,a))

Deorst, 11 bytes
'P?H*R?'ggL

Try it online!
Uses Mr. Xcoder's regex

Japt, 11 bytes
è"P?H*R?" É

Try it | Check all test cases
è counts the number of matches of the RegEx in the input and É subtracts 1.

Python 2, 48 bytes
f=lambda a,*l:l==()or(a>l[0]or l[0]==a!=1)+f(*l)

Try it online!
Takes 0,1,2 as input.

Jelly, 10 bytes
Pn1></µƝS‘

Try it online! or Test suite! (Stolen Borrowed from Jonathan.)
Alternative:
P=1=</µƝS‘

Try it online!
Pn1></µƝS‘ | Monadic chain.

      µƝ   | Map over each pair of "neighbours" (x, y) in the list.
P          | And check whether their product...
 n1        | ... 1 if it doesn't equal 1, 0 otherwise...
   >       | Is higher than?
    </     | The pair reduced by "Smaller than?". 1 if x < y, else 0.
        S  | Sum.
         ‘ | Add 1.

Jelly, 11 bytes
Saved 1 byte with help from caird coinheringaahing.
ḅ3Ɲf⁽vḲD¤L‘

Try it online!

Aww, I missed the chance to be the first to use the neighbours quick :(

You can remove the μ from the third one

Kotlin, 36 bytes
Regex("P?H*R?").findAll(i).count()-1

Beautified
Regex("P?H*R?").findAll(i).count()-1

Test
fun f(i:String) =
Regex("P?H*R?").findAll(i).count()-1
data class Test(val input: String, val output: Int)

val TESTS = listOf(
        Test("P", 1),
        Test("H", 1),
        Test("R", 1),
        Test("HP", 2),
        Test("RHP", 3),
        Test("HHR", 1),
        Test("PHRH", 2),
        Test("RHRPHHHR", 3),
        Test("HHHHHH", 1),
        Test("PPRRHHPP", 6),
        Test("HPPRHRPRHPPRHPPHRP", 12),
        Test("PRHRHPHHPRRRHPPRHHPPRRRHRHPRPHPRPRHHRPPPRHPRP", 28)
)

fun main(args: Array<String>) {
    for ((input, expectded) in TESTS) {
        val actual = f(input)
        if (actual != expectded) {
            throw AssertionError("$input $expectded $actual")
        }
    }
}

TIO
TryItOnline

Husk, 6 5 bytes
Lġo&ε

Try it online!
Input is a list over 0,1,2 (the TIO link uses letters for easier copy-pasting of test cases).
Explanation
I use the same general idea as Jonathan Allan's Jelly answer: split on occurrences of the "discontinuity pairs" PP, HP, RH, RR and RP, and count the resulting blocks.
In the 0,1,2 encoding, these pairs are exactly those whose left element is 2 or right element is 0.
Lġo&ε  Input is a list.
 ġ     Split between pairs that do not satisfy:
    ε  the left element is at most 1
  o&   and the right element is truthy.
L      Length.

Javascript (ES6), 30 bytes

f=s=>s.match(/P?H*R?/g).length-1
<input id=i oninput="o.innerText=f(i.value)" value="PHHR">
l

Haskell, 36 bytes
f a=sum[1|(x,y)<-zip(2:a)a,x>1||y<1]

Try it online!
Uses the 0,1,2 encoding.

J, 18 17 bytes
-1 Thanks to @FrownyFrog
1+1#.}:(<+:1=*)}.

Takes input in the form of 0,1,2. The helper function on TIO converts the test cases to this form.
Try it online!
The logic of the comparisons may still be golfable. I'm twisting my brain into knots trying to think of more equivalent and shorter statements.
Explanation (previous solution)
1+1#.2(</+:1=*/)\]

The only difference between the current solution and the previous one is how the comparisons are generated. The current solution explicitly compares adjacent elements by offsetting the array and the previous solution compares adjacent elements by looking at infixes of 2.
1 + 1 #. 2 (</ +: 1 = */)\ ]
         2               \ ]  On infixes of 2 on the input
                  1 = */        Is the infix 1 1 (two holds)?
            </                  Is the infix x y such that x < y?
               +:               These results NORed
    1 #.                       Add all of the results together (debase to base 1)
1 +                            Add one

This would be a lot cleaner if two holds did nothing. The code takes infixes of two and checks if they are not ascending and not two holds. If this is the case, then we add one to our final count. We have to add 1 to the end since we're off by one otherwise (or you could prepend an _ or any value greater than 2).
The way it checks if the infix is two holds is by multiplying the two values together and seeing if it is one (two holds are 1 1).

1+1#.}:(<+:1=*)}. is one shorter.

@FrownyFrog clever, I’ll edit that in.

14: 1+1#.0=}.*2-}:

Vim + wc, 25 bytes
:s/P\?H*R\?/a/g␊V!wc -c␊␘

␊ is the return key and ␘ is Ctrl+X
Try it online!
Explanation
:s/P\?H*R\?/a/g␊    Replace all button presses with the character a
V!wc -c␊␘          Count the characters using the wc command


text:
Encrypted In Numbers!
The Problem:
Two enemy secret agents have devised a wonderful (for you) method of communication!
Here’s how the encryption process works:
1) Take the ascii equivalents of each letter. (No spaces, numbers, or punctuation are sent)
2) For each letter in the message, the ascii equivalent of it and the letter after it (If it exists, if it doesn’t, it should be considered 0), are multiplied (this product is stored in an array/list) and summed (this number is also stored in a different list).
3) The two lists (of sums and products) are joined together (the sums list, then the multiples list, into the same array) and transmitted.
You need to write the smallest program able to reverse this process and decrypt messages sent in this format!
Example Input and Output Pairs:
[173, 209, 216, 219, 198, 198, 225, 222, 208, 100, 7272, 10908, 11664, 11988, 9657, 9657, 12654, 12312, 10800, 0] -> “HelloWorld”
[131, 133, 164, 195, 197, 99, 4290, 4422, 6499, 9506, 9702, 0] -> “ABCabc”

This is code-golf, so the smallest solution in bytes wins.
Error messages are allowed.
Your program can be given either a list/1-dimensional array or a comma-separated string, if you specify in your submission. The default is an array/list.

Why is the list of multiples even there? Just the sums is enough information.

@orlp maybe to allow more golfing opportunities? :)

@orlp oh no, you spoiled the fun!

@JonathanAllan is correct, partially. I wanted the two secret agents to appear super stupid, so that they add unnecessary parts to their “code”. It also adds some more possible programs that can come out.

@orlp Just the multiples isn't enough, right?

Nope, as far as I can tell.

Husk, 7 6 bytes
mcĠ≠←½

Try it online! According to the documentation the leading m should not be needed, but there seems to be a bug currently.
Edit: -1 byte thanks to Zgarb!
Explanation:
     ½ -- split input list into half
    ←  -- take first list
  Ġ≠   -- subtract each list element from the previous one
mc     -- convert list of code points to string

I think \-can be≠. The behavior of c` indeed looks like a bug.

@Zgarb That's a practical way to implement unequal. Is this documented somewhere?

It's on the Semantics page of Husk Wiki.

It seems you changed your explanation, but not the actual code snippet itself. :)

@iPhoenix Thanks, I correted it.

brainfuck, 66 bytes
,[>>>+<[-<+>>-<]<[->+<],]>[<<,>>[-<+>]<-]<<<[>[-<->>+<]<<]>.>>[.>]

Input is the encrypted string. Assumes infinite sized cells and 0 on EOF.
How it Works:
,[>>>+<[-<+>>-<]<[->+<],] Gets input and the number of characters divided by 2
>[<<,>>[-<+>]<-]<<< Remove the second half of the string (the multiplication part)
[>[-<->>+<]<<] Subtract each character from the previous one, while keeping a copy of the previous one.
>.>>[.>] Print the characters

Haskell, 45 35 bytes
map toEnum.scanr1(-).fst.span(<245)

Try it online!
Explanation

fst.span(<245) takes all numbers from the beginning of the list that are smaller than 245. Those are only the numbers from the summation part, because the largest possible summation is z + z = 122 + 122 = 244, and the smallest possible product is A * A = 65 * 65 = 4225.
scanr1(-) takes the last value of the list and uses it as initial accumulator. Then from back to front each element of the list is subtracted by the current accumulator, and the result is used as the next accumulator and and added to a list.
map toEnum replaces each number in the list with the corresponding character to recreate the string.

Jelly, 9 bytes
œs2ḢUạ\ỌU

Try it online! or Check both test cases.
Alternative.
Explanation

œs2ḢUạ\ỌU || Full program.

œs2       || Split into two parts, with the first one being longer if necessary.
   Ḣ      || Get the head (first element).
    U     || Reverse.
     ạ\   || Cumulative reduce by subtraction.
       Ọ  || Convert from code points to characters.
        U || And reverse again.

Python 2, 72 bytes
a=input();p=0;r=''
for v in a[len(a)/2-1::-1]:r=chr(v-p)+r;p=v-p
print r

Try it online!

Python 2, 92 bytes
lambda C:"".join(chr(sum((-1)**i*C[j+i]for i in range(len(C)/2-j)))for j in range(len(C)/2))

Try it online!

Jelly, 11 bytes
œs2Ḣḅ-$ÐƤAỌ

A monadic link taking a list of integers and returning a list of characters.
Try it online!
How?
œs2Ḣḅ-$ÐƤAỌ - Link: list of integers     e.g. [210,211,201,101,10989,11100,10100,0]
  2         - literal two                     2
œs          - split into equal parts          [[210,211,201,101],[10989,11100,10100,0]]
   Ḣ        - head                            [210,211,201,101]
       ÐƤ   - for postfixes:                  [210,211,201,101],[211,201,101],[201,101],[101]
      $     -   last two links as a monad:
     -      -     literal minus one           -1
    ḅ       -     convert from base           -99              ,111          ,-100      ,101
         A  - absolute value (vectorises)     [99,111,100,101]
          Ọ - convert to ordinal (vectorises) "code"

Pyt, 60 bytes
←ĐĐŁ₂⁻⦋⇹ĐŁřĐŁ₂>*ž0`ŕĐĐŁ⁻⦋3ȘĐ4Ș3Ș4Ș÷⇹ĐŁřĐŁ<*žĐŁ⁻łŕ⇹Đ3Ș⇹÷Á↔áƇǰ

Takes a list of integers and returns a string of characters.
Explanation:
←ĐĐŁ₂⁻⦋⇹          Gets the ASCII code of the last character
ĐŁřĐŁ₂>*ž         Gets the list of products and removes the 0 from the end of the list
0`ŕ ...  ł        Loops (0 is there so that the length can be removed from the stack)
ĐĐŁ⁻⦋              Gets the last product
3ȘĐ4Ș3Ș4Ș÷        Divides by the last ASCII code obtained
⇹ĐŁřĐŁ<*ž         Removes the last element from the array
ĐŁ⁻ł              Gets the length of the array - 1 (if 0, then exit loop - the last entry still has to be processed)
ŕ⇹Đ3Ș⇹÷           Divides the remaining product by the last ASCII code obtained
Á↔á               Converts to array of ints
Ƈǰ                Converts to string of ASCII characters

Try it online!

JavaScript (ES6), 80 bytes
a=>String.fromCharCode(...eval(`for(a.splice(i=a.length/2);--i;a[i-1]-=a[i])a`))

f=

a=>String.fromCharCode(...eval(`for(a.splice(i=a.length/2);--i;a[i-1]-=a[i])a`))

console.log(
    f([173, 209, 216, 219, 198, 198, 225, 222, 208, 100, 7272, 10908, 11664, 11988, 9657, 9657, 12654, 12312, 10800, 0]),
    f([131, 133, 164, 195, 197, 99, 4290, 4422, 6499, 9506, 9702, 0])
)

Clean, 96 81 78 77 bytes
zero is the null character.
I could save another byte if Clean wasn't so picky about literal nulls in the source file.
import StdEnv
f=init o foldr(\a t=[toChar a-t!!0:t])[zero]o takeWhile((>)245)

Try it online!

Anonymous functions are in general acceptable, so if you want you can drop the f=.

@Laikoni I'm not sure about the validity of that in this case, because it needs parenthesies to be used inline, and f= is the shortest assignment, so a minimal invocation adds two anyway.

Perl 5, 39 + 2 (-ap) = 41 bytes
$#F/=2;$\=chr($p=-$p+pop@F).$\while@F}{

Try it online!

C (gcc), 90 89 bytes

Saved a byte thanks to ceilingcat; s+=(i%2?-1:1)*... <~> s-=~(i%2*-2).

D(C,l,j,s,i)int*C;{for(j=~0;++j<l/2;putchar(s))for(s=i=0;i+j<l/2;)s-=~(i%2*-2)*C[i+++j];}

Try it online!

VB Script - 74 71 bytes
( I managed to reduce from 74 to 71 by using While..Wend instead of Do..Loop)
The input is in an array a(), the output is in string d
d="":p=0:n=(UBound(a)+1)/2:While n>0:n=n-1:t=a(n)-p:d=Chr(t)&d:p=t:Wend

Explanation
d=""          '// initialize the output string
p=0          '// initialize the ansii of following char (working back from last char)
n=(Ubound(a)+1)/2 '// the index of the last summed pair + 1 (base 0)
While n>0    '// begin loop working back from last summed pair
n=n-1        '// move back 1 char
t=a(n)-p     '// calculate the ansii by subtracting the ansii of following char
d=Chr(t)&d   '// prepend the char to output
p=t          '// this char becomes the following char for next
Wend         '// repeat etc.

I tested this in a vbscript file with the above code wrapped as a function:
dim s
Dim arr()
s = Split("173, 209, 216, 219, 198, 198, 225, 222, 208, 100, 7272, 10908, 11664, 11988, 9657, 9657, 12654, 12312, 10800, 0", ",")
ReDim arr(UBound(s))
Dim x
For x = 0 To UBound(s)
    arr(x) = cint(s(x))
Next

msgbox "=" & d(arr)

Private Function d(a())
d="":p=0:n=(UBound(a)+1)/2:While n>0:n=n-1:t=a(n)-p:d=Chr(t)&d:p=t:Wend
End Function

Perl 6,  43 39  35 bytes
{[~] [R,](produce *R-*,[R,] .[^*/2])».chr}

Test it
{[~] [R,]([\[&(*R-*)]] [R,] .[^*/2])».chr}

Test it (does the same as above)
{[~] [R,]([\R[&(*R-*)]] .[^*/2])».chr}

Test it
{[R~] [\R[&(*R-*)]](.[^*/2])».chr}

Test it
Explanation:
{[R~] [\R[&(*R-*)]](.[^*/2])».chr}

{                                }      # block lambda with parameter `$_`

      [\R[&(*R-*)]](.[^*/2])            # turn sums back into ordinals (reversed)

                    .[^*/2]             # first half of `$_` (implicit method call)
            *R-*                        # lambda, reverse of *-*
         [&(    )]                      # use it as an infix operator
                                        # (same as R- except left associative)
        R                               # reverse arguments and associativity
                                        # (same as - except right associative)
      [\          ](       )            # produce values `[\+] 1,2,3` => `(1,3,6)`
                                        # uses associativity to determine direction
                                        # `[\**] 1,2,3` => `(3,8,1)`

                            ».chr       # call `.chr` method on all values
                                        # (possibly concurrently)

 [R~]                                   # concatenate in reverse
                                        # (shorter than `join '', reverse …`)

Standard ML (MLton), 85 84 82 bytes
fun!(x::r)=if x>244then[]else(fn z::s=>x-z::z::s|_=>[x])(!r);implode o map chr o!;

Try it online!
Ungolfed:
fun g (x::r) =
   if   x > 244
   then []
   else case g r of
          z::s => x-z :: z :: s
        |  []  => [x]

val f = implode o map chr o g

Try it online!

05AB1E, 9 bytes
2ä¬Å«-}çJ

Try it online!
Explanation
2ä        # Split input list in two (equal if possible) parts.
  ¬       # Push head(a).
   Å«-}   # Cumulative reduce the list by subtraction (from the right).
       ç  # Convert each integer in the list to its corresponding ASCII char.
        J # Join list together to string.

You don't need the Join.

@Shaggy ç does not implicitly turn the list of characters into a string though. If I understand the problem correctly, the program needs to output a string and not a list of characters.

Japt, 12 bytes
There has to be a shorter way to get the first half of the array ...
¯UÊz)Ôån Ômd

Try it

Python 2, 70 bytes
l,j,s=input(),0,'';n=len(l)/2
while n:n-=1;j=l[n]-j;s=chr(j)+s
print s

Try it online!


text:
Recursive Collatz Conjecture
The Collatz conjecture postulates that if you take any positive integer, then repeat the following algorithm enough times:
if number is odd, then multiply by three and add one
if number is even, then divide by two

you'll eventually end up at 1. It seems to always work, but it's never been proven that it always does.
You've already golfed calculating how long it takes to get to 1, so I thought I'd switch things up a bit.
Starting with a given positive integer, calculate how long it takes to get to 1 (its "stopping time"). Then find that number's stopping time.
Repeat until you get to 1, or until you get to the entirely arbitrary limit of 100 iterations. In the former case, print how many iterations it took. In the latter case, print "Fail" or some other consistent output of your choice, as long as it's not an integer 1≤n≤100. You may not output an empty string for this option. Outputting an integer outside of the range [1, 100], however, is allowed.
Examples:
Input: 2
2->1
Output: 1

Input: 5
5->5->5->5->5->...
Output: Fail

Input: 10
10->6->8->3->7->16->4->2->1
Output: 8

Input: 100
100->25->23->15->17->12->9->19->20->7->16->4->2->1
Output: 13

Input: 10^100
10^100->684->126->108->113->12->9->19->20->7->16->4->2->1
Output: 13

Input: 12345678901234567890
12345678901234567890->286->104->12->9->19->20->7->16->4->2->1
Output: 11

Input: 1
--Depending on your code, one of two things may happen. Both are valid for the purposes of this question.
1
Output: 0
--Or:
1->3->7->16->4->2->1
Output: 6

As I calculated 10^100 and 12345678901234567890 using a language that only supports reals for that size, if your language is more accurate you may get different results for those.
Scoring
As this is code-golf, the answer with the shortest amount of bytes wins.

Let us continue this discussion in chat.

Jelly, 24 bytes
×3‘$HḂ?’Ð¿L’
Ç1¹?ȷ2Ð¡i1’

Try it online!

23 bytes (using ³ instead of ȷ2 is allowed).

Python 2, 70 bytes
f=lambda n,k=0,j=0:n-1and-~f(k*[n/2,n*3+1][n%2]or f(j/99or n,1),k,j+1)

Returns 199 for one hundred or more iterations.
Try it online!

Attache, 40 bytes
`-&3@`#@PeriodicSteps[CollatzSize@Max&1]

Try it online!
This is a new language that I made. I wanted to get around to making a proper infix language, and this is the result: a mathematica knock-off. Hooray?
Explanation
This is a composition of a few functions. These functions are:

PeriodicSteps[CollatzSize@Max&1] This yields a function which  applies its argument until the results contain a duplicate element. This function, CollatzSize@Max&1, is applying CollatzSize to the greater of the input and 1, to avoid the invalid input 0 to CollatSize.
`# is a quoted operator; when applied monadically in this sense, it obtains the size of its argument
`-&3 is a bonded function, which bonds the argument 3 to the function `-, which reads as "minus 3". This is because the PeriodicSteps application yields 0s, which need to be accounted for. (It also neatly handles out-of-bounds numbers like 5, which map to -1.)

Is using your own language really allowed? Cant you just create a langage for each codegolf with only uses some bytes?

@Tweakimp Of course creating (and using) your own language is allowed. But modifying it so that a task is a single command (after the challenge is posted) is a standard loophole.

@Tweakimp if it makes you feel any better, I had designed this function before I saw this challenge. I am a language designer, so that's what I do.

It was more a general question wether selfmade languages are allowed, not a negative statement that you used your own.

C (gcc), 75 bytes
i,j;f(n){for(j=0;(i=n)&&j++<100;)for(n=0;i-1;++n)i=i&1?i*3+1:i/2;i=!i*j-1;}

Returns -1 for n>=100 iterations.
Try it online!
C (gcc), 73 bytes
i,j;f(n){for(j=-1;(i=n)&&j++<99;)for(n=0;i-1;++n)i=i&1?i*3+1:i/2;i=!i*j;}

Returns 0 for n>=100 iterations.
Try it online!

J, 49 45 bytes
-4 bytes thanks to shorter Collatz Sequence code taken from @randomra's comment here.
(2-~[:#(>&1*-:+2&|*+:+>:@-:)^:a:)^:(<101)i.1:

Outputs 101 for invalid results.
Try it online!
Explanation
Unsurprisingly, this explanation has become quickly outdated. I'm going to leave it in terms of the old 49 byte answer I had, which I'm including below. If you want an update, just let me know. The way that it finds the length of the recursive sequence remains the same, I've just used a shorter Collatz Sequence method.
(1-~[:#%&2`(1+3&*)@.(2&|)^:(1&<)^:a:)^:(<101)i.1:

Finding the length of the Collatz Sequence
This section of the code is the following
(1-~[:#%&2`(1+3&*)@.(2&|)^:(1&<)^:a:)

Here's the explanation:
(1 -~ [: # %&2`(1+3&*)@.(2&|) ^: (1&<) ^: a:)  Given an input n
                                       ^: a:   Apply until convergence, collecting
                                                each result in an array.
                              ^: (1&<)         If n > 1 do the following, else
                                                return n.
                        (2&|)                  Take n mod 2.
           %&2                                 If n mod 2 == 0, divide by 2.
               (1+3&*)                         If n mod 2 == 1, multiply by 3
                                                and add 1.
         #                                     Get the length of the resulting
                                                array.
 1 -~                                          Subtract 1.

Unfortunately, the apply verb (^:) when told to store results stores the initial value too, so it means we're (like always) off by one. Hence why we subtract 1.
Finding the length of the recursive sequence
(1-~[:#%&2`(1+3&*)@.(2&|)^:(1&<)^:a:) ^: (< 101) i. 1:  Given an input n.
                                      ^: (< 101)        Apply 100 times,
                                                         collecting results
                                                         in an array.
(1-~[:#%&2`(1+3&*)@.(2&|)^:(1&<)^:a:)                   Collatz sequence length.
                                                 i. 1:  Index of first 1 (returns
                                                         101, the length of the
                                                         array if 1 not found).

If you don't mind using the header section, this will perhaps more accurately showcase your answer

@ConorO'Brien I don't at all -- I didn't really know how to get it formatted as such (but I'll be stealing yours from now on). Thanks

Anytime!

38 bytes with *i.~(<101)1&(#@}.a:2&(<*|{%~,*+1+])])] should be equivalent

JavaScript (ES6), 57 bytes
Returns true when it fails. Returns 0 for 1.
f=(n,k=i=0)=>n>1?f(n&1?n*3+1:n/2,k+1):k?i>99||f(k,!++i):i

Test cases

f=(n,k=i=0)=>n>1?f(n&1?n*3+1:n/2,k+1):k?i>99||f(k,!++i):i

console.log(f(2))    // 1
console.log(f(5))    // fail
console.log(f(10))   // 8
console.log(f(100))  // 13
console.log(f(1))    // 0

I am sceptical if your program happens to calculate the correct result apart from overflow / inaccuracy or if rather the OP derived their results using a language with similar number implementations (I assume they did not calculate all test cases by hand).

@JonathanFrech Indeed. It turns out both results were equally invalid.

APL (Dyalog Unicode), 39 60 53 52 49 bytes
-3 bytes thanks to @ngn
0∘{99<⍺:⋄1=⍵:0⋄1+(⍺+1)∇{1=⍵:0⋄1+∇⊃⍵⌽0 1+.5 3×⍵}⍵}

Try it online!
Uses @ngn code for Collatz, but previously used @Uriel's code.
Here's the old version that didn't meet the specification:
{1=⍵:0⋄1+∇{1=⍵:0⋄2|⍵:1+∇1+3×⍵⋄1+∇⍵÷2}⍵}

2|⍵:1+∇1+3×⍵⋄1+∇⍵÷2 -> 1+∇⊃⍵⌽0 1+.5 3×⍵

Husk, 21 bytes
←€1↑101¡ȯ←€1¡?½o→*3¦2

Try it online!
Returns -1 on failure, 0 on input 1.
Explanation
←€1↑101¡ȯ←€1¡?½o→*3¦2  Implicit input (a number).
             ?½o→*3¦2  Collatz function:
             ?     ¦2   if divisible by 2,
              ½         then halve,
               o→*3     else multiply by 3 and increment.
        ȯ←€1¡?½o→*3¦2  Count Collatz steps:
            ¡           iterate Collatz function and collect results in infinite list,
          €1            get 1-based index of 1,
        ȯ←              decrement.
       ¡               Iterate this function on input,
   ↑101                take first 101 values (initial value and 100 iterations),
←€1                    get index of 1 and decrement.

C (gcc), 70 73 bytes
g(x){x=x-1?g(x%2?3*x+1:x/2)+1:0;}f(x,m){for(m=0;(x=g(x))&&100>m++;);x=m;}

Try it online!
Returns 101 when number of iterations exceeds 100.

Welcome to PPCG! This answer isn't quite valid, because all function submissions need to be reusable. I think you can fix this by inserting m=0 into your f (probably even making use of the currently empty for intiailiser to save one a ;).

Clean, 146 ... 86 bytes
-11 bytes thanks to Ørjan Johansen
import StdEnv
?f l n=hd[u\\1<-iterate f n&u<-l]

?(?(\b|isOdd b=3*b+1=b/2)[0..])[0..99]

As a partial function literal.
Try it online!
Aborts with hd of [] if the number of iterations exceeds 100.
Exits with Heap Full for inputs above ~2^23 unless you specify a larger heap size.

I'm starting to understand some Clean syntax (as it differs from Haskell) from your answers... you can shorten that with a helper function j f l n=hd[u\\1<-iterate f n&u<-l].

@ØrjanJohansen Thanks!

You don't need the \a=...a part, it curries. (Or eta reduces.)

@ØrjanJohansen oh, missed that, thanks!

Perl 6, 56 bytes
{($_,{($_,{$_%2??$_*3+1!!$_/2}...1)-1}...1).head(102)-1}

Try it online!
Returns 101 for a non-terminating sequence.

BiwaScheme, 151 chars
(define(f n i s)(if(= s 0) 'F(if(= n 0)i(f(letrec((c(lambda(m k)(if(= m 1)k(c(if(=(mod m 2)0)(/ m 2)(+(* m 3)1))(+ k 1))))))(c n 0))(+ i 1)(- s 1)))))

You can try it here.

(Emacs, Common, ...) Lisp, 105 bytes
Returns t for iterations > 100
(defun f(n k c)(or(> c 100)(if(= n 1)(if(= k 0)c(f k 0(1+ c)))(f(if(oddp
n)(+ n n n 1)(/ n 2))(1+ k)c))))

Expanded:
(defun f (n k c)
  (or (> c 100)
      (if (= n 1)
          (if (= k 0) c
            (f k 0 (1+ c)))
        (f (if (oddp n) (+ n n n 1) (/ n 2))
           (1+ k) c))))
(f (read) 0 0)

APL NARS, 115 bytes, 63 chars
{d←0⋄{⍵=1:d⋄99<d+←1:¯1⋄∇{c←0⋄{1=⍵:c⋄c+←1⋄2∣⍵:∇1+3×⍵⋄∇⍵÷2}⍵}⍵}⍵}

Probably using loops it would be more clear...
There are 4 functions, 2 nested and ricorsive, and the first only for define and initialize to =0, the variable d, seen from the 2th function as a global variable counter.
q←{c←0⋄{1=⍵:c⋄c+←1⋄2∣⍵:∇1+3×⍵⋄∇⍵÷2}⍵}

This 3th function, would be the function that return how many call there are for resolve the Collatz conjecture for its arg
{⍵=1:d⋄99<d+←1:¯1⋄∇q⍵}

This is the 2th function, if has its arg =1,stop its recursion and return d the number of time it is called itself-1; else if itself is called more than 99times stop its recursion and return -1(fail) else calculate Collatz conjecture for its arg, and call itself for the Collatz sequence length value. For me even if all this seems run could be a big problem if is defined a global variable and one variable in a function of the same name, when the programmer sees it as just a local variable.
  f←{d←0⋄{⍵=1:d⋄99<d+←1:¯1⋄∇{c←0⋄{1=⍵:c⋄c+←1⋄2∣⍵:∇1+3×⍵⋄∇⍵÷2}⍵}⍵}⍵}
  f 2
1
  f 3
5
  f 5
¯1
  f 10
8
  f 100
13
  f 12313
7
  f 1
0

R, 119 107 bytes
Partially uses Jarko Dubbeldam's collatz code from here. Returns 0 for >100 iterations (failure).
pryr::f(x,{N=n=0
while(x-1){while(x-1){x=`if`(x%%2,3*x+1,x/2);n=n+1}
x=n
n=0
N=N+1
if(N==100)return(0)}
N})

Try it online!

Python 2, 99 98 97 bytes

Saved a byte by using c and t or f instead of t if c else f.
Saved a byte by outputting -1 instead of f or 'f' for non-halting inputs.

exec"f,F="+"lambda n,i=0:n<2and i or %s"*2%("f([n/2,3*n+1][n%2],-~i),","i>99and-1or F(f(n),-~i)")

Try it online!