43. Next Day

The coach road from Dorpat to Reval was two days in good weather. Mihkel spent the first of them watching the birch forests thin and the flatlands widen, carrying nothing unusual except a notebook and the particular silence of a person who has left something behind that cannot be explained to family.

His mother had set out cold cuts and dark bread before he had finished removing his coat. His father shook his hand, looked him over, and said he seemed thinner.

That evening, after supper, his father spread a ledger across the table. He was a careful man with cloth and timber, and his records were kept in the way of careful men— methodical at the centre, uncertain at the edges.

„Here," he said, pressing a broad finger to a column of dates. „The clerk in the harbour office writes the arrival as the last day of October. But the contract was signed for delivery on the first of November. I need to know which shipments were early and which were late. I have twelve such entries. Each one may cost me something, or save me something, depending on which side of midnight it falls."

Mihkel looked at the dates. They ran across the year— ends of months, a turn at December, one awkward line in February. His father wanted only the day that followed each. A simple question.

And yet Mihkel sat with it for a moment longer than his father expected.

„I'll work through them tonight," he said.

His father nodded and closed the ledger. He did not ask about the method. He asked about the university— whether the professors were Germans, whether the food was adequate, whether Mihkel had found sensible friends.

Mihkel answered all three questions honestly, which was easier than it might have been.

That night, in the room he had grown up in— its ceiling lower than he remembered, its smell of pine resin and old wool unchanged— he opened his notebook and began to work.

The Logic Mill was in Dorpat, under its canvas. There was no tape here. No mechanism. Only the notebook, a candle, and the method itself.

He wrote it out slowly. Day, then month, then year— three nested carries, each governed by its own exception. The day resets when it exceeds the month's length. The month resets when it exceeds twelve. The year advances when the month resets in December. And the months themselves were irregular, thirty or thirty-one or twenty-eight, the calendar's old asymmetry that no one had ever fully explained to his satisfaction.

He wrote the rules. Then he applied them, one entry at a time.

It took longer than he wished. Not because the task was difficult— it was not— but because he kept pausing to notice that what he was doing by hand, step by deliberate step, was exactly what the Mill would do by rule.

The thought settled over him quietly, the way cold air settles into a room when the fire is left too low.

Had he been thinking for the past two years— or had the Mill been thinking, and he had merely been feeding it?

He worked through the doubt as he worked through the dates: rule by rule, step by step.

The method had been his before the Mill existed. He had built the machine because he already understood the procedure. A carpenter who commissions a plane does not forget how to work the wood.

By the time the candle had burned to its last quarter, he had twelve answers. He copied them neatly onto a separate slip.

On the input tape, you'll get a calendar date in the YYYY-MM-DD format (year, month, and day, each zero-padded). Your task is to write the following day's date to the output tape.

You'll never be given February 28th or 29th of a leap year, so whenever you see February 28th the next day is always March 1st, so you never need to determine whether a year is a leap year.

The input date is in the range 1000-01-01 to 9999-12-30 (inclusive).

Examples:
1000-12-311001-01-01
2023-02-282023-03-01
9999-12-309999-12-31

Sign in to submit your solution.

Quest leaderboard
Discuss it on Reddit or Discord
This was the last quest for now.
Get updates about new quests by subscribing to the social media channels or RSS