The safe has a dial with only an arrow on it; around the dial are the numbers 0 through 99 in order. As you turn the dial, it makes a small click noise as it reaches each number.
The attached document (your puzzle input) contains a sequence of rotations, one per line, which tell you how to open the safe. A rotation starts with an L or R which indicates whether the rotation should be to the left (toward lower numbers) or to the right (toward higher numbers). Then, the rotation has a distance value which indicates how many clicks the dial should be rotated in that direction.
So, if the dial were pointing at 11, a rotation of R8 would cause the dial to point at 19. After that, a rotation of L19 would cause it to point at 0.
Because the dial is a circle, turning the dial left from 0 one click makes it point at 99. Similarly, turning the dial right from 99 one click makes it point at 0.
So, if the dial were pointing at 5, a rotation of L10 would cause it to point at 95. After that, a rotation of R5 could cause it to point at 0.
The dial starts by pointing at 50.
You could follow the instructions, but your recent required official North Pole secret entrance security training seminar taught you that the safe is actually a decoy. The actual password is the number of times the dial is left pointing at 0 after any rotation in the sequence.
Solution
If the dial turns right, it might overflow (≥ 100). We need to handle that by doing a simple modulus.
If the dial turns left, it gets a little trickier. The dial number may go negative, in which case we need to apply a modulus and then add the negative amount to DIAL_MAX. For example, if we turn to -165, we need to mod it by 100 to get -65, and then add that to 100 to finally get 35, the true dial position.
You're sure that's the right password, but the door won't open. You knock, but nobody answers. You build a snowman while you think.
As you're rolling the snowballs for your snowman, you find another security document that must have fallen into the snow:
"Due to newer security protocols, please use password method 0x434C49434B until further notice."
You remember from the training seminar that "method 0x434C49434B" means you're actually supposed to count the number of times any click causes the dial to point at 0, regardless of whether it happens during a rotation or at the end of one.
Solution
There are a lot of edge cases here. I originally thought to just use division to calculate the amount of full turns that are made. However, consider the case where the dial is at 50, and the command L51 is issued. This will turn the dial to -1 (99). If we simply divide the dial amount by the DIAL_MAX, it will return zero in this case, even though 0 was crossed during this command.