A Pile of Documents

A series of documents, identified by a 5-digit code, are delivered one at at time to an office and placed on top of a single pile of documents there. The dropoff event is recorded in a log with the code "D" as well as the time the document was left there.

From this same stack of documents, couriers come in from time to pick up a single document from the top of the pile and take it away for delivery. These events are recorded in a separate log with the code "P," along with the time the document was picked up. (There is no 5-digit code entered in the log for the pickup--it's just whatever document is sitting on top of the pile at that point.) If there are no documents in the pile at that point, the pickup effort is recorded anyway.

Consider the following log entries. There were four events where a single document was dropped off, and three attempts to pick up a single document.

Dropoff Log

D 09:33:17 32-343
D 09:38:18 21-345
D 09:39:02 34-355
D 10:45:44 23-807

Pickup Log

P 09:34:38
P 09:35:59
P 09:40:00

The first document was dropped off at 9:33:17. It was then picked up at 9:34:38. Another attempt to pickup was made at 9:35:59, but there were no documents to be picked up. At 9:38:18 a document was dropped off, and another at 9:39:02, so that there are two documents in the pile. At 9:40:00 a document was picked up, and at 10:45:44 another document was dropped off, leaving two documents in the pile at that point. The top document is 23-807.

Given this dropoff log and this pickup log, how many documents are left on the pile at the end of the day? What is the 5-digit code of the document on top of the pile?