From 1d96c68c66ba5648d1dd4d8ff2976fc97eea8a14 Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 31 Jul 2022 20:12:50 +0300 Subject: 2020 days 4 and 5 --- Advent-of-Code-2020/AOC-4/build.sh | 7 + Advent-of-Code-2020/AOC-4/example-invalid.txt | 14 + Advent-of-Code-2020/AOC-4/example-valid.txt | 13 + Advent-of-Code-2020/AOC-4/example.txt | 14 + Advent-of-Code-2020/AOC-4/input.txt | 1130 +++++++++++++++++++++++++ Advent-of-Code-2020/AOC-4/main.c | 140 +++ Advent-of-Code-2020/AOC-5/build.sh | 7 + Advent-of-Code-2020/AOC-5/example.txt | 4 + Advent-of-Code-2020/AOC-5/input.txt | 908 ++++++++++++++++++++ Advent-of-Code-2020/AOC-5/main.c | 137 +++ 10 files changed, 2374 insertions(+) create mode 100755 Advent-of-Code-2020/AOC-4/build.sh create mode 100644 Advent-of-Code-2020/AOC-4/example-invalid.txt create mode 100644 Advent-of-Code-2020/AOC-4/example-valid.txt create mode 100644 Advent-of-Code-2020/AOC-4/example.txt create mode 100644 Advent-of-Code-2020/AOC-4/input.txt create mode 100644 Advent-of-Code-2020/AOC-4/main.c create mode 100755 Advent-of-Code-2020/AOC-5/build.sh create mode 100644 Advent-of-Code-2020/AOC-5/example.txt create mode 100644 Advent-of-Code-2020/AOC-5/input.txt create mode 100644 Advent-of-Code-2020/AOC-5/main.c diff --git a/Advent-of-Code-2020/AOC-4/build.sh b/Advent-of-Code-2020/AOC-4/build.sh new file mode 100755 index 0000000..6be9241 --- /dev/null +++ b/Advent-of-Code-2020/AOC-4/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -xe + +gcc -o main -Wall -Wextra main.c + +./main diff --git a/Advent-of-Code-2020/AOC-4/example-invalid.txt b/Advent-of-Code-2020/AOC-4/example-invalid.txt new file mode 100644 index 0000000..68287d5 --- /dev/null +++ b/Advent-of-Code-2020/AOC-4/example-invalid.txt @@ -0,0 +1,14 @@ +eyr:1972 cid:100 +hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926 + +iyr:2019 +hcl:#602927 eyr:1967 hgt:170cm +ecl:grn pid:012533040 byr:1946 + +hcl:dab227 iyr:2012 +ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277 + +hgt:59cm ecl:zzz +eyr:2038 hcl:74454a iyr:2023 +pid:3556412378 byr:2007 +EOF diff --git a/Advent-of-Code-2020/AOC-4/example-valid.txt b/Advent-of-Code-2020/AOC-4/example-valid.txt new file mode 100644 index 0000000..a2614f8 --- /dev/null +++ b/Advent-of-Code-2020/AOC-4/example-valid.txt @@ -0,0 +1,13 @@ +pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980 +hcl:#623a2f + +eyr:2029 ecl:blu cid:129 byr:1989 +iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm + +hcl:#888785 +hgt:164cm byr:2001 iyr:2015 cid:88 +pid:545766238 ecl:hzl +eyr:2022 + +iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719 +EOF diff --git a/Advent-of-Code-2020/AOC-4/example.txt b/Advent-of-Code-2020/AOC-4/example.txt new file mode 100644 index 0000000..58190a3 --- /dev/null +++ b/Advent-of-Code-2020/AOC-4/example.txt @@ -0,0 +1,14 @@ +ecl:gry pid:860033327 eyr:2020 hcl:#fffffd +byr:1937 iyr:2017 cid:147 hgt:183cm + +iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 +hcl:#cfa07d byr:1929 + +hcl:#ae17e1 iyr:2013 +eyr:2024 +ecl:brn pid:760753108 byr:1931 +hgt:179cm + +hcl:#cfa07d eyr:2025 pid:166559648 +iyr:2011 ecl:brn hgt:59in +EOF diff --git a/Advent-of-Code-2020/AOC-4/input.txt b/Advent-of-Code-2020/AOC-4/input.txt new file mode 100644 index 0000000..1d41d0b --- /dev/null +++ b/Advent-of-Code-2020/AOC-4/input.txt @@ -0,0 +1,1130 @@ +eyr:2029 byr:1931 hcl:z cid:128 +ecl:amb hgt:150cm iyr:2015 pid:148714704 + +byr:2013 hgt:70cm pid:76982670 ecl:#4f9a1c +hcl:9e724b eyr:1981 iyr:2027 + +pid:261384974 iyr:2015 +hgt:172cm eyr:2020 +byr:2001 hcl:#59c2d9 ecl:amb cid:163 + +eyr:2024 hcl:#b6652a +cid:340 +byr:1929 ecl:oth iyr:2014 pid:186640193 +hgt:193in + +iyr:2015 eyr:2024 hgt:184cm +ecl:blu hcl:#a97842 byr:1959 pid:932817398 + +iyr:1933 hcl:7c63aa cid:72 eyr:2028 +ecl:hzl +byr:2009 hgt:164cm pid:104496116 + +byr:1980 +hgt:181cm pid:192793676 hcl:8f6ae6 iyr:2021 eyr:1978 + +pid:#63f479 hgt:75cm +hcl:z iyr:1956 +byr:2024 ecl:#051344 + +byr:2014 pid:159cm +hgt:161cm +ecl:#b4eef2 +iyr:2027 eyr:1933 hcl:743b1a + +cid:79 hgt:172cm byr:1932 eyr:2020 pid:127319843 hcl:#6b5442 iyr:2017 ecl:brn + +ecl:gry eyr:2020 byr:1976 +pid:093137171 iyr:2012 hgt:178cm hcl:#733820 + +byr:1933 hcl:#733820 hgt:165cm eyr:2027 iyr:2018 ecl:oth pid:0952910465 + +iyr:2014 +byr:1965 pid:304542033 +eyr:2032 +ecl:brn hgt:153in cid:259 hcl:z + +byr:2004 ecl:amb iyr:2013 +hcl:#a97842 +hgt:68in +pid:248926471 eyr:1930 + +pid:048596900 iyr:2021 byr:2021 eyr:2021 cid:104 +hcl:c3c9e0 ecl:hzl +hgt:75cm + +pid:590195280 cid:159 byr:1951 hcl:#ceb3a1 ecl:brn iyr:2012 hgt:189cm eyr:2024 + +iyr:2015 pid:639647361 hcl:#b6652a +hgt:151cm byr:1957 cid:284 +ecl:gry +eyr:2026 + +ecl:blu hgt:175cm pid:462959720 hcl:#602927 iyr:2014 byr:1972 +eyr:2023 + +ecl:blu eyr:2023 hgt:175cm +pid:090406335 hcl:#b6652a iyr:2012 byr:1921 + +eyr:2025 hcl:#733820 +pid:775468504 ecl:hzl byr:1934 hgt:187cm iyr:2019 + +ecl:#b35d5b hgt:121 hcl:z iyr:2002 eyr:2034 +byr:2014 + +ecl:hzl byr:2026 hgt:77 iyr:1952 +hcl:#a97842 pid:#1461ed +eyr:1921 + +iyr:2019 +hgt:171in eyr:2040 pid:788162609 ecl:grn byr:2023 + +hcl:#efcc98 eyr:2039 hgt:158cm byr:2026 pid:216112069 + +ecl:blu hcl:#fffffd eyr:2020 pid:496018604 +byr:1982 hgt:168cm +cid:70 iyr:2016 + +eyr:2031 iyr:1958 +hcl:#c0946f hgt:181in ecl:#f88f2c pid:7896132641 + +byr:1933 cid:118 eyr:2037 hcl:#cfa07d iyr:2030 +ecl:#686f76 hgt:170 + +iyr:2010 +hgt:161cm ecl:grn byr:1958 hcl:#7d3b0c +pid:523557068 + +hcl:ba3af2 pid:157cm eyr:2037 cid:135 ecl:zzz hgt:153 byr:2030 + +ecl:grn byr:1967 cid:191 +iyr:2012 hcl:#866857 +pid:822899368 hgt:152cm eyr:2024 + +iyr:2015 +cid:343 hcl:#6b5442 pid:119981062 hgt:67in eyr:2027 +ecl:gry +byr:2001 + +pid:#c68245 ecl:blu hgt:107 hcl:74f3fb eyr:1996 iyr:1955 byr:2025 + +hgt:63cm eyr:1925 +iyr:2019 byr:2013 pid:#3ab227 ecl:#e33d1d hcl:#efcc98 + +byr:1941 eyr:2029 iyr:2011 hgt:159cm +hcl:#602927 +ecl:brn cid:245 pid:977877701 + +pid:575539099 +eyr:2031 byr:1987 ecl:oth hcl:#cfa07d +iyr:2017 +hgt:69cm + +pid:563180951 hgt:153cm ecl:amb iyr:2016 +byr:1951 hcl:#341e13 eyr:2029 +cid:277 + +hcl:#623a2f iyr:2011 hgt:171cm byr:1929 ecl:oth +eyr:2024 pid:959212059 + +byr:1943 ecl:#3925f3 hgt:68cm pid:155cm cid:127 eyr:2011 +hcl:2a53fd +iyr:2030 + +hgt:160in byr:2014 pid:7846412647 +hcl:2d18c8 +ecl:#8655df eyr:2034 iyr:2023 + +byr:1932 hgt:170cm cid:331 eyr:2020 pid:52551410 ecl:gry +iyr:2013 +hcl:#c6944c + +hcl:#888785 pid:177cm ecl:oth +hgt:160cm eyr:2021 byr:1957 +iyr:2013 + +iyr:2020 pid:6245137 eyr:2027 cid:111 hgt:181cm +byr:2024 ecl:gmt hcl:fe8828 + +pid:648300488 cid:230 hcl:#efcc98 +byr:1989 hgt:159cm +ecl:gry iyr:2015 +eyr:2030 + +iyr:1929 cid:144 hgt:168in pid:185cm +byr:2017 hcl:z eyr:1960 ecl:#d406d2 + +hcl:3a4933 +hgt:155cm +pid:337576945 byr:1925 iyr:2014 ecl:brn eyr:2026 + +pid:170cm cid:291 eyr:2017 iyr:2017 hgt:177cm hcl:z ecl:gmt + +pid:271148544 hgt:163cm +byr:1926 hcl:#fffffd iyr:2013 +eyr:2022 + +hgt:64in iyr:2030 ecl:#15c6b5 eyr:2028 byr:2025 +pid:3426144 + +eyr:1923 byr:1943 hcl:#64d609 iyr:2017 pid:154cm hgt:160cm ecl:brn + +hcl:#602927 hgt:170cm ecl:utc iyr:1954 pid:370180054 +byr:1925 cid:162 +eyr:1983 + +hcl:#888785 byr:1932 hgt:163cm +eyr:2026 +ecl:grn pid:799844918 + +eyr:2029 +ecl:blu cid:231 hgt:157cm +pid:609233861 +hcl:#462640 +byr:1940 iyr:2012 + +iyr:2025 +byr:2004 pid:#e92a77 +eyr:2014 cid:78 +ecl:zzz hgt:187in hcl:76be6e + +eyr:2027 iyr:2012 ecl:brn byr:1955 pid:128923308 +cid:313 hgt:156cm hcl:#623a2f + +hcl:#ceb3a1 +hgt:178cm byr:1984 +pid:121442385 eyr:2036 iyr:2014 ecl:hzl + +eyr:2038 ecl:#c6149f iyr:1983 +cid:304 hgt:193 byr:2019 +hcl:z pid:5871630079 + +iyr:2028 eyr:2002 +hgt:146 +hcl:#623a2f +pid:390145814 +byr:1937 + +pid:923652966 ecl:amb +eyr:2027 hgt:174cm byr:1932 iyr:2014 +hcl:#fffffd + +iyr:2026 cid:202 byr:1995 hcl:69c01a +hgt:164cm eyr:2020 ecl:hzl + +hgt:156cm +byr:2004 +pid:537532371 +hcl:z iyr:1988 +eyr:2024 +ecl:utc + +iyr:2018 byr:1924 hcl:#602927 cid:132 pid:947815343 eyr:2030 ecl:grn + +byr:1978 hcl:#c0946f iyr:2012 hgt:67cm +eyr:2032 pid:929470763 ecl:amb + +eyr:2028 +pid:545502229 ecl:gry +hcl:#866857 hgt:182cm +byr:1964 iyr:2016 + +hcl:z cid:82 hgt:108 byr:2010 pid:#1650b3 eyr:2020 iyr:2017 ecl:hzl + +iyr:2018 +hgt:61cm +ecl:lzr byr:1980 hcl:1d4bc2 cid:306 +pid:763925614 eyr:2006 + +byr:2021 eyr:2029 +pid:610596568 +ecl:oth +hcl:#7d3b0c +iyr:2010 cid:83 hgt:156cm + +cid:181 ecl:hzl +hcl:#8d79d2 +hgt:192cm +byr:1958 iyr:2014 eyr:2026 pid:118367138 + +byr:1978 +eyr:2020 +iyr:2025 hgt:176cm +ecl:grn hcl:faedc2 + +hgt:156cm eyr:1989 pid:#7acc45 cid:235 hcl:1332ba +ecl:#2b7525 iyr:1950 byr:1943 + +pid:147647267 hcl:#341e13 +ecl:hzl +iyr:2019 +byr:1975 +hgt:153cm eyr:2020 + +iyr:2026 hgt:170cm ecl:oth +byr:2017 pid:047129729 +eyr:2024 hcl:#733820 + +hcl:#fffffd byr:1960 ecl:gry eyr:2023 +iyr:2013 hgt:186cm pid:145757697 + +hgt:64in +ecl:amb +byr:1930 pid:808797855 iyr:2019 +hcl:#b6652a eyr:2022 + +eyr:2030 +hcl:z iyr:2013 hgt:165cm ecl:#5ba775 +pid:168306092 byr:1988 + +eyr:2026 ecl:gry iyr:2020 hcl:#b6652a hgt:177cm +byr:1991 pid:780666689 + +iyr:2020 +pid:#d08e64 eyr:2010 hcl:411b04 cid:140 hgt:76cm ecl:grn byr:2005 + +iyr:1945 +pid:973836167 ecl:zzz +hcl:z hgt:181in byr:2008 eyr:1993 + +cid:58 eyr:2024 hgt:159cm byr:1977 ecl:hzl pid:402427328 +hcl:#888785 +iyr:2012 + +pid:533381616 byr:2027 +eyr:2040 hgt:60cm iyr:2023 hcl:z +ecl:gmt + +pid:229044973 cid:149 hgt:178in eyr:2029 +byr:2006 ecl:dne iyr:2012 +hcl:bf4bc2 + +hgt:161cm byr:1973 ecl:oth iyr:2015 hcl:#341e13 pid:658452720 +eyr:2024 + +hcl:#efcc98 hgt:156cm +byr:1931 iyr:1997 pid:0548175409 ecl:utc + +pid:575623915 iyr:2017 eyr:2023 hcl:#733820 byr:1938 +ecl:blu +hgt:185cm + +hcl:#55ebaa +hgt:157cm ecl:blu byr:1945 +pid:946614649 +eyr:2020 iyr:2012 + +hgt:158cm hcl:#b80425 iyr:2017 eyr:2025 ecl:gry +byr:1944 pid:838975683 + +hcl:#41731c iyr:2020 byr:1971 ecl:oth +hgt:186cm +eyr:2030 pid:495358045 + +pid:3884291521 +eyr:2037 hgt:74cm byr:2003 ecl:hzl iyr:2022 hcl:#888785 cid:124 + +hgt:175cm cid:340 byr:1921 +pid:183491348 +iyr:2017 ecl:brn hcl:#602927 eyr:2028 + +hcl:#cfa07d +hgt:161cm byr:2006 +eyr:2024 +pid:109854634 +ecl:xry iyr:2024 + +ecl:#ec6311 hcl:z iyr:2015 +pid:#783693 +eyr:1932 +cid:271 +hgt:82 + +ecl:grn +hgt:164cm hcl:#efcc98 eyr:2020 pid:824236769 +byr:1952 iyr:2014 + +eyr:1964 pid:85558869 byr:2017 hcl:c81d94 +iyr:2028 +hgt:63cm +ecl:#c00640 cid:115 + +byr:2010 +pid:431600716 +hcl:z hgt:112 ecl:#3057e9 eyr:2027 iyr:2017 cid:91 + +byr:2026 +eyr:2037 +pid:3800489571 ecl:grn +cid:91 hcl:94b4d1 hgt:59cm + +cid:199 byr:2030 +iyr:2021 +hcl:c55653 +hgt:168cm +pid:160cm + +hgt:68cm +byr:2025 iyr:2023 eyr:1983 +hcl:0004d4 ecl:#19fca6 pid:89901951 + +hgt:170cm byr:2012 +eyr:1981 hcl:c95b58 +pid:#d28b3f cid:302 iyr:1953 ecl:#151ea4 + +hcl:#6b5442 eyr:2024 hgt:161cm +cid:210 ecl:#793ac0 +pid:480283173 +iyr:2019 byr:1967 + +cid:82 ecl:amb iyr:2017 eyr:2023 byr:1980 hgt:59in hcl:#888785 pid:323524654 + +hcl:#341e13 hgt:154cm +iyr:2015 eyr:2023 +byr:1953 ecl:blu pid:872964523 + +iyr:2019 +byr:1945 hcl:#efcc98 +hgt:155in +ecl:#1608c7 eyr:2030 pid:406045604 + +ecl:lzr byr:2015 iyr:1938 +eyr:2026 hcl:z +pid:542894703 hgt:185 + +eyr:2021 hcl:#cfa07d ecl:hzl hgt:82 +iyr:2018 byr:1932 +pid:661993261 + +ecl:brn hcl:#602927 +hgt:193cm pid:572216250 +byr:1929 eyr:2020 iyr:2010 cid:206 + +ecl:amb +eyr:2025 +pid:932260335 byr:1978 iyr:2012 +hcl:#cfa07d +cid:260 hgt:67in + +pid:635410614 +byr:1948 hgt:156cm hcl:#071bc0 eyr:2026 +ecl:grn +cid:275 +iyr:2014 + +hcl:#8a4888 byr:1986 +iyr:2010 ecl:amb cid:113 +pid:974757414 hgt:174cm +eyr:2024 + +byr:1934 ecl:amb iyr:2016 +pid:280206549 hgt:176cm +eyr:2020 hcl:#fffffd + +pid:544634927 +eyr:2021 hgt:188cm byr:1947 iyr:2020 +hcl:#008716 ecl:oth +cid:97 + +eyr:2026 pid:863010622 +byr:1978 hcl:#b6652a hgt:157cm cid:323 iyr:2020 ecl:blu + +cid:105 +byr:1926 +hcl:#6b5442 pid:049198636 eyr:2026 hgt:75in +iyr:2018 ecl:blu + +eyr:2038 hgt:76cm byr:2020 pid:9036865757 iyr:2025 +ecl:#a2c975 +hcl:z +cid:340 + +pid:425619875 cid:263 byr:1935 +eyr:2028 hgt:192cm iyr:2010 hcl:#a6ddfc ecl:hzl + +cid:107 hgt:189cm +hcl:#733820 ecl:blu +eyr:2028 iyr:2020 pid:814895947 + +cid:96 hgt:74in +hcl:z +pid:170cm ecl:#0240fd byr:2004 iyr:2013 eyr:1936 + +ecl:blu +eyr:2027 hcl:#341e13 +iyr:2020 +cid:94 +hgt:174cm + +iyr:2013 ecl:amb +eyr:2030 hcl:#b6652a +byr:1964 +pid:329942894 + +byr:1995 ecl:hzl eyr:2030 +hgt:177cm hcl:#341e13 +cid:64 + +eyr:2027 pid:708191313 +ecl:#390609 byr:2022 iyr:2010 cid:292 hgt:129 +hcl:#733820 + +hcl:#733820 ecl:hzl eyr:2030 +iyr:2011 +hgt:156cm +byr:2002 pid:932464949 + +iyr:1941 +byr:2027 ecl:xry eyr:1949 pid:82479270 +hgt:175 hcl:z +cid:157 + +byr:1927 pid:708954312 eyr:2028 ecl:oth hgt:167cm hcl:#602927 iyr:2011 + +cid:125 eyr:2034 iyr:2030 +hgt:116 byr:2030 +hcl:f773ce pid:#d24ed1 ecl:lzr + +hcl:#efcc98 byr:1947 pid:423105162 ecl:brn iyr:2019 hgt:154cm +eyr:2026 +cid:174 + +iyr:2017 +ecl:gry +hcl:#341e13 +pid:314487906 eyr:2038 hgt:171cm byr:2014 + +pid:630479640 ecl:brn hgt:163cm +iyr:2013 eyr:2028 byr:1998 hcl:#866857 + +iyr:2013 hcl:z byr:2016 +ecl:#43d879 pid:996281170 +cid:200 hgt:153 eyr:2030 + +byr:2023 +pid:081908248 iyr:2020 +eyr:2035 +hgt:175in ecl:grt hcl:30ab42 + +iyr:2018 byr:1995 eyr:2029 ecl:grn pid:882123182 hgt:62cm hcl:#fffffd + +byr:1978 hcl:z +iyr:1923 ecl:blu eyr:2037 pid:#1f3467 hgt:186cm + +cid:264 ecl:#ab07c5 iyr:1927 hcl:2d6f9c +hgt:74cm byr:2008 pid:874594495 eyr:2035 + +ecl:lzr hgt:69cm +hcl:76854c cid:336 pid:7830555583 +iyr:1920 +byr:2021 eyr:2038 + +hgt:160cm byr:2029 ecl:#7f9d1b hcl:z iyr:1975 +pid:652466273 +eyr:2031 + +ecl:oth +eyr:2027 iyr:2019 pid:544347482 +byr:1988 hgt:182cm hcl:#cfa07d + +hgt:176cm iyr:2016 hcl:ec1dc3 +pid:521230755 byr:2030 ecl:amb eyr:2025 + +pid:005216805 byr:1951 +ecl:hzl hcl:#efcc98 eyr:2022 +iyr:2016 +hgt:154cm + +byr:1943 hcl:#866857 +eyr:1984 hgt:64cm +pid:3105984 iyr:1997 +ecl:lzr + +eyr:2024 +byr:1931 pid:929699878 hgt:169cm cid:81 hcl:#efcc98 + +iyr:2011 pid:558972589 +hgt:163cm cid:155 eyr:2025 byr:1952 ecl:oth +hcl:#c0946f + +pid:787560595 eyr:2036 +hcl:#888785 byr:1999 iyr:1971 ecl:blu + +hgt:165in pid:032310066 +eyr:1926 byr:1954 ecl:brn hcl:41964f iyr:2023 + +hcl:#733820 +pid:563740385 +hgt:184cm +iyr:1959 +ecl:gmt cid:242 byr:1999 + +pid:4949046383 byr:2011 hcl:fcf63b +ecl:hzl +hgt:174in +iyr:2023 eyr:1939 + +cid:331 +ecl:grt hcl:z eyr:2003 hgt:172in byr:2012 iyr:1954 pid:#9f4663 + +cid:223 byr:1939 eyr:2025 +ecl:oth hgt:161cm iyr:2015 pid:214576789 hcl:#866857 + +ecl:oth pid:912009529 byr:1968 hgt:161cm +hcl:#ceb3a1 eyr:2023 iyr:2017 + +pid:858541281 hgt:150cm eyr:2021 +iyr:2013 ecl:gry +hcl:#fffffd byr:1959 + +ecl:#0024e0 byr:2006 cid:107 +iyr:2015 hcl:684416 hgt:94 pid:152cm eyr:2031 + +byr:1987 hcl:z +ecl:gry pid:#246fe1 hgt:65cm eyr:1992 iyr:2020 + +pid:426999585 +ecl:hzl byr:1949 hcl:#888785 hgt:191cm +iyr:2020 eyr:2020 + +byr:1951 hcl:#623a2f +cid:308 ecl:hzl +hgt:174cm pid:226138254 +eyr:2028 +iyr:2018 + +ecl:brn hgt:62in +eyr:2020 hcl:#ceb3a1 pid:650916481 +byr:1940 +iyr:2018 + +hcl:#efcc98 ecl:brn +byr:1940 eyr:2024 pid:#68d3ab +hgt:177cm cid:83 +iyr:2017 + +pid:9704738756 hcl:#fffffd eyr:1925 +iyr:2019 byr:1929 ecl:blu hgt:191cm + +ecl:brn hgt:151cm hcl:#c0946f iyr:2018 pid:602505609 eyr:2020 +byr:1974 + +hgt:178cm +eyr:2023 byr:1922 +iyr:2013 +hcl:#fffffd pid:205291054 ecl:blu + +byr:1985 +iyr:2016 hcl:#ceb3a1 hgt:161cm eyr:2030 ecl:amb +pid:871809978 + +iyr:2027 ecl:#d9c9cb hgt:110 +eyr:2034 +hcl:99d4ee pid:13355969 cid:168 + +ecl:utc byr:2019 +iyr:2016 hgt:173in cid:266 +hcl:z eyr:2033 +pid:1835189643 + +pid:364874100 ecl:amb hcl:#6b5442 hgt:184cm +iyr:2017 eyr:2026 byr:1920 cid:127 + +ecl:dne eyr:2020 +byr:2018 cid:262 +iyr:2010 hgt:60cm +pid:95409983 hcl:z + +eyr:2026 +pid:135963889 iyr:2018 hcl:#ceb3a1 +ecl:amb + +hcl:#341e13 eyr:2028 iyr:2014 byr:1978 +cid:309 +pid:503628987 +ecl:oth hgt:159cm + +hcl:#a97842 +pid:171194014 hgt:193cm eyr:2023 +byr:1945 ecl:grt +iyr:2019 + +eyr:1967 cid:135 hcl:z +ecl:gmt +iyr:2024 pid:#a87744 +byr:2023 hgt:168cm + +pid:169cm +cid:337 ecl:hzl hcl:#888785 byr:1927 hgt:153cm +iyr:2022 eyr:2020 + +byr:1963 hcl:#fffffd eyr:2021 +hgt:62in pid:702188504 iyr:2013 +ecl:hzl + +iyr:2024 ecl:amb hcl:#ceb3a1 +eyr:2017 pid:49752568 hgt:179cm byr:1938 + +byr:2006 +ecl:#08021a +eyr:2022 pid:520309937 +hgt:61in hcl:#ceb3a1 +iyr:2013 + +hgt:150cm hcl:#733820 byr:1971 ecl:zzz cid:347 +iyr:2020 eyr:2020 pid:6028818045 + +byr:2005 hgt:69cm +ecl:lzr hcl:z iyr:2009 eyr:2038 pid:79626157 + +iyr:2020 byr:2015 pid:882923693 hcl:#888785 eyr:2030 +ecl:xry hgt:65in + +hcl:z hgt:187cm pid:4397913655 iyr:1973 eyr:1925 +ecl:#93ae1a + +hgt:169cm +iyr:2019 eyr:2023 pid:678937529 +ecl:blu byr:1998 hcl:#fffffd + +cid:87 hcl:#efcc98 +ecl:#e56390 +iyr:2013 hgt:191in +eyr:2027 pid:923358773 byr:1960 + +hgt:190cm byr:1939 +cid:55 eyr:2026 ecl:blu hcl:#623a2f pid:363917612 +iyr:2012 + +pid:177cm hgt:165cm cid:276 eyr:2002 byr:2010 hcl:#7bea4c iyr:2017 +ecl:grt + +byr:2023 eyr:2031 +iyr:1987 hgt:172 hcl:z +pid:4973557135 ecl:#7517e2 + +eyr:2036 iyr:1989 ecl:#ef5492 hgt:188in pid:#b50065 +hcl:92e9ee byr:2015 + +pid:873654822 iyr:2016 cid:310 +hgt:76in +eyr:2029 hcl:#888785 byr:1958 +ecl:brn + +iyr:2013 ecl:amb byr:2024 +hgt:166cm +cid:221 eyr:2040 pid:358648642 hcl:#733820 + +hgt:181cm cid:295 ecl:blu eyr:2027 +iyr:2016 +byr:1932 +hcl:#2502ba +pid:177357899 + +pid:154588649 eyr:2028 +byr:1945 iyr:2020 +ecl:amb cid:220 +hgt:189cm hcl:#a97842 + +iyr:2011 +eyr:2030 cid:143 byr:1998 pid:403108989 +ecl:oth hcl:#6b5442 +hgt:151cm + +pid:071042426 cid:217 iyr:2017 ecl:grn byr:1989 eyr:2026 hgt:193cm hcl:#7d3b0c + +eyr:2025 +iyr:2025 pid:3942412883 hcl:#cfa07d cid:237 ecl:utc hgt:182 + +iyr:2012 eyr:1982 byr:2029 pid:8573047090 +hgt:159in ecl:#1e0124 hcl:#b6652a + +hcl:53c64f ecl:gmt iyr:1984 byr:2029 +hgt:59cm +pid:#106076 eyr:2031 + +hcl:#733820 iyr:2019 +eyr:2031 +pid:706963298 +hgt:134 +byr:2004 + +byr:2012 cid:161 +eyr:2039 ecl:gry hgt:61cm iyr:1949 pid:870113802 hcl:z + +byr:1961 eyr:2023 pid:353075198 iyr:2020 hcl:#888785 ecl:oth +hgt:163cm + +byr:2001 iyr:2015 +hgt:159cm hcl:#623a2f ecl:#3303fc +pid:86352609 eyr:2030 + +pid:392475721 ecl:brn byr:1927 iyr:2014 eyr:2024 hcl:#fffffd + +hgt:160cm eyr:2022 byr:1979 iyr:2010 +pid:974489456 +hcl:#efcc98 + +ecl:grn eyr:2024 +hgt:166cm byr:1961 +pid:221051556 +hcl:#6b5442 +iyr:2028 + +iyr:2010 cid:156 +byr:2005 hgt:155cm ecl:amb eyr:1988 +hcl:#866857 +pid:169cm + +eyr:2038 byr:1991 pid:#9b82ce +iyr:2027 hcl:z +cid:278 hgt:59cm ecl:#179d81 + +ecl:blu hgt:151cm +iyr:2013 +cid:117 pid:129843687 hcl:#c429e7 byr:1961 +eyr:2022 + +hcl:#602927 byr:1996 pid:507775673 eyr:2020 hgt:153cm ecl:oth +cid:251 iyr:2010 + +hgt:170cm ecl:oth iyr:2010 eyr:2025 hcl:#602927 byr:1983 pid:113809908 + +hcl:#c0946f pid:172142380 +iyr:2017 byr:1926 +hgt:190cm eyr:2028 +ecl:brn + +pid:812443511 hcl:#6b5442 eyr:2021 ecl:amb +cid:60 iyr:2017 hgt:157cm byr:1926 + +hgt:177cm +ecl:gry eyr:2022 hcl:#888785 pid:570572334 byr:1943 iyr:2017 + +pid:#967cbc hcl:z byr:2020 ecl:oth eyr:2035 iyr:2015 +cid:99 hgt:65cm + +iyr:2019 pid:285935311 hcl:#4c1ee4 byr:1954 eyr:2028 hgt:157cm + +ecl:xry eyr:1939 +pid:192cm +hgt:114 +hcl:b97555 byr:2004 iyr:1970 + +ecl:grn byr:2021 iyr:2030 +hcl:z pid:305489303 hgt:61cm eyr:2020 + +eyr:2036 hgt:179cm +pid:#8be5f5 byr:1981 +hcl:#cb5848 iyr:2015 + +iyr:2011 ecl:oth hgt:176cm cid:344 pid:539941547 hcl:#efcc98 + +eyr:1987 ecl:amb +byr:2029 pid:046017350 +cid:182 iyr:2011 hcl:z hgt:191cm + +iyr:2019 byr:1948 eyr:2020 ecl:hzl hgt:176cm hcl:#733820 pid:235101182 + +ecl:hzl +eyr:2029 pid:262843012 hgt:76in hcl:#efcc98 iyr:2015 byr:1931 + +iyr:2011 ecl:blu hgt:184cm +byr:1945 +hcl:#c0946f pid:105042852 + +iyr:2010 +pid:485638522 hcl:949a37 eyr:2030 +hgt:193cm +ecl:gry byr:2021 + +pid:565896801 eyr:2029 hcl:#fffffd ecl:amb iyr:2016 byr:1977 +hgt:170cm + +byr:1987 +hcl:#c0946f pid:931311386 +iyr:2010 eyr:2022 + +eyr:2030 +hgt:177cm hcl:#a97842 byr:1978 +ecl:hzl pid:358177000 +iyr:2014 + +iyr:2025 +pid:3639383157 cid:82 hcl:f2aec0 hgt:179cm +eyr:1944 byr:1969 +ecl:#e167d3 + +hgt:107 ecl:gmt iyr:2030 hcl:#866857 byr:2026 eyr:1990 pid:#87773e + +cid:220 hcl:z iyr:1921 hgt:65cm byr:1998 ecl:#34397f eyr:2035 + +hcl:44e552 pid:#6f341e ecl:#59aeb1 +eyr:1926 hgt:187 iyr:1988 +byr:1991 + +hcl:z hgt:70cm pid:653386115 iyr:1964 byr:2026 cid:103 +ecl:#b81c45 eyr:2034 + +hcl:#623a2f cid:307 pid:204266921 hgt:172cm +iyr:2012 +ecl:hzl +eyr:2021 +byr:1984 + +hgt:192cm +byr:1930 pid:39349843 hcl:#866857 iyr:2013 cid:130 ecl:blu eyr:1962 + +cid:97 eyr:2036 pid:#279c0b ecl:dne hgt:186in iyr:1973 hcl:691266 + +byr:2026 hgt:185cm hcl:z ecl:grt pid:#562f7a eyr:1986 iyr:2029 + +ecl:brn +hcl:#b6652a eyr:2028 +pid:570023672 +byr:1988 hgt:162cm iyr:2015 + +hgt:180in ecl:zzz hcl:5b1477 byr:2024 +eyr:2028 +pid:#b03174 + +pid:157cm eyr:1989 hgt:188cm +iyr:2015 +hcl:3362a9 ecl:gry byr:2027 + +pid:111584950 +byr:1941 ecl:grn iyr:2013 hgt:179cm hcl:#866857 +eyr:2024 + +ecl:#7f4baa +iyr:2015 hcl:de1367 +eyr:2024 byr:1959 +pid:#cf4e78 hgt:60cm + +byr:2024 eyr:1953 pid:21579220 +hgt:179 +cid:94 +hcl:#a97842 +iyr:1977 ecl:xry + +hgt:179cm eyr:2020 +ecl:hzl hcl:#efcc98 +pid:905622096 byr:1929 + +ecl:oth +byr:2001 eyr:2008 iyr:2020 +hcl:#ceb3a1 pid:244298637 hgt:160cm + +eyr:2030 +byr:1972 hcl:#341e13 +ecl:grn iyr:2014 pid:274475554 hgt:71in + +byr:1938 hcl:z iyr:1956 pid:153cm hgt:62cm ecl:grt +eyr:2036 + +hgt:177cm cid:276 iyr:1921 hcl:19aa96 pid:843799864 eyr:2033 +ecl:#812d68 + +pid:686496844 +ecl:brn hcl:#733820 +byr:1948 iyr:2010 eyr:2020 +hgt:164cm + +pid:39436322 ecl:blu hcl:25b3d4 hgt:185in +iyr:2019 byr:1959 eyr:2022 + +pid:119603708 hcl:#866857 byr:1983 hgt:157cm iyr:1978 ecl:hzl eyr:1945 + +cid:331 hcl:z iyr:2017 +pid:255988517 +byr:2015 +eyr:2020 ecl:amb +hgt:171 + +hgt:180cm iyr:2013 ecl:brn +hcl:#602927 byr:1943 +pid:898265221 eyr:2025 + +eyr:2024 +hgt:163cm +pid:892793767 byr:1971 ecl:oth iyr:2013 cid:119 hcl:#02f6b3 + +byr:1920 cid:221 +pid:#7515a7 hgt:160in +eyr:1921 iyr:1983 hcl:z + +byr:2029 hcl:z hgt:75cm eyr:1975 pid:184cm iyr:1992 ecl:dne + +iyr:1990 +hgt:174in eyr:1961 ecl:brn +hcl:#a3313e byr:2029 + +hgt:191cm eyr:2026 iyr:2019 ecl:brn +byr:1930 hcl:#7d3b0c cid:174 + +ecl:amb iyr:2015 hgt:163cm +pid:664966673 hcl:#602927 eyr:2026 cid:229 byr:1941 + +pid:3123244013 eyr:2037 iyr:2022 hcl:103dfa +hgt:156cm byr:2027 ecl:gmt cid:195 + +cid:151 ecl:blu pid:693382940 +iyr:2011 byr:1954 +hgt:170cm eyr:2030 hcl:#866857 + +hcl:#341e13 eyr:2023 byr:1948 iyr:2010 pid:607929427 +ecl:oth hgt:160cm + +hcl:#c0946f +ecl:brn +hgt:189cm +cid:116 iyr:2013 pid:277606931 +byr:1975 + +eyr:2027 +cid:206 ecl:gry iyr:2010 hcl:#866857 byr:1997 hgt:190cm pid:687577894 + +eyr:2029 iyr:2015 pid:681485527 +byr:1925 hgt:152cm +ecl:amb hcl:#341e13 + +eyr:2030 +hcl:#c396d9 +hgt:159cm pid:686268817 +ecl:brn byr:1983 +iyr:2017 + +eyr:2038 byr:2012 +cid:303 +iyr:1941 hcl:z ecl:utc pid:203595168 +hgt:71cm + +pid:863355278 hcl:#888785 +iyr:2018 +byr:1953 eyr:2022 hgt:167cm +ecl:amb + +pid:141244310 eyr:2025 hcl:#733820 ecl:amb hgt:154cm cid:61 iyr:2017 +byr:1929 + +pid:361065637 +hcl:#623a2f byr:1964 iyr:2015 eyr:2027 ecl:gry hgt:67in + +cid:117 ecl:brn iyr:2025 byr:1982 +hcl:#ceb3a1 hgt:185cm +pid:34652522 + +cid:275 ecl:#7a4722 eyr:2001 byr:2018 iyr:1995 +hgt:105 +pid:95250112 hcl:z + +iyr:2017 ecl:amb hgt:152cm hcl:#733820 cid:57 eyr:2020 pid:701621326 +byr:1944 + +hcl:#18171d +ecl:brn iyr:2015 hgt:175cm eyr:2028 pid:311636591 cid:113 +byr:1979 + +ecl:grn +hgt:185cm +pid:920998407 iyr:2016 byr:1930 eyr:2029 hcl:#7d3b0c + +iyr:2021 eyr:1931 +hcl:z byr:2010 +hgt:177in +pid:#cfb659 ecl:zzz + +cid:171 hcl:#888785 iyr:2010 byr:1970 ecl:hzl +pid:141430645 hgt:160cm +eyr:2026 + +hgt:172cm ecl:gry +pid:428207256 cid:237 hcl:#733820 iyr:2012 +eyr:2027 byr:1951 + +hgt:70cm cid:76 ecl:#c544c3 byr:2019 +pid:6133497812 +hcl:#efcc98 +eyr:2037 iyr:2015 + +hgt:176in pid:582383714 byr:1980 ecl:amb hcl:08097e iyr:2020 eyr:2021 + +ecl:oth +eyr:2024 +hgt:176cm byr:1923 +iyr:2014 pid:737058734 +hcl:#b6652a cid:203 + +ecl:amb +eyr:2029 +hgt:186cm +pid:440986981 iyr:2010 hcl:#cfa07d +byr:1967 + +pid:8729818647 hcl:z +ecl:#ae70eb cid:168 hgt:161cm iyr:2030 +eyr:2020 byr:2022 + +hcl:#43a092 hgt:165cm byr:1961 +pid:026098019 +iyr:2019 eyr:2020 ecl:amb + +cid:154 hgt:192cm +eyr:2016 iyr:2030 +ecl:brn pid:#8e0762 byr:2020 + +hgt:175cm ecl:brn byr:1944 +pid:553456151 iyr:2016 eyr:2027 hcl:#085f41 + +ecl:gry +byr:1975 eyr:2025 cid:122 pid:111078821 +hcl:#b6652a iyr:2015 +hgt:151cm + +hgt:159cm pid:946458516 eyr:2020 hcl:#a97842 byr:1972 +iyr:2016 cid:88 ecl:oth + +eyr:2023 +cid:156 +byr:1999 +hgt:186cm hcl:#fffffd pid:499141155 +ecl:grn + +hcl:#888785 hgt:165cm pid:864544116 +ecl:gry byr:1937 +iyr:2020 eyr:2026 + +hgt:155cm +iyr:2018 ecl:blu +hcl:#a97842 +byr:1994 eyr:2024 + +eyr:2021 iyr:2019 hgt:175cm cid:127 byr:1982 hcl:#888785 ecl:amb + +eyr:2022 iyr:2011 ecl:blu +pid:202081532 hcl:z hgt:177in byr:1923 + +iyr:2017 cid:213 hcl:#fffffd +ecl:hzl +hgt:193cm pid:564823661 byr:1966 eyr:2030 + +hcl:#623a2f iyr:2014 hgt:177cm byr:1950 ecl:amb +cid:290 eyr:2025 pid:669369557 + +hgt:67cm +eyr:2028 ecl:brn +hcl:411b18 pid:222472243 + +byr:1981 ecl:gry hcl:#b6652a eyr:2033 iyr:1943 pid:832989613 hgt:167cm + +byr:1970 +cid:172 hcl:#64fbcb eyr:2007 +ecl:hzl pid:982450142 +hgt:61cm iyr:2019 + +eyr:2025 +hgt:161cm iyr:1962 +pid:394421140 +ecl:gry +cid:209 hcl:#efcc98 byr:2001 +EOF diff --git a/Advent-of-Code-2020/AOC-4/main.c b/Advent-of-Code-2020/AOC-4/main.c new file mode 100644 index 0000000..895dd00 --- /dev/null +++ b/Advent-of-Code-2020/AOC-4/main.c @@ -0,0 +1,140 @@ +#include +#include +#include +#include + +#if 0 +#define PART_1 +#else +#define PART_2 +#endif + +#if 0 +#define FILE_PATH "example-valid.txt" +#else +#define FILE_PATH "input.txt" +#endif + +char fields[8][4] = {"byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid", "cid"}; + +size_t valid = 0; + +void parse() +{ + FILE *fp = fopen(FILE_PATH, "r"); + if(!fp) { + fprintf(stderr, "ERROR: Could not open file: %s", FILE_PATH); + exit(EXIT_FAILURE); + } + + char line[2048] = {0}; + int field_valid[8] = {0}; + while(fgets(line, sizeof(line), fp) != NULL) + { + if(line[0] == '\n' || strncmp(line, "EOF", 3) == 0) + { + int result = 1; + for(int i = 0; i < 7; i++) + result *= field_valid[i]; + + valid += result; + memset(field_valid, 0 , sizeof(field_valid)); + continue; + } + + char *tok = strtok(line, " "); + while(tok != NULL) + { + for(int i = 0; i < 8; i++) + { + if(strncmp(tok, fields[i], 3) == 0) + { + #ifdef PART_1 + field_valid[i] = 1; + #endif + + #ifdef PART_2 + + char *saveptr; + (void)strtok_r(tok, ":", &saveptr); + char *val = strtok_r(NULL, ":", &saveptr); + assert(val != NULL); + assert(strtok_r(NULL, ":", &saveptr) == NULL); + + if(val[strlen(val)-1] == '\n') val[strlen(val)-1] = '\0'; + + int ival; + switch(i) + { + case 0: ival = atoi(val); + if(ival >= 1920 && ival <= 2002) field_valid[i] = 1; + break; + case 1: ival = atoi(val); + if(ival >= 2010 && ival <= 2020) field_valid[i] = 1; + break; + case 2: ival = atoi(val); + if(ival >= 2020 && ival <= 2030) field_valid[i] = 1; + break; + case 3: + if(strlen(val) == 5) + { + if(!(val[3] == 'c' && val[4] == 'm')) break; + char _val[4] = {0}; _val[0] = val[0]; + _val[1] = val[1]; _val[2] = val[2]; + ival = atoi(_val); + if(ival >= 150 && ival <= 193) field_valid[i] = 1; + } + if(strlen(val) == 4) + { + if(!(val[2] == 'i' && val[3] == 'n')) break; + char _val[3] = {0}; _val[0] = val[0]; _val[1] = val[1]; + ival = atoi(_val); + + if(ival >= 59 && ival <= 76) field_valid[i] = 1; + } + + break; + case 4: + int num = 0; + char valid_vals[16] = "0123456789abcdef"; + for(int k = 1; k <= strlen(val); k++) + for(int j = 0; j < 16; j++) + if(val[k] == valid_vals[j]) num++; + + if(val[0] == '#' && num == 6) field_valid[i] = 1; + break; + case 5: + int valid_ecl = 0; + char valid_cols[7][4] = {"amb", "blu", "brn", "gry", "grn", "hzl", "oth"}; + for(int k = 0; k < 7; k++) + if(strncmp(val, valid_cols[k], 3) == 0) valid_ecl++; + + if(valid_ecl == 1) field_valid[i] = 1; + break; + case 6: + int valid_pid = 0; + if(strlen(val) != 9) break; + char valid_nums[10] = "0123456789"; + for(int k = 0; k < strlen(val); k++) + for(int j = 0; j < 10; j++) + if(val[k] == valid_nums[j]) valid_pid++; + + if(valid_pid == 9) field_valid[i] = 1; + break; + } + #endif + } + } + tok = strtok(NULL, " "); + } + } + + fclose(fp); +} + +int main(void) +{ + parse(); + printf("%ld passports are valid\n", valid); + return 0; +} diff --git a/Advent-of-Code-2020/AOC-5/build.sh b/Advent-of-Code-2020/AOC-5/build.sh new file mode 100755 index 0000000..6be9241 --- /dev/null +++ b/Advent-of-Code-2020/AOC-5/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -xe + +gcc -o main -Wall -Wextra main.c + +./main diff --git a/Advent-of-Code-2020/AOC-5/example.txt b/Advent-of-Code-2020/AOC-5/example.txt new file mode 100644 index 0000000..6b89eb8 --- /dev/null +++ b/Advent-of-Code-2020/AOC-5/example.txt @@ -0,0 +1,4 @@ +FBFBBFFRLR +BFFFBBFRRR +FFFBBBFRRR +BBFFBBFRLL diff --git a/Advent-of-Code-2020/AOC-5/input.txt b/Advent-of-Code-2020/AOC-5/input.txt new file mode 100644 index 0000000..bf62729 --- /dev/null +++ b/Advent-of-Code-2020/AOC-5/input.txt @@ -0,0 +1,908 @@ +FBFBFBFRRR +BBFBFBFRRR +BFFFFFBRRR +BFFFFBBLRR +BBFFBBFLRR +BBFFFFBRLL +BBFBFFBLLL +FBFFBFBRLR +FBFFBFBLLR +FBFBBFFLLR +BFBFBBFLLL +FFFBFFBRLR +FFFBBBFRRR +BBFFFFFLRL +FFFFBBFRLR +BBBFFFFRLL +BBFFBFFRLL +BFBFFFBLRR +FFBBBFFRRL +FBFFFFFLRL +FBFFBBBRRR +BFFFBFFLRR +FFFBBBBLLR +BFFBFFFLLL +BFFBBBFLRR +FBFBBFFRRR +BBBFFBFRRL +BFBBBFFRRR +FFFBFBBLRL +BBFFFBBRRR +FFFBBFFRLR +BFFFFFBRRL +BFFFBBFRLR +FBBBBBBLLR +BFFBBBBLLL +FFFFBBFLRL +FBFBBFBLRR +FBBBBFBLRL +FBBBFFFRLL +BBFBFBBLRL +FBFFBFFRLL +FFBFBFFLRL +BFBFBBBLRR +FFBFFBFLRR +BFBFFBFLRR +BFFBFFFLLR +BBBFFFBLRR +FBFBBBFRRL +FBBFFFFLRR +FFBBBBFLRL +FFFFBBBLRL +FBBFFFBRRR +FBBBFFFRRR +FBFBBFFRLL +FFBBBBFLLR +FBBFFBBRRL +BBFBFFBLLR +FFBBBBFRLR +BBFBFFFLRR +FFFBFBFRLR +BFBBFBFLLR +BFBBBFFRRL +FFBBBFBRLR +BFBFFFFLRL +FBBFBFFRRR +BBFBFBBLLR +BFFBFBBRRL +FFFBFFFRRL +BFFFBFFRRR +FFBBFBBLLL +FBBFFBFLL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ent-of-Code-2020/AOC-5/main.c b/Advent-of-Code-2020/AOC-5/main.c new file mode 100644 index 0000000..2634753 --- /dev/null +++ b/Advent-of-Code-2020/AOC-5/main.c @@ -0,0 +1,137 @@ +#include +#include +#include + +#if 0 +#define PART_1 +#else +#define PART_2 +#endif + +#if 0 +#define FILE_PATH "example.txt" +#define IDS 4 +#else +#define FILE_PATH "input.txt" +#define IDS 908 +#endif + +#define LOWER(min, max) ((max) - (((max) - (min))/2 + 1)) +#define UPPER(min, max) (((min) + (max))/2 + 1) + +#define ROWS 128 +#define COLUMNS 8 + +int highest_id = 0; +int ids[IDS] = {0}; + +void process_pass(char *pass, int index) +{ + int min_r = 0; int max_r = ROWS - 1; + int min_c = 0; int max_c = COLUMNS - 1; + + for(int i = 0; i < 10; i++) + { + switch(pass[i]) + { + case 'F': + max_r = LOWER(min_r, max_r); + break; + case 'B': + min_r = UPPER(min_r, max_r); + break; + case 'L': + max_c = LOWER(min_c, max_c); + break; + case 'R': + min_c = UPPER(min_c, max_c); + break; + } + } + + int id = min_r * 8 + min_c; + +#ifdef PART_1 + (void)index; + if(id > highest_id) highest_id = id; +#endif + +#ifdef PART_2 + assert(index < IDS); + ids[index] = id; +#endif + +} + +void parse() +{ + FILE *fp = fopen(FILE_PATH, "r"); + if(!fp) { + fprintf(stderr, "ERROR: Could not open file: %s\n", FILE_PATH); + exit(EXIT_FAILURE); + } + + int i = 0; + char line[256] = {0}; + while(fgets(line, sizeof(line), fp) != NULL) + { + if(line[10] == '\n') line[10] = '\0'; + process_pass(line, i); + i++; + } + + fclose(fp); +} + +int find_id() +{ + int your_seat; + int seat_missing; + + for(int i = 0; i < IDS; i++) + { + your_seat = -1; + seat_missing = 0; + + for(int j = 0; j < IDS; j++) + { + if(ids[i] == (ids[j] + 2)) + { + your_seat = ids[i] - 1; + seat_missing = 1; + + for(int k = 0; k < IDS; k++) + if(your_seat == ids[k]) seat_missing = 0; + } + } + + if(your_seat!= -1 && seat_missing != 0) + return your_seat; + + } + return -1; +} + +void part_1() +{ + printf("Highest boarding ID is %d\n", highest_id); +} + +void part_2() +{ + printf("Your id is: %d\n", find_id()); +} + +int main(void) +{ + parse(); + +#ifdef PART_1 + part_1(); +#endif +#ifdef PART_2 + part_2(); +#endif + + return 0; +} -- cgit v1.2.3