Added Solution for 2020 day 16

This commit is contained in:
Burnus 2023-04-11 21:32:32 +02:00
parent 5728d1c5d3
commit e71b1b62fb
5 changed files with 480 additions and 0 deletions

View file

@ -0,0 +1,8 @@
[package]
name = "day16_ticket_translation"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View file

@ -0,0 +1,83 @@
As you're walking to yet another connecting flight, you realize that one of the legs of your re-routed trip coming up is on a high-speed train. However, the train ticket you were given is in a language you don't understand. You should probably figure out what it says before you get to the train station after the next flight.
Unfortunately, you can't actually *read* the words on the ticket. You can, however, read the numbers, and so you figure out *the fields these tickets must have* and *the valid ranges* for values in those fields.
You collect the *rules for ticket fields*, the *numbers on your ticket*, and the *numbers on other nearby tickets* for the same train service (via the airport security cameras) together into a single document you can reference (your puzzle input).
The *rules for ticket fields* specify a list of fields that exist *somewhere* on the ticket and the *valid ranges of values* for each field. For example, a rule like `class: 1-3 or 5-7` means that one of the fields in every ticket is named `class` and can be any value in the ranges `1-3` or `5-7` (inclusive, such that `3` and `5` are both valid in this field, but `4` is not).
Each ticket is represented by a single line of comma-separated values. The values are the numbers on the ticket in the order they appear; every ticket has the same format. For example, consider this ticket:
```
.--------------------------------------------------------.
| ????: 101 ?????: 102 ??????????: 103 ???: 104 |
| |
| ??: 301 ??: 302 ???????: 303 ??????? |
| ??: 401 ??: 402 ???? ????: 403 ????????? |
'--------------------------------------------------------'
```
Here, `?` represents text in a language you don't understand. This ticket might be represented as `101,102,103,104,301,302,303,401,402,403`; of course, the actual train tickets you're looking at are *much* more complicated. In any case, you've extracted just the numbers in such a way that the first number is always the same specific field, the second number is always a different specific field, and so on - you just don't know what each position actually means!
Start by determining which tickets are *completely invalid*; these are tickets that contain values which *aren't valid for any field*. Ignore *your ticket* for now.
For example, suppose you have the following notes:
```
class: 1-3 or 5-7
row: 6-11 or 33-44
seat: 13-40 or 45-50
your ticket:
7,1,14
nearby tickets:
7,3,47
40,4,50
55,2,20
38,6,12
```
It doesn't matter which position corresponds to which field; you can identify invalid *nearby tickets* by considering only whether tickets contain *values that are not valid for any field*. In this example, the values on the first *nearby ticket* are all valid for at least one field. This is not true of the other three *nearby tickets*: the values `4`, `55`, and `12` are are not valid for any field. Adding together all of the invalid values produces your *ticket scanning error rate*: `4 + 55 + 12` = *`71`*.
Consider the validity of the *nearby tickets* you scanned. *What is your ticket scanning error rate?*
Your puzzle answer was `23954`.
\--- Part Two ---
----------
Now that you've identified which tickets contain invalid values, *discard those tickets entirely*. Use the remaining valid tickets to determine which field is which.
Using the valid ranges for each field, determine what order the fields appear on the tickets. The order is consistent between all tickets: if `seat` is the third field, it is the third field on every ticket, including *your ticket*.
For example, suppose you have the following notes:
```
class: 0-1 or 4-19
row: 0-5 or 8-19
seat: 0-13 or 16-19
your ticket:
11,12,13
nearby tickets:
3,9,18
15,1,5
5,14,9
```
Based on the *nearby tickets* in the above example, the first position must be `row`, the second position must be `class`, and the third position must be `seat`; you can conclude that in *your ticket*, `class` is `12`, `row` is `11`, and `seat` is `13`.
Once you work out which field is which, look for the six fields on *your ticket* that start with the word `departure`. *What do you get if you multiply those six values together?*
Your puzzle answer was `453459307723`.
Both parts of this puzzle are complete! They provide two gold stars: \*\*
At this point, you should [return to your Advent calendar](/2020) and try another puzzle.
If you still want to see it, you can [get your puzzle input](16/input).

View file

