Problem: A stack of $2000$ cards is labelled with the integers from $1$ to $2000,$ with different integers on different cards. The cards in the stack are not in numerical order. The top card is removed from the stack and placed on the table, and the next card is moved to the bottom of the stack. The new top card is removed from the stack and placed on the table, to the right of the card already there, and the next card in the stack is moved to the bottom of the stack. The process - placing the top card to the right of the cards already on the table and moving the next card in the stack to the bottom of the stack - is repeated until all cards are on the table. It is found that, reading from left to right, the labels on the cards are now in ascending order: $1,2,3,\ldots,1999,2000.$ In the original stack of cards, how many cards were above the card labeled $1999$

Solution: Let us treat each run through the deck as a separate "round". For example, in round one, you would go through all of the $2000$ cards initially in the deck once, in round two, you would go through all $1000$ cards initially in the deck once, so on and so forth. For each round, let us record what the initial and final actions are ( $r$ for moving the card to the right, $b$ for moving the card to the bottom), the number of cards moved to the right, the number of cards left, and what the position of the cards moved to the right were in the original $2000$ card deck (as $n = a + ck$ where $n$ is the position, $c$ is the spacing of the cards moved, $a$ is an integer such that the correct first card is moved, and $k$ is an integer greater than or equal to $1$ which represents which card out of all the cards moved to the right you are finding the position of). Then,
Round 1: $r$ to $b$ $1000$ to right, $1000$ left in deck, $n = -1 + 2k$
Round 2: $r$ to $b$ $500$ to right, $500$ left in deck, $n = -2 + 4k$
Round 3: $r$ to $b$ $250$ to right, $250$ left in deck, $n = -4 + 8k$
Round 4: $r$ to $b$ $125$ to right, $125$ left in deck, $n = -8 + 16k$
Let us treat the remaining deck of $125$ cards as a totally independent deck, note that the positions of card in this deck are $n = 16k$ . Also note that the first action of a new round is never the same action as the last action of the previous round because actions alternate. Also note that for every new round, the spacing between cards moved doubles, and that the cards remaining in the beginning of a new round have position $n = a + c/2 + ck$ for the values $a, c$ of the previous round. Also note that if there are an odd number of cards in an initial deck, the first and last actions are the same. Then,
Round 5: $r$ to $r$ $63$ to right, $62$ left in deck, $n = -1 + 2k$
Round 6: $b$ to $r$ $31$ to right, $31$ left in deck, $n = 4k$ , because $n = 2k$ positioned cards are left at the beginning of this round and the first card is sent to the bottom, only every second card is sent to the right, and because spacing doubles every round,
Round 7: $b$ to $b$ $15$ to right, $16$ left in deck, $n = -2 + 8k$ , because $n = 2 + 4k$ positioned cards are left at the beginning and only every second card is sent to the right, and because spacing doubles every round,
Round 8: $r$ to $b$ $8$ to right, $8$ left in deck, $n = -14 + 16k$ , by similar reasoning, since the cards $n = 2 + 8k$ are left and spacing doubles every round, from here on things get real easy,
Round 9: $r$ to $b$ $4$ to right, $4$ left in deck, $n = -22 + 32k$
Round 10: $r$ to $b$ $2$ to right, $2$ left in deck, $n = -38 + 64k$
Round 11: $r$ to $b$ $1$ to right, $1$ left in deck, $n = 58$ , since $58 = -38 + 64/2 + 64$
This card must be labeled 1999 since it is second to last. Then, since it is the $58th$ in the deck of $125$ , it must be the $58 * 8 = 928th$ card in the original deck, and because we've been numbering from the top of the deck to the bottom (also because AIME answers are 000-999), there were $928 - 1 = \boxed{927}$ cards above it in the deck - Romulus and minimaxweii

Answer:  927