@ -0,0 +1,108 @@
use core::fmt::Display;
use std::num::ParseIntError;
#[derive(Debug, PartialEq, Eq)]
pub enum ParseError {
ParseIntError(std::num::ParseIntError),
LineMalformed(String),
}
impl From<ParseIntError> for ParseError {
fn from(value: ParseIntError) -> Self {
Self::ParseIntError(value)
}
}
impl Display for ParseError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::ParseIntError(e) => write!(f, "Unable to parse into integer: {e}"),
Self::LineMalformed(v) => write!(f, "Line is malformed: {v}"),
}
}
}
struct Requirement {
is_departure: bool,
left_range: (usize, usize),
right_range: (usize, usize),
}
impl TryFrom<&str> for Requirement {
type Error = ParseError;
fn try_from(value: &str) -> Result<Self, Self::Error> {
let components: Vec<_> = value.split(&[' ', '-']).collect();
if !(6..=7).contains(&components.len()) {
return Err(Self::Error::LineMalformed(value.to_string()));
}
Ok(Self {
is_departure: components[0] == "departure",
left_range: (components[components.len()-5].parse()?, components[components.len()-4].parse()?),
right_range: (components[components.len()-2].parse()?, components[components.len()-1].parse()?),
})
}
}
impl Requirement {
fn is_valid(&self, value: usize) -> bool {
(self.left_range.0..=self.left_range.1).contains(&value) || (self.right_range.0..=self.right_range.1).contains(&value)
}
}
pub fn run(input: &str) -> Result<(usize, usize), ParseError> {
let parts: Vec<_> = input.split("\n\n").collect();
let mut requirements: Vec<_> = parts[0].lines().map(Requirement::try_from).collect::<Result<Vec<_>, _>>()?;
let mine: Vec<_> = parts[1].lines().nth(1).unwrap().split(',').map(|n| n.parse::<usize>()).collect::<Result<Vec<_>, _>>()?;
let nearby: Vec<_> = parts[2].lines().skip(1).map(|line| line.split(',').map(|n| n.parse::<usize>()).collect::<Result<Vec<_>, _>>()).collect::<Result<Vec<_>, _>>()?;
let first = nearby.iter().map(|ticket| ticket.iter().filter(|value| !requirements.iter().any(|r| r.is_valid(**value))).sum::<usize>()).sum();
let valid: Vec<_> = nearby.iter().filter(|ticket| ticket.iter().all(|value| requirements.iter().any(|r| r.is_valid(*value)))).collect();
let mut undecided_fields: Vec<_> = (0..requirements.len()).collect();
let mut departure_fields = Vec::new();
while requirements.iter().any(|req| req.is_departure) {
let mut possible = Vec::new();
undecided_fields.iter().for_each(|field_idx| {
possible.push((*field_idx, requirements.iter().enumerate().filter(|(_req_idx, req)| req.is_valid(mine[*field_idx]) && valid.iter().all(|ticket| req.is_valid(ticket[*field_idx]))).map(|(req_idx, _req)| req_idx).collect::<Vec<_>>()));
});
let pos_idx = if let Some(pos) = possible.iter().position(|(_field_idx, reqs)| reqs.len() == 1) {
pos
} else if let Some(req_id) = (0..requirements.len()).find(|req_idx| possible.iter().filter(|(_field_idx, reqs)| reqs.contains(&req_idx)).count() == 1) {
possible.iter().position(|(_field_id, reqs)| reqs.contains(&req_id)).unwrap()
} else {
panic!("Unable to discard any possibilities");
};
let field_idx = possible[pos_idx].0;
let req_idx = possible[pos_idx].1[0];
if requirements[req_idx].is_departure {
departure_fields.push(field_idx);
}
undecided_fields.remove(undecided_fields.binary_search(&field_idx).unwrap());
requirements.remove(req_idx);
}
let second = mine.iter().enumerate().filter(|(idx, _val)| departure_fields.contains(&&idx)).map(|(_idx, val)| val).product();
Ok((first, second))
}
#[cfg(test)]
mod tests {
use super::*;
use std::fs::read_to_string;
fn read_file(name: &str) -> String {
read_to_string(name).expect(&format!("Unable to read file: {name}")[..]).trim().to_string()
}
#[test]
fn test_sample() {
let sample_input = read_file("tests/sample_input");
assert_eq!(run(&sample_input), Ok((71, 132)));
}
#[test]
fn test_challenge() {
let challenge_input = read_file("tests/challenge_input");
assert_eq!(run(&challenge_input), Ok((23954, 453459307723)));
}
}

View file

@ -0,0 +1,267 @@
departure location: 28-787 or 804-964
departure station: 41-578 or 594-962
departure platform: 50-718 or 733-949
departure track: 27-846 or 862-949
departure date: 50-241 or 249-957
departure time: 44-81 or 104-972
arrival location: 45-292 or 299-954
arrival station: 46-650 or 657-974
arrival platform: 42-396 or 405-953
arrival track: 42-871 or 886-973
class: 31-808 or 829-964
duration: 39-909 or 935-969
price: 49-350 or 364-970
route: 44-251 or 264-959
row: 50-539 or 556-952
seat: 45-624 or 630-951
train: 28-283 or 290-960
type: 44-334 or 340-951
wagon: 43-699 or 716-961
zone: 42-668 or 688-958
your ticket:
131,67,137,61,149,107,109,79,71,127,173,157,167,139,151,163,59,53,113,73
nearby tickets:
436,66,560,233,594,569,437,864,15,350,199,146,265,166,666,490,494,689,170,869
744,207,488,829,776,123,949,327,308,219,624,600,337,197,941,502,305,659,77,63
941,201,228,759,490,232,469,631,660,305,562,339,237,185,290,123,411,536,64,772
155,204,699,517,689,940,520,700,756,329,459,690,843,901,534,662,416,212,483,868
715,465,463,519,304,133,561,309,216,367,440,239,899,78,602,566,453,535,487,482
898,250,181,392,176,977,666,160,603,754,941,524,304,501,107,640,495,649,309,899
936,143,507,778,162,652,134,520,316,523,316,393,769,405,458,195,620,832,161,611
843,500,66,657,278,414,313,676,280,483,431,841,442,868,204,632,159,427,690,445
764,303,208,865,127,832,533,758,508,518,14,173,473,227,194,424,344,835,325,606
540,487,392,468,309,632,905,425,534,274,634,866,749,174,734,642,125,600,529,366
640,57,896,574,646,170,688,597,384,312,193,273,724,315,938,440,207,63,425,201
212,468,410,429,232,867,527,875,386,185,199,871,78,487,310,465,506,786,693,241
161,863,209,420,904,771,864,227,761,220,537,623,287,366,161,507,443,251,832,693
202,446,491,835,222,377,377,603,578,787,376,441,342,891,67,628,862,160,129,717
521,208,909,490,806,492,733,750,507,472,314,353,212,473,571,81,50,612,304,157
178,708,525,140,438,772,165,560,158,365,64,382,783,321,514,186,251,568,439,658
319,697,507,238,316,55,668,629,667,80,663,368,772,214,76,439,949,133,311,452
51,190,433,337,370,830,450,344,72,178,227,899,649,889,690,178,638,769,613,598
895,460,557,769,936,386,743,418,528,845,661,791,737,863,507,129,179,532,935,737
464,269,472,426,617,169,613,179,189,113,457,564,120,287,843,347,835,274,305,741
181,528,250,907,189,498,599,309,155,840,198,741,769,132,159,336,210,223,164,537
288,434,171,643,80,577,606,513,61,329,459,631,113,594,193,618,430,909,617,409
189,178,281,329,300,612,613,566,532,434,79,887,322,935,518,427,487,5,907,904
177,311,995,775,535,695,371,162,504,948,753,370,776,182,267,407,136,765,948,342
737,420,898,875,118,764,574,374,233,52,612,186,534,462,836,272,172,193,471,160
797,227,198,237,203,182,481,320,765,600,558,439,428,78,364,382,235,69,835,454
447,385,322,132,299,429,829,484,865,529,519,845,938,340,201,65,886,471,785,288
942,448,611,434,479,280,841,537,894,427,237,656,889,665,661,662,907,525,221,768
303,437,386,276,867,559,71,114,347,185,572,578,881,196,595,366,279,465,762,225
51,114,176,557,692,466,54,779,234,435,130,535,637,654,480,614,179,468,557,70
535,717,599,490,632,371,178,458,138,499,207,574,507,115,656,741,636,434,370,845
388,573,617,440,218,564,862,532,764,377,691,499,126,728,140,438,616,668,50,431
440,519,944,6,516,524,137,76,496,272,307,611,906,782,946,127,735,482,567,376
738,149,775,769,529,748,759,536,694,447,443,126,852,105,139,312,830,345,434,79
184,689,766,273,51,547,758,607,772,531,380,149,349,318,232,184,408,387,485,323
130,694,234,184,184,493,901,343,17,637,634,646,318,110,161,219,512,696,738,510
659,939,577,158,291,136,560,291,279,642,182,489,121,183,869,705,151,750,733,274
485,470,412,644,514,866,462,381,277,267,132,488,419,625,607,196,639,771,528,782
558,844,893,653,137,234,406,535,145,429,516,388,473,748,509,314,451,420,334,806
830,203,407,482,768,319,476,886,327,378,439,173,81,601,214,743,60,57,398,494
132,171,67,240,74,908,770,621,318,52,562,201,920,190,312,942,478,120,221,461
404,233,623,475,220,498,140,187,344,184,127,232,78,841,696,195,538,138,597,225
485,308,624,840,944,641,773,517,526,388,775,184,842,290,617,788,465,475,597,772
127,76,125,462,837,616,391,348,208,648,512,510,176,180,338,761,347,488,742,642
668,235,183,186,745,836,718,624,239,224,228,757,56,801,634,217,787,343,63,762
566,62,367,789,79,664,660,500,155,309,742,236,808,600,428,936,280,190,216,313
561,694,449,280,662,609,513,566,769,185,57,429,655,300,148,903,452,64,900,536
172,159,434,142,191,212,868,604,344,367,495,392,126,167,181,676,534,169,487,863
770,61,942,159,427,334,908,233,626,470,736,302,466,516,568,611,897,320,301,657
133,234,161,388,564,866,531,458,136,438,111,778,320,634,323,113,223,505,331,548
376,648,236,322,871,516,304,405,209,121,641,868,375,385,537,572,274,510,284,773
171,984,445,427,494,596,471,862,281,942,455,949,940,350,907,53,909,342,79,282
196,742,223,221,142,389,175,392,594,135,653,130,198,199,571,108,416,698,897,893
191,321,749,886,493,753,377,560,711,221,311,218,55,158,319,233,718,226,382,301
58,72,159,69,111,371,71,461,334,124,104,663,624,312,410,247,477,834,835,119
762,65,76,595,949,1,55,600,374,210,512,428,613,832,167,643,383,737,442,453
470,611,780,888,472,373,611,270,126,433,227,188,434,497,647,529,488,908,267,653
213,610,449,423,639,215,761,891,568,416,412,350,161,381,185,436,446,896,189,789
474,51,347,840,846,376,421,330,539,559,535,980,56,188,177,576,194,307,189,105
621,838,488,325,395,286,331,742,569,840,612,193,479,393,894,615,466,237,104,509
457,197,300,683,783,322,633,328,372,892,566,439,659,521,163,909,617,561,348,634
743,132,563,559,617,447,456,80,152,829,80,278,249,246,422,329,272,426,613,642
479,736,894,484,776,518,110,221,320,429,299,834,864,468,994,840,345,770,465,760
717,272,203,833,214,208,461,185,59,838,864,702,221,182,318,345,751,431,316,735
371,178,333,374,558,337,865,842,225,405,372,63,277,563,381,446,787,518,749,114
199,534,534,142,630,151,349,597,504,461,454,254,197,451,213,153,746,114,186,575
639,431,938,241,904,760,834,479,464,151,67,693,716,101,170,509,438,570,104,601
470,429,303,184,139,136,888,789,267,182,562,311,660,898,119,573,115,501,272,694
939,832,492,943,61,615,526,423,560,769,718,998,160,76,504,141,136,771,445,739
290,905,292,509,568,513,506,467,498,120,395,59,640,373,192,787,939,195,116,673
638,862,697,235,374,567,405,643,906,421,447,111,427,335,777,605,406,903,866,409
489,553,504,863,524,462,657,807,214,193,562,445,133,333,511,435,215,619,744,193
475,612,240,458,845,694,522,438,793,735,173,618,521,200,441,610,396,238,282,278
186,465,633,128,196,236,507,129,767,497,302,110,300,62,647,872,752,566,516,117
199,136,485,167,250,769,937,4,181,694,777,174,421,595,70,869,601,143,392,647
842,733,227,437,491,344,443,750,552,556,662,693,236,417,78,374,224,424,134,379
868,430,202,553,429,515,935,465,174,391,167,134,158,138,190,905,771,499,394,562
326,785,182,782,74,752,81,147,641,51,199,403,393,182,448,381,434,942,759,455
869,846,430,197,452,747,899,668,86,268,268,333,276,563,773,497,742,394,209,410
190,699,744,384,110,417,435,231,278,432,500,80,736,939,767,993,608,668,776,697
125,152,612,215,666,138,831,468,754,132,64,691,105,661,884,938,461,104,845,640
559,366,418,422,17,219,319,638,277,139,368,888,635,600,439,494,537,389,179,180
949,435,908,442,53,104,314,693,270,210,413,614,516,202,166,436,565,595,936,398
349,485,119,840,190,158,240,327,171,345,291,75,169,837,421,305,781,757,631,99
898,302,373,845,559,198,412,530,68,453,662,941,54,574,540,71,570,350,299,165
502,220,147,471,568,624,935,454,806,453,776,639,410,706,222,495,659,196,636,59
425,469,18,131,331,535,346,500,438,783,268,71,786,57,115,573,622,764,452,159
618,395,658,219,595,426,471,220,388,208,73,77,609,662,427,618,698,457,463,993
528,451,215,232,390,56,201,718,485,668,432,477,536,331,155,137,649,540,276,739
613,637,717,422,763,76,514,641,676,718,210,234,112,637,699,68,154,464,218,449
768,557,945,695,265,900,197,864,318,139,179,906,751,869,757,224,312,629,478,218
481,756,840,345,651,566,316,279,140,694,137,561,748,446,277,311,117,743,418,557
292,246,502,212,268,564,196,368,151,785,122,166,172,645,459,183,316,185,224,537
370,314,299,556,452,805,179,369,909,513,577,694,502,178,10,210,512,634,758,435
482,401,109,396,249,156,304,197,350,373,61,405,939,829,645,749,556,745,831,59
522,781,837,108,753,785,435,234,575,224,525,456,506,558,829,725,829,218,317,763
430,568,830,979,199,331,317,515,426,130,65,120,838,948,647,560,154,371,768,752
407,165,181,413,613,395,841,227,310,428,383,633,193,664,698,776,339,409,233,782
481,275,630,776,343,766,688,630,228,892,631,626,446,896,594,63,431,935,782,750
340,493,746,371,426,752,489,537,529,634,112,884,755,420,783,346,163,148,631,68
417,379,504,138,733,163,147,869,112,613,274,270,301,374,833,142,541,890,784,518
787,472,566,504,568,890,595,657,388,434,292,103,272,428,74,408,201,310,155,190
350,280,418,410,482,466,473,62,304,317,743,316,122,684,749,898,520,774,573,642
235,787,495,275,140,422,768,944,463,249,129,307,108,779,436,524,157,643,507,14
230,646,390,649,867,829,609,100,133,186,690,831,415,381,376,645,393,615,716,634
68,112,62,754,833,778,239,663,267,110,806,914,762,868,168,200,602,350,663,198
625,347,513,513,842,507,330,160,489,532,226,193,130,423,444,567,307,222,63,111
836,140,661,871,169,664,312,745,742,646,998,322,450,214,939,503,161,274,636,224
344,603,649,492,478,772,377,281,250,411,497,719,517,758,643,183,600,464,315,559
119,442,4,105,179,365,425,145,61,535,637,640,434,304,194,562,175,233,539,211
477,337,374,215,778,68,830,141,272,196,483,347,460,118,165,326,693,443,164,867
886,501,607,617,202,222,436,992,577,319,501,745,805,949,232,309,887,533,445,498
471,783,436,899,561,396,431,379,906,407,942,208,611,840,449,304,286,519,163,274
113,494,448,508,889,576,159,271,51,831,597,844,535,736,900,478,328,457,552,107
603,905,104,906,898,871,435,318,327,158,381,536,458,854,178,347,455,606,106,897
223,517,205,658,643,661,522,273,892,250,736,849,532,65,186,689,733,376,521,763
232,166,699,128,378,626,478,534,937,81,617,81,529,333,441,502,903,170,756,603
386,301,123,435,461,830,694,455,519,606,480,245,425,691,214,751,895,415,65,196
203,418,776,525,935,833,171,394,194,180,745,140,981,608,614,775,833,630,193,457
415,944,138,399,563,229,486,268,121,839,697,228,771,739,717,76,250,143,650,164
454,808,116,72,214,458,292,485,634,746,326,754,238,69,72,647,348,487,166,996
153,158,634,314,776,535,326,384,248,510,178,234,274,415,517,104,650,558,454,435
864,805,184,109,895,76,210,114,904,597,751,277,504,649,612,618,164,178,12,749
737,203,403,751,616,868,135,70,202,330,346,59,383,275,442,842,716,381,742,692
652,846,312,130,456,406,207,182,444,650,62,182,304,212,485,69,782,187,132,892
133,783,325,578,893,393,527,620,890,648,560,286,945,845,497,376,269,152,779,179
507,698,459,661,251,835,976,603,165,233,222,365,643,665,531,649,744,519,126,326
508,781,456,657,648,223,291,104,327,556,845,585,690,785,110,536,112,868,574,516
539,612,197,394,188,936,642,440,664,349,231,414,249,445,304,548,457,443,944,145
273,433,434,831,525,213,208,390,213,903,419,418,326,659,525,399,738,143,265,532
896,269,870,376,434,114,113,338,498,898,866,290,395,72,428,831,135,324,176,947
225,556,841,718,304,770,415,888,453,528,644,490,478,106,163,396,733,440,693,295
384,627,842,476,396,774,169,562,129,373,177,51,430,205,130,316,660,624,128,56
383,215,559,449,143,867,505,649,649,182,206,528,398,126,596,561,459,212,577,570
831,128,519,536,395,644,526,119,336,836,837,619,646,774,619,109,473,843,185,349
897,239,486,288,115,432,273,560,453,322,661,453,753,617,144,375,333,140,482,224
528,224,561,382,643,523,219,518,134,5,641,538,753,836,161,417,341,562,607,537
437,406,552,419,558,466,187,947,428,717,190,643,169,943,620,829,482,699,437,525
382,318,630,318,223,495,520,105,514,737,148,421,627,695,374,808,210,196,147,160
380,320,889,902,131,525,176,838,516,642,597,266,686,530,150,154,221,638,368,756
196,273,155,190,534,488,231,641,475,865,742,807,698,204,240,427,272,396,654,333
887,227,176,753,830,899,107,59,623,886,740,319,409,77,375,904,654,524,428,334
754,441,229,483,162,494,226,888,477,322,114,834,790,151,477,837,64,126,751,364
533,217,737,575,11,888,904,566,426,441,748,346,275,762,893,302,609,603,558,533
558,194,717,752,388,53,664,765,854,445,903,599,118,645,70,372,773,347,557,745
900,557,390,326,768,126,143,206,503,169,303,474,694,209,364,185,736,149,664,850
682,891,442,863,474,830,119,746,662,155,781,214,421,308,461,274,365,524,153,889
446,133,603,526,309,716,779,588,204,193,208,778,505,907,188,185,465,240,649,888
153,144,324,248,498,889,772,433,61,843,331,486,380,840,498,116,576,237,786,127
778,201,708,738,485,414,104,314,209,937,122,266,378,842,756,193,842,743,660,214
68,141,763,380,642,180,733,837,741,457,450,534,451,941,534,630,436,469,706,188
280,321,658,383,147,485,613,174,486,622,452,317,711,433,621,452,938,190,693,271
481,668,239,459,308,533,442,319,154,844,422,50,517,193,837,894,621,343,230,243
300,527,206,425,123,393,194,568,191,194,278,622,328,468,170,652,520,234,475,153
209,142,5,51,408,370,57,754,115,214,571,511,201,716,134,223,866,474,408,697
885,277,513,513,106,410,753,866,56,906,426,478,949,328,439,64,378,197,765,762
557,576,230,323,227,484,608,404,455,343,570,947,163,321,155,738,349,277,172,495
302,636,617,623,649,421,70,115,497,303,601,782,216,499,479,297,173,151,604,632
844,442,307,142,54,459,601,510,754,327,219,750,114,935,739,86,636,804,236,181
385,895,761,840,144,787,349,134,122,347,55,836,202,386,131,176,807,227,808,921
414,326,457,781,946,787,224,517,426,307,597,185,444,241,196,903,211,240,445,363
435,644,227,640,937,409,527,936,395,157,846,688,611,166,148,484,890,837,625,163
411,62,612,448,154,276,117,243,66,304,657,571,805,396,606,469,429,280,150,322
106,608,786,320,521,229,227,780,188,599,273,425,389,153,410,804,330,412,128,721
54,935,207,830,697,985,596,120,200,143,564,340,375,841,831,894,842,521,531,691
570,8,646,342,890,939,451,312,805,624,292,908,772,462,454,698,313,568,898,638
138,241,61,124,524,436,109,559,586,411,642,310,386,81,639,170,220,320,862,389
462,472,504,909,689,428,449,633,438,755,576,698,519,404,774,506,365,310,898,179
621,173,315,321,299,174,444,379,619,311,197,431,422,940,179,10,539,206,619,630
773,688,665,323,366,323,785,368,438,329,157,217,600,657,365,286,907,166,534,165
565,393,431,864,288,775,63,528,72,760,142,598,161,465,389,241,210,489,535,231
846,148,153,345,306,747,422,831,560,380,938,460,758,839,130,847,108,783,537,612
246,122,767,806,424,769,314,522,273,166,839,575,182,194,760,617,480,168,604,487
562,878,786,217,271,772,137,63,267,177,408,427,116,215,176,862,787,432,775,395
867,534,55,741,234,689,419,416,639,603,566,684,606,947,221,140,162,568,435,865
481,166,382,489,364,187,612,469,807,159,491,221,18,71,558,599,266,445,189,373
839,535,338,787,68,269,142,649,415,666,604,189,303,521,396,167,320,65,780,232
787,381,210,146,406,387,119,1,946,631,635,67,495,846,641,125,747,418,559,126
396,396,311,418,434,695,844,427,388,629,304,140,228,496,239,465,449,59,130,459
210,762,161,745,829,690,169,976,237,105,532,427,576,889,341,695,375,890,230,622
205,346,438,870,894,601,761,412,455,613,936,324,456,178,492,279,14,409,236,328
487,463,842,750,840,186,222,461,289,280,72,699,538,521,224,419,780,191,367,898
139,187,389,643,349,502,300,367,561,130,186,345,143,137,739,756,77,129,601,628
349,678,188,752,156,225,463,188,278,949,457,375,808,67,905,497,328,488,782,769
77,418,829,134,532,445,276,535,650,698,322,181,496,393,139,931,865,458,148,453
772,224,886,597,752,778,330,525,652,157,290,946,62,773,608,490,179,124,249,164
901,213,286,411,305,392,909,158,139,642,392,304,175,529,125,473,578,569,740,315
147,464,371,159,508,154,571,523,518,534,210,456,77,864,710,717,893,172,424,81
782,125,55,182,631,523,481,556,174,107,369,130,53,328,530,580,104,180,135,451
829,284,330,739,659,81,148,508,179,699,467,372,414,945,527,472,72,633,467,159
218,563,469,976,306,320,838,604,241,769,940,317,383,443,805,455,618,128,645,488
112,213,147,870,743,397,118,616,666,717,453,557,73,174,522,69,556,869,558,317
893,323,841,333,109,638,140,527,665,493,210,295,390,199,328,346,408,610,150,126
597,462,312,704,180,429,482,479,374,534,409,773,505,527,186,348,764,115,688,280
900,943,941,470,484,385,532,618,224,523,753,594,621,602,681,528,455,229,448,898
109,808,741,275,606,744,634,459,474,10,108,383,425,845,739,52,484,124,938,183
165,488,740,429,503,113,620,60,304,514,834,73,76,324,168,141,532,718,318,713
515,761,560,561,371,505,188,617,833,420,753,177,869,884,183,527,165,130,518,909
619,77,573,306,515,306,157,945,239,305,665,836,428,442,394,440,201,866,684,116
808,763,568,507,149,434,503,164,112,75,939,775,145,448,844,21,468,444,496,889
980,524,175,500,233,416,151,864,110,203,936,415,74,616,479,691,617,470,842,639
483,308,315,20,577,209,864,567,569,780,201,716,892,766,869,557,602,907,224,632
585,212,382,778,605,846,602,364,220,251,113,745,511,767,522,146,237,105,750,528
977,180,597,938,81,668,171,778,436,304,199,197,718,864,466,609,716,347,605,348
576,938,215,381,483,350,160,772,131,182,126,831,248,306,622,599,520,416,504,201
648,754,640,159,76,396,753,56,111,690,644,108,588,372,439,665,635,509,80,203
203,807,844,190,317,949,639,654,735,603,603,490,413,604,377,315,370,327,779,127
573,482,656,492,241,417,325,126,806,165,407,890,753,617,347,372,165,236,869,596
907,64,218,516,366,840,233,291,892,122,575,6,424,187,482,665,616,510,232,531
325,806,514,395,475,532,209,412,483,391,480,554,939,607,224,153,602,124,894,119
832,234,384,318,449,980,374,330,221,659,598,235,408,74,906,50,436,718,647,569
179,749,599,150,759,350,75,59,405,568,476,866,757,505,689,230,600,285,641,668
389,510,565,75,264,452,463,537,53,650,526,54,450,59,629,377,81,62,466,746
235,764,889,230,148,935,517,893,717,832,808,754,346,444,907,648,450,890,407,984
427,377,486,453,71,115,567,524,777,529,279,762,544,667,623,290,207,688,571,181
334,388,472,470,277,217,485,549,894,945,612,573,597,768,438,774,435,128,500,305
986,141,211,116,213,302,534,300,598,777,171,841,444,128,183,76,122,131,325,447
904,807,782,62,215,119,442,395,229,52,160,641,185,249,602,772,627,236,482,448
18,69,835,599,760,111,784,109,660,782,937,328,125,126,281,198,766,128,417,176
226,59,511,514,665,643,120,689,517,331,556,411,424,427,935,164,426,275,194,584
300,140,127,746,595,390,502,512,274,69,520,463,170,207,742,188,375,944,127,339
657,479,173,329,126,112,266,808,575,203,176,316,947,270,218,481,978,768,423,563
202,429,520,643,471,778,369,211,125,285,292,207,736,606,774,162,396,696,427,693
320,233,870,887,501,168,13,299,778,110,646,533,477,154,457,474,317,457,128,751
338,783,162,199,755,420,436,838,890,223,378,603,290,907,181,506,301,635,889,205
846,129,187,232,313,756,524,63,610,393,431,60,196,638,539,482,617,805,782,882
449,774,650,625,484,471,806,304,456,443,70,907,904,394,716,267,619,603,236,641
835,300,278,444,54,783,450,144,516,390,718,777,84,528,61,200,766,348,662,173
79,652,480,558,210,649,421,212,736,232,350,329,444,624,768,835,111,146,770,602
778,892,327,612,213,909,458,697,402,127,163,846,488,892,735,459,889,769,482,869
596,223,62,412,396,319,533,745,473,321,642,563,576,543,694,78,188,374,290,279
868,557,782,570,870,463,433,659,785,567,630,441,862,659,446,348,201,65,336,341
463,835,138,829,940,474,473,344,210,568,436,113,834,316,427,124,620,656,313,578
60,414,625,415,608,106,453,620,408,598,832,690,331,63,607,457,364,182,539,838
667,438,458,81,202,487,80,288,413,494,452,609,326,565,409,283,907,467,514,647
893,319,561,225,490,943,658,394,129,465,417,459,563,579,836,164,265,323,312,942
264,308,375,833,539,411,561,66,292,564,121,383,203,870,403,405,207,774,832,442
438,71,218,766,454,505,504,116,890,619,995,316,771,763,364,373,767,480,439,660
475,322,522,173,215,485,311,151,532,655,735,59,173,689,434,106,425,478,139,189
269,382,107,487,233,532,58,471,787,69,216,895,596,314,284,194,662,842,52,839
192,506,574,77,64,575,275,445,885,315,643,223,380,59,770,232,574,376,127,381
198,890,449,749,80,275,114,305,131,754,943,150,211,140,561,761,58,4,158,210

View file

@ -0,0 +1,14 @@
departure class: 0-1 or 4-19
departure row: 0-5 or 8-19
seat: 0-13 or 16-19
your ticket:
11,12,13
nearby tickets:
3,9,18
15,1,5
5,14,9
3,17,20
9,27,7
24,3,0