commit 59f432a8efca67f32ed3a2ecdacd04f9fd9227d5 Author: Kienan Stewart Date: Fri Dec 11 16:13:51 2020 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3cef7be --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +zig-cache/ diff --git a/day1/input-part1 b/day1/input-part1 new file mode 100644 index 0000000..ba38c4a --- /dev/null +++ b/day1/input-part1 @@ -0,0 +1,200 @@ +1322 +1211 +1427 +1428 +1953 +1220 +1629 +1186 +1354 +1776 +1906 +1849 +1327 +1423 +401 +1806 +1239 +1934 +1256 +1223 +1504 +1365 +1653 +1706 +1465 +1810 +1089 +1447 +1983 +1505 +1763 +1590 +1843 +1534 +1886 +1842 +1878 +1785 +1121 +1857 +1496 +1696 +1863 +1944 +1692 +1255 +1572 +1767 +1509 +1845 +1479 +1935 +1507 +1852 +1193 +1797 +1573 +1317 +1266 +1707 +1819 +925 +1976 +1908 +1571 +1646 +1625 +1719 +1980 +1970 +1566 +1679 +1484 +1818 +1985 +1794 +1699 +1530 +1645 +370 +1658 +1345 +1730 +1340 +1281 +1722 +1623 +1148 +1545 +1728 +1325 +1164 +1462 +1893 +1736 +160 +1543 +1371 +1930 +1162 +2010 +1302 +1967 +1889 +1547 +1335 +1416 +1359 +1622 +1682 +1701 +1939 +1697 +1436 +1367 +1119 +1741 +1466 +1997 +1856 +1824 +1323 +1478 +1963 +1832 +1748 +1260 +1244 +1834 +1990 +1567 +1147 +1588 +1694 +1487 +1151 +1347 +1315 +1502 +546 +730 +1742 +1869 +1277 +1224 +1169 +1708 +1661 +174 +1207 +1801 +1880 +1390 +1747 +1215 +1684 +1498 +1965 +1933 +1693 +1129 +1578 +1189 +1251 +1727 +1440 +1178 +746 +1564 +944 +1822 +1225 +1523 +1575 +1185 +37 +1866 +1766 +1737 +1800 +1633 +1796 +1161 +1932 +1583 +1395 +1288 +1991 +229 +1875 +1540 +1876 +1191 +1858 +1713 +1725 +1955 +1250 +1987 +1724 diff --git a/day1/main.zig b/day1/main.zig new file mode 100644 index 0000000..5e01860 --- /dev/null +++ b/day1/main.zig @@ -0,0 +1,94 @@ +const std = @import("std"); + +pub fn main() !void { + var allocator = std.heap.GeneralPurposeAllocator(.{}){}; + var f = std.fs.File { .handle = try std.os.open("input-part1", std.os.O_RDONLY, 0) }; + var buffer : [1024]u8 = undefined; + var expenses = std.ArrayList(u32).init(&allocator.allocator); + defer expenses.deinit(); + + var byte_buffer = std.ArrayList(u8).init(&allocator.allocator); + defer byte_buffer.deinit(); + + var read = try f.read(&buffer); + std.log.info("Read {} bytes", .{read}); + while (read != 0) { + for (buffer) | v, k | { + if (std.ascii.isDigit(v)) { + try byte_buffer.append(v); + } + if (v == '\n') { + var x = atoi(byte_buffer.items[0..]); + //std.log.debug("{}", .{x}); + try expenses.append(x); + // Set the position back to zero, without freeing existing memory + byte_buffer.deinit(); + byte_buffer = std.ArrayList(u8).init(&allocator.allocator); + } + } + read = try f.read(&buffer); + //std.log.info("Read {} bytes", .{read}); + } + //std.log.info("{}", .{expenses.items.len}); + part1(expenses.items[0..]); + part2(expenses.items[0..]); +} + +fn part2(expenses : []u32) void { + var i : u32 = 0; + var elements : [3]u32 = undefined; + while (i < expenses.len) : (i += 1) { + var j : u32 = 0; + while (j < expenses.len) : (j += 1) { + var k : u32 = 0; + while (k < expenses.len) : (k += 1) { + if (k == j or k == 1) { + continue; + } + if (expenses[i] + expenses[j] + expenses[k] == 2020) { + elements[0] = expenses[i]; + elements[1] = expenses[j]; + elements[2] = expenses[k]; + } + } + } + } + std.log.info("{} and {} and {} sum to {} and multiply to {}", + .{elements[0], elements[1], elements[2], elements[0] + elements[1] + elements[2], + elements[0] * elements[1] * elements[2]}); +} + +fn part1(expenses : []u32) void { + var i : u32 = 0; + var elements : [2]u32 = undefined; + while (i < expenses.len) : (i += 1) { + var j : u32 = 0; + while (j < expenses.len) : (j += 1) { + if (i == j) { + continue; + } + if (expenses[i] + expenses[j] == 2020) { + elements[0] = expenses[i]; + elements[1] = expenses[j]; + } + } + } + std.log.info("{} and {} sum to {} and multiply to {}", + .{elements[0], elements[1], elements[0] + elements[1], + elements[0] * elements[1]}); +} + +fn atoi(a: []u8) u32 { + var i : u32 = 0; + for(a) |v, k| { + if (! std.ascii.isDigit(v)) { + std.log.warn("Byte {x} is not a digit", .{v}); + continue; + } + // 48 is '0' in ascii + std.debug.assert(v >= 48 and v < 58); + i += @as(u32, (v - 48) * std.math.pow(u32, 10, @intCast(u32, a.len - k - 1))); + } + //std.log.debug("{x} --> {}", .{a, i}); + return i; +} diff --git a/day2/input b/day2/input new file mode 100644 index 0000000..082b283 --- /dev/null +++ b/day2/input @@ -0,0 +1,1000 @@ +13-17 s: ssssssssssssgsssj +7-9 p: pnlzhcppvl +5-6 z: zzbwrv +7-15 w: wwwwwcqwwwwwwwww +8-9 h: hhhhhhhhsh +12-13 l: mtrkqfllrglll +3-4 t: nntt +10-14 g: svgggggfhqggghlg +3-10 x: djxxxpmcxx +1-10 z: ztzzzgzzzz +3-4 j: jjjjj +3-4 c: fbhnsccbc +2-4 q: thql +15-18 w: tcwzpwzfwwqftvczbw +5-7 l: lblwblbmllqnlbl +3-4 b: bvbfnbb +4-5 f: ffgzf +7-9 c: cctcccccc +5-6 k: szkgsk +2-5 n: nqvnmgnqnsxfn +2-10 s: dsfsbsssltss +12-14 s: ssskrssssssfsxpsqsp +13-15 j: jjjjjjjjjjjjjjjj +16-17 l: jllclhllkgcpljzwk +6-9 f: fsffwffbffbfff +5-9 s: xtzscxsstcss +6-9 h: hmnhshhhhqhrthmh +3-6 x: xxxxxx +9-11 m: mcmmmktmtmmmmm +2-6 r: grrprrsmr +15-16 v: vvvvvvvvvvvvvvwdv +2-14 j: jmjdbhjjjjjjjxnjj +5-9 r: rrwrrrrrr +3-9 b: wbbcbvbtbbbbb +2-9 r: rrtjlplkrgmrrrrxq +9-12 s: sssshsmsssss +2-14 t: qzxxvthtthtthv +2-11 p: pvlsppwmgcspl +12-15 s: dsjqsshdssbssstsssss +3-9 k: tkkkpkkklk +7-15 s: sssssssssssssgsssss +6-9 x: xxxsxzxglpwxl +2-3 x: xxmh +7-9 g: ggsggggggg +4-17 t: vtttrrrhtghfjvnqtttj +1-2 n: jgnpn +11-12 k: vlkkbkkkkklk +9-12 v: vvvvvvvvwvvvv +10-11 j: jjjjljjjjvm +1-5 x: vvxlx +3-4 l: flll +10-11 q: qqqqqqqqqlq +4-5 d: vdvhmpdtrdhdzfdsgk +14-16 b: bbqbbbxbhrbpbtmhbbb +18-19 d: dzpnbxngpgsjtnvtcdd +2-16 v: jtrhtlfhvkbbflfq +15-17 q: qqqsqqqqqqjqqqlqm +5-6 q: tqrhtqqspdqvzqbx +4-8 b: lbbzbwtv +10-13 f: hrsnsfflfffsfjff +10-14 k: kkjkkkkkkkkkkkkkkhk +4-9 c: ccwcccccc +5-7 r: grkrrrwjrrgbdtd +8-12 p: tgspnljpfhtr +5-6 v: vvvvvvm +5-7 v: vvvvvvv +6-8 q: qqqqqdqqq +2-4 v: xfvqvlp +3-4 g: gghb +3-14 z: xflgzzrkzqzxzzxgd +1-7 g: ldsgswgdgdmjlggb +5-10 h: rhhmhhnbdhhqhwp +16-18 m: mmmmmmwmmmmmmmmmmmm +5-11 j: scssgcjjjjpzjjn +13-14 s: wznksvkfvfskfs +3-9 q: qdqqkqtbcnqqqsrklqbf +7-9 c: cccchcmcvdcczwt +15-16 g: gggdgggggggggggg +1-5 k: kkkkkk +7-10 q: qqqqqqqqqqqqq +3-12 b: bbbrhbspbrbfbbqbbbb +3-5 r: gczrgr +2-6 h: whnlvhsftp +8-20 h: fhhhsdfhhfzgmhpqhhjh +15-16 z: sbzzzzzzdzjbwhgb +4-8 h: jgtbmhwb +8-9 s: hssksrnhlsdslssvcsbs +2-6 v: vvvvvvv +13-14 x: xxxxxxxxxxxxnsbx +12-13 l: pgllllltpdfpxlll +2-17 v: vqnncnxkssmhvkzstzgp +4-5 r: rrrhw +8-11 p: pppdppphppp +6-7 t: lrmqtts +8-12 h: hhlthhhhhhhhhtrzh +9-10 g: jpgpmpcrwfkz +12-13 w: wwwwwwwwwwhwwww +5-13 l: jwtlqglllllxkllls +2-4 c: ncpcgd +3-7 l: llslllll +2-5 n: jdfwnn +3-5 z: xctxd +4-6 l: lllrll +6-7 q: fqqqqqqzqqqqq +9-12 c: gccwgwqlcxccchchcrcb +7-12 p: pppgpppppppps +10-16 g: xrgfggzzghtgxgbggg +7-11 d: tdddddqdwdgxldj +11-14 p: pppppbpppppppppp +1-2 j: jhjj +8-9 v: pvvvvvvvcgvq +5-6 n: qcrhnnkktxvdxcp +7-12 x: lfnxxxdxxxxp +10-12 s: sssssssssbsgs +2-3 x: rqhzxmjnjxx +13-14 w: wwwwvwwwwwwwqhww +10-11 t: dgttttgttttt +7-9 w: wdzwwwwjj +4-10 v: vvsjvvbvvncvvvvxv +6-8 w: wwwwwpwq +7-9 j: jtjjjjrjmxg +5-11 z: zzdgztshstzczw +1-4 s: ssss +3-10 p: pqppgrphrpkdmp +9-12 x: xxxqxxxlxxsx +3-4 v: nvswzv +3-9 d: vdjvdcxdkdd +2-10 v: vvjcvvvzvkb +11-14 g: gggzggggggjgghg +4-19 p: pppqppppppppppppppvq +3-5 n: ngznkgdpn +13-14 t: tttwtbtttttxxmttt +3-7 q: qnqqqqqtqqz +3-4 r: rkgr +9-12 l: lqkfljzllqtl +5-8 m: vpmmsnfmtxbcknlmpb +15-19 s: ssptssnhsksnszsdpqss +13-14 j: jsjjjjnjjjjjjjj +6-9 p: ppppppppz +5-8 r: tqzbnvgsvfrx +7-9 h: hhhhhhhhp +8-11 s: ssssssssssss +3-10 t: ttttttttttttt +4-5 g: ngtgg +7-8 n: tnnnnnnqn +12-16 x: bxxxxxzxxxxxxxbxx +1-3 z: zzzt +11-14 x: xxgxxxxxxxwcxfx +6-11 v: rgkkhpkjvvf +16-17 n: nfgnnnnnnnnnnnngvn +3-7 w: wkwwwww +5-16 g: ggggcggwgggggggggg +1-3 l: sjvjlkzrpn +17-19 p: pppppppppppppppptpd +2-6 b: vjjwbqbdbpwsbw +4-8 g: gggggjvgd +2-6 w: pzzpwdm +3-10 g: ggggcggggggg +1-3 v: vxvjcvcpslpfn +9-10 r: qrrwrrjrrr +5-10 m: qbmdzvqmxnnmmmtk +2-14 q: vqttpdjhqvkqzqxz +12-13 r: rrxbrrrrrcrptjrr +13-15 s: cscssssssssssssss +7-10 z: zxbrzxbdbhzzzfzz +2-16 n: skqkxqmqbvbrnspnrgq +14-18 b: bbxsbbdpbnbbbnbbbpbb +5-8 b: bmcrdhbbk +11-13 f: fffffffzfffwffb +5-6 w: wwbwlww +12-14 d: gzxclqbnmnxjlzd +13-19 z: fzzzctzzdsbgzzzzwzpb +2-12 w: lcwwtwwpwffdjqwms +9-10 x: hznxnxxxxxxxgkxx +2-4 g: cwfjtlgf +11-12 k: bqfkkkklkkkkb +2-4 l: llllgxk +5-9 m: cpwmqkzhxs +8-15 b: bbwlwkblvbwdvrjbgsb +3-4 f: ffmff +4-10 c: nqxcqcfcqc +10-12 d: ddqddddddtdhd +3-4 n: dghnnqnn +6-15 s: rsbxbrfmssdknppw +2-13 m: mmkmmmmqdmkmmm +8-12 n: nnnnnnnnnnnn +2-5 d: mdkwd +14-15 l: hllllllllllllgl +6-11 g: jgccfnggggpgkt +4-6 j: jjjtjjjjjj +9-12 v: hgpjjlvhvhljb +2-4 g: jfwdgfr +4-5 f: fhffffchf +16-17 j: jjjjjjjjjjjjjjjjj +1-4 t: tcttwtttttrkt +6-13 x: qmxfxxwxrxdxxxfvgv +6-7 c: cckpccc +3-10 m: qwmmpknsgmdmfvrcvw +2-4 r: rszv +1-7 q: qqqqqqqq +1-6 l: lzlmjl +11-12 q: mqqqqxbqqrqqqdqqbkq +8-11 h: jtvbhxhhphhhh +9-11 b: bbbbfbzbzbb +5-7 l: gljssxddzscvhwrlrb +3-6 c: fxcbccddxxcn +3-5 s: ssssz +17-18 n: jctqdsjchwknkffpnn +8-10 c: crtwbwcfcqkf +3-5 r: qrzqc +7-12 z: zzzzzzzzsfzsz +13-15 p: pppppppppzrllplp +11-12 h: nhhhhjhqhhplhhh +4-5 l: lllll +4-10 g: gggzgggggg +15-16 h: qhhhshrhhfhhhhch +5-7 k: jsrvnjlkq +16-17 p: pppplppppppppppml +13-14 m: xqhmjdmrmmmffr +6-11 c: cccccgccccrccccccc +9-10 l: llllllllxllt +8-9 b: bbbpbbbwbdnkbb +5-9 m: sfmmpmmmzn +5-15 k: kkkkkkkkkkkkkkkckkkk +3-4 h: hhhh +15-19 g: gggwgggrslgxjgfgbfs +12-13 d: dddddddddddxb +6-14 k: kkrgdvhscffwwm +14-16 m: zmmmmqmmmmmmmgmm +8-9 w: wwwwgwwww +1-12 x: xxxxxxxxxxxx +1-5 b: bwrbbfwgh +1-3 t: ftttttttttttttt +10-11 m: mwmmmwkmxsf +8-9 t: tqtttttttdtttt +7-8 z: hzbkpzfg +2-3 h: htblhdhh +3-4 p: pptnlpc +4-7 l: lqlnqhljt +12-14 n: nnnnnnnnnnjnnt +1-4 d: dszd +12-13 f: fvrffffffffkfff +9-15 t: bkzstqvtgtwxtzqttd +6-7 v: vrvvvkgv +6-9 n: knbpnnjnnsn +5-8 n: nznkzzqrbn +9-12 s: ssscssssgsqwsspssp +4-16 q: slqqqqqhqqqqqqdqc +1-3 d: gdttdd +2-6 h: hhqzmh +4-9 k: lkckkpbzkl +8-17 b: bbbbkbbpbbbbbbbbn +1-2 r: bqmrw +8-9 s: ztssqssbz +1-13 s: stbqmhspsdgjs +8-10 z: trnsmlxzmzzzz +6-8 v: vlxvgzbzvvv +3-6 c: xddhwtcbpcf +13-19 g: rjvsgpnfjvzlxxzzgxgm +5-9 m: qffpmxmfmk +14-15 c: dcfwcpxcmvpxxtcbmzhc +6-10 k: jkpbkvghpxksfkkk +2-3 j: jmgjjjj +7-12 z: szrznmkjxnzj +4-9 s: ssssssssss +2-4 h: hkqvfgpsxlnhtrqr +6-11 g: gggglrlgggwv +1-6 v: vrbvlvrvv +4-10 j: jjjjjjjjjz +3-12 k: kkjkkkkkfckgkkkkk +3-15 x: xxrxxxxxxxwxpxg +5-8 v: vvhvvdzvqfrvgqvt +5-17 z: zznzzzzzzzzzzzzvf +4-12 n: fdrncrggjlbgbmwv +6-17 d: tcddhdbdvtsnrdstd +1-10 m: mqljmgchlmsx +4-6 l: fbllbl +8-9 p: kpmtpphwp +3-6 j: sjjjjj +5-6 n: nnnnbs +7-12 p: ppqppngcphpk +5-15 x: xxxxgxxxxxxxxxqx +1-3 p: ppppm +3-6 w: wwwkwww +1-4 r: rrrx +3-4 z: zzznp +12-14 n: tnzwtmnnnnndnfnnn +9-10 d: ddfdddtdddd +4-14 l: hvllsgncmhxhwl +10-15 j: kxftfsmjvjgslsjpp +2-10 g: gtgvggqggggxggdg +1-9 v: cvnxhhffnbcv +1-14 c: ccccccccccccccc +3-8 q: fnqmkbhqtbjqvczq +2-4 v: fvphvgv +10-11 k: kkkkkkkkkpt +1-10 d: dddldkddmdd +4-6 x: xxxxxxxx +4-11 k: kxkfkkkskkrkmk +1-6 n: nlmngnkqww +1-9 j: jjjjjjjjsj +5-6 b: bbbbbb +9-11 q: qqnqqmqqqpq +4-7 r: drrrrsrrz +10-15 n: nnhncnpsnxtnpnqnnghn +3-6 d: ddddddd +4-7 x: bxvxbxjwxgx +1-2 n: cmpwsbjzghgndj +2-4 r: przczfjfrbwj +3-17 k: qbvmqxxffdfpkwxdgxv +7-12 v: llmjvscvjvpvp +2-7 z: vzxzxxz +9-18 r: srdrjcrrrvhrcqrrrr +7-8 f: rffffvtrfsqff +5-8 w: pdcwwvmwwwkzwwjwxks +3-4 c: cccc +15-19 c: cccccccnccclbnplccqc +2-13 f: fffffffffffffff +3-9 t: thrkzdttb +6-11 p: pppppgppppjp +5-8 q: qqqrqfqs +7-11 r: crprgtwwrzp +2-10 f: qfhgfftfdbfnlffffff +4-5 h: dhvvlcw +3-6 s: sffsfws +2-7 b: jrvxbhbp +10-11 w: wwwgwwwwwkb +5-9 d: dddddddddddddkdv +4-14 b: bbbbbbbbbbbbbbb +4-8 x: xxxxdxbqxc +5-9 l: phlkhlllbc +1-2 s: ssgskqvrsrwdt +19-20 x: xcxqxvxxxtstnqxhxxxx +6-7 x: gxxxxgb +4-5 c: cccccc +3-10 q: pzzjqjqpfbqws +4-10 t: ttdttsccttpt +14-18 c: ccrccccccccccccccrc +2-5 x: xxzqx +5-11 c: qbckpccckccccws +5-6 g: gggggg +3-5 n: wknbnnlnnq +9-13 j: jjxjjjnjjjdqjjj +5-9 s: smsxsrfss +2-4 v: vxphvvk +6-7 x: xxxqxxbbx +1-3 g: zrgtghjwd +4-5 n: nmntwnn +6-8 g: ggznggggg +4-5 k: tkkzs +9-10 g: hqdhggggqggk +12-16 w: wwztwmwwspwhmwwz +3-5 m: mmmvmjmmm +3-4 j: jjjj +6-16 z: kzbtzqrkzzcfhvpwjszx +3-9 f: ffwffffffff +13-15 b: bbbmsbbbbbbwbbbbwb +11-14 n: nnnnnnnnnnnnnnv +8-9 v: bvvflvvbjvbtjqrvsxf +1-5 g: gjgnggg +15-16 n: nnnnnnnnnnnnnnwvqnn +12-13 l: lllhllrlllllllll +5-6 l: llmlll +8-9 z: zzqzdzvzzzz +3-4 d: ntdd +4-5 b: sbndbkjxldqpzfbzbqx +2-5 t: bwcfzdlfslsd +4-5 d: dddddd +1-3 t: jtpt +10-12 q: qqqqgqqqqqqmqq +10-19 m: mmmmmmmmmsmmmmmmmgs +2-14 x: xxxxxgxvxmxxxbx +3-13 l: tzljvxspwxdnl +6-10 p: lhnppkpswrppgppzpppn +2-6 j: djgwjjhvpwkcgsfbf +10-11 p: ppppppppprpppppp +7-12 l: lvgcbnlclvjlk +6-11 z: zzzzzzzzzzn +3-5 x: xzvhxnpwbxgxx +4-6 h: hhlrhnl +8-10 b: brngbslhqhb +6-11 s: ssqjxsssdsssss +2-5 s: dbjdjknspbdldfbjd +10-16 z: ctzzzzznzcwzztzl +14-15 j: jjjjjjjjjjjjjjjj +9-13 d: qvdpwddddddddd +10-12 c: ccccchcccccq +3-5 x: xxxxx +13-14 t: ttstttztttttltt +3-16 k: qvfjklgzlwfwnbjklqdx +12-13 g: ggggggtgggggggvg +11-15 j: vqzjvzvxjhjnjtj +7-8 t: tttttttg +6-7 x: xxxxfmn +10-13 m: mmlmmgvfmmmdmmcmmq +7-14 w: wwkwwwwwwwmptwww +17-18 b: bbbbbbbbbbbbbbbbbb +2-8 c: kbvcnrpx +16-17 n: nnnnnnnnpnnnnnngl +10-15 k: kbkjkdkwpkkhkkksklx +2-12 p: pjhdkvwdltvqrhm +2-4 x: vxhxxk +3-5 m: mmfmf +6-8 n: ngnggfnwnn +9-16 b: bnbbbtcbbbvbbrbbbbb +2-8 p: ppphpzppcgptpprhpp +9-12 x: xxxxxxxxxxxx +5-7 d: dknbddd +7-9 r: rrrrrrrrj +3-6 f: fjmfxk +3-4 n: jnnnbjckggnpjnddhx +6-12 d: dznpsfdtdsdndjddvcdd +7-12 x: xxxxxxhqxxxbxbsx +1-2 k: kkfkkkk +4-7 l: lprlqllll +10-13 x: qxxqkjxxxxxxmz +3-8 f: rxfffwcff +4-5 s: cpscszdssc +5-6 t: tttftt +2-6 p: kpvtkprdqhxzpxrbfp +6-12 s: ksnsklwqfssdsbsss +6-7 l: lzlflfl +7-9 t: ttktttttt +8-14 d: hdddzndhsddpfpdxt +8-10 d: ddnddrddvxbzskddzd +11-13 v: mvhvrtvvvvzvrvdv +4-5 g: gggjw +3-6 m: xhmrpm +7-13 k: kkkkkkkkkkkkk +10-13 n: nnnnnnmnngnnnnnn +7-15 m: kcmtmjtmwjmcsbbms +13-16 j: jjjjjjjjjjjjpjjlj +2-4 n: nnmnkn +12-14 j: jjjjjjjjjjjdjj +1-2 c: cchc +9-12 m: mmmqbmlwmmjmzmmml +3-8 r: rrkkrrrt +4-5 k: wckknxkpkktmks +9-10 d: ddddpdddnpx +1-8 q: qmpmxzfqnqctwpprm +10-12 q: sgkfxhqjkqqq +5-11 p: rwpppdlmhpptkbrlp +1-2 d: lzrbxnlcsqhssgdpvjs +5-6 c: scccck +4-5 s: ssshxsssws +3-11 l: nslwgmxmtblzttxxg +10-11 z: zzzzzzzzzzz +7-8 j: bjjjjjqdbjj +7-8 d: glpfjbpdxd +2-4 k: wkvwrk +1-5 c: vtcgcbc +16-17 x: xxxxxxxxxxxxxxxxm +2-11 f: ffffffsfffffffffffff +4-8 m: mrmmmmmmmmmmmm +2-3 x: xvzxx +2-4 h: hxpn +13-17 x: xxxxxxxxxxxrxpxxxx +4-13 q: wcqqtwwmwqqtqmqtqrqq +10-12 d: dddtdqdnjxdzdfdd +13-14 f: jffffsffmffqjff +6-7 d: sxdvddddwqxd +5-11 d: ddddfdddddcdddd +11-14 b: bbbbbbbbbhlbbj +3-4 p: pfpp +4-7 j: jjjgwkgwnfffvfzfl +6-9 l: gknrmjgxtlzcbvkgxb +4-10 n: nnnnnnnnntnnnnnnxn +1-4 r: rjrr +3-4 m: nkmr +9-10 f: fffffffffff +2-6 r: rnhtml +3-12 q: qqkqqqqqqqqkqqqqq +3-10 r: rrnrrrrrrrrrrrrr +6-8 m: bmmmdmmmmdmh +10-12 g: ppdvvxgkhfskfqc +2-10 v: txpvkgvcbqvqfk +1-5 p: tqcvbtp +6-7 z: zzzzzzz +7-16 z: fdjbbkrzjzdbdblhxb +2-4 x: xlkz +4-11 m: glhknzmvqzfmnsbn +6-8 q: qhmdgqvq +8-16 t: tttdtttdtttttttbvt +4-7 v: vptcmgvvjvvvfvvmht +7-8 t: ttttttngt +5-15 t: ztgbttrntttdvgtptjdb +10-12 b: bvndbbbbbbbbbbbbtb +2-3 t: sbqts +12-16 w: wwwwwwwwwwwwwnwww +2-3 m: kmmr +12-15 k: kkmkrkkkkzkdkrgkk +5-13 h: hhhhzhhhhhhhzhhhh +16-17 l: lllllllllllllcllq +1-3 b: bbjb +2-5 t: vtjhmf +4-5 q: vzdqfd +2-3 n: nnnn +7-14 j: jpjjjjjjljjjjjjjj +12-15 j: crsjpjjjqjjfjkv +10-11 t: ttttttttttttt +1-2 j: jjbjsjvhbfssznf +9-13 f: ffmfffffzfffgfff +15-18 g: sgblrqdftpwzggvgqt +19-20 r: rrrrrrrrrrrrrrrrrrvj +1-4 j: mjlt +3-10 x: jxxxxxxxxgxxx +6-7 p: ppptppp +7-8 b: jbmnbmsc +2-6 f: zshfcbhsh +2-5 r: rrrqwtrvclf +3-8 g: chgtwlbg +11-15 n: knnhnnhnnnpnlknnkhnn +3-8 z: zkqlzzpmjph +5-10 b: bbbbhbbbbbbbbbbbbb +6-15 c: ccccdkrncwrcclc +6-7 c: ckcccwdhcc +12-13 t: ntttktttttftttt +5-8 j: jpjzcjjjjj +7-8 k: kpkkksbkkkkkr +9-12 s: sqssssbssxcs +3-7 p: pbbplhtfpktpnppx +5-7 n: ncnnnsn +4-6 s: sssrss +3-16 v: kvvvvvvczvvvvvvvkww +3-6 k: kkkpmk +8-9 h: hhhhhhhmb +7-9 c: czwcccmtckccc +5-7 t: tstglltkt +2-6 c: cccccv +11-14 z: zzzkzqzzzzzvzzz +3-4 d: ddch +4-6 j: jjjjjvj +5-9 c: cccccccccccccc +7-9 j: hjkwpjjbjfsq +4-6 t: tttlcdb +13-15 z: zzzzzzzzzsqzzgzzzkz +8-10 t: ptckdjtsptlmzrktwcw +2-5 n: tnbhnnkvnq +11-12 m: fqmmmmmqmtmkcmmvnwmm +7-8 z: zzzzztvl +6-7 j: jbpjjjjpxmqxcbwsjrjj +2-8 t: ttkdzfwdtflfswlkntt +6-11 j: rnjjjjjjjjj +10-13 f: fwhkbfdfffvfs +5-8 l: pflplntf +3-5 r: rrrrr +16-20 g: gggggggggggggggggggg +1-12 t: xtnsxbjtttxtt +7-9 r: zrrrrrkrnrrrrrrrrr +2-11 n: nrjnnnwnnprnnn +10-12 z: zzzkxzzhznzdz +7-13 d: pdcjdddqddlddcdkdxk +10-15 r: rrrbrrrmvrcphrrqr +1-3 l: rsll +7-8 x: xxxqvrxx +5-14 p: ppcdvppbppppjpbg +5-11 x: dxdxdhkxxvxqxxxfx +6-12 r: pvbfrhqrhftqrrxcrr +4-7 t: zdbtzst +1-13 k: kkkpkghkqkskk +5-17 g: gvggqgggggqmgxggfgg +12-13 l: llllwllllllwf +2-11 b: bbbbbbbbbbbbb +7-17 h: hhhhhhhhhhhhhhhhhh +2-3 w: lwww +2-3 s: vstcs +4-6 s: vssssxss +14-16 r: fmrrrrrrrrrrwwrvrr +6-7 g: dgwgggp +12-16 g: wggxgggrggggzgbgggg +7-9 s: tjhxrscnsscssssnms +3-12 n: nnnnnnnnjnnlnnnnn +7-8 b: zncbmbglqbbbbpgm +12-18 l: lllllllllllvlllllwl +10-16 q: qqqgqfqqqqqrrqgqq +1-7 n: nnnsnrnnnp +10-11 q: qqqqqbqqqqq +5-8 k: bnsfzkkwfkknkccwqkm +4-5 c: ccdcccc +5-9 z: nlsgzzzdz +2-3 k: xkgxhqkpftx +10-13 d: ddddddddhdddddddd +4-6 x: xmjxwxx +14-16 z: zzzzzzzzzzzzzrzq +3-14 n: qnznjvlzdnnrgwfr +7-13 s: sssxsspsssssrz +4-11 k: pkkkcklbkkkk +9-11 x: xxxxxxxxxxtx +4-6 z: zzjzzfz +3-6 d: zddddddz +10-20 c: smccccvcpbccbqcxbccq +13-15 m: mmmmmvmmmjmnnmlpsm +12-13 j: jjjjjjjjjjjjj +3-5 m: pmmbm +7-17 m: mmmmmwcmmdfqrmmhlmm +3-17 g: gcggnggbgdggggggg +10-16 b: sqpsqkfbnbqzswbb +3-4 w: wwwn +5-6 d: dddddpd +12-15 m: mmmmmmdmmmqlmnvms +13-15 j: jjjjjtjjjjjjzjcj +17-18 t: ttttttttjtttttttttt +17-18 d: dcddmchdwbqrllsxjdv +16-17 h: hshghhndnhhfhhhhh +3-5 g: ggggch +6-13 c: ccvccpccccccvcccccc +2-4 h: hbfh +3-9 l: lllptphml +2-3 s: xwrqssfzr +9-13 m: mktmmwmmmmrmmrqmmmcm +8-11 l: rkvxvrglltlc +1-8 q: jfqqxngqnqchq +2-6 x: zxgjxx +5-14 g: mlbgvdglrgcqjgz +4-5 t: tqgtv +2-6 s: ssfnzs +9-11 m: mxwhmmmmmmzm +1-5 d: dbhjzd +2-16 f: fffffffffffkffffff +6-10 b: dbbbbbbbbbbb +5-6 x: xxxmxxcx +7-8 l: lllpllcb +16-17 d: dzdddddddddddddddd +3-10 t: tklkqftnwcj +9-15 g: jccxpmfjgntpptgkkcvt +1-8 r: sdrwgcvprt +4-5 v: nhbwx +17-18 z: zzzzzzzzzzzzzzzzxsz +5-13 l: cbdklqhnklkmwhpp +4-5 f: fffff +1-4 q: qpwq +9-11 x: vxxgrgxxfvvgx +3-4 r: rrfd +3-16 x: sxqxxxxxxxxxxxxwxxx +5-8 s: ssssssss +5-13 b: jbbhqqbblbbbbfcb +17-18 p: ppppppppprpppwppphp +3-9 p: kdpnpfphppvffpwf +7-8 r: jvrrrrrnrpqrn +5-6 m: ncmmdxmm +10-11 v: vvvvvvvvvdl +3-8 g: jlsscggg +1-3 m: gwms +4-5 f: fpkvnf +6-15 j: zfdrxjgxtbkbbjjctmsk +5-6 v: qnnbvvwqvbwqblqd +2-5 v: kvhvt +2-6 x: lxrgsxg +6-8 s: sssxswsjsssxss +1-6 t: dxwjttnqkt +13-14 s: sssssssssssvjg +1-2 t: rtttnf +9-17 h: hjhhhvhhbhhwhhhhphd +2-3 m: mmmwcm +10-12 v: vvvvvvvvvvvv +6-10 j: flcjtzwhwsnjjjrjrj +3-8 d: ddmrddddd +5-8 c: ccccslcrwrc +13-14 s: hpsqtxvkrsssshh +11-15 t: hrxtjgtwtlmpqfx +11-14 l: llbxlsllllqrqlllzlb +3-4 c: crlcvcxwd +3-9 s: vjbsxhwwdvshfxstc +7-8 f: jfhnffbgsfjfwf +15-16 x: ksxqvfsvnxsgvwgpjzl +16-19 g: gggggggggggggggdggg +9-11 h: hhhhhchhzmqhh +2-6 f: kfdlcfrxftzgq +2-8 p: ppnppkpwwmgp +1-2 g: ggfgrg +1-7 n: nnnnnnqwnnn +5-6 h: hzjgthqphwhnjh +10-15 l: xlllllllvlllllll +3-4 l: lzjb +4-6 l: ldzlql +7-12 b: mzlbqzbrqjjbddr +10-13 t: tttttxtttpttt +4-6 d: dddddd +4-5 k: kzvkkrkf +1-2 h: fqml +17-18 f: jhtfdfgmnchprbwbfrf +3-10 s: sjsnsksbdsss +1-17 j: jgcbjmjjjjjcxsjjjjhj +15-16 k: tkjkjbkkrkkkklmgkj +2-13 k: kkkkfkqkkkkkkkkpkk +4-13 d: ddkkdtddzdnnddjdd +1-3 v: fxvnxdvxnrbjs +8-11 s: sssssssssspssssss +1-8 k: khkkkkkkhk +8-9 k: kkktmkkzk +4-9 w: wrqdfwxwnfwwwnmzww +3-5 l: lgtcvl +13-18 n: nnnnnnnnnnqnnnvnnnn +15-17 z: zzzzzzzzzhzzzzqzv +3-5 q: lxnqsvk +8-13 g: rzzwdlzgbcmggct +10-14 d: ddvdbddddnddpd +6-10 d: dphsszqrvz +8-16 b: bnbgfbkbbbqlbcbbgqbb +13-15 d: dddjddmqndddddddvjdd +8-11 q: tnhgqkqfpjhwqgktq +1-3 n: nnnbn +11-12 f: fwfffbfcvflff +7-8 s: sssglsvssvls +2-5 z: zzzzzzzzzqjzz +2-11 m: mhzrwphzxgj +4-6 k: kkkwkd +8-15 m: mrmmmmmzmmmmzmgmm +1-7 w: wwwwwwxwwww +1-3 l: nllllllll +4-5 m: zbshj +3-9 x: xssxqxxxsxkzx +5-9 d: dnpfhsdmrxbvgxqrs +7-12 r: vhrgcnxrvksg +8-10 c: ccccccctzv +16-17 l: lllllllllllllllhl +6-15 n: nnnnnnngnnfhwwzsnnn +6-19 z: zzzzzlzzzzzzzzzzzjv +7-12 b: bxfbbwsjtbbvbqvbmbpb +5-14 g: gggcjggggggggmgg +5-8 d: wdddddkdpd +4-17 x: xtxxxxxxxxxxxxxxmkx +4-10 c: cccccccccjcscv +9-11 v: ttjzfjldvvmswpqt +5-8 r: tjrwhzgfrkgfq +5-8 m: cvhsmnzmncsfmbqmm +7-8 z: krctfpzz +2-6 w: mlnlswvh +12-15 t: zrntxzttqlthfdttt +1-8 r: pkcsjkrrrzxxsfnjw +5-15 p: xbhpkpnngpqvpcwdppg +3-4 t: tttt +8-11 j: wjjjmjjjjjqp +8-14 h: gjslnklhhkhthxh +2-6 q: qqlqqq +3-6 p: pppgppppppppppp +7-11 l: llhllllrllllxldllll +11-12 d: lddkdddddddddd +4-12 z: zwlzzqsvvclw +15-18 c: tflkxflqccwkmlckck +8-12 h: hhhhrhhhhfwhhh +6-9 r: rrrmrjrrvkrrjrdr +8-19 k: tmdlkcktbkkskvkbkbz +1-13 s: ssssssssssssss +4-5 v: xtcfvx +1-15 s: shtssssswghsfsss +2-4 k: krkl +7-12 q: dxqqqhqqqtqj +1-5 r: rrrvvrrrr +5-9 t: ttrttftxztnhtvkcmtth +7-9 g: gngkcggrg +12-13 z: zzzzzzzzzzzbk +3-4 l: lslllc +4-5 t: pqchpk +5-6 h: hhhhml +15-16 h: qhhhhhhhhhhhhhhhhhmh +5-6 d: ddddfs +1-6 d: dthfdzddfnsdddm +14-15 d: ddddddddndhtddsdnddh +5-7 j: qjjjpjplljjc +2-6 q: qqqqqqq +3-4 b: bbbb +5-6 s: ssssjjs +1-6 b: bbbbfb +7-13 m: cpvmbbnnrmzwf +2-4 f: fnhn +6-7 d: gdktlddrdlvmqdtddpzv +4-5 w: cwlww +6-9 z: zmdrgzlmzx +5-10 m: mjbjmmmlmmwxm +2-4 s: ssnhht +8-16 t: tttttttdtttdtttjtt +3-5 z: wxgzhtswb +13-14 l: lllllblpllllchll +4-8 g: vggqzvggnggggggggg +8-9 h: hhthkshhpnhqhgh +4-7 l: hglxklpl +2-3 w: mkmgkwzwmw +6-7 h: hhhhhrz +4-6 f: tdffff +1-7 l: lmfhgqschjqglrvwwnnz +12-13 g: gggggggggggfhggg +2-10 m: ntmmmdjmmmsvmm +1-2 s: sqsssssssssss +3-8 f: frnthfcfxfft +7-16 w: wwwwwwmwwnwwwwmk +11-13 j: jjkjrjjjjjjjjjd +3-4 s: ssvc +3-13 t: ddttttnnqpqztzbbdv +3-5 g: gggggg +3-4 r: rrrzlklfljqvz +5-12 m: kdgmmrszqpfsbmz +11-14 g: gqgvzgxhgbtngxggh +7-16 k: qqptmhhfkhsgkhbmkx +5-8 p: ppppptppp +2-17 x: vxtxpvnxvlctrcpfxxx +2-3 w: bwmwjwwwwwtnqwxc +4-5 g: gggggg +4-7 z: znzwzzzs +4-5 v: kvvvv +10-14 r: rrrrrrrrrbrrrx +4-5 t: xtttt +4-11 w: wwwwwwdcmkrwx +6-7 c: ccccccjc +12-14 w: wkwwwwwwwhwlwwwk +5-9 s: hmssssssssss +2-4 r: rrrjsh +12-13 m: mmmmmmmmmmmmmx +3-5 s: sshsvssss +4-5 l: xllwnshchfdfk +16-18 w: wwpwwpwwwmwwzwwtwwww +2-9 c: zsfgbrrprlszrr +10-11 n: thnmfndnnbnnbhnnnn +13-14 v: vvvcvvvvvvvvvvv +3-4 n: rwcm +14-15 t: tttttztttttttpjt +5-8 j: jjjjwhjdj +5-8 f: fffffffm +6-7 z: zzqzzzz +12-19 j: kjrfnsjnhjdzgqpcjzvh +3-7 p: pxpdvcqdptxpvk +1-4 c: wccqj +1-2 w: pwsqhwjdhcm +2-3 b: bfbn +10-19 q: qqqqqqqqqtqqqsqrqqq +5-8 p: pppppppppppppppp +10-13 g: rjghslgbggkgjdgvp +3-9 z: fnnfzzdnf +9-16 g: tlgtgggggggggggqm +3-12 r: rrrvccrrvbdbncrrr +1-4 v: jvhbv +15-16 v: vvvdvvcvvvpvvvvvvvv +3-4 g: ggggg +7-8 w: wwwwwwmpw +4-9 s: gkxshzkpssc +2-8 q: pqttnpqqqfwqs +3-4 n: nlnp +3-4 h: phhh +16-18 g: hqsxhmmpfgggmgpqhrjg +15-17 w: wwgwwwwwwwwwwwmwl +7-9 x: xxxxxxmxv +1-7 s: ssssssbs +1-3 x: dxlxxx +3-6 p: wpxppq +5-7 c: clcclcfcbccc +3-5 s: sbmst +3-5 d: xqmdn +5-10 z: zbzwfddkzzc +18-19 d: dpdddddddddddddddwcv +3-4 r: rrrr +8-9 f: ffnffffwd +12-16 h: hxnlxghzkpcpdhqqvl +6-7 m: jngclmm +5-13 m: rmmmpmrmmmmmjmmmm +1-3 f: dfwfs +7-8 l: lclllwllll +16-18 j: jjjjjjjjjjpjnjjgjbj +12-15 f: fffffffffffnfftfffff +9-13 w: qbnpmklbwxdbbwkklpwb +1-3 j: mjkj +1-3 h: hphwdh +3-5 x: vrxxb +1-15 v: mvvvvvvvvvvvvvj +8-12 v: lvzfvzvvnjtvvvvvv +4-6 g: gggvggggg +13-20 l: zdllslnlxslqpnvgwlwm +2-4 l: lllhll +3-14 k: kckzddtzbmvkpkhb +4-5 k: hbkgbxzj +2-4 p: lppp +2-11 r: rrrrrbrrbrrrrwrrrwr +4-7 k: knkqkkk +7-8 r: njrrrrrrrr +4-7 h: phhhnhdhc +4-5 r: nsnrrfktwbbhrrrh +4-5 q: qqzvzsvkq +6-7 b: jbbbbbbbkbgb +5-11 f: ffffcfffffgff +12-16 v: vfvvqvvdvvvlhvzjvmzv +9-10 v: vvzvvtvvjgvv +1-7 v: vvvvvvvv +3-12 z: zmncxhrdzdmtcbxtlrzq +3-7 r: rbfbrjrr +12-13 n: nnnnnnnnpnnldnn +5-12 j: jjjjjjjjjjjlj +3-6 s: sssfsgss +13-17 h: hhhfhhhhhhhhvhhhhhhh +5-10 g: gggxkggggvg +1-4 b: hbbtb +14-15 t: tttttttttttttnb +7-14 d: ddddddddddddddhdw +15-16 d: rbdddbdwmjdhmpdd +7-13 s: kxpdntprmskcs +3-5 m: gmdmpj +4-5 j: jjjjjvjsj +1-14 q: qmqqqntqcqxmqsqkqq +4-5 q: tqxqq +8-11 m: mmmxmmmvmmv +5-8 q: qqqqrqqw +5-15 d: dqdddddddddddvspd +1-4 t: tttttt +12-15 z: dhzzxwfjgnzhzxt +8-11 v: kdnmfnmqvvdvqdlvk +16-18 s: sssssssssssssssjstss +2-5 c: ccwdccc +3-11 x: nxjxxxxxxxxxxx +13-15 v: vvvvfvvqvlvvvvvv +4-11 s: sssszssnqjsbsvs +9-18 j: gxhjjjjjnjjsjjjrjjjj +3-4 t: ttfttt +9-10 s: qzgxjhpsss +9-10 q: qqqqnrtxrqqsqqq +6-13 k: kkkrgspkkkpwjshmk +9-12 h: xhhhmhbhhhdhh +3-12 g: gfgggggjgggggggggg +13-15 z: zzfzzszzzzzzvzzzhzw +5-15 m: mzrmmmmndchfzmmrr +5-10 z: zzzzzzmzzh +4-5 s: wscfc +3-6 m: kmmtmm +5-7 h: hhhhchh +4-14 w: wwgwwwqwsfrjvmbwj +2-9 v: vwvvwvmjcqnxv +9-10 x: qxxhfxchrx +17-18 x: xxxxxxxxxxxxxxxxwp +4-6 v: vvvvvtv +11-14 l: lcqlclllllrlddxlzll +1-4 r: trrn +10-13 h: thnsxphnfgvhvq +11-12 s: sssssssssshsss +10-11 z: rqpzszzmzdz +3-6 q: qrqqqq +5-6 h: hhkhhhh +8-16 h: wqhjvhlgwtsgvlpf +3-6 f: gqfpcfsfhfjgrbqv +3-5 l: lqllsrjlv +6-10 v: vvvvvvkvjv +3-8 t: gtttcbnkxxstttd +2-6 j: jjjjbjz +10-15 j: ftwjtfzjmjsvwjj +8-11 d: ddsksddddzfd +2-3 b: bhngbb +14-16 c: mllmcbfxwxrqlcjcw +7-8 q: qqqqqqdv +5-6 s: slkzlfvg +3-5 q: qqqqq +3-12 p: pddpdpszrppxcpjgv +11-18 r: rrrrrrrrrrprqrrrrr +3-4 c: cscckcxcn +11-13 g: gvgwmlngggqggrtgtkg +5-7 b: smfpbbb +7-18 l: sqmlklvkqfjrgtqhzr +6-7 k: kkpqqfgz +7-9 n: fnndnnxnndn +11-12 c: ccccccccccxv +6-9 d: dddvdddddddvd +1-4 v: nvjfv +3-8 g: gggggggg +6-7 x: xxxxxxx +4-5 c: scccc +6-13 q: nchlfqqqlqnqqqtq +1-8 r: srrrrrrnrrrrrrr +4-5 p: sdpscpppp +9-11 r: rrrdrkrrrqg +3-5 m: xwmscmmm +7-11 r: rrrfrrrrkfrvrf +4-6 b: bbfbbb +4-9 v: rblrvrvpvz +2-8 w: wwwvwgwww +8-9 w: wwwwwwwwzw +16-18 t: ttttttttttttttttttt +8-9 n: nfrzsdjxr +1-2 w: wwfwwmfbww +2-4 s: dfsksft +1-13 d: dwdrccnddqmndcl +1-4 f: qfflf +3-7 d: dnddjpdfgc +3-5 l: lkglx +1-13 j: jjjjgbjtpjjhd +15-16 j: jjjjjjvjjjjjjjjjdjj +4-13 t: tttxztttttttkt +4-5 m: mmmmm +4-6 j: jgjrjwjfjx +8-11 t: ttbjttvttsttdqtn +14-15 w: wwwwwwwwwwwwwkjw +1-6 x: nrscxn +3-13 w: wwwwwvgnwbwwwwwwv +12-15 p: pppppppppppjpppppppp +5-11 v: vvvkvbvwkwnvvvsxvv +1-11 m: mmmmmmmmmmtm +10-11 c: cccccccccwc +5-8 f: xvgstwfxfhxknds +12-13 t: tttttztttttttt +4-17 k: vkpkfkkkqnkqnkgkkknk +9-12 k: kkwpzpdzxhxk +14-17 v: fgvvvvvvvvvvvjpvv +7-8 k: kndnqkkk +7-11 c: gfcbccccjvcskcmrcxc +4-5 n: ngtnr +3-12 k: mtcfszkdhkdkd diff --git a/day2/main.zig b/day2/main.zig new file mode 100644 index 0000000..0df591a --- /dev/null +++ b/day2/main.zig @@ -0,0 +1,129 @@ +const std = @import("std"); + +pub const Policy = struct { + min: u32 = 0, + max: u32 = 0, + value: u8, + password: []u8, + + pub fn matches_policy_one(self: *Policy, s: []u8) bool { + var c : u32 = 0; + for(s) | v | { + if (@as(u8, v) == self.value) { + c += 1; + } + } + var valid = (c >= self.min and c <= self.max); + //std.log.debug("{} is {} for Policy {}-{} of {c} [{} found]", + // .{s, valid, self.min, self.max, self.value, c}); + return valid; + } + + pub fn matches_policy_two(self: *Policy, s: []u8) bool { + var n_matches : u32 = 0; + if (s[self.min-1] == self.value) { + n_matches += 1; + } + if (s[self.max-1] == self.value) { + n_matches += 1; + } + return n_matches == 1; + } +}; + +pub fn main() !void { + var allocator = std.heap.GeneralPurposeAllocator(.{}){}; + var f = std.fs.File { .handle = try std.os.open("input", std.os.O_RDONLY, 0) }; + var buffer : [1024]u8 = undefined; + + var byte_buffer = std.ArrayList(u8).init(&allocator.allocator); + defer byte_buffer.deinit(); + + const stdout = std.io.getStdOut().writer(); + var n_valid : u32 = 0; + var read = try f.read(&buffer); + std.log.info("Read {} bytes", .{read}); + while (read != 0) { + for (buffer) | v, k | { + // We're through the read part of the buffer + if (k >= read) { + break; + } + if (v == '\n') { + var p = parse_policy(byte_buffer.items[0..]); + if (p.matches_policy_two(p.password)) { + n_valid += 1; + } + try stdout.print("{}-{} {c}: {}\n", .{p.min, p.max, p.value, p.password}); + //std.log.debug("{}", .{x}); + // Set the position back to zero, without freeing existing memory + byte_buffer.deinit(); + byte_buffer = std.ArrayList(u8).init(&allocator.allocator); + continue; + } + try byte_buffer.append(v); + } + read = try f.read(&buffer); + std.log.info("Read {} bytes", .{read}); + } + std.log.info("{} valid items", .{n_valid}); + //part1(expenses.items[0..]); + //part2(expenses.items[0..]); +} + +fn parse_policy(line: []u8) Policy { + var min : u32 = 0; + var max : u32 = 0; + var char : u8 = 0; + var pass : []u8 = undefined; + + var start : usize = 0; + var got_min = false; + var got_max = false; + for (line) | v, k | { + if (v == '-') { + min = atoi(line[start..k]); + start = k + 1; + got_min = true; + } + if (v == ' ' and !got_max) { + max = atoi(line[start..k]); + start = k + 1; + got_max = true; + } + if (v == ':') { + char = line[start..k][0]; + start = k + 2; + } + if (k == line.len-1) { + pass = line[start..]; + } + } + return Policy { + .min = min, + .max = max, + .value = char, + .password = pass, + }; +} + +fn part2() void { +} + +fn part1() void { +} + +fn atoi(a: []u8) u32 { + var i : u32 = 0; + for(a) |v, k| { + if (! std.ascii.isDigit(v)) { + std.log.warn("Byte {x} is not a digit", .{v}); + continue; + } + // 48 is '0' in ascii + std.debug.assert(v >= 48 and v < 58); + i += @as(u32, (v - 48) * std.math.pow(u32, 10, @intCast(u32, a.len - k - 1))); + } + //std.log.debug("{x} --> {}", .{a, i}); + return i; +} diff --git a/day3/input b/day3/input new file mode 100644 index 0000000..6333a60 --- /dev/null +++ b/day3/input @@ -0,0 +1,323 @@ +..#...##...###.........#..#..#. +#.###........#..##.#......#...# +#.#.###..#.#..#.#............#. +.##............#......#...#.#.. +..#..#.....##..##..##.......... +...#...........###.#.##........ +....#.#...#..#..##............# +....#....##...##..##........#.. +.#..#..#....#...#..##.....##... +.#.###..#......####........##.. +..#...###....#......#.....##.## +..#...#.......#......#..##....# +#...##....#.#..#.......#....#.. +.#......#..#...........#....##. +.##.#......#.#.#.....##........ +.....#.................#.#..#.# +....#..#........##......#..#.#. +..#...#..##.......#..##...#..#. +..#.......#.............#.#.... +.#.................#.........#. +..#..#.#.#.#............##.#..# +.#.#.##.#.....#.....#..#......# +..#.#..#.#..........##........# +.........#...#.....#.#...#####. +##..#.....##.##........#...##.. +.#.....#....##.#..#....##...##. +.##.....#.#....#.#.....#......# +.....#..#.##.....#.#....#.#..## +#......##..##....##...###..#... +.......#..#...........#......#. +#...#......#........#..#....... +##..#.....##.....#...#...#....# +.###..##..#.#........#..#.#.... +#.#...#...#......##........#.#. +......#....#.#........##...#..# +.#.....#..#.#.....#......##.... +.....#.....#.#.#....###.....#.. +#.......##.#......#.#.#....###. +.......#..#..#...#.#.##........ +.#......##..#.........###..#... +....#..##.......##.###...###... +.##............#..#.##.....#.## +..##.#.......##....#.......##.# +#..###............#.#...#...#.# +...##.#.#.#..#.##........#.#... +.#.....#...##.#..###..##.##...# +..............#.#.#.........#.. +.....#...........#.#...#....#.. +.....#...##.##.#....#.###..#... +#..###.........#......#.#.#.... +.....#..#...##...###.#....#.... +#..........#.#.#....#..#......# +###...................#......#. +........####......#.#.......... +.......#.....#...#.......#...#. +.....#.....................#... +...#.#...#...#...........#..... +..#.........#...#....###..#.... +.....#.#..##......##........##. +..#.............#............#. +.#....##.......#..#............ +.#............#.#..#.##....#... +.####...##.#....#.....#...#.... +##..#....#.#.#...........#..#.# +...#..#...........#...#..#....# +.....##.....#..#...#.........#. +...##........#....##........#.. +.##.#...#...#..#.....#....##.#. +#.#...#.#.#.#.#..#....#....#... +#..#.#...#..#........#....#.#.. +....#.#.....#......##...#....#. +.###.##...#....##.#...###..#..# +###..#...##..#......#.........# +..#.#......##.......#.....#...# +..#...#........#.........#.#... +#....#..#.........###.#......## +...#..#....#...#.......##.#.#.. +....#.......#....###...##.#.... +..#.....#.#.....###..#####....# +##......#....#.....##..#..#...# +#...........#..#..#....#....#.. +.#...#.##.#.#.#....#......#..#. +.......#.#....#....#...#.#..#.. +..#.#..#.##..##...##..#..#..... +...##.##.................#.#... +.....#...#......##.#....#.....# +......#..##.#..#.#.........#... +.............##.#......#....... +..#.#.....#...#.#.....#..#..... +.........#..#.#......#..#...... +#..#.#.##..........#.##......## +......#.......#.....#..#.#...#. +.#....#....#.#.....#.......#... +#..#..##..................#.... +............#...........##.#... +####...#..##.#....#.##..#...... +#...#...#.....#.#...#.#........ +.......##.........#.....#.....# +.....#...........##......#.#### +.##....#.#.##......###.#.##.... +........#.####.......#.#...#... +.#.#...##.#.#.#.........##..... +....#............###.##....#... +...##........##.#...#....#..### +..#.#.........#....##.#........ +..#..##..#...##..#.##...#.....# +.#......#..#..#.........#...... +..#........##.#......#.....#... +.##.......#....#.#......#...... +#........#....#.####...#.#..... +##......#.............#....###. +..#....####.#.#.#.#...##......# +#.#.#.....#...#.......#...##... +........#...#....#..#......#.#. +#..#...#.#.##.....#.#....#....# +#...#....#......#.........##.## +..##.#..##............#........ +#.........####.........#....... +#.##.........#..##....#.#.#.#.. +.###......##..#.#.....#.#...##. +...#.........#.#...##.##....#.. +#..#......#....##..#.#...#...## +...#.......#.#.#.....#..##...#. +....................###........ +#...........###......#.#...##.# +.................#.#...###....# +...#..###..#.##...#..#....##... +###..#..#.#...#.....#.#.......# +.........#..#.#.....#.........# +.##..#.........#.#.....##...... +.....#..........#.#.##....#.... +........#.##.....#...##...#.... +#.#.#...#......##....#.###..... +.#.##.....##.....#....#.##.#.## +.#...#.....##.#.##....#.....#.# +...#.....#........#............ +##...####..#....#..##...#...... +#.......#...#.#...#........#..# +......#.....#....#..#..#.#..... +..............##.....#.##....## +.#..##.........###..#.......... +......#......#............#..#. +#.....###...###..........#..... +...###...........#....##..#.... +.....................#...#.##.. +###....#.#....#...#....#.#..##. +..#.............#.#....#..#.#.. +.......#..###....#...#...#...#. +.##..#....##..............##... +...#...#..#..#.##.#....##...#.. +#..#....##......#....###..####. +.##...#.#....#..#..#....#....#. +.#.##..#..#.........#.#......## +#..#.................#.....#... +..#............#........#...#.. +##.##.......#.#....#..#....##.# +..##...#.#.....#......#........ +......#.##.........##...#...... +......##.#......#.##....##.#..# +.#.#......####.#.#.#.#..#...... +..#.#....#...###....#.#...###.. +.#.#...#....##..###.#..#....... +..#.....##..#............#..#.# +.#...#....#.....#....#..#.#.#.. +..#....#..#......##...##......# +....#.......#.##.#.........#..# +#............#...##.....#..##.. +......#..#..........#.#..#..... +...........#.#..#...##.#...#..# +.........###..#......##.###.#.. +.....#....#......#...#....##... +..#.......#..#.#.#......#...... +.#....#.....#.#.#.##...#....##. +....#.##.##.......#..#.....#... +.#.....#......#.......#..#..... +....###.....##.....##..#.#...#. +#.......#.#....#.#.#....#...... +#...#..#.#......#...##.#....... +....##.##....#..#.......#..#.#. +.#.##.#.#..#.....#.#.......##.. +..#..#..#..#.###............... +#.#......##....##.#.#.....#.#.. +..##...#.........#.#..#.##..#.. +.........####...#.....##.#..... +..#...................#.###.... +..#.....#..#....#..#........... +.....###.#.........#.#......... +#..#..#........#..#......#..#.. +###..##...#.......#........#.#. +.#.#.#.###.#............##..... +#..............#......#....#.## +.#...#..###...###.#..#.#....... +.###....##.#.......#.#.....###. +.##.....#.#.................... +#..#.....#.....#...#.....#..##. +#.#....##..#......##..#...##..# +...........#....#..#.##.##....# +......#.......##....#.#....#.#. +###..#.#..........#.......#.#.. +..#.#..##....##............##.. +..#.....#..#....###............ +.#...#...##...#..#..#..#.#....# +...#....#........#............. +#.#......#.#.....##..........#. +....#..#...............#...##.. +........#..#....#..#..#..##.... +....#......#.#.#...#.......#.## +.#.....#.#.#........###....#... +.#..#.......#...........#...#.. +#.#.#####..#......#...#.#.###.. +...##...#.#.....#..#...#...#... +..#....#.....#..#....#.#.....#. +....#.......#.....#........###. +..##..........#...###.......#.. +#.#.##..#........##...#.#...... +....##...#......#..........#.#. +#.......#..#.##.............#.. +......#..........#...#....#...# +#.#.....#.##.#.#.............## +#...#.........##.##......#.##.. +.........##.....#....#...##..#. +#.#...##.#...#.....##...#..#..# +......##.#.....#.#.....#.##.... +....#.............#...#.......# +.#......##...#.#...#.##........ +...#..#..#...........#..#..#.#. +.#...#...........#.#.##....#... +..#...#...#.#..#....#..#..#.... +..###..##..#..#.........#.#..#. +....#.##.#...#.......#...#..... +.#.#.................#.......#. +.#..#.....#.##...#.#.....#...#. +.#.......#...#....#.......#.... +###....##....#..#...#.#..##.... +.........#.#.#.#...###.......## +....##.......#......#......##.. +......##.###.#..#...#.#.#.#.... +.#.###.#.#......#.#.......##... +.#.....##..#.#.....#...#.##.... +.#..##.#.....#........###...#.# +.......#.#...........#........# +..........#...##..##.......#.#. +...#..#..#...#....#.#......#.#. +....#...#..#....#....#.#.##.... +...#.#...##...#...##..#........ +..#........#...##.#...##.#.#.#. +...##.#..#.......###.#.#.#..... +..##......#.#.#.........###.#.. +.......#.#...##...#.#.......#.# +.#....##..#..#....#..#...#..... +.#....#.#.......#..#..##.#....# +#.#..##..#.#............#....#. +##..#....#.##.#....#...#..##... +.###.#.#..#...##........###.##. +...........#..#...#..#.#..###.. +.#.#.#...#....#...##.##........ +.....###.........#......#####.. +#.#.#.....#....#..#...#.#.#.#.. +..##.....#..#..#.#.#...#....#.# +......#.##..##..#.#.#.......#.. +...#.#..###.........#........#. +......#.##..####...#...#..#...# +#.......#.........#....#....### +#......#...#........#.##....### +.#.#..............#...#...###.# +.#....####...#..##.###.....#... +.......#......#..#...#..##.#... +...........#.......#........... +..............#...#.#.#.#...##. +.###.....##.#.....#..........#. +##.##......#....##..#.....###.# +#.......#...##...#....##...#... +##.#.##...#....#....#....#..... +.....####...........#.#......#. +......#...#....#..#......#..... +...#...##..........#.......##.# +.#....#..........#.####........ +...##...#..#...##........##..#. +.........##....#...##..#.##.#.. +##.#.....#.......#.....#....... +#..#....#.##.#........#........ +#.#...#...##........#.#.....### +....#...................#.#.#.. +.......#..#.#...#....#.##.#.... +....##...###.#.#.##...#...#.... +.#....#....#...##.#......#...#. +............##..#.#.#........#. +...#....#.....#......#........# +...#.#.....#.##.....#....#...#. +.....#..##.......#.##.......#.# +........##................#.... +....#..###...##.#..#...#......# +.#.#.......#.......#....##.#..# +..#........#............#...... +..##.......#..#..#....#....#..# +#...###.......#.##...#......... +.....#...#...#..##..#....#..#.. +.##.#..#...##.........###.#.... +..#.#..#...#...####.#...#.#.#.# +#....#..###.....#......#.##..## +##......#...##...###......#.##. +...........#.....##...#...#...# +..#..#.#.....#..#.....###...#.. +.............#..........###...# +....##............#....###.##.# +..##.#..##.....#.#.........#.#. +....#.#...........####......... +.##.###.##.#.#......#.##.#.#... +.....##.........#..#.......#... +...........#.........#....###.. +...#.#..#..........#.....#..#.. +.#..###.......##........#.#.... +.#...###.....#..#.#..#...#.##.. +##...###.#.#....#......#...#..# +....#.......#..#..##..#.#...... +#.#......#.##..#......#..#....# +....#..#..#.....#.#......#..#.. +..#...###......##.............# +..#....####...##.#...##.#...... +.....#.......###............... +.......#...#.#.......#.#.##.### +.#.#...#.....#...##.........#.. +..#..........#..#.........##... diff --git a/day3/main.zig b/day3/main.zig new file mode 100644 index 0000000..e12163d --- /dev/null +++ b/day3/main.zig @@ -0,0 +1,134 @@ +const std = @import("std"); + +pub fn main() !void { + var allocator = std.heap.GeneralPurposeAllocator(.{}){}; + var gpa = &allocator.allocator; + + var f = std.fs.File { .handle = try std.os.open("input", std.os.O_RDONLY, 0) }; + var buffer : [1024]u8 = undefined; + + var byte_buffer = std.ArrayList(u8).init(&allocator.allocator); + defer byte_buffer.deinit(); + + var map = std.ArrayList([]u8).init(&allocator.allocator); + defer map.deinit(); + + const stdout = std.io.getStdOut().writer(); + + var read = try f.read(&buffer); + std.log.info("Read {} bytes", .{read}); + while (read != 0) { + var last_pos : usize = 0; + for (buffer) | v, k | { + // We're through the read part of the buffer + if (k >= read) { + break; + } + if (v == '\n') { + try map.append(try std.mem.Allocator.dupe(gpa, u8, byte_buffer.items)); + last_pos = k + 1; + // Reset buffer + byte_buffer.deinit(); + byte_buffer = std.ArrayList(u8).init(&allocator.allocator); + continue; + } + try byte_buffer.append(v); + } + read = try f.read(&buffer); + std.log.info("Read {} bytes", .{read}); + } + + std.log.debug("Map has {} items", .{map.items.len}); + //for (map.items) | v, k | { + // try stdout.print("{s}\n", .{v}); + //} + var results : std.meta.Vector(5, u32) = [_]u32 { + sled(map, 1, 1), + sled(map, 3, 1), + sled(map, 5, 1), + sled(map, 7, 1), + sled(map, 1, 2), + }; + std.log.info("Hit {} trees on slope 1,1", .{results[0]}); + std.log.info("Hit {} trees on slope 3,1", .{results[1]}); + std.log.info("Hit {} trees on slope 5,1", .{results[2]}); + std.log.info("Hit {} trees on slope 7,1", .{results[3]}); + std.log.info("Hit {} trees on slope 1,2", .{results[4]}); + std.log.info("Multiple of each slop hits: {}", .{@reduce(.Mul, results)}); +} + +fn sled(map: std.ArrayList([]u8), right: usize, down: usize) u32 { + var map_height : usize = map.items.len; + var map_width : usize = map.items[0].len; + var x : usize = 0; + var y : usize = 0; + var n_trees : u32 = 0; + while (y < map_height) { + var char : u8 = map.items[y][x]; + std.log.debug("{},{} : {}", .{x, y, char}); + if (char == '#') { + n_trees += 1; + } + y += down; + x += right; + x %= map_width; // loop around + } + return n_trees; +} + +fn parse_policy(line: []u8) Policy { + var min : u32 = 0; + var max : u32 = 0; + var char : u8 = 0; + var pass : []u8 = undefined; + + var start : usize = 0; + var got_min = false; + var got_max = false; + for (line) | v, k | { + if (v == '-') { + min = atoi(line[start..k]); + start = k + 1; + got_min = true; + } + if (v == ' ' and !got_max) { + max = atoi(line[start..k]); + start = k + 1; + got_max = true; + } + if (v == ':') { + char = line[start..k][0]; + start = k + 2; + } + if (k == line.len-1) { + pass = line[start..]; + } + } + return Policy { + .min = min, + .max = max, + .value = char, + .password = pass, + }; +} + +fn part2() void { +} + +fn part1() void { +} + +fn atoi(a: []u8) u32 { + var i : u32 = 0; + for(a) |v, k| { + if (! std.ascii.isDigit(v)) { + std.log.warn("Byte {x} is not a digit", .{v}); + continue; + } + // 48 is '0' in ascii + std.debug.assert(v >= 48 and v < 58); + i += @as(u32, (v - 48) * std.math.pow(u32, 10, @intCast(u32, a.len - k - 1))); + } + //std.log.debug("{x} --> {}", .{a, i}); + return i; +} diff --git a/day4/build.zig b/day4/build.zig new file mode 100644 index 0000000..7f5f614 --- /dev/null +++ b/day4/build.zig @@ -0,0 +1,27 @@ +const Builder = @import("std").build.Builder; + +pub fn build(b: *Builder) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard release options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. + const mode = b.standardReleaseOptions(); + + const exe = b.addExecutable("day4", "src/main.zig"); + exe.setTarget(target); + exe.setBuildMode(mode); + exe.install(); + + const run_cmd = exe.run(); + run_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); +} diff --git a/day4/input b/day4/input new file mode 100644 index 0000000..fdedcca --- /dev/null +++ b/day4/input @@ -0,0 +1,1138 @@ +eyr:2028 iyr:2016 byr:1995 ecl:oth +pid:543685203 hcl:#c0946f +hgt:152cm +cid:252 + +hcl:#733820 hgt:155cm +iyr:2013 byr:1989 pid:728471979 +ecl:grn eyr:2022 + +hgt:171cm +iyr:2013 pid:214368857 hcl:#cfa07d byr:1986 eyr:2028 ecl:grn + +hgt:167cm cid:210 ecl:brn pid:429131951 hcl:#cfa07d eyr:2029 iyr:2010 +byr:1945 + +hcl:#888785 iyr:2015 +hgt:170cm pid:893805464 ecl:amb byr:1966 eyr:2028 + +hgt:170cm ecl:amb +hcl:#c0946f eyr:2020 iyr:2016 pid:725010548 +byr:1928 + +byr:1999 hcl:#888785 +eyr:2026 +ecl:hzl +iyr:2016 hgt:193cm pid:170608679 + +eyr:2024 iyr:2016 hcl:#cfa07d ecl:grn byr:2001 pid:391942873 cid:104 hgt:164cm + +iyr:2019 +eyr:2025 pid:138912840 byr:1996 +hgt:166cm +hcl:#888785 ecl:grn + +iyr:2023 hcl:a58381 pid:#401a29 eyr:1940 +byr:1920 +ecl:utc hgt:183cm + +pid:493510244 ecl:gry hgt:153cm byr:1950 cid:181 eyr:2028 +hcl:#ceb3a1 +iyr:2020 + +iyr:2018 pid:074340974 hgt:182cm +hcl:#866857 byr:1988 ecl:hzl eyr:2023 + +hcl:#866857 ecl:oth byr:1977 iyr:2014 hgt:180cm pid:860745884 +eyr:2023 + +eyr:2026 pid:815594641 +ecl:gry iyr:2012 byr:1992 hgt:161cm hcl:#b6652a + +ecl:gry cid:338 eyr:2021 pid:777099878 hgt:193cm hcl:#efcc98 +byr:1945 +iyr:2015 + +iyr:2016 byr:1934 hcl:#b6652a +hgt:162cm ecl:hzl +cid:296 +pid:742610207 +eyr:2022 + +ecl:#ba3242 +hgt:80 byr:1931 +pid:550004054 iyr:1949 eyr:1944 hcl:fb3859 + +ecl:amb eyr:2024 +byr:1965 iyr:2010 pid:094059049 +hcl:#fffffd +hgt:168cm + +pid:159cm +iyr:1923 eyr:2032 hcl:701107 cid:343 ecl:gmt byr:2010 +hgt:177cm + +eyr:2021 +ecl:grn byr:1991 +hcl:#fffffd hgt:167cm pid:243218792 iyr:2019 + +hgt:157cm byr:2017 ecl:grn iyr:2012 +eyr:2030 hcl:#18171d pid:173cm + +pid:260101979 hgt:187cm eyr:2033 ecl:lzr +byr:2020 hcl:1058ce cid:133 iyr:2012 + +hcl:#7d3b0c +pid:307828343 byr:2001 +cid:317 iyr:2013 +eyr:2029 + +pid:472940417 eyr:1960 +hgt:181cm hcl:#c0946f cid:269 +byr:2014 +iyr:1956 + +hcl:#18171d eyr:2021 byr:2001 pid:421443124 +ecl:brn iyr:2020 hgt:156cm + +cid:347 hgt:60in pid:359783692 byr:1932 +ecl:hzl +eyr:2023 +hcl:#888785 iyr:2019 + +pid:230915137 +byr:1999 +iyr:2011 eyr:2020 hcl:#7d3b0c ecl:hzl +hgt:164cm + +iyr:1989 +byr:2008 +hgt:154cm +eyr:2028 pid:280298169 +cid:208 +ecl:oth + +byr:1954 iyr:2017 +ecl:hzl +eyr:2026 +pid:966957581 hgt:175cm hcl:#18171d + +pid:308053355 hgt:192cm eyr:2022 ecl:amb cid:146 iyr:2015 +byr:1991 hcl:#c0946f + +hcl:#a97842 pid:244441133 iyr:2019 +hgt:182cm +ecl:amb cid:172 byr:1973 eyr:2029 + +iyr:2017 +byr:1985 cid:215 +ecl:blu hcl:#623a2f hgt:160cm pid:157856689 eyr:2030 + +eyr:2027 ecl:#d72f9b hgt:162cm +iyr:2018 hcl:#a97842 +byr:1945 +pid:131243258 + +hcl:#b3f2f0 pid:204254353 cid:169 eyr:2020 +iyr:2013 hgt:172cm ecl:blu byr:1950 + +byr:1957 hcl:#c0946f hgt:152cm ecl:blu eyr:2027 pid:325917033 +iyr:2010 + +ecl:oth byr:1950 hgt:166cm pid:007352351 +hcl:#b6652a +iyr:2020 +eyr:2024 + +hgt:165 eyr:2030 iyr:2027 +ecl:#1a34f1 pid:2894591864 byr:2024 hcl:z + +byr:1971 ecl:oth +hgt:163cm eyr:2021 pid:040443396 + +hgt:177cm +byr:1955 pid:585735590 iyr:2010 ecl:grn eyr:2024 +hcl:#602927 + +cid:74 +iyr:2010 +pid:014378493 hgt:174cm eyr:2020 +ecl:grn byr:1944 + +pid:404141049 +byr:1947 ecl:blu hgt:170cm iyr:2011 +eyr:2028 +hcl:#cfa07d + +ecl:hzl byr:1938 pid:235085606 cid:180 hcl:8fb74c eyr:2021 hgt:73 iyr:2015 + +pid:860077423 ecl:gry +hcl:#3e845b +hgt:167cm byr:1933 iyr:2016 eyr:2021 + +hcl:#733820 hgt:66in eyr:1920 +ecl:oth byr:1941 pid:979460474 iyr:2010 +cid:247 + +hcl:#cfa07d ecl:#13bd36 hgt:193cm eyr:2027 pid:181cm byr:1952 iyr:1951 + +ecl:brn hcl:#602927 +hgt:161cm +eyr:2027 pid:822749462 byr:1946 +iyr:2014 + +byr:2013 +iyr:2021 ecl:zzz eyr:2032 hgt:193in hcl:#a97842 pid:163cm + +eyr:2029 cid:140 +byr:1984 +iyr:2018 hgt:187cm hcl:#b6652a pid:910674579 + +ecl:hzl hgt:173cm pid:096026282 +iyr:2014 byr:1956 +eyr:2029 hcl:#866857 + +eyr:2024 iyr:2019 pid:301205967 +cid:276 byr:1957 hcl:#3fec29 ecl:gry hgt:165cm + +iyr:2013 ecl:oth hgt:177cm hcl:#6b5442 eyr:2021 byr:1962 pid:006347857 + +ecl:grt byr:1983 hcl:#cfa07d +hgt:163cm +eyr:1979 +iyr:1958 pid:796395720 + +iyr:2011 pid:415403544 hcl:#c0946f byr:1990 ecl:oth eyr:2023 hgt:73in +cid:107 + +hgt:166cm eyr:2029 iyr:2015 +hcl:#c0946f ecl:brn +byr:1964 +pid:469449137 + +eyr:2023 +byr:1969 iyr:2010 hgt:163cm hcl:#a97842 pid:570942274 +ecl:blu + +hcl:#623a2f +ecl:brn hgt:183cm pid:524675399 +eyr:2020 iyr:2012 byr:1981 + +iyr:2017 hcl:#fffffd eyr:2026 +ecl:gry byr:1979 hgt:152cm pid:505790864 + +hgt:68in +hcl:#c0946f iyr:2012 +eyr:2023 pid:933562997 byr:1993 +ecl:grn + +pid:267705171 +hgt:166cm byr:1970 iyr:2019 hcl:#341e13 ecl:oth +eyr:2030 + +ecl:brn byr:1972 eyr:2026 pid:774637408 hgt:189cm iyr:2015 hcl:#341e13 + +hgt:175cm eyr:2026 byr:2001 iyr:2020 +hcl:#733820 ecl:blu pid:686996160 + +hgt:190cm hcl:#c0946f pid:228444464 byr:1987 +iyr:2020 eyr:2030 +ecl:blu + +byr:1990 hgt:179cm +pid:885359438 eyr:2028 iyr:2010 ecl:amb +hcl:#67067e + +byr:1945 hcl:#866857 eyr:2022 iyr:2019 +pid:708146656 cid:65 +hgt:172cm ecl:brn + +ecl:hzl hgt:191cm +cid:260 pid:010716679 iyr:2011 eyr:2029 byr:1920 hcl:#efcc98 + +iyr:2012 +cid:313 pid:264894705 byr:1951 hcl:#733820 eyr:2030 ecl:blu +hgt:178cm + +eyr:2027 pid:790510379 +iyr:2013 +ecl:amb +hgt:186cm +hcl:#866857 +byr:1926 + +pid:535750794 hgt:191cm iyr:2016 hcl:#a97842 eyr:2029 +ecl:hzl byr:1923 + +byr:2023 pid:#eb4c2a iyr:1939 ecl:grn hcl:06d729 hgt:73 eyr:2038 + +pid:792365221 iyr:2013 ecl:oth +byr:1997 +hgt:170cm hcl:#efcc98 +eyr:2022 + +hgt:192cm pid:874141668 +byr:1957 iyr:2015 +ecl:gry + +hcl:#b6652a pid:770238761 eyr:2029 byr:1934 iyr:2013 +ecl:blu cid:177 +hgt:184cm + +ecl:hzl eyr:2024 hgt:72in pid:546439165 +iyr:2013 +hcl:#c0946f cid:223 byr:1989 + +byr:1985 +ecl:utc pid:#ff1cbf +iyr:2018 hcl:#866857 hgt:169cm eyr:2026 cid:194 + +hgt:189cm +eyr:2026 pid:120642045 ecl:blu +hcl:#602927 cid:177 +byr:1954 iyr:2012 + +pid:314624973 +byr:1959 iyr:2015 hcl:#c0946f ecl:grn +eyr:2027 cid:349 hgt:156cm + +byr:1978 +iyr:2020 hgt:150cm cid:266 eyr:2026 +pid:443912835 hcl:#b6652a + +hgt:174cm byr:1974 pid:729198828 +ecl:brn iyr:2014 +hcl:#18171d eyr:2027 + +pid:472891001 ecl:xry +hgt:96 hcl:1b816a iyr:1954 +byr:2015 eyr:2037 + +byr:1966 eyr:2022 +iyr:2014 +pid:848187688 hcl:#602927 ecl:gry hgt:152cm + +hgt:129 eyr:2037 cid:61 iyr:2009 byr:2027 hcl:#c0946f +pid:3569865 +ecl:#4e3d72 + +ecl:gry +eyr:2021 pid:234525998 byr:1964 hgt:168cm cid:140 +hcl:#7d3b0c iyr:2013 + +ecl:xry +cid:86 +hgt:172in +byr:1972 +iyr:2015 hcl:#7d3b0c pid:833809421 eyr:2030 + +pid:444365280 hgt:72in +ecl:brn +hcl:#b6652a byr:1985 eyr:2027 iyr:2012 + +iyr:2010 byr:2013 hgt:181cm eyr:2021 +pid:072317444 +ecl:oth hcl:#866857 +cid:118 + +pid:4354408888 iyr:2012 +hcl:#b6652a cid:104 +hgt:96 eyr:2020 +byr:1933 ecl:amb + +eyr:2023 ecl:gry hcl:#a97842 pid:287719484 byr:1994 +iyr:2011 hgt:163cm cid:299 + +byr:1932 +hgt:170cm +iyr:2014 pid:777844412 eyr:2040 hcl:#cfa07d ecl:brn + +cid:160 hgt:191cm eyr:2020 iyr:2012 +ecl:brn byr:1981 pid:077027782 + +cid:182 hgt:176cm hcl:#7d3b0c +eyr:2030 ecl:blu pid:096742425 iyr:2010 byr:1963 + +byr:2010 cid:337 hcl:z pid:525126586 iyr:2010 hgt:73cm eyr:2040 ecl:blu + +ecl:gry +iyr:2017 +hgt:185cm hcl:#6b5442 byr:1993 +eyr:2029 pid:366083139 cid:343 + +eyr:2028 ecl:amb +pid:878658841 byr:1960 hgt:179cm hcl:#18171d iyr:2010 + +pid:537309261 iyr:2015 hgt:187cm +hcl:#4fe831 eyr:2026 +ecl:blu byr:1982 + +ecl:brn hgt:163cm +eyr:2021 hcl:#6b5442 byr:1979 iyr:2013 pid:924759517 + +pid:683651053 hcl:#179c55 +ecl:blu byr:1989 hgt:190cm +iyr:2016 +eyr:2030 + +ecl:grn +iyr:2016 hcl:#b6652a +byr:1994 eyr:2020 pid:448424292 hgt:174cm + +hgt:157cm +ecl:grn +byr:2000 +pid:734707993 hcl:#341e13 iyr:2020 + +hcl:#341e13 hgt:156cm iyr:2020 pid:299213638 +byr:1947 ecl:hzl eyr:2023 + +hgt:193cm hcl:#b6652a iyr:2014 ecl:hzl byr:1947 eyr:2025 +pid:044486467 + +byr:1975 +hgt:159cm +ecl:grn pid:318489576 eyr:2029 hcl:#6b5442 +iyr:2020 + +iyr:2018 pid:512971930 +hcl:#888785 byr:1966 eyr:2024 hgt:158cm +cid:100 ecl:gry + +ecl:amb eyr:2030 hgt:171cm hcl:#efcc98 pid:800921581 cid:339 byr:1980 iyr:2017 + +iyr:2019 cid:172 +hgt:152cm +eyr:2022 ecl:oth hcl:#602927 byr:1960 + +iyr:2019 pid:762312913 +eyr:2029 +ecl:hzl +hcl:#6b5442 +byr:1940 +hgt:169cm cid:289 + +eyr:2022 ecl:gry byr:1976 +iyr:2020 hcl:#733820 hgt:172cm pid:040331561 + +hgt:171cm ecl:brn iyr:2013 eyr:2027 byr:1940 hcl:#a6e32a pid:223986941 + +hcl:#341e13 +eyr:2028 ecl:amb byr:1942 +hgt:166cm pid:435382099 iyr:2020 + +cid:298 pid:641326891 +hgt:155cm hcl:#623a2f ecl:grn byr:1981 eyr:2025 +iyr:2010 + +iyr:2015 pid:472000322 eyr:2021 byr:1977 +ecl:gry hgt:165cm cid:270 + +eyr:2027 byr:1956 +pid:193087729 hcl:#ceb3a1 +cid:213 hgt:193cm ecl:oth + +iyr:2014 +byr:1971 cid:96 +hgt:74in +pid:136003336 +eyr:2020 ecl:hzl hcl:#efcc98 + +hcl:z pid:097595072 ecl:amb +iyr:2015 byr:2021 +eyr:2039 hgt:188cm + +pid:74823273 +hcl:#341e13 +cid:166 hgt:182cm byr:2026 iyr:2027 ecl:amb +eyr:2032 + +byr:1932 eyr:2022 pid:367248062 hgt:182cm ecl:oth hcl:#c0946f +iyr:2020 + +hgt:72cm +iyr:2015 cid:234 byr:2013 +ecl:brn pid:9401866358 + +pid:022399779 iyr:2010 byr:1969 hcl:#6b5442 +ecl:grn eyr:2020 +hgt:189cm + +byr:1971 iyr:2011 cid:161 ecl:brn hgt:153cm +eyr:2028 pid:819137905 hcl:#cfa07d + +cid:161 hgt:159cm iyr:2011 pid:815860793 hcl:#a97842 ecl:grn byr:1972 eyr:2027 + +ecl:amb +hgt:118 byr:1981 iyr:2019 +hcl:#a97842 eyr:2021 pid:270790642 + +hcl:#b6652a pid:732272914 eyr:2030 hgt:183cm ecl:hzl +byr:1934 +iyr:2018 + +eyr:2027 +pid:877388498 hcl:#ceb3a1 +byr:1925 cid:236 ecl:grn +iyr:2019 hgt:191cm + +eyr:2020 ecl:brn hcl:#fffffd hgt:181cm pid:801311341 byr:1986 iyr:2010 + +byr:1925 cid:179 ecl:hzl pid:360641953 eyr:2030 +hgt:171in iyr:2015 +hcl:#602927 + +cid:83 hgt:181cm +eyr:2028 byr:1941 pid:165937945 hcl:#888785 iyr:2014 +ecl:grn + +hcl:#a97842 byr:1928 +iyr:2013 +pid:870072019 hgt:76in +ecl:oth cid:127 eyr:2026 + +cid:169 +hgt:187cm pid:008180128 iyr:2013 byr:1991 hcl:#7d3b0c ecl:hzl eyr:2026 + +ecl:amb +eyr:2027 hgt:155cm pid:586151564 iyr:2010 +byr:1949 +hcl:#18171d + +hgt:167cm +iyr:2010 byr:1982 ecl:amb +cid:235 pid:557737957 eyr:2020 +hcl:#ceb3a1 + +ecl:grn byr:1939 hcl:#733820 +eyr:2026 pid:993218958 iyr:2010 +hgt:150cm + +hgt:68in ecl:blu +byr:1965 iyr:2017 pid:854858050 eyr:2021 + +ecl:gry pid:347763159 eyr:2024 iyr:2017 byr:1961 +hgt:151cm +hcl:#623a2f + +ecl:utc hcl:#602927 +pid:#1408ff byr:1941 +cid:82 +iyr:2015 hgt:185cm eyr:2028 + +iyr:2020 hgt:151cm eyr:2025 +byr:1934 hcl:#888785 +pid:396545094 ecl:oth + +hgt:153cm +eyr:2028 hcl:#733820 ecl:gry iyr:2019 +pid:081352630 byr:1943 + +eyr:2030 +iyr:2011 +ecl:grn pid:313741119 +hgt:161cm byr:1946 +hcl:#a97842 + +byr:1968 ecl:gry +pid:742357550 +eyr:2024 hcl:#18171d iyr:2018 +hgt:157cm + +pid:387505919 +ecl:oth byr:1945 +iyr:2014 +hgt:190cm hcl:#888785 +eyr:2028 + +iyr:2017 hgt:175cm +byr:1989 eyr:2022 +hcl:#b6652a pid:499016802 ecl:gry cid:136 + +pid:490807331 iyr:2016 +hcl:#ceb3a1 +hgt:150cm eyr:2026 +ecl:amb byr:1967 + +iyr:2011 +hgt:155in +hcl:#ceb3a1 pid:118497416 +eyr:2029 byr:2011 ecl:oth + +hcl:03a888 byr:2029 +ecl:#6f7292 eyr:1969 iyr:2028 hgt:162cm pid:73551266 + +iyr:2016 hgt:182cm +byr:1966 ecl:grn eyr:2022 +hcl:#fffffd pid:061720787 + +byr:1971 hcl:z +eyr:2035 pid:158cm +ecl:#d3ec19 + +hcl:#623a2f hgt:156cm eyr:2028 +ecl:brn iyr:2013 +byr:1980 pid:112283719 + +eyr:2020 +byr:1956 iyr:2013 +hcl:#6b5442 +ecl:grn pid:876589775 hgt:179cm + +hgt:138 +byr:2013 eyr:2040 iyr:2028 cid:197 ecl:#8844fd pid:8524414485 +hcl:z + +eyr:2040 +hgt:173in hcl:z pid:#654654 byr:2016 iyr:2022 ecl:#452d22 + +iyr:2012 cid:265 eyr:2021 hgt:192cm +byr:1993 ecl:brn + +eyr:2026 hcl:#888785 +hgt:158cm byr:1942 +iyr:2015 +ecl:amb pid:546984106 + +iyr:2019 +ecl:hzl +byr:1922 eyr:2028 hgt:172cm +pid:465052232 hcl:#602927 + +pid:710362693 eyr:2023 +hcl:#c0946f byr:1951 ecl:grn +iyr:2019 hgt:190cm + +iyr:2024 pid:#a08e69 +hcl:z byr:1966 ecl:#7b9978 eyr:2035 +hgt:69cm + +hcl:#efcc98 +pid:164cm +iyr:2010 cid:194 hgt:71cm byr:1923 eyr:2026 + +hgt:65in +iyr:2019 byr:1969 pid:466669360 eyr:2022 ecl:brn hcl:#b6652a + +pid:42472559 hcl:#6f5763 +eyr:2035 +iyr:2014 hgt:154in byr:1939 ecl:grt cid:323 + +pid:715680334 hgt:166cm cid:283 +byr:1982 +iyr:2015 eyr:2030 hcl:#ceb3a1 ecl:grn + +eyr:2018 iyr:2029 +ecl:brn +byr:2022 pid:#ff6df1 +hcl:z +hgt:68cm + +pid:094541122 +eyr:2024 byr:1940 +ecl:amb iyr:2019 hgt:64in hcl:#733820 + +hgt:163in +eyr:2022 ecl:utc hcl:#ceb3a1 iyr:2028 + +ecl:gry pid:53552934 +hgt:193 byr:2021 +eyr:2028 +iyr:2011 cid:98 hcl:90c63f + +eyr:2024 hcl:#cfa07d ecl:brn +iyr:2019 byr:1993 hgt:156cm pid:449484188 + +iyr:2020 +hgt:164cm hcl:#623a2f +pid:820731743 eyr:2025 +byr:1997 ecl:hzl + +hcl:47242b ecl:utc hgt:156 +pid:#9a9903 eyr:2030 iyr:1990 +byr:2011 + +hcl:#602927 +hgt:189cm +pid:949021883 iyr:2014 ecl:oth cid:327 +eyr:2027 byr:1953 + +hgt:189cm cid:301 +byr:1982 +ecl:grn +eyr:2028 hcl:#733820 pid:796040143 iyr:2015 + +cid:169 iyr:2013 pid:355177646 byr:1988 +ecl:oth +hcl:#cfa07d +hgt:185cm eyr:2022 + +pid:563150261 eyr:2020 ecl:brn byr:1996 hcl:#7d3b0c iyr:2018 hgt:189cm cid:84 + +cid:188 eyr:2027 +byr:1944 +pid:486184923 +iyr:2010 hgt:193cm hcl:#341e13 ecl:oth + +iyr:2019 +byr:1969 hgt:152cm pid:430698432 ecl:gry hcl:#888785 eyr:2026 cid:293 + +ecl:gry +cid:270 hcl:#602927 iyr:2017 hgt:151cm eyr:2029 pid:051398739 byr:1954 + +ecl:oth eyr:2030 pid:024655030 +hgt:184cm byr:1969 +hcl:#18171d + +eyr:2030 +pid:899973263 hgt:178cm byr:1987 hcl:#cfa07d iyr:2012 +ecl:amb + +iyr:1958 hgt:165cm pid:377677319 +ecl:grt eyr:2032 byr:2025 +hcl:bbfbe2 + +ecl:blu +iyr:2016 +hgt:152cm byr:1964 +hcl:#c4f777 +eyr:2021 +pid:044307549 cid:80 + +ecl:brn pid:330836320 +byr:1963 cid:217 hgt:169cm +eyr:2024 +iyr:2019 hcl:#ceb3a1 + +byr:1976 eyr:2027 +pid:452662874 hgt:192cm ecl:oth iyr:2018 hcl:#602927 + +eyr:2027 hgt:183cm ecl:brn iyr:2017 hcl:#341e13 pid:827463598 + +ecl:brn pid:930667228 cid:310 iyr:2020 +eyr:2027 hgt:160cm byr:1932 hcl:#c0946f + +pid:955804028 byr:1983 +hcl:#fffffd +hgt:178cm iyr:2013 +eyr:2021 ecl:gry + +hgt:189cm eyr:2021 pid:430243363 iyr:2015 hcl:#ceb3a1 +byr:2000 ecl:oth cid:284 + +pid:436671537 hcl:#cfa07d iyr:2011 cid:106 hgt:171cm +ecl:blu eyr:2021 byr:1943 + +eyr:2028 hgt:169cm +iyr:2015 pid:177443573 byr:1945 +hcl:#c0946f ecl:gry + +hcl:#fffffd byr:1995 eyr:2021 +ecl:grn +hgt:192cm iyr:2010 pid:754912745 + +pid:330882171 iyr:2015 cid:211 ecl:grn byr:1961 eyr:2021 hcl:z +hgt:169cm + +byr:1926 eyr:2029 pid:178633665 cid:141 iyr:2017 hcl:#b99eb9 +hgt:178cm ecl:brn + +eyr:2022 ecl:hzl hcl:#cfa07d hgt:168cm iyr:2015 +byr:1982 pid:645675448 + +ecl:blu byr:1980 hgt:186cm iyr:2010 cid:94 hcl:#c0946f eyr:2027 pid:384440210 + +cid:309 hcl:#602927 hgt:192cm eyr:2027 ecl:amb +pid:527932745 iyr:2012 byr:1982 + +cid:132 +ecl:blu iyr:2016 +eyr:2027 byr:1940 hcl:#341e13 hgt:166cm pid:613386501 + +pid:360563823 eyr:2028 byr:1990 iyr:2016 +ecl:blu cid:287 hgt:162cm hcl:#888785 + +hgt:161cm +byr:2002 +hcl:#623a2f pid:535361632 +ecl:gry eyr:2021 iyr:2013 + +hgt:67in +byr:1967 +cid:333 hcl:#cfa07d +iyr:2012 eyr:2024 ecl:hzl pid:538161833 + +ecl:#2bc145 eyr:1963 iyr:2030 +cid:241 hcl:2fc384 hgt:156in pid:2899917140 +byr:2005 + +eyr:2021 pid:021590229 ecl:gry +hgt:164cm iyr:2013 hcl:#efcc98 byr:1985 + +ecl:hzl byr:1943 +cid:279 pid:979130395 +iyr:2011 +hgt:165cm +eyr:2021 +hcl:#f331b3 + +hgt:161cm +hcl:#888785 byr:1981 pid:835477382 eyr:2025 iyr:2012 +cid:348 +ecl:blu + +hgt:159cm hcl:b4ce6a cid:319 eyr:2035 iyr:1965 ecl:oth +byr:2010 pid:158cm + +iyr:2020 +eyr:2026 ecl:grn hcl:#a97842 pid:126915503 +hgt:178cm byr:1986 + +hgt:184cm ecl:hzl +cid:67 iyr:2020 eyr:2026 pid:168775568 byr:1944 hcl:#a97842 + +hcl:#fffffd iyr:2016 pid:379463363 +ecl:oth +hgt:179cm byr:1988 +eyr:2028 + +hcl:#cfa07d ecl:amb eyr:2030 pid:320360020 +iyr:2016 hgt:172cm byr:1961 + +cid:221 hcl:#cfa07d byr:1946 eyr:2024 ecl:oth pid:066950409 hgt:173cm +iyr:2020 + +hcl:#602927 eyr:2028 ecl:gry iyr:2019 pid:583204134 byr:1966 hgt:178cm + +byr:1930 +iyr:2020 ecl:hzl +hcl:#ceb3a1 pid:285751767 cid:287 eyr:2023 hgt:192cm + +eyr:2024 +ecl:hzl cid:87 iyr:2015 +hgt:152cm hcl:#18171d pid:959574669 +byr:1990 + +pid:45938863 +hcl:49c7ce cid:349 hgt:181cm +eyr:2023 ecl:grn iyr:2015 byr:1948 + +hcl:#866857 iyr:2012 ecl:amb cid:132 byr:1955 hgt:162cm pid:597748286 eyr:2023 + +pid:293364535 byr:2024 +hgt:177cm eyr:2039 +iyr:2020 hcl:#dae928 ecl:hzl + +pid:212659709 iyr:2018 +hgt:188cm +hcl:#efcc98 byr:1974 eyr:2029 ecl:oth cid:244 + +cid:140 +ecl:amb +eyr:2022 hgt:181cm hcl:#efcc98 +byr:1943 +iyr:2016 + +cid:71 hgt:151cm pid:5063555219 eyr:2023 ecl:hzl +byr:2019 +hcl:#7d3b0c iyr:2023 + +hgt:157in pid:#298b06 iyr:2030 ecl:#66a631 eyr:2035 hcl:z byr:2019 + +hgt:190cm iyr:1943 +pid:644021656 hcl:#6b621c +ecl:oth eyr:2021 byr:1923 + +ecl:hzl iyr:2012 eyr:2023 pid:881271720 hcl:#ceb3a1 hgt:172cm +byr:1957 + +iyr:2017 hcl:#888785 +ecl:amb hgt:170cm byr:1967 pid:198856675 eyr:2027 + +eyr:2026 +ecl:gry +pid:834980363 hcl:#733820 byr:1930 +hgt:175cm iyr:2018 +cid:214 + +hcl:#efcc98 eyr:2029 iyr:2010 pid:980087545 +ecl:brn hgt:157cm + +pid:57513658 iyr:2011 byr:1993 ecl:brn eyr:2027 hcl:#6b5442 hgt:165cm + +ecl:hzl +eyr:2025 +hcl:#733820 +hgt:169cm iyr:2018 cid:328 byr:1999 pid:694719489 + +eyr:2023 +cid:125 byr:1925 +hgt:185cm pid:806769540 iyr:2013 ecl:hzl +hcl:#866857 + +iyr:2010 cid:225 +ecl:hzl eyr:2027 pid:615545523 +hcl:#733820 +byr:1994 +hgt:166cm + +byr:1941 ecl:gry iyr:2019 eyr:2026 hgt:73cm hcl:#602927 +pid:352996721 + +pid:140250433 +eyr:2030 ecl:grn +hcl:#fffffd iyr:2011 byr:1937 hgt:185cm + +ecl:gry byr:2002 iyr:2017 hcl:#b6652a cid:261 pid:178cm eyr:2022 hgt:166cm + +ecl:grn iyr:2010 eyr:2022 byr:1924 +pid:214641920 hcl:#ceb3a1 +hgt:155cm + +hcl:z pid:150cm ecl:utc iyr:1981 +eyr:2034 +hgt:156in cid:260 byr:2027 + +byr:1987 hgt:66in +eyr:2021 pid:876757018 iyr:2015 hcl:d596e4 ecl:hzl + +cid:116 ecl:oth hgt:180cm +iyr:2020 byr:1942 hcl:#2fc31f +eyr:2027 +pid:253569416 + +pid:509387921 +eyr:2022 +hcl:#888785 ecl:oth hgt:193cm +iyr:2012 cid:97 +byr:1975 + +hcl:#18171d hgt:190cm pid:062827417 byr:1939 +iyr:2019 eyr:2022 +ecl:hzl + +iyr:2025 +byr:2028 +hgt:165in eyr:2027 pid:6259332452 +hcl:#478251 + +iyr:2018 eyr:2026 pid:523863237 +hgt:187cm +ecl:oth +byr:1944 +hcl:#a97842 + +hgt:181cm hcl:#733820 pid:923996316 +cid:110 +iyr:2011 byr:1949 ecl:blu eyr:2023 + +pid:304792392 hcl:487823 eyr:2020 +hgt:70cm byr:2024 +iyr:1953 +ecl:blu + +pid:142200694 +ecl:oth hcl:#888785 eyr:2028 +hgt:152cm byr:1954 iyr:2018 + +ecl:utc +iyr:2015 byr:1932 hcl:#623a2f +eyr:2027 hgt:183cm pid:036300444 + +iyr:2014 ecl:hzl byr:1935 hgt:190cm hcl:#efcc98 pid:945893288 +eyr:2025 + +hcl:#efcc98 pid:252639104 hgt:188cm +byr:1998 iyr:2019 ecl:grn +eyr:2023 + +hcl:58aa4a byr:1930 hgt:193cm +iyr:1998 cid:196 ecl:brn +eyr:2032 + +iyr:2015 ecl:hzl +hgt:193cm pid:653794674 eyr:2024 +hcl:#fffffd byr:1921 + +pid:980680460 byr:1962 ecl:blu +iyr:2013 +hcl:#72cace +eyr:2030 +hgt:180cm + +eyr:2025 +hgt:182cm hcl:#ceb3a1 iyr:2010 byr:1945 cid:314 pid:597769706 ecl:amb + +pid:761757504 +hcl:#888785 hgt:161cm iyr:2015 +byr:1939 eyr:2025 +cid:326 ecl:blu + +ecl:gry +hgt:163cm byr:1981 +pid:330818500 iyr:2017 eyr:2024 +cid:71 hcl:#888785 + +pid:190cm cid:267 iyr:2015 ecl:brn +hcl:869252 +byr:1935 hgt:142 eyr:2033 + +cid:239 +eyr:2038 ecl:lzr hcl:z iyr:1987 pid:4632768239 +hgt:162in + +pid:158038227 ecl:brn byr:1995 eyr:2028 hcl:#efcc98 +cid:252 iyr:2021 +hgt:184cm + +eyr:2027 +cid:124 ecl:amb hgt:165cm byr:1949 +pid:727126101 iyr:2010 hcl:#602927 + +ecl:grn +byr:1966 pid:184245393 hgt:164cm +eyr:2022 +iyr:2014 hcl:#866857 + +cid:62 hgt:180cm eyr:2027 hcl:#18171d +iyr:2017 ecl:blu byr:1942 pid:930210027 + +ecl:grn hgt:171cm iyr:2017 hcl:#fffffd eyr:2029 byr:1946 pid:863414762 +cid:95 + +eyr:2025 ecl:grn iyr:2019 cid:226 hcl:#b6652a +byr:1932 pid:715708549 +hgt:156cm + +pid:505158338 iyr:2019 byr:1981 hgt:193cm +hcl:#696a5c cid:57 ecl:hzl eyr:2023 + +byr:1987 +hgt:155cm cid:99 ecl:grn iyr:2010 +hcl:#c0946f eyr:2023 +pid:431067921 + +hgt:190in +hcl:z eyr:2029 pid:74228790 +iyr:2016 byr:2018 ecl:brn + +eyr:2022 +ecl:xry hgt:154cm pid:62205162 +iyr:2014 byr:1936 +cid:61 + +ecl:amb eyr:2026 +byr:1966 cid:95 hcl:#733820 pid:957767251 iyr:2013 hgt:157cm + +byr:1969 +hgt:156cm iyr:2013 ecl:blu hcl:#a97842 +cid:183 +pid:960672229 eyr:2020 + +iyr:2013 +cid:243 eyr:2028 hgt:192cm hcl:#efcc98 +ecl:grn pid:222407433 byr:1978 + +iyr:2014 byr:1935 +eyr:2021 cid:235 pid:#1b34e1 +hcl:#89313f hgt:164cm ecl:blu + +ecl:hzl iyr:2016 cid:327 +byr:1923 pid:695935353 hgt:184cm +hcl:#a97842 +eyr:2028 + +pid:6010745668 +byr:1934 ecl:oth eyr:2020 hgt:164cm +hcl:#733820 +iyr:2016 + +ecl:blu pid:071991002 eyr:2021 byr:1978 cid:321 +hcl:#efcc98 +iyr:2013 hgt:68in + +ecl:grn iyr:2015 pid:137792524 cid:156 +hcl:#efcc98 +eyr:2029 byr:1955 +hgt:165cm + +byr:1949 +hgt:176cm pid:531868428 +hcl:#cfa07d ecl:brn iyr:2014 eyr:2024 + +iyr:1955 cid:108 pid:712137140 byr:2019 eyr:2040 hgt:184cm hcl:220cfe ecl:#551592 + +iyr:2016 eyr:2030 +hgt:177cm cid:137 ecl:brn +hcl:#efcc98 pid:712202745 byr:1938 + +pid:357180007 iyr:2010 ecl:grn +byr:1991 +hcl:#341e13 +eyr:2020 hgt:159cm + +eyr:2023 ecl:grn +hcl:#733820 iyr:2020 byr:1927 hgt:151cm +pid:165936826 + +ecl:gry +pid:794227261 iyr:2014 eyr:2030 +hcl:#18171d +byr:1994 +hgt:162cm + +iyr:2017 eyr:2024 +hcl:#7d3b0c cid:279 +ecl:gry byr:1981 hgt:176cm pid:973822115 + +eyr:2029 +hgt:152cm hcl:#fffffd ecl:amb byr:1946 iyr:2013 +cid:62 pid:005240023 + +iyr:2010 +ecl:amb hcl:#341e13 hgt:184cm +eyr:2027 +pid:976217816 byr:1950 + +ecl:grn hgt:178cm cid:192 hcl:#602927 pid:684333017 eyr:2022 +iyr:2011 byr:1987 + +pid:306960973 ecl:hzl hgt:168cm +byr:1954 iyr:2015 eyr:2029 hcl:#602927 + +hcl:#18171d +byr:1973 ecl:hzl hgt:174cm pid:922891164 +iyr:2013 +eyr:2023 + +byr:1998 hgt:189cm pid:472066200 ecl:gry iyr:2012 eyr:2021 hcl:#c0946f cid:299 + +iyr:2014 +eyr:2028 byr:1922 pid:594856217 hgt:158cm +ecl:oth +hcl:#623a2f + +pid:215206381 byr:1928 +hgt:163cm +hcl:#b6652a ecl:oth iyr:2011 + +cid:145 iyr:2013 +ecl:#38a290 +eyr:2034 +hcl:#602927 hgt:186cm pid:517498756 +byr:1945 + +hcl:#5637d2 eyr:2030 byr:1955 +hgt:187cm +pid:862655087 iyr:2014 ecl:grn + +hcl:#7d3b0c hgt:176cm iyr:2019 +eyr:2029 byr:1980 ecl:hzl +cid:346 pid:703908707 + +hgt:185cm +iyr:2017 +cid:120 eyr:2020 hcl:#733820 ecl:blu pid:458522542 byr:1966 + +pid:#725759 +hcl:#602927 iyr:2013 byr:2003 eyr:2023 cid:100 diff --git a/day4/src/main.zig b/day4/src/main.zig new file mode 100644 index 0000000..d95a319 --- /dev/null +++ b/day4/src/main.zig @@ -0,0 +1,215 @@ +const std = @import("std"); + +pub fn main() anyerror!void { + var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + defer arena.deinit(); + var gpa = &arena.allocator; + + var record_indexes = std.ArrayList(usize).init(gpa); + + var f = std.fs.File { .handle = try std.os.open("input", std.os.O_RDONLY, 0)}; + var reader = f.reader(); + + var records = std.ArrayList([]u8).init(gpa); + var record = std.ArrayList(u8).init(gpa); + var n_newlines : u32 = 0; + var just_had_newline = false; + const state = enum { + AddingData, + CheckingNewline, + RecordEnd, + }; + var current_state = state.AddingData; + while(true) { + var n = reader.readByte() catch |err| { + // Finalize record + try records.append(try gpa.dupe(u8, record.items[0..record.items.len])); + //std.log.debug("Found record: '{}'", .{record.items}); + record.deinit(); + record = std.ArrayList(u8).init(gpa); + std.mem.set(u8, record.items, 0); + break; + }; + if (n == '\n') { + if (current_state == state.CheckingNewline) { + current_state = state.RecordEnd; + // Finalize record + try records.append(try gpa.dupe(u8, record.items[0..record.items.len])); + //std.log.debug("Found record: '{}'", .{record.items}); + record.deinit(); + record = std.ArrayList(u8).init(gpa); + std.mem.set(u8, record.items, 0); + current_state = state.AddingData; + continue; + } + else { + current_state = state.CheckingNewline; + // whitespace can always be added + try record.append(' '); + continue; + } + } + else { + if (current_state == state.CheckingNewline) { + current_state = state.AddingData; + } + try record.append(n); + } + } + std.log.debug("Found {} records", .{records.items.len}); + //std.log.debug("{}", .{records.items[0]}); + //const fields = comptime std.meta.fieldNames(RequiredFields); + const fields = comptime std.meta.fields(RequiredFields); + const valid_passport = RequiredFields { + .byr = true, + .iyr = true, + .eyr = true, + .hgt = true, + .hcl = true, + .ecl = true, + .pid = true, + }; + var n_valid : u32 = 0; + for (records.items) | r, k | { + // Everything is separated by whitespace + var passport_info = RequiredFields{}; + var iter = std.mem.tokenize(r, " "); + //std.log.debug("{}", .{r}); + while (iter.next()) |aspect| { + inline for (fields) |field| { + if (std.mem.startsWith(u8, aspect, field.name)) { + @field(passport_info, field.name) = validate_field(field.name, aspect[4..]); + std.log.debug("Field {} with contents {} is {}", + .{field.name, aspect[4..], @field(passport_info, field.name)}); + } + } + } + if (std.meta.eql(passport_info, valid_passport)) { + std.log.debug("'{}' is valid", .{r}); + n_valid += 1; + } + else { + std.log.debug("'{}' is invalid", .{r}); + } + } + std.log.info("Valid passports: {}", .{n_valid}); +} + +pub fn validate_field(field: []const u8, data: []const u8) bool { + if (std.mem.eql(u8, field, "byr")) { + if (data.len != 4) { + return false; + } + var i = atoi(data); + //std.log.debug("byr {} --> {}", .{data, i}); + return (i >= 1920 and i <= 2002); + } + if (std.mem.eql(u8, field, "iyr")) { + if (data.len != 4) { + return false; + } + var i = atoi(data); + //std.log.debug("iyr {} --> {}", .{data, i}); + return (i >= 2010 and i <= 2020); + } + if (std.mem.eql(u8, field, "eyr")) { + if (data.len != 4) { + return false; + } + var i = atoi(data); + //std.log.debug("eyr {} --> {}", .{data, i}); + return (i >= 2020 and i <= 2030); + } + if (std.mem.eql(u8, field, "hgt")) { + var unit = data[data.len-2..]; + var i = atoi(data[0..data.len-2]); + //std.log.debug("hgt {} --- > {} '{}'", .{data, i, unit}); + if (std.mem.eql(u8, unit, "in")) { + return (i >= 59 and i <= 76); + } + else if (std.mem.eql(u8, unit, "cm")) { + return (i >= 150 and i <= 193); + } + else { + return false; + } + } + if (std.mem.eql(u8, field, "hcl")) { + if (data.len != 7) { + return false; + } + if (data[0] != '#') { + return false; + } + for (data[1..]) |d| { + // less than ascii 0 + if (d < 48) return false; + // greater than ascii f + if (d > 102) return false; + // after ascii 9 but before ascii a + if (d > 57 and d < 97) return false; + } + return true; + } + if (std.mem.eql(u8, field, "ecl")) { + if (data.len != 3) { + return false; + } + for (valid_eyecolours) | colour | { + if (std.mem.eql(u8, colour, data)) { + return true; + } + } + return false; + } + if (std.mem.eql(u8, field, "pid")) { + if (data.len != 9) { + return false; + } + for (data) |d| { + if (!std.ascii.isDigit(d)) { + return false; + } + } + return true; + } + if (std.mem.eql(u8, field, "cid")) { + return true; + } + std.log.debug("Uknown field {}", .{field}); + return false; +} + +const valid_eyecolours = [_][]const u8 { + "amb", + "blu", + "brn", + "gry", + "grn", + "hzl", + "oth", +}; + +fn atoi(a: []const u8) u32 { + var i : u32 = 0; + for(a) |v, k| { + if (! std.ascii.isDigit(v)) { + std.log.warn("Byte {x} is not a digit", .{v}); + continue; + } + // 48 is '0' in ascii + std.debug.assert(v >= 48 and v < 58); + i += @as(u32, (v - 48) * std.math.pow(u32, 10, @intCast(u32, a.len - k - 1))); + } + //std.log.debug("{x} --> {}", .{a, i}); + return i; +} +pub const RequiredFields = packed struct { + byr: bool = false, + iyr: bool = false, + eyr: bool = false, + hgt: bool = false, + hcl: bool = false, + ecl: bool = false, + pid: bool = false, +}; diff --git a/day5/build.zig b/day5/build.zig new file mode 100644 index 0000000..03f1f55 --- /dev/null +++ b/day5/build.zig @@ -0,0 +1,27 @@ +const Builder = @import("std").build.Builder; + +pub fn build(b: *Builder) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard release options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. + const mode = b.standardReleaseOptions(); + + const exe = b.addExecutable("day5", "src/main.zig"); + exe.setTarget(target); + exe.setBuildMode(mode); + exe.install(); + + const run_cmd = exe.run(); + run_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); +} diff --git a/day5/input b/day5/input new file mode 100644 index 0000000..6887b63 --- /dev/null +++ b/day5/input @@ -0,0 +1,814 @@ +FBFBBBFRLL +BFFFBFFRRR +BBFBFFFLLR +FBFFFBFLRR +FBFFBFBLLR +BFBBFBBRLL +BFFFFFFRLR +FBBBBFFLLR +FFBBFFFLRL +FFBFBBFLLR +FBFFFBBRRR +FBFFBFBLRR +FBBFBFFRLR +FBBBFBFRLL +FFBFFBBRLR +FBFBBBFRRL +BFFBBBFRRR +FBFBBBBLLR +FFBFFBBLLL +BFFBFBBLLR +BFFBFBBRLR +BFFBBBBLLL +FBBBBFBLLR +FFBFBBBLRR +FFBFBBFLRR +FFFBFBBRRL +FFFFFBBRLL +BFFFBFFLRR +FFFBFBBRLR +FBFFBBFLLR +BFBFFBBRRR +FBBFBBFLRL +BFBBFBFRRR +BFFFBBBLRL +BBFFFBFLLR +BFFFFBFLRR +BFFBFFBLLL +FFBBFBFRRR +BFBFFFBLLL +FBFBFFFRRR +BFBFBBBLLL +BFFFBBFLLL +BFBFFFBLLR +BFFBBBFRRL +FFFBBFFLLR +BFFBBBFLRR +FBFFBBBRLR +FBBFBBFLRR +FBBFFBFRRR +FBBFBBBRRL +FFFBFFBRRL +FBFBFFBRLL +FBFFBBFRLL +BFBFBFFRLL +FBFBFFFRLR +BFBFFBBRRL +FFBBFFBRRR +BFFBFBBLRL +FFBFBFBLLL +BBFFFBFRLL +FBFBBBFRRR +BFFBBFFLRR +BFBBFFBLRL +BFFFFFBLLL +BBFFFFFRLR +FBBFFBFRLL +FFBFBFFRRR +BFBBBBFLRR +BFFBBFFRLL +BFBBFFBLLL +BFFFFFBRRR +FBBFFFBLRL +FFFBBBFRLR +FFBBBFBRRL +BFFFBBBRRL +FFBFBFBRRR +FBBBBBFRRR +BBFBFFFRLL +FBFFFBBLRR +FBFBFFBRRR +BFBFBFBRLR +FBBBFFFRRL +BFBFFFBRLL +FBBBFFBLLL +BFBFBFFRLR +BBFFBFBLRL +BBFFBFBRLR +BBFBFFFRRR +BFBBFFFRLL +BFFBBBBRRL +FFBFFBFRLL +FBBBFBBLRR +FBFFFFFRLR +FBFFFBFLLR +BBFFBFFRRR +BFBFBFBRLL +BFFBBBBLLR +FBBBFBFLLL +FFBBFBBRLR +FFFFBBFRRR +FFFBFFFRRL +FFFFBBBLLL +FBBBBFBLLL +BFBBFBFRLL +FFBFBFFRLR +FBFBBBFLLL +BFBBBFFLLL +BBFFBFFRLL +FBFFFFFLLR +FBBBBFBLRR +BFBFFFFRRR +BFFBBBBLRL +BFFBBFFLLL +FBFFBBFLRR +BBFFFFBLRR +FBBBBFFRLL +FBFBFFBRLR +FFFFBBFRLR +FBBFFBBLLR +BFFFBBFLRL +BFFFFFFLRR +BFBFBFBRRL +FFBBFBFLLR +BFBBFBFLLR +FFBBBFBLRR +BBFFBFBRRL +BFFBBBFLRL +BFFBFFFRRR +FFFFBBFLLL +BBFFFBBRLR +FFBBBBBRLR +FFBFBBBRLR +FFFFBFBLLR +FBBBBBBLLR +FBBBFFBLRL +BFFFFFFLLL +FBBFBBFLLL +BFBBBBBLRR +FBFBBFBLLL +FBFFFBBLLL +FBFFFBBRLR +FFFBBBFRRL +FBFFFFBLLL +BBFFFFFRLL +BFBFBBFLRL +FBBBFFFLLL +BFBBFBBRLR +FFBFBBFRLL +FFBFBFBLRL +BFFBBBBRRR +FFFFBBFLRL +BBFFFFBLLR +FFFBBBFLLR +FFFBFFFLLR +FFBBBFFLRL +FBFBBBFLRL +FBBFBBFLLR +FBFBBFFLLR +BBFFBBBRRL +FBFBBFBLRR +FBBBFFFLLR +FBFBFFFRLL +FFBBFFBLLL +FBBBFBFRRR +BFBFFFBRRR +FBBBFFFRRR +BBFFBBBLLL +BFFBFFBRLR +BFFFBFBLLR +FBBBBBFLRR +FBBFBBBLRL +FFFBFFFLRR +FFFFBBBRRR +BBFFFBFLRL +FBFBBFFRRL +BBFBFFFRLR +FBFBFBBRRL +FFBFFBFLRL +FBFFBFBRLR +BFBFFFFLRL +FBFFFBFRRR +FFFFBFBRRR +BBFFFFBRLR +FBBBFFBRRL +FBBFFBBRLR +FFBBFBFLRL +BFFFBBBLLR +BFFFFFFRLL +BFFBBBBLRR +BFBFBBBRRL +FBFBBBBLLL +BBFFFBBLRR +FFFFBBFLRR +FFBBFBBLRR +FFFBBBBLLL +FFBBBBFLLL +FBBFFFFLLR +FFBFBBBRLL +FFBBFBBRRR +BFBFBBBLLR +FBBBBBFLLL +FFBBFFBRLL +BFBFFBFRLR +FBBFBFBRRL +FFBBFFFLRR +BFBFBFFLRL +FBFFBFFRRR +BBFFBFFRLR +FFBBBBBRRL +FBBBFBBLLR +FFFBBBBLLR +FFBBFBBLLR +BBFBFFBLRL +BFFFFFBLLR +FFFBFFBRLL +FFFFBFBRLR +FFBFFBBRRR +FBBBBFFLRR +BFBFFFFRLR +FFBBFFBLRL +BFBBFBBLLR +BBFBFFFLRR +FBFFFBBLLR +BFFBBBFLLR +BFFBBFFLLR +BFBBBBFRLR +FBFFBBBLLR +FFBFFFFLLR +FBBBBFFRRL +FBFBBFBRRL +FFFFBFBLRR +BBFFFFBRRR +BFBBFBFRRL +BFFBBFFRLR +FBFBFBFLLR +BBFFBFFLRL +BBFFBBBLLR +BFBBBFBLLL +BFBBBBBLLR +FBBBFFBRLL +FBFFBFBRLL +BFBFFBFLLR +BFBFFFFLLL +FBFFFFFRLL +FFBBFFFLLR +FFFBFFFRRR +FBFFFBFRLR +FFFBFBBLLL +BBFFFBBLLL +FFFBBFBLRL +FBBBFBFRRL +FFFBBFBRLR +BFBBBFFLRR +FFBBBFFLRR +FFBFBBBLLR +FBBFBFBLLR +FFBFFBBRRL +FFFBFBFLRR +FBBFBFBRLL +BBFFBBFLRL +FBBFFBFRRL +BFBFBFFRRR +BFBBBFBRRR +BFFFFBFLLR +FBBFBFBRRR +BFFFFBBLLL +FFFBFFFRLR +FBBFBFBRLR +BFFFFBFRLL +FFBFBBFRRR +BBFFBFBRRR +FFBBBFFRLR +BFBFBFFRRL +BFFFBFBLRR +BFBBFBBRRR +FFBFFBFRLR +BFFFBFFRRL +BFBFBBBLRR +FFBBBBBRLL +BFBBFFBRLR +FBFFFFFLRL +FFBBBBBRRR +FFBFFFBLLL +FFBBBBBLLR +BBFFBFBRLL +BFBFBBBLRL +FBBFFFFLRR +BBFFBFBLLR +FFBBBFBLLR +BFBFFFBRLR +FBFBBBFLRR +FBFBBBBRLL +BFFFFBFLRL +BFFFBFBRLR +FBBFFFFLRL +FFFBBBBRLL +FFFBFFFRLL +FFFFBBBLRL +BFFFBFBRLL +FBFBBBBLRR +BFBBBFFLLR +FFFBFFBRLR +FBFFBFFLRR +FFFFBFFLLL +BFFBBBFLLL +BFFFBBBRLL +FBFFFFBLRL +BBFFBBFRLL +BFBBBFBLRL +FBBFFBBRLL +BFBBBBBLLL +BFBFBFBLRL +BFFBBFBLRL +BFFBFFBRRR +FFBBBBFLRR +FBBBBFBRRR +FBBBFBFLLR +FFBFBBFLLL +BBFFBBFLRR +FFFBBFFRLR +FBBBFFFRLL +FBBBBFFRRR +FFFBFBFLLL +BBFBFFFLLL +FBFFBFBRRR +BFFFBFFLRL +FFBBBFBLLL +FBBBBFBRLR +BFBFFBFLLL +BFBFBBFLLL +FBFBFFBLLL +FBBBBFFRLR +FBFFBFFRLR +BFBFBBFLRR +FBFBBBBLRL +FFFFBBFRLL +FFBFBBBRRR +BFFBBFFRRL +BBFFBBFRLR +FBBFFBFLLR +FBFFBFFLLL +BBFFFBFRRL +FBFFFFBRLL +FBFBFBFRRL +FFBFFFBLLR +BFBFFBBLLL +BFBFBFFLRR +FBFFBFFRLL +BFFBFBFLLR +FBFBFFBLRL +FFBFBFFRRL +FBFBBBBRLR +FFFFBBBRLL +BFBBFBFLLL +FBFFFFFLLL +FFBBFBFLRR +FFBFBFBRRL +FBFFBFBRRL +FBFBFBFRLR +FFFBBBFLRL +BFBBBBBRLR +BBFFBBFLLL +FBBFBBBLRR +FFBBBFBRLL +FBFFBBFRRR +FFFFBFFLRL +FFBFBBFRLR +FBBFBFFLRR +FFBBFBFLLL +FFBFBBBLLL +BFFFBBBLLL +BFFBBBBRLR +BFBBFBBLLL +FFBBBFBLRL +BFFBBFFRRR +FFFBBFBRLL +BFBFBFFLLL +BFFBBBFRLR +BFBFFBBLRR +FBBFFFBRRR +FBBFFFFRRR +BFBFBFBLLR +BBFFBBFRRL +FFFFBBBRRL +FFFBFBFLRL +BFFFBFFLLR +FFBBFFFRRL +FFFBFBBRRR +BFFFFBBRRL +BFBBFFFLRR +BFBFFFFRLL +FFFFBBBRLR +FFFBBFBLLR +FBFBFBFRLL +BFBBFBFLRL +BFBBBBBRRR +FBFFFFBRRL +BFBFFFBLRL +FBFBBBFRLR +BFBFFBFLRR +FFBFBFFLRR +FFFBBBFRRR +FFBBFFBRLR +FFBFFFFLRR +FBBBFFFLRL +BFBBFFBLLR +BFFBFBBLRR +FBBFBFBLRL +BFFFBFBLLL +FFFBBFFLRR +FBFFFFFRRR +BFBFFBFLRL +FFBFFFBRRR +FBFBFBBLLR +FFFFBBBLLR +BFBFFFFRRL +FFBBFFFRRR +FBBBFBFLRL +BFBBBFFRLL +BFBFFBBLRL +BBFFFFFLLR +FFBBBFFLLL +FFBFFFBRLL +FFBBFFBLLR +BBFFBFFLLL +FBFBBFBRRR +FBBBBBFLLR +FFBFFFFLRL +FBBBBFFLLL +BFFBFBFRRR +FBFFFFFLRR +FFFFBBFLLR +FFFBFBFRRL +FBFBFBFLRR +FBFBBFFRLR +BFFFBBFRLR +FFBFFBBLRR +FFBBFFBRRL +BFBFFBFRRL +FFFBFFBLRR +BFBBFFFRRR +BFFBFBFLRL +FFBFBBFRRL +BFFFBFFLLL +FBFFBFBLLL +BFBBFFFLLR +BFFFFBBLRR +FFFBFFFLLL +BBFFBBBRLL +BFFBFBFLRR +FBBFBFFRLL +BFFBBBBRLL +BFBFBBFLLR +FBBBBBBRLR +BFBBBBFRRR +FFBFFBFLLL +BFFFFFBRRL +BFFFBFFRLL +BFFFBFBLRL +FFBBBBFRLR +FBBBFFFLRR +BFFBFBBRRL +BBFFFFFRRR +FBBBFBBLLL +FFBFFFBLRR +FFBBFBBRLL +FBFBBFFLLL +BFFFBFFRLR +BFBBBBBLRL +FFFBFFBRRR +FFFBBFFLRL +FBFBFBBRLL +FFFBFBBRLL +FFBFBFBRLL +FBFFFBFRLL +BFFBFBFRRL +FBBFFFBRLR +BFBBBFFRRR +FBBBBBFLRL +FFFFFBBRRL +FBFFBBFLLL +BFBBFBBLRL +BFFBBFBLLL +FFBFBFFLLL +FFFBBBFLLL +BFFBFBFLLL +FBFFFFBRLR +FBFBBFBLRL +BBFFFBFRLR +FFFBBFBLRR +BFFBFFBRLL +BFFBBFBRLL +FBBFFFFRLR +FBBFFFBLLL +FFBFFFFRRL +FFFFBFFLLR +FFFBBFFRLL +BFBBBFBRLR +BFBFFFBLRR +BFFFBBFLRR +BFBFFBFRLL +BFBBFFBRRL +FFFFBBBLRR +FBFFFBBLRL +FFBBBFFRLL +FBBBFBBRLR +FFBFFBFRRR +FBFBFFFRRL +BFBBBFFRLR +FFFBBBFLRR +FFFFBBFRRL +FFBFBFBLRR +FFFBFFBLLL +FBFFFBBRRL +FFFFBFFRLR +FFBBBBBLRR +FFFFBFFRLL +FBFFBBBRRL +BFFFFBBLRL +FBFFBBBRLL +BBFFFFFLRL +FBFBBFFLRR +FBBBBFBRLL +BFFBFFFLLL +FBBBFFFRLR +BFBBFFBLRR +FFBBFBBLLL +FBBFFBBRRL +BFBFBFBLRR +FFFBBFBRRL +BBFFFBFLRR +FBBBBBBLLL +BFFFBFBRRR +FBFBFFFLLL +FFBBBBBLLL +BFBFBFFLLR +FBBFFBBLLL +FBBBBBBLRL +BBFFBBBRLR +FBFFFBBRLL +BFBFBBBRLL +BBFBFFBLLR +FFFBBFFRRR +FBFBFBBRRR +FBBFBFFRRR +BFBBBFBRLL +FBFBFFBLLR +BBFFBFBLLL +BFFFBBFRLL +FBFBFFFLLR +FBFFFFBRRR +FFBFBBFLRL +BBFFFBFLLL +FBBFBBBLLL +FBBBFBBRRL +FBFBFBFLLL +FFFFBFBLRL +FFFFFBBRRR +FFBFFBBLLR +BBFFFFFRRL +FBFBBBFLLR +BFBBBFFRRL +FBFBBFBRLR +BFBBBFBLRR +FFBFBFFLLR +FBFBFFBRRL +FFBFBFBRLR +BFBFFBBRLL +FFBFFFFRRR +BFFBBFBRRR +FFBBBBFRRL +FFFBBBBLRL +FFBBBFFRRL +BFBBBBFRLL +BFBFBFBLLL +BFBBFFFRRL +BFFBFFBLLR +FFBBBFBRLR +FFBBFBFRRL +FBFFBBBLRR +FBBFBBBLLR +BFBFFBBLLR +BFFFFBFLLL +FFFBFBFLLR +FBFFFFBLRR +FBBFBFBLLL +BFFFFBFRLR +FBBBFBFRLR +FFBBFBFRLR +BFFFFFFLLR +BFFFFBFRRL +BBFFBBFRRR +FBFFBFFLRL +FBBBBBFRLR +FBBBBFBLRL +BFFFBBBRRR +FFFFBFFRRL +FFBFFFFLLL +FFFBFBFRLL +FFBFFBFLRR +FBBFFBFLRL +FBBFFBBLRR +FFBFFBFRRL +BFFFFFFRRR +BFBFBBBRLR +BFFBFBBRLL +BBFFBFFRRL +FBBFBBFRLL +BFFFFFBRLR +BFBBBBFLLL +BFBBFFBRRR +FFFFBFBLLL +FFBBFFFRLR +BFBBBFBRRL +BFFFBBFRRR +FBFFFFFRRL +BFFBFFFRLL +BFFFFBBRLR +FFBBFFBLRR +BBFFBBBLRR +FBBFFFFRRL +BFFFFBBRLL +BFFFFFBRLL +BFBFFFFLLR +FBBBBBFRRL +FBFBBBBRRR +FBBFBBFRRL +FBBBFBBRLL +FBFFBFFLLR +FFBFFFFRLR +BFFFFFFRRL +BFBBFFFRLR +FFBBBBFLRL +FFBFFBBRLL +FFBBFBBLRL +FBFBFFBLRR +BFFBFBFRLR +FBFFBBBRRR +FBBBBFFLRL +FBBFBFFRRL +FFBFBFFLRL +BFFBBFBRLR +BBFFFFFLRR +FBBFFFBRLL +BFFFBFBRRL +FFBFBFFRLL +BBFFBBBRRR +BBFFFFBLRL +BBFFFBBRRR +BBFFFFBRLL +FBBFFBFLLL +BFFFBBBLRR +FFBFFBFLLR +FBBFBFFLLR +FBFBBFFLRL +FBBBBFBRRL +BFBBFBFLRR +BBFFBFBLRR +FFFBBBBLRR +FBBBFFBRLR +FBFBFBBLRR +FBBBFBBRRR +BFBBFFFLLL +BFFFFBBLLR +FBBBBBBRLL +FBBBFBBLRL +FBBBBBBRRR +FFFBBBFRLL +BBFFFFFLLL +FBBFFBFRLR +BFBBBBFLRL +BFFFFBFRRR +FBFFBBBLRL +BFBBFBBRRL +FBFFBFBLRL +FFFBBFBRRR +BFBFBBBRRR +BFBBFFFLRL +BBFFFBBRRL +FFFBBBBRRL +FBBBFFBLLR +FBFBFFFLRR +FBFBFBBRLR +BFFFBBFRRL +FBFBFBFRRR +FBBFFFFLLL +FBBFFBBLRL +FBBBFBFLRR +FFFBBFFLLL +BFFBFFBRRL +BFFFFBBRRR +FFFFFBBRLR +BBFFBBBLRL +FBBFBBFRRR +BFBBFBBLRR +FFBFFFFRLL +BFBFFFBRRL +FBBFBBBRLL +FBFBBFBRLL +FBFFFBFRRL +BFFBFFBLRR +FBBFBFBLRR +BFBBBBFLLR +BFBBBFBLLR +FFFFBFBRRL +FFFBBBBRLR +FFBFFFBRLR +BFFBFFBLRL +FBBFBFFLLL +BFFBFBBLLL +FBFBBFBLLR +FBBFFBFLRR +FFBBBBFLLR +FBBFBFFLRL +FFFBFBBLRL +FBBFFFFRLL +BFBFBBFRRR +FBFFBBBLLL +FFBFBBBLRL +BBFFBBFLLR +FBFFFBFLLL +BFBFBFBRRR +BFBBBBBRRL +BBFBFFBLLL +BFFFFFFLRL +FBBFFFBRRL +FFBBFBFRLL +BBFFBFFLLR +BBFBFFFRRL +FFFBBFBLLL +BFFBFFFRRL +BFBBBBBRLL +FFFBFBFRLR +FBFFBBFRRL +BFFBFFFLLR +FFBBFFFLLL +BFFBBBFRLL +FFBBBBFRLL +FFFFBFFLRR +FFBBBBBLRL +FBBBBBBLRR +FBBFFFBLLR +BBFFFBBRLL +BFFBBFFLRL +FFFBFBFRRR +FBFBFBBLLL +FBBBBBFRLL +FBBBBBBRRL +FBFBBBBRRL +FBFFBFFRRL +BFFFBBFLLR +BFFBFFFLRR +BFFBBFBLRR +FFFFBFBRLL +BFFBFFFLRL +FFBFFFBLRL +FBBFFFBLRR +BFBBBFFLRL +FBFFBBFLRL +BFFFBBBRLR +BFFBFBBRRR +BFFFFFBLRL +BBFBFFFLRL +BFBFBBFRRL +BBFFBFFLRR +FBFBFBBLRL +BFBFBBFRLR +FFFBBBBRRR +FBFFFFBLLR +FBFBBFFRLL +BFBFFBFRRR +FFFBFFBLLR +FBFBFBFLRL +FBBFBBBRLR +FFFBFBBLLR +FFBBFFFRLL +BFBFFBBRLR +BBFFFFBLLL +FFBBBFFRRR +BFFBFFFRLR +FFBFFBBLRL +FBBBFFBRRR +BFBFBBFRLL +BFBBBBFRRL +BFBBFFBRLL +BBFFFBBLRL +FFBBBBFRRR +BBFFFBFRRR +BFBFFFFLRR +FFFBFBBLRR +BFFBBFBRRL +FBBFBBBRRR +FBFBFFFLRL +BFBBFBFRLR +FFFBFFFLRL +FFBBBFBRRR +FBBFFBBRRR +BBFFFBBLLR +FFFBFFBLRL +FFBFBBBRRL +FFBBBFFLLR +FBFFBBFRLR +FBFFFBFLRL +FFBBFBBRRL +FFFBBFFRRL +FBBFBBFRLR +FBFBBFFRRR +FFFFBFFRRR +BFFFFFBLRR +BBFFFFBRRL +FBBBFFBLRR +BFFBFBFRLL +FFBFFFBRRL +FFBFBFBLLR \ No newline at end of file diff --git a/day5/src/main.zig b/day5/src/main.zig new file mode 100644 index 0000000..990a96c --- /dev/null +++ b/day5/src/main.zig @@ -0,0 +1,99 @@ +const std = @import("std"); + +pub fn main() anyerror!void { + var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + var gpa = &arena.allocator; + defer arena.deinit(); + + // Read entire file + var f = try std.fs.cwd().openFile("input", .{}); + var contents = try f.readToEndAlloc(gpa, std.math.maxInt(u32)); + + var highest_id : u32 = 0; + var seat_ids : [814]u32 = undefined; + var it = std.mem.tokenize(contents, "\n"); + var i : u32 = 0; + while (it.next()) |n| { + var s = decode_seat_id(n); + var id = s.get_id(); + highest_id = std.math.max(highest_id, id); + seat_ids[i] = id; + i += 1; + } + std.log.info("Highest seat id: {}", .{highest_id}); + + // Part2: This works because the IDs are otherwise contiguous + std.sort.insertionSort(u32, seat_ids[0..], {}, asc_u32); + // Search for a gap of 3, we're the middle of the gap + var prev : u32 = 0; + for (seat_ids) |id| { + //std.log.debug("{} [prev: {} // delta {}]", .{id, prev, id - prev}); + if (prev == 0) { + prev = id; + continue; + } + if ((id - prev) != 1) { + std.log.info("Gap of {} found between {} and {}", .{id - prev, prev, id}); + std.log.info("Seat ID: {}", .{id - 1}); + } + prev = id; + } +} + +const asc_u32 = std.sort.asc(u32); +const Seat = struct { + row : u32 = 0, + col : u32 = 0, + + pub fn get_id(self: *Seat) u32 { + return (self.row*8) + self.col; + } +}; + +fn decode_seat_id(code: []const u8) Seat { + //std.log.debug("{}", .{code}); + return Seat { + .row = _bsp(code[0..7], 127), + .col = _bsp(code[7..], 7), + }; +} + +fn _bsp(code: []const u8, max_val: u32) u32 { + var min : u32 = 0; + var max : u32 = max_val; + for (code) |c| { + var half_range = (max-min)/2; + if (c == 'F' or c == 'L') { + // Low half + max = min + half_range; + } + else if (c == 'B' or c == 'R') { + min = max - half_range; + } + } + //std.log.debug("{} --> {}, {}", .{code, min, max}); + std.debug.assert(max == min); + return max; +} + +test "bsp" { + var s0 = decode_seat_id("FBFBBFFRLR"); + std.testing.expectEqual(s0.row, 44); + std.testing.expectEqual(s0.col, 5); + std.testing.expectEqual(s0.get_id(), 357); + + var s1 = decode_seat_id("BFFFBBFRRR"); + std.testing.expectEqual(s1.row, 70); + std.testing.expectEqual(s1.col, 7); + std.testing.expectEqual(s1.get_id(), 567); + + var s2 = decode_seat_id("FFFBBBFRRR"); + std.testing.expectEqual(s2.row, 14); + std.testing.expectEqual(s2.col, 7); + std.testing.expectEqual(s2.get_id(), 119); + + var s3 = decode_seat_id("BBFFBBFRLL"); + std.testing.expectEqual(s3.row, 102); + std.testing.expectEqual(s3.col, 4); + std.testing.expectEqual(s3.get_id(), 820); +} diff --git a/day6/build.zig b/day6/build.zig new file mode 100644 index 0000000..be1b13a --- /dev/null +++ b/day6/build.zig @@ -0,0 +1,27 @@ +const Builder = @import("std").build.Builder; + +pub fn build(b: *Builder) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard release options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. + const mode = b.standardReleaseOptions(); + + const exe = b.addExecutable("day6", "src/main.zig"); + exe.setTarget(target); + exe.setBuildMode(mode); + exe.install(); + + const run_cmd = exe.run(); + run_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); +} diff --git a/day6/input b/day6/input new file mode 100644 index 0000000..67f02f8 --- /dev/null +++ b/day6/input @@ -0,0 +1,2079 @@ +x +x + +ygzdvpxjk +bzdgq +aulrhfwi + +tpasjur +jrutopas +rtjpaus +sraetpju +tpajsru + +vus +uvs +vwups + +r +r +r +d +j + +qohtkgcpl +yukohqglp +dobtpghlkq +hglqpaosrnk + +zathopqrnf +tfphoznqra +ornthfpqza + +xymf +yfm +yaeflpmc +mxfy + +xhjnyblvetrzcsdfgioqw +nyvjcwruaitzkbsfelxhqmo +vqlebsnycaijwxhftzor + +pvnbhgqxokzfls +ktfiphrwzyu + +snadfrzvj +huravjsfnz +wrfajsvznx + +gzqpt +htzqp +pltxqz + +dwf +fwvd +fwjxzd + +wvkaetlonsmzyxp +flamyzwpnexosvk +ylsoxwnmkpegvazf +xnozlvwayepksmj + +hegoanjwcuqr +unjghwraoecqm + +vrmuincbeax +mrxcevanu +cmanxeuqvr +xmcrunveqa +rvxcunmea + +edz +zgesn +ozqjtrewa +zdefv +czdenf + +imnklhe +flsnkj +nkljfv + +dtkhezmqarglsyujifncbpx +smyaqrdnjzutcpfkbxghl +nzupmhqkjfblrdasxgcty +ltbdpxsmhzkyjargfcunq + +khbnlsgcwdepajfqry +fcglrsedyjkbnwpahz +rngyalswjpecfktbhd +eajkdwshrclpfgnby +eqvgcfpyxdjirlwhkabsn + +nsxzlycfmhtkpr +wmxstkfoyrhlzp + +jqxfycbl +fjztavkuxeh +mxdfipon +eyrvxswhgfa + +yqutg +qytgu +ytugq +tlgquy +uqytg + +lsnvemdftqgzk +ethkglvsqdf +edxfsltqgvk +zflnhgtsvkqde + +zxqiowjp +ojziqxwp +pxwjizoq + +jxfsvcu +scqufxjv + +nmkbsdpth +ekqzlgwuyrcapt + +bvxfjegzyawqtdpkrihonl +kgdxaywnmbthueqpfjvilo + +wukhzt +ztqhipkexwo +zhkwltfu + +dosntymrebgxip +vbakzmsqnxehtyg +besntwxymgju +pbsgyntoemx + +ke +ke +ek + +gkqrxeyhmpwoavszftnid +qablonwmkpridxgcztsehy + +ejnuvyrgwkfphld +vyejdomzqcrtwuigs + +sxjnructhkifz +umktfhirxnec +iunkcfhryxt +hftciukrnx +kuctixrfhn + +m +c + +ktwhurxsgza +huntakrzxg + +bfiecpvksjzgxmtrhwndy +yewjdrpcfvmxub + +kxv +bvkx + +mpkdrilqnvgjszxhbceat +qplbdncjxgzvsimakehrt +abwpdvkcmjihleqsrxztgn +ejkotbiyranhvzpgmdsqlcx + +upykgj +lkqbapvf +wpzmkr +upkngjw + +henpvx +uhnepi +vhpn +unph +gacnoptsyh + +va +v +v +v + +mfgsejknphquwvtzic +nyfhzpkxqtmlwivsgec + +l +l +lr + +vneibmqwsuropl +qulpwvhbmirne +priwulqenbmv +uwbznlqrmpviea +nmvqulerpdbiw + +zrcedpsjlgavqhkfwyxinobmut +wvzastimlhdyeobxckurfgpnjq + +c +w +c +c + +eavhgx +axvegh +xghvae +eagvhx +xaehvg + +qhvryckj +cyqhvkj +vhyjmzcgqk + +inyetbqzdcu +cezuhin +ejaurictfnym +hrngcezuia +xkliecvuwsn + +qowvezrdukfbn +zewvyunqoambdr +zngwprusefvdbkqo +euwdbvqnzfro +xrqovndztwueb + +klpubivcyfoemgdqzasn +stujebgynqmlxvak +nvmqsubergklwyh + +pbsjdzutfgwmxieqcraklhv +bjcexgqskpvolmadnzryftwu +mvxrzwtqaujgpcebdklsf + +balwcovj +jwobvalc +bwjaolvc +lbaojcvw +cvbwlajo + +onvtx +xotnv + +y +ydg +y +fy + +ndluot +huotfw +gouqtl + +usvy +qf + +h +c +c + +vjyolxpgqfk +qbugnhjvpx +xtzaprdcvjqigm + +idryqgoevjwhpal +jwrledyhvgpaoqi +olgejvpdaqwiyrh +ajehiwrlodvypgq +oylrhqwajevgpid + +x +x +p +r + +rnqocxehf +yrjmlgdavuwihox +xrqpnkoht + +yvackuxdrbespfoz +oyxcabeuszrfvpkd +utxobrfckapdvzsey +eoxsdayfpkucvbzr + +jortnzkcqb +bznrjycktqo +zjqnkrtcob +qojktrnbcz +qktojzrncb + +uokgp +krui + +iqbhupfzg +fqklopwh +qstfhnp +nqykmsphf + +jnzpybrvctmgx +pzjbyxmgkcvn +cvxjzgpnbmy +gvynmcxzbpj + +zihyt +zihty +zhtyi +ohytiz +tyizh + +hrtmfqdnbsjceuxgiakol +lxprsezfuyw + +bnpesm +fqhcya +kdoy + +hsfj +qecixr +dyzpo + +nsviyq +isyqnv +cvqdsfnjyi +qvniys +qvysni + +olsytfpiqbcgruavnmkdj +wobyanuximplfgtrc + +fakvjrdemphinxzboygcq +rpxbevcfsodljzqmaigkh + +osh +hoprni +efzcdv +jxih +p + +qhamel +slehaz +mealyh +hela +belahtkn + +ertwyfubagxcilm +gfytuxwmrbialec +cmxybwaptedlrufig +uciewrabfxymltg +geurytlicmbawxf + +pqosuijf +qfsjiup +ifsrpujq + +iv +vi +iv +gvi +vi + +gcpsri +tsmvokr +usqagr + +svtwqplur +thzwuporavyl +ltupsqrwv +utvwlsprq + +apeidznxcr +imgtbyekslu +hseitolv + +tfhpmels +haspqmfel +kplfrjymxeh +pthlvmqef +cehdmtfpsl + +dj +caj +d +vohrlqx + +kuzcdayghrqbtpe +kcpxwmaeruqzhvb + +riwuxjg +puwhxdj +blknsvt + +jtvyr +tjrvy +vjyrt +vytjr +jvrty + +qngcme +qenc +knecpq + +psetjy +xvikrzflgdm +yco +wconu +bucqa + +kdnt +udnz +dnagt +xdkn + +jsikbcef +ksefbi +yeikfbs +snevfqxiakb + +wqtgfxruzyd +jrkfxwtzqdub + +kemcnsaxjfiubg +mankwgqsuxibcj +sbgkvujnmcxai +fgyixmnkdacbujs + +dmrkoujzbvtwsqyx +fqibxwkhmzcertd + +jbw +wryg +w +w + +y +g + +bcfztdseowilyqapun +wpmsdbozlqvciku +xqsbloudprihcwz + +intvfbkagzs +krweqxlajmtyu + +r +p +zjcogl +pv + +fljxyzkgt +ktzlcsigxyf +xygltfzki +lgyxtbkfzj +klmtrzdfegqxhny + +ejfndtrmwlyzxqavhcbspoikg +ajnlbfrcswgmdkthpxiqvz + +ysikgwrpx +rdmkqgsw +wgrchksjf +wykdasgr + +emaizfwdc +adcwsozetmf + +m +r +z + +knvpqjbasl +jqnsvklbpa +dvksqnbljpa +pawskblnqjv +blakpsqjnfv + +phioqsu +gunio +uoi + +wlqhkndiuoxtgesrmpfv +wvgsmtolekfhaxnpqui + +slu +uisal + +fsepbqldiztcwanjohruky +lsbtpoenyvuazqghijfrkcwd +kqzrdphyoacenswumblxtij + +zfbadvte +zteda +otazie +eturlyah + +gt +tgd +gvta +tg + +rjck +ymcv +lctoweb +cmqh +mruchy + +iztpec +ipeztc +zceipt +icpzet +ecptzhi + +mjubdrwxaitnvcekgslhqpz +ldhvzxbrqjtcmpuiasewk + +dkjlrwqbpa +jqlzerbpa + +svupyxrbk +grtnawqcybmdhfiz + +qzjmpxinvwked +bxfuzhany +snxotzlgc + +cfvejdxqrzlhobi +vrojlcdmzebuq + +idrjshpbqtevogmy +ysdvpeuqlmhgbioj +pgwybvmosdjiehu +pvdhcseguyomjbi +kixjgompdbnvfhzseya + +jgl +gjlez +glj +jgl + +zrbxvcuwjidklfmnqotg +lmurpfvqzoxjgwbckndti +umlqjgbxdkrivcntwzfo +wsedxcrblhmotqjkavzfuing +tnqdxjmcrofvbzkyguwil + +dmxcntqwauokif +tqmufiwnhk +inzeftquwmvpbjs +iwgfymqrutdn + +ejsfxcgdtkhoqu +kfhitexsugdj + +tnypmbxl +rxmbnltpy +xnbylmtp + +c +ksc +thcpjf +gmucyaxdz +ck + +xqizlfeksrjh +wgetzlkx + +khnawcubgpx +knctwgupa +kpwngcau +apzwqckgnu +npkawcgu + +itlec +lhectib +lctesi + +mhanjrlytudgzovf +nzjgdapevrh +inhdrjeazgv +gznhdiajrv +jazvhdrng + +itgemupjxbhvs +epsjthguxvimz +jmhxspugetvi +pjhiseuvtgmx + +beln +le +xle +elhazjy +ecl + +ev +v + +ryzfswe +sylrkzc + +vezqnasodyjxlfkgiup +vlkyixzeqdbajfruongp + +td +tkqpl +tde + +lcdkt +tcnkd +okciajvuxdqt + +usoyw +owuys +ouswy +swyou +wsyou + +xmfovdhgnlcja +qfympwaotzvchrlu + +gcx +c +c + +cxpanqwbzjeiruogsh +npqobaijrgwsecuh +vjfbmsagotwpyhckeriqu +biosrpqwgljexauch + +kriedwmbz +ykhebdsjtz + +inblqrgm +rqbimln +nbrqlim + +wdlmasxozvngrkuy +zguaymvdolnkwsxr +gvxadrlowkmzunsy + +frpv +vprasf +irapxf +unmfpe + +icgmloskedvrhfq +xzitwrbjpny + +qbvwlyext +qtblesvw +etlwbqv +tebvlw +hpbevwtl + +bmnpvz +nbvmoz +nwczgybvlkd +abvztn +bnzve + +b +c +b + +tchlzb +gz + +ndr +rdn +dnr + +sctrbhpnmzev +qedsncvaruymg +dncrsemkvaox +yarlncvdwxsem + +sfhunci +nsuhifc +siuhcfn +icufhns + +gnheqlb +ukpd + +lixtrswd +wntldgisx +spclikxftdhwzuejabo +stywildxv +stmlxdiwq + +ehsqnvgzw +neszvwgqh +qwzhsevgn + +etgcydsljko +xoyiqbumwanhr + +hvbqfdkyzupwnctr +jnchwzpsobtkfeqruy + +gvzipoldfjx +zodxivgpl +noibqzgxvldp +doqplvgzxi +olxpvdzig + +sqri +qirs + +nzhagdpqyrtuclsxojbfev +uqznepyjgfoavrthslbcdx +uxztlrfhgevopdbsancqjy +uqrtexnlzvjahcgbdpsfyo +jdhgotuxqvpzsrcfnaylbe + +anytx +mgldfs +vn +jpxn +yujnw + +zdgnamji +pmjnzgdwbcoi +jynmiguzd +jgrumdntiz +mganjdsiz + +jikqaxmebd +uolhrpecyxvda +dafxhtrse + +lbjmzepw +barycf +suxb +xuqb + +xjkpdbsycqzfml +pszjxdkycmfq +hyqzxfpjctwkdsmn +fqsdkuyxcpjmez + +tmxoylwjzas +gqbwlujd +pldwnjibrqe + +oxtwegdyarcmufj +dcfuwrgxmytejo +mwutxyorcdgfej +dctrumjwxegyfo +twpyflemcjgourxzdk + +ji +ij + +hbjzg +czbtgj +bgjz +zjbg + +hziwf +jqhgmlybvf + +sgukx +jxqts + +rbekhvqmjw +wjkmvbrghqye +qowekvthnjrb +jevhqkwbr +wreyhjvqkb + +f +f +lfi + +b +r +b +nim + +ds +dms +nsd + +reydi +clbyfjoqg +pzny +wekuiy +yhi + +ujqkgvwhybdaxfoz +joaxzvkgbufqhw + +zcyhdxriqtolasnwpmfvukg +tpolkuqmhzcyisvndargxfw +umphysgavwqixcdfrlkotzn +wgpruaotvcklnfidmxzyqhs + +ubwgxvmkjz +gzkbmuxwvj +jyuxgbkvmwz +xvjkubzmgw + +cjbalye +naero +aspe +ache + +usfcwigx +wcistfguxz +ishfguxcw + +vowtyizedpxjkuhgln +rtacogzuipjydhxlnew +gjmzenuwstlpxqbhyodfi + +humbgtvizaqnrekx +urixmqaghktbnezv +geabrihuzvtqnsxdmk + +oqdctfig +itmfgcqoyk +ijuoaqxcfthg + +slbj +bslj +lbjs +jslb + +dyhijmulgn +gcxrkbt +cogkr + +l +hl +le +el +l + +rd +dr +dr + +sx +kzfyajw +cuplmx + +yos +ys +jqyta + +b +b +b + +hwotauyxk +koufjyh +ouhyk +hklouy + +sm +s +csig +sgi +esxy + +rgukjdhytpmoewicz +dzgwtkejyacros + +dwpuknfajbeztsvlcir +nbeilkzmyqswjfdapuvgt +zbvuifewstkadpnjl + +lctyng +yncldht + +hdusmgynzxba +auzvjdmhxybgns +hbumansdxogzyek + +lnshkwetqz +enxhqolgkds + +hxczvrwn +xzrwvnfoh +khrwsbeytzil + +qr +o +o +hey + +krtpbuzgy +buztrpkgy +tupybkrgzq +pyubztkogr + +f +fx +m +x + +uvbf +awy + +odwf +fdwo +wodf +odwf + +atnskdpybvlowehzmx +aopknhzybdwtsumlvx +lsbqxonmwgthdaykvzp + +zcvgrlkiwdnjxuyeabftosqp +ijhuaexordwgtlqbpsynkcz + +rb +b +e +e +p + +rgfljswuqmnxdyzve +sdurkno +budprnsac +anruids + +s +q +q + +xq +x + +mkcounerqzvywhb +rhmuwbylqcxzedovn +wcyrzehguqknbvmol +uiosmjcwyfqzvhptrben + +cbafotnhw +ztbwievgscufo +kmrqfbwtcoy +ftwcosb + +pqbdg +lvyknqjdt +okcdy +durhfwzamsi +edkt + +rteknjgdziaxuvqpwms +euqatrgskzjdxpiwmnv +odpxerktavzujqiwsngm +xpajvmrwugsqzdyhitkne +zjpmskatnegrquxwifvd + +ucp +puc + +sbhrmvgkxlwcuizf +irughftcbsxvkzm + +jgufnkhxcrwsqyav +rhjndfxayuqgsvc + +wh +hw +hw +wh +hw + +oskmgp +pskmorb + +zbjxfa +afzujx + +lrucpk +bosmyzdf + +jxtmurs +kmou +uybvqmc + +c +cha +h +t + +yj +yj + +ubhwxkosgq +giqwkhtuesbox + +pwqjdvbzir +ijrzqdub +sjanrzbiq +jizqbry + +m +m +um +m +m + +hmgxpcyfzenjlavbrtd +yvtxmarbphjoefzgnl + +dsmcohpqxzytbefwun +vkglfzxscniymhqurpdtbeoa + +b +e +q + +dr +rd +dr +dr + +peqvdfnayt +qpjcsu + +lfq +lqf +lfq +flq +qlf + +thnkmpcl +fkiavtnux +tqpkn + +zuxche +zcxuhr +xcznhua +xhuzcd +pxuhnczs + +vdtesl +ktlmxsf + +ekrfgonxblyuqwcmithazvdjp +awlpvtybicnhqdxeofzgjkmru +zdyfgtaoilqwuhkpbexcjvrnm + +zutmxljqsbwevaog +jnouplrwkzq + +bvkwprm +xiz +i +gdc +if + +krm +rm +rmush +opjrnmeb +rmuki + +iw +ysw +kl +gtjb +hrndzmf + +z +sjcdb +d +cqs +hlot + +ehs +yabvz +hjsgx + +fgexm +xtjfe +ebfjxh +zsvfopulwnixc + +kmqupeigvojczwbadlx +gxmawjupbvkedqlzco +exlzudcqbmvawjgokp +lgkconmhwxyvqtzuedbpaj +guofmwqdjxvezlapcbk + +yzvldxhqpcregionbwmast +oxbnyzpseagchiqrtwvmld +ivmargzsdlcwhoxynpqbet +dfeczlatxrgybwpnmvisohq + +sbdtompfakqzuw +odwukmshptfizq +pquszdktmifwno + +uhgxdiptswayqref +waqdrxpltvufsciyge + +lxkvhzeruigsboft +hobvxrieltumgyzfs +bovtrghfxeiulsz + +mkxhjuygbvcno +ygoqnubvj +pyzdubtlnsjgvo +bnguvojy + +pmuxezk +odpiyevns + +iergxuojpqwskbdnyt +dtebiujnospkwyragq +roqbendjksgiwupty +nbhftycoqleusjdwpvgkri +qryzgjekwpubidtosn + +hkosdxcnztelmp +ltxcshpodmkenz +aeokdzmhlxnctps +tcohzelnsxdpmk +rlmxzsdchoipenkt + +klodupfxjg +dxouflgj +zjfugadelox + +qe +eq +qey +nkemqr + +kpyahrdgnv +vkrnygdpah +nygrkhdvpa +hngyqkrdcvpa +nhygkpravd + +pojt +tjp +tpij +tpj +ptjx + +ptudvwcsnbzlkmh +pnvuklmedhwcstzb +stpkbndzwcxulmhv +lshkvqbtnmauwpdzc +lvbkdstmhczunpw + +cjki +i +dh +nayubo +zte + +lrsyuzkehwmdi +uilhsekdmwr +ehlmdkiuwsr +mlwuiskedhr +remuhcdikwls + +nevqwlas +tafkhjrndcsgm +aizsxn +anqlswvy + +tdfxwikmqcygoja +pbmnevlsoxkiudhyctqf + +uncjptla +snpj + +mqnwhueayizvl +zwqlijnymve +pkloymxntbigqwzerdf +nvqyeilmzw +icjmlezwqyn + +echgfxinmd +ftcmixeghn +xbikghlcpfnwem +jxcfgedimnh +jehnsmgxcdif + +qorpli +ipohrq +pqirko +prioq + +vcptybfelzaihduknmwgs +hsugpzyftmeiklbawnvcd +caukmbihneywsdvfztplg +tcziphfsbdkmavwulnyge +kcmfhlgbnaztdsyuvrpwei + +yvzouqjilkgm +mgkpqyzotublsevi +iazkvluoygmq + +wphvnftyxedckbzq +dbzhwqxnpvfyce +sqebwpydfvncxhz + +jdtehlm +rz +rv + +bw +wb +bw +btw +bw + +esviqco +uceqvxj +qcvywrat + +y +qf +y + +wdopylavgxi +uomhenqjzbrcf + +gyowtsk +hplycvznxtqw + +xhlomdpznrcavebti +barocdnhpmgtlk +phrtmbdnacol +rgdomapnhbltc + +sdqiauyzgvj +uvayizq +iqyuavz +qauzyvi + +uvrs +usv +svu +suv +vsu + +zg +mge +y +vcf + +gunfyiqemws +esywnimfugq +mfwysnquieg + +ag +gab +pga +agd +ga + +npgitkbz +vxhzakcj + +rkdst +onhzibjuyg + +bha +la + +iepquktyaxmfhnlobcrwjvds +kmfpuchdwbaxqviojynrstel +jwotpldbxqnkrichseyuvmfa + +agunzk +izug + +lawqrc +fdo +dp + +ptmfuje +umfqjbedtlz +rmwxfjute +utsjmfer + +fymhpzavr +lehormypnfwx +hpljurctygmf +upylfqtrdijhbm + +ugscvjxfkh +sihzmngcjdv + +pbwjhdvlntmxuykzcqf +nmisaefgqhcoz + +orcfsxm +xcmfrs +syrxfcm +srfmxc + +yjodxnav + +smvkfxt +sutnflvk + +rgb +b +b + +uahjwtqbeklgfzixpocrvmn +kbjlqzxwuratocmfpinhegv +qrijtvkzbsclmefahpwugonx + +cnvxwskaithmrpdjzegoufly +yojesiunmzclkvghxwtrdapf +fcazyohpuliwmgdnvsjterxk +padmkvwzgyxtjcselruhofni +thjrfauldyvpcisxngokmewz + +jtr +tr +tr +rlt + +o +fx +o +o + +jviduxrqhpzykm +jrlhykixbv +hkyjilrvx +yhxivkrjl +xryhbkijv + +jx +i +rekgmt + +hdigybslxfozca +sbypgfvxzihcmlau +caliwbxzfgehy + +xwbdprtsoqzuny +smkhxcjfaived + +j +j +j + +nvwbegrypaofxq +ofvqxeyrgp + +klw +lkw +kwl + +zyrfuqhnagk +ghfzeswqkc +ekqzohgf + +rgumpkoehtndcb +gcdfkipuvbojlmn + +uqlivpmac +vplcqimua +upmalcvqi +mcuvlpqai + +woi +wio + +zycvodbiatfr +boycztjaidfrv + +kyimbvawqx +mvwkyjcqaiptr +vhiykmaqw +kqmvxyiwa +vakmqwiy + +mb +axhbf +ldpczbr +vhfbym + +zvibckofgyjqtw +fmqzswhpeklyjtbvuoi +fjixaznqkywtbvco + +vxcnagsqdmhuotwe +envfkxdroqawcgsmty +aspitmqnxwedvcbl + +tqsizydbaw +ohejgpk + +xvrzbcpogdyfuhwknmiesqa +oigwafzqnmshkevcuxbypdrl +grhcbdxyuewisvazfqpkomn +mnyvbxcsaeoufpwrqzkdhgi +dxzyrsogubncfqtmvepihwka + +n +n +n +n +n + +bmpkgzfojxelrwtc +qairymcnsuxlokj + +dewfscvkqbtzpx +cdpuewltsbzormq +wvtdngphbkeszcqj + +disryhxvpbulzw +hbzlwdirsvpyxu +irzldphyubxswv +wihdrypxvuszlb + +fxtqpck +xqkptcf + +factlhdbwurgvxiekpszqjo +gjhxkdfpsltcvoibruqewaz +tcpfirvxkjwolzasbeguqhd +vjrfpclktdeshquigxbowza + +pqabsimryhtd +uvlconjzxgwke + +pmyjflwzckdvnergq +zjprwygclekfmqvdn +wykjldrvfqecngmzp +vjfmcynwegzprdklhq +cfqnmrldegyzpwkvj + +xh +h +eh +nh +hldjq + +kapbqmo +fbakptzq +okpcqbat +xjopbqka +ubpdqrkhga + +wyaudlen +eawulynd +wueadlny +uaelndwy +aluewndy + +byzxchgujesn +ygzxanucbejh + +ehftw +lmvfa +hfsg + +wvmfzghpsy +hfm +dhgmjzux +reablkontchmq + +gzwqlcx +bgzlctwn +uzcwdpgaxlv + +nukwtrszf +rfndkzcsomwu +rusfnwzk +ufzwlrnsk + +bv +ai +b +v +v + +uxcdomyb +qrwgzvfnai +lhntkrpjsegf + +fqxugyni +ifynw +ayigfkn +qynafsgi +yfqcni + +yecqrtdzbnhp +hcrzqodnv +qhnrzdcf + +p +v + +afoxchynvipsel +nsxlcohfpeiyav +sxalyfhpwvoneci +xislpcoyefvnha + +najlhzu +zjyclua +tslumedaiq + +k +k +k +k +k + +odetwpfglrcjqmuihx +dyrqkfweansjvmhglzpu + +igskahu +esihkglu +giushk +guhxkis +suknighx + +oxemfvj +xomzsqv +mlnxvo + +tlwfvk +tlvw +ztvlxcr +vwltf +vwlt + +uwmpzlhenva +otzqhxmngylkup +whnufmlzpev +lfupmhnz +vmluszhpn + +nqsireakdvpbtfcwgxy +bkqygapisnxfwrtecvodj +enbvtdisqwaxfpgrcyk +xvdbrwgimatefqcyspkn + +ajumckognwqs +mcwbsjqtkgfdziro + +acpzwt +zlcyaet + +gvu +vg +gv + +qgcjztkuo +ojbwtrxaq + +tecrwjigkqpbnufmldavxh +fxvhgjetlrwdpziukbnc +xkvlhwrtbfydigpsocnje + +kqyn +uw + +caixsqhpgwvmo +uhxomepiqc + +naud +numdat +vuzaednw +nagtdxu +guxdna + +xdmkliqsw +kwlqxamti +vdqpmwlxik + +mixyslpha +ayihosplx +xytbdakhiplrswz +povsiyhflxa + +ynli +boyins +yin +iny + +fgjmlirc +rjfilcgm + +mohvfnrgzjkuc +ujroykmzfwa + +xljiqtkpe +glymhtqpak +etpsklnq +dtpqkl + +cefwpgnbamdzj +zyjeaxwumpdcfnbr + +vxdhgi +hgdixv +dnxrhqvgim +ixvdghb +pgxihdv + +ytbgfrm +mgoty +qjltepmgsy +tfymg + +xlgpjbkwqeavsu +exjaugptqlsbkwv +jegvpwluibkaqysx +qwbexsvfprjulz + +ugnwqbiyp +gnbqyipu +bygiqnpu +gybnpuqi + +tmldrwhgivbnq +wtgdqhvrljb + +cvlt +peoxb + +rblnmixegdwafuoyq +qgoylwxbarumifedn +arfquebxydimnvclowg + +fywzsnhitdcae +tadizcyfsnewh +sawtdziyfngpchx + +vnuhpkriz +lrupivknj +hunripvk +vdkuqsrifnp + +axdzckpvimueqjtgy +ctpymavjkxzreuqli +pedavgzqxthkcmjuiwy + +kxperoiadjgsnfbm +jpikdgrexanmbfos +jrcedfukonpbgixsma + +ugo +guos +guo + +bmhnfupxotj +bjhftongxyupmz +uxbnmjocpfht + +gdx +gk +gc + +fvwc +wkqzcfvh +wcfv +vwecf +cvywf + +w +w +w +c + +eosuimrzpqvyk +kzmicpqvexours +ivrmseztophqkug +kipmquyorvezs + +fpmkrd +tzupnklqxfa +ypfgek +jrfcpkbd +ofkgp + +qrwoydm +bgtlcxpsh + +gawqbjoyrcvizhpmsel +aveozrfgjpismdbcyhwl +rchmbojzqiweplygvsa +zbvclsxrmitehywjoapg +yjhimlberdvscgzpaowu + +qawpmhydzn +rfbyw +wgokjfy + +pnhbd +qfug +fdep +imowsvtxlzkry +ajg + +nquegztm +srnj + +wit +tusiv +qmcoftrljdyk +t + +hxbsozmwegqjkicufl +likdywshmvxuzcfqb + +vtaqrdcfoybz +cfozirq +frkqocz +qfhrzoc + +t +t + +xjqbomigwrfckhsynva +mqoniwygafbkcrsjvxh +aicnmeoqgvwjyfurxhztsbk +wfrmbcaivnskyhjxqgo + +vzad +dvaqz +udazj + +dqsvrj +jkcq +ezuqxjm +qdtavj +jtsq + +qgawvsxo +cpmaxziubdewlfnt +rjsxaw +hkwxya + +lmbopvufrxnw +mvdnioxjpaqeyfrlsgh +nzmtklorpxvf + +eqiwxhrvudokt +xumrqhvnswiaky +vupkbiqrmwxnh +hixwqvzgck + +ziedvfb +fvbezid +bidzefv +bfezvid +edizbfv + +eglq +lgeq +qlge + +pabzfmvsxdqoykhurtjl +zyleahvmbocxpkrtfs + +g +g +g +gv + +mgwxotefbiqjudn +uoniqfdtgxwbjeml + +ryzmxkwosabecqvtj +bftceznowiyskpqvjxdm +ecmxqktvoswbzjy +czjhkyvsmwoetbaqx +zqrwuyesmvbcoktjx + +ytanuz +byanf +jpoglevikmyhc +wsqdyx + +uzwbmdsgafvyk +noqlhcjwx +qxrtpowh + +vlsgakpqfjemz +kgvqauiesdjlfnz +fcegqzsjkvla +kglzqajpseyvf + +hztmnjip +cfptrw + +kaeubgqoxsfiyjtwmhcvzrnl +ikmhteubjczxyvoqsfln +vnxsukmbecqljfidozyth +ushnpjevlkbocxfmiqtyz + +mye +ezmy +mye +meysnt +yme + +xtvlmhrbdypeaf +bvxftlaephdmyr +dhuxmtryeplfvab +vxrmaybhplfdet +vxrfeyhplbdmta + +pek +pe + +dpo +gpdfjsaho +hnpo +dpamoy +wvueozqxp + +wjdqzpftmhk +vmtod +tbdmg +rytuvcdbm +rtboyemdca + +dxmsyfacqoigtuvjnwph +upojvbynselfdzhkwqrt + +d +dmo + +cymqgxwurzhdbteok +acydrugmobzlxek +xmugryzcobked +cmbyokexuldgzr + +uebznq +ubqzen +qunbez +zuqebn +buzeqn + +uewpvklzhoqifcsb +rlvdyhnkjptiwxgab + +xgdazmoqwislvb +qxodszwlvbgai +azsdiwlgqoxvb +ldzvgwoqsxiba + +ozbnvjquac +pgntbvw + +aexsklbwjydt +akjbwedsxylt +keaxswdbtjyl +leykdbstjwxqam +xewlkdytasbj + +ahzvbeqsctofui +ueabotfhvdzcsrqi +obzhuvteqapscfi +ovhbpuqcslzfieta +vbfhtqszaociue + +ugilv +ivlgm +vxigrl +gvli + +qjni +qongz +nyqj +sfdqwlvcxn + +bcgdtuaxmlkrevof +ftorcabmwueykglxd +tahfxumdobrclzikneg +xakfmdtgocruleb + +ihrobnmcpqtgwk +hwkrgmpoctuqni +nwiphcogrkqtm +whrqpktngmycboi +vjiwsothqgnkdrzecmp + +fmvhjo +fomhvjq + +pkvcijtamu +xijwkrbmluneta + +evjomncktgpu +gumxn +mnuyqgfai +luqxgmwn + +vgxsetchwpajodzmu +tubxpkqheniygjodwm + +zugtaqdsofhpe +tuqpdhgar +ugnoadthq +yvkugjhdaxbcmqt +gthudaq + +dzfmjsgaqubntpkvleo +zuwgvfbkarlyxpdihnme + +z +z +zp +zb +z + +khdj +dhj +hdkjrgz +eofuhjdta + +gauozreitvy +oeidrzyv + +zlvxcidkob +obdckzlvix +olckbzdxiv +lkxcboidvz + +rpslxjnfh +bhvuytmosdzaqwgk + +rbjloemzv +zlbeormj +rlmbjezo + +djbyqfcoknxsmtzghrp +hksxmbyzgfnpdjqocr +cjodkxfrpgnmbqhyzs + +ko +rok +kwo +kgio + +ypocjw +hyw +pwy +iyfw +yqwgjv + +hyto +hqtko + +gw +g +ag +gj + +sckdazw +fazodyc + +wofxjgyqurha +fhxjboaerg +ztsgrohfjcal +hjgxarfou +rvqyegxakhbfoj + +coat +coa +oca +coat +oack + +tzcdyrhfuxisvlgm +txuplzrcsjhmyavi + +ahcxfelbv +haxlbfevc + +owfizxugtsemclrypjvahqdnb +ugncvldopbwqjzmxhirfaet +oupwmqnzilhdtcbavrkxejfg + +fjyagkzt +gfyktjza +kayfgzqtj + +iutxmzd +dmtuzix +tzmxidu + +cndejklaphsquowi +pjocdlehukqai +hixujeqlrktapdco + +xcapfuiljwgqsevot +tlfdxuwkjpnqvsmoeg + +madurwbn +anwdbqmru +rdwubanm + +gl +lanp +wlkijdruy +zlg +hlx + +d +da +da +dmwp + +e +ey +e + +mcxndruabhvp +pnqudhcymb + +qxldtifpvshowjbkemza +hvziwsglkjepobfmqaxd +hzxeslvdomagbrwkjifpq +hbxdsfkizqvljwopae +zucafhbkvelxoqipdsnjyw + +hoeqg +fqghrt +gqh + +v +r +r + +iovxlnqsz +iosnqfxzl +ozxinsql + +pqsvfxihdmzkrnacobetjluwy +wytcbhvxsrndpafleuiqozjkm + +ngi +ogi +ticfga + +qg +drl + +mzbfwevsodakx +gdwvskin +vdskwli + +jienvauxkgfdqh +qdhxjktavizcpnuef +fkbqueiladvjnxh +ukfwjndxhaieqv + +gdlrowxahs +lusdcwhyg +dwalghs +hzdgitqeflws +dgkhlws + +pmjkz +kzpmvj +pzkjmh + +dshpxl +vbtmniafszewdkxup +opsqdxyj + +etki +eikt +tiek +iket +ktei + +yvfta +atypkqfv diff --git a/day6/src/main.zig b/day6/src/main.zig new file mode 100644 index 0000000..55b0dab --- /dev/null +++ b/day6/src/main.zig @@ -0,0 +1,118 @@ +const std = @import("std"); + +pub fn main() anyerror!void { + var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + defer arena.deinit(); + var gpa = &arena.allocator; + + var records = try read_records("input", gpa); + + // part 1 + var yes_per_group = std.ArrayList(u32).init(gpa); + var yeses : u32 = 0; + for (records.items) |r| { + var map = std.hash_map.AutoHashMap(u8, bool).init(gpa); + defer map.deinit(); + try map.ensureCapacity(26); + + for (r) |c| { + if (std.ascii.isAlpha(c)) { + map.putAssumeCapacity(c, true); + } + } + var count = map.count(); + std.log.debug("{} yeses in group '{}'", .{count, r}); + try yes_per_group.append(count); + yeses += count; + } + std.log.info("{} yeses across {} groups", .{yeses, yes_per_group.items.len}); + + // part 2 + const one :u26 = comptime 1; + var and_yeses : u32 = 0; + for (records.items) |r| { + var it = std.mem.tokenize(r, " "); + var state : u26 = std.math.maxInt(u26); + while (it.next()) |answer| { + var person_yeses : u26 = 0; + for (answer) |c| { + if (std.ascii.isAlpha(c)) { + person_yeses |= (one << @intCast(u5, (c-97))); + } + } + //std.log.debug("{x} <-- {}", .{person_yeses, answer}); + state &= person_yeses; + } + //std.log.debug("{x}", .{state}); + var count = count_one_bits(state); + //std.log.debug("{} and-yeses in group '{}'", .{count, r}); + and_yeses += count; + } + std.log.info("{} and-yeses across {} groups", .{and_yeses, yes_per_group.items.len}); +} + +fn count_one_bits(a: u26) u32 { + var i : u5 = 0; + var one : u26 = 1; + var count : u32 = 0; + while (i < 26) : (i += 1) { + var b : u26 = one << i; + if ((a & b) == b) { + count +=1; + } + } + return count; +} +fn read_records(filename: []const u8, allocator: *std.mem.Allocator) !std.ArrayList([]u8) { + var file = try std.fs.cwd().openFile(filename, .{}); + var reader = file.reader(); + + var records = std.ArrayList([]u8).init(allocator); + var record = std.ArrayList(u8).init(allocator); + var n_newlines : u32 = 0; + var just_had_newline = false; + const state = enum { + AddingData, + CheckingNewline, + RecordEnd, + }; + var current_state = state.AddingData; + while(true) { + var n = reader.readByte() catch |err| { + // Finalize record + try records.append(try allocator.dupe(u8, record.items[0..record.items.len])); + //std.log.debug("Found record: '{}'", .{record.items}); + record.deinit(); + record = std.ArrayList(u8).init(allocator); + std.mem.set(u8, record.items, 0); + break; + }; + if (n == '\n') { + if (current_state == state.CheckingNewline) { + current_state = state.RecordEnd; + // Finalize record + try records.append(try allocator.dupe(u8, record.items[0..record.items.len])); + //std.log.debug("Found record: '{}'", .{record.items}); + record.deinit(); + record = std.ArrayList(u8).init(allocator); + std.mem.set(u8, record.items, 0); + current_state = state.AddingData; + continue; + } + else { + current_state = state.CheckingNewline; + // whitespace can always be added + try record.append(' '); + continue; + } + } + else { + if (current_state == state.CheckingNewline) { + current_state = state.AddingData; + } + try record.append(n); + } + } + std.log.debug("Found {} records", .{records.items.len}); + return records; +} diff --git a/day7/build.zig b/day7/build.zig new file mode 100644 index 0000000..b3ce472 --- /dev/null +++ b/day7/build.zig @@ -0,0 +1,27 @@ +const Builder = @import("std").build.Builder; + +pub fn build(b: *Builder) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard release options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. + const mode = b.standardReleaseOptions(); + + const exe = b.addExecutable("day7", "src/main.zig"); + exe.setTarget(target); + exe.setBuildMode(mode); + exe.install(); + + const run_cmd = exe.run(); + run_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); +} diff --git a/day7/input b/day7/input new file mode 100644 index 0000000..8954672 --- /dev/null +++ b/day7/input @@ -0,0 +1,594 @@ +vibrant aqua bags contain 1 shiny magenta bag, 2 muted teal bags, 1 dim magenta bag, 1 muted chartreuse bag. +vibrant violet bags contain 4 pale maroon bags. +dark indigo bags contain 1 light maroon bag, 3 pale red bags, 1 drab brown bag, 4 dim magenta bags. +dark coral bags contain 5 dull aqua bags, 5 plaid green bags, 2 posh bronze bags. +dim lavender bags contain 2 muted violet bags, 5 wavy gold bags, 3 vibrant plum bags, 5 bright teal bags. +mirrored turquoise bags contain 5 muted olive bags, 5 bright gold bags, 2 vibrant violet bags. +faded brown bags contain 5 faded tomato bags. +muted orange bags contain 5 dull aqua bags, 2 light salmon bags, 1 striped black bag, 1 pale gray bag. +posh black bags contain 4 faded silver bags. +muted coral bags contain 3 mirrored turquoise bags. +clear silver bags contain 5 dark cyan bags. +clear crimson bags contain 2 dim blue bags, 4 bright indigo bags. +clear salmon bags contain 4 striped cyan bags, 1 muted maroon bag, 1 light bronze bag, 1 vibrant tan bag. +light olive bags contain 1 faded white bag, 2 dull chartreuse bags, 5 faded gray bags. +muted maroon bags contain 5 dark fuchsia bags, 5 drab violet bags. +posh plum bags contain 2 striped gray bags, 5 dim violet bags. +light orange bags contain 1 light purple bag. +drab white bags contain 4 plaid lime bags, 1 drab gold bag. +plaid indigo bags contain 5 clear lime bags, 1 dark fuchsia bag. +muted red bags contain 1 dull bronze bag. +mirrored magenta bags contain 5 plaid white bags, 1 faded plum bag, 5 wavy purple bags. +dotted lavender bags contain 5 shiny olive bags, 3 plaid blue bags, 1 shiny gold bag. +drab bronze bags contain 3 wavy silver bags, 4 light turquoise bags, 1 vibrant lavender bag, 5 light magenta bags. +plaid maroon bags contain 2 dim salmon bags, 5 muted violet bags. +dull salmon bags contain 5 striped beige bags, 2 muted plum bags, 1 posh teal bag. +dotted turquoise bags contain 5 striped orange bags. +bright yellow bags contain 2 shiny olive bags, 3 wavy teal bags, 1 pale plum bag, 3 mirrored coral bags. +dark black bags contain 5 pale gray bags. +shiny yellow bags contain 4 dark aqua bags, 2 drab lime bags, 2 bright gold bags, 4 dark cyan bags. +shiny red bags contain 2 posh blue bags. +posh olive bags contain 3 dim aqua bags. +muted chartreuse bags contain 4 posh brown bags, 5 shiny magenta bags. +mirrored orange bags contain 5 dotted salmon bags, 1 posh green bag. +muted plum bags contain 1 dull red bag, 4 posh green bags. +light green bags contain 2 wavy plum bags. +light cyan bags contain 2 dotted crimson bags, 4 faded salmon bags, 3 muted coral bags, 3 plaid blue bags. +dull lavender bags contain 3 drab gold bags, 5 plaid crimson bags. +posh red bags contain 3 dotted salmon bags, 2 pale beige bags, 2 mirrored coral bags, 5 muted teal bags. +vibrant beige bags contain 2 faded lime bags. +plaid blue bags contain 5 dull red bags, 3 light maroon bags, 4 muted gold bags, 2 drab orange bags. +dotted white bags contain 3 muted white bags. +drab fuchsia bags contain 2 shiny fuchsia bags. +drab crimson bags contain 1 posh beige bag, 4 drab violet bags. +drab beige bags contain 3 mirrored orange bags, 1 wavy silver bag, 2 pale magenta bags, 1 drab lime bag. +posh teal bags contain 2 clear brown bags. +mirrored brown bags contain 2 faded tan bags. +clear coral bags contain 1 muted chartreuse bag, 2 muted violet bags, 2 faded purple bags. +pale lime bags contain 5 vibrant aqua bags, 3 wavy purple bags, 1 drab violet bag. +vibrant red bags contain 5 shiny gold bags. +shiny fuchsia bags contain 1 dark salmon bag, 1 posh white bag. +bright gray bags contain 2 dim red bags. +drab lavender bags contain 2 clear tomato bags, 1 faded red bag, 1 pale chartreuse bag. +clear red bags contain 3 light salmon bags, 1 bright red bag, 5 dark indigo bags. +bright aqua bags contain 3 faded brown bags, 1 shiny yellow bag. +faded red bags contain 3 posh turquoise bags, 5 dark fuchsia bags. +faded turquoise bags contain 3 drab fuchsia bags. +dim aqua bags contain 1 faded white bag, 5 faded violet bags. +muted white bags contain 5 pale red bags, 4 dull red bags, 3 dotted maroon bags. +dull gold bags contain 3 posh green bags, 2 mirrored yellow bags, 2 dull olive bags, 2 bright purple bags. +faded blue bags contain 3 wavy crimson bags, 1 plaid beige bag, 3 dotted orange bags, 1 vibrant purple bag. +faded gray bags contain 1 bright gold bag. +dim bronze bags contain 2 bright gold bags, 4 light brown bags, 5 muted chartreuse bags. +light teal bags contain 5 striped tomato bags, 5 drab teal bags, 5 shiny lavender bags. +striped white bags contain 1 plaid silver bag, 2 wavy plum bags, 3 dull maroon bags, 2 muted green bags. +vibrant salmon bags contain 2 shiny violet bags, 4 light salmon bags. +dim plum bags contain 1 dull blue bag, 5 vibrant bronze bags. +dotted fuchsia bags contain 4 plaid green bags. +plaid crimson bags contain 3 clear teal bags, 5 dark gray bags, 2 mirrored tan bags, 5 shiny fuchsia bags. +pale white bags contain 2 muted silver bags, 1 muted lime bag. +bright violet bags contain 2 clear chartreuse bags, 2 dull gray bags, 2 muted cyan bags. +drab red bags contain 1 dotted white bag, 1 light plum bag, 5 muted indigo bags, 1 dull lime bag. +muted indigo bags contain 3 mirrored blue bags, 5 light fuchsia bags. +vibrant cyan bags contain 2 pale blue bags, 3 mirrored chartreuse bags. +mirrored gray bags contain 1 shiny red bag, 2 pale blue bags, 4 dotted lime bags, 1 faded violet bag. +posh lavender bags contain 3 vibrant aqua bags, 5 mirrored chartreuse bags. +dotted silver bags contain 3 dark beige bags, 5 dotted teal bags, 3 mirrored indigo bags, 2 dim yellow bags. +wavy magenta bags contain 4 wavy beige bags. +faded tomato bags contain 3 plaid black bags, 5 bright orange bags, 2 vibrant blue bags. +mirrored maroon bags contain 3 plaid gray bags. +pale bronze bags contain 4 vibrant violet bags, 2 muted white bags. +plaid turquoise bags contain 2 dotted lime bags, 3 striped beige bags, 1 pale crimson bag, 2 pale purple bags. +posh turquoise bags contain 5 clear yellow bags, 1 dotted turquoise bag, 3 dim cyan bags, 5 pale maroon bags. +wavy white bags contain 2 mirrored gray bags, 3 pale yellow bags. +vibrant tan bags contain 1 wavy lavender bag. +pale turquoise bags contain 2 dark gray bags, 4 faded green bags, 1 light maroon bag, 5 posh white bags. +faded beige bags contain 1 striped brown bag, 1 dull gray bag, 5 mirrored blue bags. +bright maroon bags contain 1 light blue bag, 5 dim bronze bags, 4 dotted beige bags. +shiny lavender bags contain 3 dim gray bags, 4 pale gray bags. +dull beige bags contain 3 dark crimson bags. +striped coral bags contain 3 dark lavender bags, 2 mirrored turquoise bags, 5 posh maroon bags, 1 striped yellow bag. +shiny magenta bags contain 1 plaid black bag. +muted magenta bags contain 2 plaid beige bags. +light salmon bags contain 5 striped black bags, 1 pale lavender bag. +shiny white bags contain 2 bright gold bags, 3 mirrored olive bags. +dark tomato bags contain 2 dark gold bags, 2 clear teal bags, 5 dull fuchsia bags, 4 dotted gold bags. +dotted violet bags contain 3 plaid teal bags, 5 mirrored aqua bags. +plaid purple bags contain 4 mirrored olive bags. +drab lime bags contain 5 bright beige bags, 4 mirrored tan bags, 5 striped black bags, 4 faded green bags. +dull blue bags contain 4 light red bags, 2 pale turquoise bags, 1 posh maroon bag. +muted tan bags contain 1 pale magenta bag, 3 mirrored turquoise bags, 3 shiny blue bags, 4 dotted salmon bags. +dim teal bags contain 1 posh turquoise bag, 3 dull red bags. +muted fuchsia bags contain 4 pale salmon bags, 1 pale silver bag, 3 pale maroon bags, 2 bright purple bags. +bright gold bags contain 2 shiny magenta bags, 4 pale red bags, 4 posh brown bags. +faded lime bags contain 5 vibrant bronze bags, 2 pale violet bags, 2 plaid coral bags. +posh tan bags contain 3 bright lavender bags, 2 striped blue bags, 5 shiny gold bags. +posh bronze bags contain 3 plaid olive bags, 3 dotted salmon bags. +shiny lime bags contain 1 bright salmon bag, 3 faded green bags, 2 wavy aqua bags. +faded lavender bags contain 2 bright silver bags. +muted black bags contain 5 mirrored coral bags. +plaid chartreuse bags contain 3 dull coral bags, 2 light tomato bags. +mirrored aqua bags contain 2 dark cyan bags, 2 dark indigo bags. +dark yellow bags contain 5 dotted lime bags, 1 dim cyan bag. +bright plum bags contain 5 dim salmon bags. +striped gray bags contain 3 plaid black bags, 1 wavy crimson bag, 5 bright orange bags. +faded salmon bags contain 3 clear lime bags, 4 drab purple bags. +pale olive bags contain 2 light magenta bags, 4 dim salmon bags, 5 light olive bags, 2 pale salmon bags. +faded crimson bags contain 2 wavy beige bags, 4 dim aqua bags, 5 light lavender bags. +posh chartreuse bags contain 5 pale lavender bags, 5 mirrored turquoise bags, 2 dark maroon bags. +posh aqua bags contain 5 faded crimson bags, 2 mirrored tan bags. +faded coral bags contain 2 dotted lime bags, 2 faded white bags. +striped bronze bags contain 4 plaid blue bags, 1 plaid coral bag. +wavy orange bags contain 5 pale tomato bags. +dim crimson bags contain 4 posh tan bags, 1 muted gold bag. +clear gray bags contain 3 striped lime bags, 4 vibrant fuchsia bags. +light gold bags contain 4 bright tan bags, 5 faded lime bags, 4 faded plum bags, 5 clear brown bags. +wavy red bags contain 4 pale red bags, 4 dotted maroon bags, 4 mirrored violet bags. +dull silver bags contain 1 striped turquoise bag, 2 striped orange bags, 1 dotted plum bag, 3 muted coral bags. +striped magenta bags contain 1 mirrored tan bag. +plaid plum bags contain 4 wavy tan bags, 5 wavy brown bags, 5 shiny olive bags, 5 clear yellow bags. +faded chartreuse bags contain 1 shiny teal bag. +clear chartreuse bags contain 2 drab tan bags, 3 plaid maroon bags, 2 drab orange bags, 2 plaid salmon bags. +wavy olive bags contain 5 dark lavender bags. +dull orange bags contain 1 dull gray bag, 2 light magenta bags. +wavy gold bags contain 5 vibrant yellow bags, 4 pale black bags, 2 light olive bags. +muted salmon bags contain 5 dotted turquoise bags, 5 dotted violet bags. +wavy tan bags contain 2 plaid green bags. +dotted cyan bags contain 4 drab gold bags, 1 dark crimson bag, 3 pale lavender bags. +wavy coral bags contain 3 mirrored blue bags, 5 wavy white bags, 1 striped indigo bag. +clear olive bags contain 4 wavy silver bags, 2 pale orange bags, 2 bright tan bags. +light indigo bags contain 1 pale purple bag, 4 clear teal bags, 1 plaid indigo bag, 4 dim blue bags. +dotted tomato bags contain 4 dim cyan bags. +pale indigo bags contain 2 muted chartreuse bags, 4 faded salmon bags, 3 dull brown bags. +bright magenta bags contain 1 vibrant salmon bag, 1 pale teal bag, 4 faded orange bags. +faded gold bags contain 4 striped cyan bags. +shiny orange bags contain 5 vibrant turquoise bags, 3 pale purple bags. +posh salmon bags contain 1 dotted crimson bag, 3 dark maroon bags. +dull violet bags contain 2 clear indigo bags. +posh gray bags contain 1 shiny fuchsia bag, 1 faded plum bag, 5 pale turquoise bags. +dull chartreuse bags contain 4 dull red bags, 1 striped black bag, 3 dark tan bags, 3 muted maroon bags. +dotted chartreuse bags contain 5 striped aqua bags. +dim magenta bags contain no other bags. +light lime bags contain 2 shiny magenta bags, 3 striped black bags. +drab maroon bags contain 2 vibrant bronze bags, 1 clear white bag, 2 dim gray bags. +drab salmon bags contain 2 wavy crimson bags, 3 dim gold bags, 5 drab chartreuse bags. +dotted crimson bags contain 4 pale purple bags, 3 plaid coral bags. +dull red bags contain 3 dark indigo bags, 2 posh white bags, 4 light maroon bags. +drab turquoise bags contain 2 striped tomato bags, 1 bright gold bag, 5 mirrored tan bags, 1 drab chartreuse bag. +shiny teal bags contain 4 bright lime bags, 2 pale red bags. +dark purple bags contain 5 mirrored beige bags, 1 posh purple bag, 5 dotted beige bags. +drab aqua bags contain 4 plaid blue bags, 3 dark salmon bags, 4 striped lime bags, 4 striped blue bags. +dull magenta bags contain 2 clear white bags, 5 muted bronze bags. +pale tan bags contain 1 pale lime bag. +dark fuchsia bags contain 3 dim coral bags, 1 muted white bag, 2 plaid blue bags. +mirrored beige bags contain 5 dotted magenta bags, 1 wavy olive bag, 1 dark tan bag. +drab tomato bags contain 4 dim cyan bags. +shiny tomato bags contain 2 shiny maroon bags, 2 dark lavender bags, 1 posh red bag, 3 vibrant green bags. +dim turquoise bags contain 4 muted salmon bags, 2 bright purple bags, 4 plaid maroon bags, 3 bright beige bags. +mirrored salmon bags contain 2 drab violet bags, 3 faded red bags. +pale crimson bags contain 3 bright white bags, 5 plaid beige bags. +shiny cyan bags contain 4 light blue bags. +clear lavender bags contain 5 bright turquoise bags. +vibrant purple bags contain 5 pale turquoise bags, 2 posh orange bags. +striped purple bags contain 5 muted orange bags, 5 dark aqua bags. +pale gray bags contain 5 dark indigo bags, 1 vibrant violet bag, 3 pale maroon bags, 4 bright gold bags. +posh brown bags contain 3 drab brown bags, 4 pale red bags, 2 posh white bags, 4 muted gold bags. +muted bronze bags contain 2 clear magenta bags, 5 shiny green bags, 2 mirrored tan bags, 4 posh gray bags. +pale brown bags contain 5 muted white bags, 3 plaid beige bags, 3 wavy lavender bags, 3 clear indigo bags. +dull yellow bags contain 5 clear lime bags, 4 plaid blue bags, 4 dotted lime bags. +light tan bags contain 5 dull blue bags, 2 drab yellow bags, 5 mirrored red bags. +posh gold bags contain 4 dull chartreuse bags, 2 dim magenta bags. +pale silver bags contain 4 dull aqua bags, 4 bright gold bags. +light beige bags contain 3 posh orange bags, 3 mirrored gray bags, 2 bright red bags. +striped turquoise bags contain 2 posh blue bags, 1 striped orange bag, 2 shiny tan bags, 5 vibrant aqua bags. +vibrant plum bags contain 4 pale gray bags. +dotted teal bags contain 2 dim magenta bags. +dull purple bags contain 5 drab brown bags, 4 dotted maroon bags, 1 muted white bag. +mirrored fuchsia bags contain 2 dark tomato bags, 4 faded tan bags, 2 faded white bags, 4 dotted orange bags. +dotted plum bags contain 2 dull aqua bags, 4 faded green bags. +bright fuchsia bags contain 2 wavy blue bags, 5 clear brown bags. +dim beige bags contain 2 pale orange bags. +dotted orange bags contain 2 faded brown bags, 1 clear tomato bag, 1 clear indigo bag. +plaid gold bags contain 1 striped turquoise bag, 3 vibrant magenta bags, 5 shiny gray bags, 5 shiny red bags. +clear plum bags contain 3 dim turquoise bags, 3 faded magenta bags, 2 dull coral bags. +muted green bags contain 3 dim crimson bags. +bright black bags contain 3 pale purple bags, 3 plaid white bags, 1 clear teal bag, 3 pale magenta bags. +dim gray bags contain 3 dull coral bags, 1 pale turquoise bag, 5 wavy cyan bags, 5 striped lime bags. +dotted beige bags contain 5 dull aqua bags, 3 dark fuchsia bags, 1 pale violet bag, 4 dim gold bags. +mirrored lime bags contain 4 plaid tomato bags, 1 pale lavender bag, 5 shiny blue bags, 1 light gray bag. +bright chartreuse bags contain 1 dotted teal bag, 3 shiny lavender bags. +vibrant tomato bags contain 1 vibrant coral bag. +mirrored purple bags contain 4 dark tan bags, 4 faded coral bags. +pale tomato bags contain 1 dull maroon bag, 2 striped tan bags, 5 muted cyan bags, 2 dark maroon bags. +vibrant brown bags contain 1 vibrant bronze bag, 2 pale yellow bags, 4 wavy coral bags. +dim green bags contain 2 striped coral bags. +muted lavender bags contain 3 clear purple bags, 4 dark red bags, 1 light silver bag, 1 dull blue bag. +wavy crimson bags contain 5 muted teal bags, 1 drab brown bag, 3 posh brown bags. +wavy tomato bags contain 4 striped blue bags, 3 mirrored lime bags, 1 shiny gray bag, 1 dark plum bag. +muted aqua bags contain 3 clear silver bags, 3 bright chartreuse bags, 4 striped teal bags, 2 clear indigo bags. +posh blue bags contain 2 posh teal bags, 4 dark maroon bags, 2 drab brown bags, 5 faded coral bags. +vibrant silver bags contain 5 drab yellow bags, 3 faded silver bags, 2 bright silver bags. +dim chartreuse bags contain 4 pale beige bags. +shiny gray bags contain 3 dotted magenta bags, 4 plaid crimson bags. +dim salmon bags contain 4 clear lime bags, 3 muted tomato bags, 2 shiny olive bags. +clear orange bags contain 4 posh beige bags, 5 dotted gray bags, 5 dotted turquoise bags. +plaid salmon bags contain 4 bright indigo bags. +posh beige bags contain 3 pale red bags. +clear lime bags contain 1 bright gold bag. +faded magenta bags contain 5 dim salmon bags, 3 dull aqua bags, 5 drab crimson bags. +drab blue bags contain 5 dark maroon bags, 4 wavy plum bags. +plaid aqua bags contain 5 mirrored orange bags, 3 dull violet bags, 3 bright salmon bags. +muted teal bags contain 4 dull red bags, 1 light maroon bag, 4 dark cyan bags. +posh green bags contain 1 mirrored chartreuse bag, 4 muted chartreuse bags, 5 plaid olive bags, 4 dark salmon bags. +posh fuchsia bags contain 3 bright cyan bags, 1 bright salmon bag, 4 dim salmon bags, 1 light black bag. +muted yellow bags contain 2 muted teal bags, 5 pale orange bags. +clear cyan bags contain 3 clear teal bags, 5 drab aqua bags, 2 drab brown bags. +wavy salmon bags contain 5 dark fuchsia bags, 2 dull gray bags, 4 pale tan bags. +dull crimson bags contain 5 faded indigo bags, 2 plaid black bags. +mirrored white bags contain 2 dotted plum bags, 2 dark coral bags, 3 faded gray bags. +striped violet bags contain 4 mirrored tan bags. +striped tan bags contain 2 posh coral bags. +striped tomato bags contain 1 muted teal bag, 1 faded tan bag. +faded aqua bags contain 5 faded red bags, 2 mirrored coral bags, 5 light red bags, 2 mirrored purple bags. +drab olive bags contain 2 drab gold bags. +bright lavender bags contain 1 dark salmon bag, 1 striped olive bag. +plaid green bags contain 2 bright gold bags. +dim purple bags contain 1 plaid yellow bag, 3 muted plum bags, 2 vibrant magenta bags. +faded violet bags contain 3 mirrored violet bags. +posh tomato bags contain 1 dark indigo bag, 2 pale yellow bags, 5 dull orange bags. +dim silver bags contain 1 dotted white bag, 5 faded white bags. +dotted red bags contain 2 dull yellow bags, 4 dim lavender bags, 1 light gold bag. +bright indigo bags contain 5 pale gray bags, 3 posh white bags. +faded fuchsia bags contain 4 muted green bags, 3 posh magenta bags. +wavy silver bags contain 1 dotted violet bag, 3 drab tomato bags, 4 dark fuchsia bags. +dim white bags contain 2 bright magenta bags. +pale beige bags contain 5 dim orange bags, 5 vibrant red bags. +vibrant orange bags contain 4 dull violet bags, 2 mirrored salmon bags, 1 drab lavender bag. +clear fuchsia bags contain 1 mirrored olive bag, 4 mirrored chartreuse bags, 1 posh beige bag. +vibrant indigo bags contain 5 dim lavender bags, 4 drab blue bags, 1 muted beige bag. +dim brown bags contain 2 posh brown bags. +plaid beige bags contain 1 dark tan bag, 5 clear teal bags, 2 light gray bags, 4 wavy lime bags. +bright crimson bags contain 4 drab chartreuse bags, 4 vibrant blue bags, 5 mirrored lime bags, 2 muted plum bags. +shiny purple bags contain 1 muted crimson bag. +wavy bronze bags contain 1 dim brown bag, 3 light salmon bags, 1 muted teal bag, 3 plaid olive bags. +faded bronze bags contain 2 striped blue bags, 2 posh white bags, 2 posh orange bags. +dark orange bags contain 2 vibrant aqua bags, 5 dark maroon bags, 1 mirrored aqua bag. +drab green bags contain 2 faded aqua bags, 5 posh crimson bags. +clear white bags contain 3 plaid black bags, 2 posh white bags, 5 posh lavender bags, 1 dull purple bag. +wavy black bags contain 4 bright magenta bags. +posh crimson bags contain 3 dark yellow bags, 1 mirrored purple bag, 2 dark maroon bags, 5 shiny olive bags. +dotted gray bags contain 4 posh maroon bags, 2 mirrored chartreuse bags, 5 wavy fuchsia bags. +vibrant lavender bags contain 2 plaid coral bags, 4 posh brown bags, 4 dim tan bags. +drab violet bags contain 4 muted gold bags. +striped maroon bags contain 4 dotted lavender bags, 2 dark fuchsia bags, 3 bright olive bags. +plaid white bags contain 2 wavy olive bags, 2 pale blue bags, 4 pale aqua bags. +pale gold bags contain 4 bright teal bags, 2 posh bronze bags, 3 shiny maroon bags, 1 pale brown bag. +vibrant olive bags contain 3 plaid green bags, 2 light maroon bags, 3 dotted salmon bags, 4 faded tomato bags. +dotted maroon bags contain no other bags. +light blue bags contain 2 dim violet bags, 1 vibrant beige bag. +mirrored tan bags contain 4 drab brown bags, 1 striped orange bag, 5 light maroon bags, 2 dotted maroon bags. +dark beige bags contain 1 drab maroon bag. +light silver bags contain 1 shiny chartreuse bag, 2 dim turquoise bags. +dull green bags contain 2 striped chartreuse bags, 2 mirrored gold bags, 4 dim fuchsia bags. +faded silver bags contain 3 drab violet bags. +bright beige bags contain 5 bright teal bags, 5 mirrored violet bags. +striped gold bags contain 2 wavy beige bags, 4 dim black bags. +wavy fuchsia bags contain 4 posh green bags. +shiny blue bags contain 3 posh maroon bags. +mirrored indigo bags contain 3 striped cyan bags, 2 vibrant blue bags, 5 wavy violet bags. +dim tomato bags contain 4 dull orange bags, 5 shiny green bags, 1 plaid olive bag. +plaid violet bags contain 1 dull violet bag, 4 plaid fuchsia bags. +dark white bags contain 3 drab orange bags. +drab indigo bags contain 3 dark red bags, 2 plaid tomato bags, 5 clear white bags. +shiny beige bags contain 2 posh tomato bags. +striped indigo bags contain 5 clear lavender bags, 5 dotted indigo bags, 1 muted cyan bag, 5 dark olive bags. +drab cyan bags contain 1 drab orange bag, 4 posh gold bags. +light red bags contain 4 dark indigo bags, 1 vibrant violet bag, 4 shiny magenta bags. +muted gold bags contain 3 light maroon bags, 1 striped orange bag, 4 pale maroon bags. +clear indigo bags contain 4 faded green bags, 3 clear crimson bags, 2 vibrant cyan bags. +faded tan bags contain 5 bright gold bags. +shiny salmon bags contain 1 bright lavender bag, 1 posh blue bag, 4 shiny coral bags. +dull turquoise bags contain 5 drab yellow bags, 5 dotted plum bags, 5 plaid magenta bags. +posh lime bags contain 4 wavy tan bags, 4 shiny tomato bags, 4 dim violet bags, 5 bright tan bags. +pale green bags contain 1 wavy gray bag, 2 faded lavender bags, 1 vibrant yellow bag. +mirrored gold bags contain 2 light gray bags, 5 wavy tan bags. +mirrored green bags contain 1 faded violet bag. +dark red bags contain 3 faded bronze bags, 4 dark green bags, 4 wavy crimson bags. +bright tomato bags contain 4 faded bronze bags. +mirrored crimson bags contain 5 faded red bags, 1 drab crimson bag. +faded orange bags contain 2 muted teal bags, 5 pale maroon bags, 1 dark yellow bag. +striped silver bags contain 4 mirrored lime bags, 1 dull tan bag, 1 pale fuchsia bag, 1 wavy purple bag. +wavy aqua bags contain 4 vibrant aqua bags, 4 shiny fuchsia bags, 4 dotted turquoise bags, 4 striped olive bags. +striped lavender bags contain 5 shiny lavender bags, 3 pale lime bags. +vibrant white bags contain 2 dim bronze bags, 2 light red bags, 5 shiny gold bags. +vibrant yellow bags contain 1 shiny turquoise bag, 5 dull beige bags, 4 dark gold bags, 5 dull tomato bags. +striped green bags contain 5 striped tomato bags. +muted silver bags contain 5 striped maroon bags, 5 light salmon bags, 4 clear maroon bags. +light plum bags contain 5 mirrored blue bags, 2 vibrant coral bags, 5 dim brown bags, 2 striped yellow bags. +posh yellow bags contain 1 mirrored salmon bag, 5 light plum bags. +plaid magenta bags contain 3 dull plum bags, 2 mirrored tan bags. +plaid tan bags contain 4 light turquoise bags, 4 faded purple bags, 3 mirrored crimson bags. +shiny black bags contain 3 striped violet bags, 1 dim cyan bag, 2 dim white bags. +wavy brown bags contain 2 plaid lavender bags. +vibrant gold bags contain 1 clear tomato bag, 1 wavy olive bag, 2 faded magenta bags. +clear brown bags contain 2 dim blue bags. +dim fuchsia bags contain 2 bright gold bags, 5 wavy purple bags, 3 posh orange bags. +muted turquoise bags contain 1 light turquoise bag, 3 vibrant plum bags, 5 posh maroon bags, 1 muted maroon bag. +shiny coral bags contain 3 striped yellow bags. +dotted coral bags contain 1 dark orange bag, 4 striped violet bags. +shiny bronze bags contain 5 mirrored yellow bags, 4 light violet bags, 4 light crimson bags. +dull cyan bags contain 2 dim cyan bags, 5 pale red bags. +bright tan bags contain 4 pale gray bags, 4 posh brown bags, 3 shiny fuchsia bags. +pale purple bags contain 5 wavy cyan bags, 5 dark salmon bags, 2 dark indigo bags, 1 plaid black bag. +shiny gold bags contain 2 pale maroon bags, 5 pale purple bags, 4 posh brown bags, 1 dotted turquoise bag. +dim tan bags contain 4 dark violet bags, 3 shiny blue bags. +wavy green bags contain 3 plaid gray bags. +pale orange bags contain 3 dim lime bags, 2 dark coral bags. +faded maroon bags contain 5 clear black bags, 3 light lavender bags, 3 light black bags, 2 muted orange bags. +drab teal bags contain 2 dotted crimson bags, 3 dim teal bags, 5 pale turquoise bags, 4 dark plum bags. +bright orange bags contain 3 pale maroon bags, 1 pale bronze bag, 3 dotted maroon bags. +posh coral bags contain 3 dim gold bags, 1 bright indigo bag, 3 clear black bags. +mirrored bronze bags contain 5 dull violet bags, 3 vibrant red bags. +pale lavender bags contain 2 pale purple bags, 1 pale red bag, 4 vibrant blue bags, 3 muted chartreuse bags. +wavy lavender bags contain 3 drab chartreuse bags, 1 posh teal bag. +pale blue bags contain 1 dark tan bag, 4 faded violet bags, 3 dim coral bags. +striped yellow bags contain 2 pale red bags. +shiny aqua bags contain 3 pale magenta bags. +faded olive bags contain 1 vibrant white bag, 4 muted cyan bags. +dark chartreuse bags contain 3 dim magenta bags, 3 dull plum bags, 2 pale lime bags. +dim lime bags contain 3 muted white bags, 4 striped blue bags. +wavy cyan bags contain 4 light maroon bags. +light bronze bags contain 1 dull lime bag. +muted beige bags contain 4 wavy blue bags, 2 dotted violet bags, 4 shiny orange bags. +dim coral bags contain 4 wavy crimson bags, 3 mirrored tan bags, 2 wavy cyan bags, 5 light maroon bags. +dark green bags contain 2 striped gray bags, 3 pale lavender bags, 1 striped lime bag. +pale cyan bags contain 2 vibrant green bags, 1 mirrored lime bag, 5 vibrant chartreuse bags, 1 shiny lime bag. +shiny crimson bags contain 4 dull aqua bags, 1 pale turquoise bag. +pale black bags contain 3 vibrant olive bags, 2 dull aqua bags, 1 drab turquoise bag. +striped crimson bags contain 4 dotted lavender bags, 2 clear orange bags. +clear maroon bags contain 2 muted bronze bags, 3 vibrant olive bags, 1 striped lavender bag. +dim olive bags contain 1 wavy lavender bag, 1 dotted salmon bag, 1 pale silver bag, 5 vibrant coral bags. +dotted indigo bags contain 3 dark salmon bags, 2 shiny turquoise bags, 4 plaid coral bags. +plaid orange bags contain 2 mirrored plum bags, 5 faded lime bags, 4 dotted brown bags, 2 pale tan bags. +light maroon bags contain no other bags. +light violet bags contain 5 clear yellow bags, 4 muted chartreuse bags. +light lavender bags contain 3 striped olive bags, 1 posh black bag. +muted lime bags contain 2 muted turquoise bags, 3 mirrored yellow bags, 5 clear gray bags. +faded black bags contain 1 bright crimson bag, 1 dotted beige bag, 2 shiny magenta bags. +wavy blue bags contain 5 vibrant plum bags, 5 shiny fuchsia bags, 2 posh orange bags, 1 wavy purple bag. +dark turquoise bags contain 5 shiny tan bags, 2 dull silver bags, 2 muted lime bags, 2 mirrored tan bags. +mirrored teal bags contain 4 pale brown bags, 5 drab lime bags, 5 striped beige bags. +vibrant gray bags contain 5 bright yellow bags, 1 vibrant teal bag. +clear purple bags contain 5 bright silver bags, 1 bright teal bag, 1 wavy lime bag, 4 striped blue bags. +striped lime bags contain 1 mirrored violet bag, 3 dim cyan bags, 3 vibrant turquoise bags, 2 muted white bags. +mirrored lavender bags contain 2 faded yellow bags. +posh maroon bags contain 1 dotted salmon bag, 5 drab violet bags, 5 striped lime bags, 3 dotted olive bags. +faded yellow bags contain 1 dull plum bag, 5 dim fuchsia bags. +dull aqua bags contain 2 pale maroon bags. +dark tan bags contain 4 dark salmon bags. +dim maroon bags contain 4 posh aqua bags, 3 striped yellow bags. +faded purple bags contain 5 clear teal bags, 2 dark olive bags. +clear tomato bags contain 2 pale maroon bags. +dull gray bags contain 5 light brown bags, 3 bright gold bags, 4 faded white bags, 3 vibrant coral bags. +dull maroon bags contain 4 clear indigo bags, 5 shiny magenta bags, 3 drab tomato bags, 4 dim violet bags. +pale coral bags contain 2 pale bronze bags, 2 wavy salmon bags. +drab silver bags contain 3 dark coral bags, 5 shiny violet bags, 5 faded indigo bags. +plaid black bags contain 1 dull red bag. +plaid silver bags contain 4 clear cyan bags. +dotted blue bags contain 2 plaid beige bags, 4 posh cyan bags, 4 shiny gray bags. +dotted magenta bags contain 1 drab orange bag, 5 wavy aqua bags, 2 wavy lavender bags. +clear aqua bags contain 4 striped magenta bags, 4 muted chartreuse bags. +pale red bags contain no other bags. +bright turquoise bags contain 1 wavy purple bag, 3 vibrant turquoise bags, 2 dark brown bags. +vibrant magenta bags contain 5 drab brown bags, 2 striped olive bags, 5 light plum bags. +dull brown bags contain 4 drab teal bags, 4 bright gold bags, 4 dim blue bags, 3 dotted teal bags. +dotted olive bags contain 5 striped orange bags, 1 wavy cyan bag, 3 wavy crimson bags. +bright teal bags contain 3 dim coral bags, 1 dark cyan bag, 4 bright indigo bags. +shiny chartreuse bags contain 1 drab brown bag. +bright lime bags contain 2 pale silver bags. +vibrant crimson bags contain 4 shiny white bags, 4 pale black bags, 5 clear cyan bags, 1 bright tan bag. +muted brown bags contain 5 drab purple bags. +dotted aqua bags contain 1 dim gray bag, 1 dark indigo bag, 3 posh tan bags, 5 dim lime bags. +muted tomato bags contain 1 faded orange bag, 3 vibrant aqua bags. +bright cyan bags contain 4 dotted coral bags, 2 dull lime bags, 5 clear maroon bags. +posh violet bags contain 1 light magenta bag, 4 pale maroon bags, 1 dark teal bag. +wavy turquoise bags contain 1 shiny gray bag, 4 drab tan bags, 3 pale lavender bags. +dark magenta bags contain 2 dull bronze bags. +drab gray bags contain 4 dotted turquoise bags, 5 light aqua bags. +dull coral bags contain 2 plaid black bags, 2 striped cyan bags, 3 faded bronze bags, 5 plaid crimson bags. +vibrant chartreuse bags contain 5 pale turquoise bags. +bright purple bags contain 5 vibrant salmon bags, 1 posh green bag, 4 vibrant beige bags. +mirrored tomato bags contain 4 wavy beige bags, 5 striped tan bags, 2 pale aqua bags. +shiny violet bags contain 3 shiny tan bags, 3 faded brown bags, 4 shiny green bags, 3 shiny orange bags. +plaid lavender bags contain 1 light maroon bag. +faded green bags contain 5 dark cyan bags, 2 clear teal bags, 5 muted olive bags. +dotted salmon bags contain 3 dotted olive bags, 1 dark cyan bag. +faded white bags contain 3 drab brown bags. +striped black bags contain 2 dark green bags, 5 pale bronze bags, 2 plaid olive bags. +dotted brown bags contain 1 drab salmon bag. +dark crimson bags contain 1 vibrant teal bag, 2 dim gray bags, 1 posh orange bag, 3 faded tan bags. +pale teal bags contain 5 dim violet bags. +striped cyan bags contain 3 pale purple bags, 4 dull red bags, 1 dark indigo bag, 3 dark yellow bags. +mirrored coral bags contain 2 shiny olive bags. +shiny maroon bags contain 5 vibrant coral bags, 3 plaid maroon bags, 1 striped turquoise bag, 2 wavy violet bags. +dull indigo bags contain 2 plaid magenta bags, 1 bright chartreuse bag. +drab magenta bags contain 4 striped olive bags, 3 posh white bags. +clear tan bags contain 4 light gold bags, 4 muted gold bags. +dark gray bags contain 4 plaid blue bags, 5 drab brown bags, 3 pale gray bags, 3 mirrored violet bags. +wavy teal bags contain 4 drab aqua bags, 3 pale salmon bags. +dotted tan bags contain 2 pale bronze bags, 3 faded orange bags. +bright brown bags contain 3 bright blue bags. +clear blue bags contain 5 shiny crimson bags, 1 dark cyan bag. +clear yellow bags contain 1 muted gold bag, 1 posh orange bag, 1 dull purple bag, 4 dark indigo bags. +pale aqua bags contain 3 dim coral bags, 2 mirrored aqua bags. +dull olive bags contain 1 dull yellow bag. +muted violet bags contain 3 shiny tan bags. +striped aqua bags contain 2 vibrant green bags, 2 faded coral bags, 2 dark cyan bags, 4 wavy beige bags. +pale fuchsia bags contain 5 dull green bags, 2 dotted aqua bags. +shiny brown bags contain 4 dim black bags. +plaid coral bags contain 3 faded bronze bags, 2 pale lavender bags, 3 dotted tan bags, 2 wavy lavender bags. +posh magenta bags contain 2 clear red bags, 4 dim brown bags. +wavy purple bags contain 4 dim magenta bags. +plaid fuchsia bags contain 2 striped olive bags, 3 light gray bags. +dim violet bags contain 3 dark brown bags, 4 muted plum bags. +light turquoise bags contain 5 clear brown bags, 5 muted chartreuse bags. +dull white bags contain 4 wavy salmon bags, 3 dotted crimson bags, 1 dark coral bag, 1 pale chartreuse bag. +light brown bags contain 2 plaid black bags, 3 light red bags. +dotted purple bags contain 1 posh crimson bag, 4 vibrant red bags, 2 wavy beige bags. +striped orange bags contain no other bags. +clear green bags contain 3 light plum bags, 1 wavy lavender bag, 1 shiny olive bag. +bright red bags contain 5 dotted turquoise bags, 3 dim aqua bags, 2 posh orange bags. +dark bronze bags contain 2 pale yellow bags, 1 striped brown bag, 3 striped chartreuse bags. +muted cyan bags contain 3 muted olive bags, 2 shiny red bags, 1 vibrant lavender bag, 5 drab gold bags. +light coral bags contain 3 shiny gray bags, 5 dull bronze bags, 5 muted fuchsia bags, 5 clear magenta bags. +shiny olive bags contain 4 dull cyan bags, 5 dark gray bags. +drab orange bags contain no other bags. +striped salmon bags contain 5 drab salmon bags, 5 pale plum bags. +plaid cyan bags contain 2 bright blue bags, 1 mirrored gray bag, 5 faded violet bags. +plaid teal bags contain 3 pale maroon bags, 1 clear teal bag. +faded cyan bags contain 1 dim bronze bag, 3 light olive bags, 1 muted beige bag, 1 wavy teal bag. +clear magenta bags contain 5 striped orange bags. +dull black bags contain 1 shiny purple bag, 1 mirrored red bag, 4 dotted fuchsia bags, 3 vibrant crimson bags. +mirrored blue bags contain 3 light brown bags. +mirrored black bags contain 3 dim coral bags, 3 plaid purple bags. +dim black bags contain 4 dim blue bags. +pale plum bags contain 4 muted coral bags, 2 light purple bags. +dark salmon bags contain 2 plaid blue bags, 4 vibrant turquoise bags, 3 posh white bags. +striped red bags contain 1 dim plum bag. +striped beige bags contain 1 dark tomato bag. +clear beige bags contain 2 posh orange bags, 4 muted coral bags. +bright blue bags contain 4 faded gold bags, 4 faded indigo bags. +light purple bags contain 4 muted violet bags, 1 pale red bag. +dim indigo bags contain 3 dim silver bags, 2 faded violet bags. +dotted green bags contain 5 dotted chartreuse bags, 1 pale black bag. +pale yellow bags contain 3 plaid tomato bags. +drab tan bags contain 3 dim plum bags, 2 dark fuchsia bags. +bright white bags contain 3 muted bronze bags. +shiny turquoise bags contain 4 drab brown bags. +pale maroon bags contain no other bags. +faded indigo bags contain 1 faded tomato bag, 2 light red bags, 5 vibrant bronze bags. +dotted black bags contain 1 clear brown bag, 5 mirrored olive bags, 4 dim brown bags, 2 drab red bags. +light chartreuse bags contain 5 muted black bags. +posh orange bags contain 4 light maroon bags, 1 muted white bag. +vibrant turquoise bags contain 1 dark maroon bag, 1 shiny magenta bag, 2 dotted maroon bags. +striped fuchsia bags contain 5 clear blue bags, 5 pale black bags, 1 mirrored maroon bag, 2 dotted maroon bags. +dark violet bags contain 5 clear white bags. +pale salmon bags contain 1 vibrant violet bag, 3 plaid olive bags. +pale violet bags contain 4 shiny chartreuse bags, 5 dark salmon bags, 3 bright indigo bags, 4 dark orange bags. +faded teal bags contain 2 dark gray bags, 2 posh black bags, 3 plaid maroon bags. +drab yellow bags contain 4 mirrored blue bags, 4 mirrored violet bags, 3 dim salmon bags, 1 clear yellow bag. +wavy indigo bags contain 2 shiny olive bags, 5 plaid aqua bags. +shiny tan bags contain 2 wavy purple bags, 1 dotted aqua bag, 1 light violet bag. +dull lime bags contain 1 dull coral bag. +clear turquoise bags contain 1 vibrant fuchsia bag, 5 dull beige bags. +dark blue bags contain 2 dark violet bags, 2 dotted maroon bags, 4 bright aqua bags, 4 clear black bags. +drab black bags contain 2 dim gold bags, 1 plaid crimson bag. +dotted bronze bags contain 5 dim bronze bags. +mirrored cyan bags contain 3 muted salmon bags. +light gray bags contain 1 faded gold bag, 4 faded coral bags, 4 faded silver bags, 2 faded tomato bags. +vibrant blue bags contain 2 muted gold bags. +dark maroon bags contain 3 mirrored violet bags, 3 muted gold bags, 3 drab brown bags, 4 plaid black bags. +pale chartreuse bags contain 5 dotted teal bags, 4 bright gold bags. +mirrored yellow bags contain 4 dim cyan bags. +shiny plum bags contain 3 dull green bags, 3 vibrant olive bags, 3 dim tan bags. +mirrored chartreuse bags contain 1 dark tan bag, 5 drab aqua bags. +dark gold bags contain 4 drab yellow bags, 4 pale bronze bags. +vibrant lime bags contain 3 dull salmon bags. +dim blue bags contain 2 dull cyan bags, 2 dull purple bags, 1 dark indigo bag. +dark brown bags contain 5 dull chartreuse bags. +light tomato bags contain 5 posh teal bags, 3 wavy yellow bags, 5 bright olive bags, 4 pale brown bags. +bright green bags contain 2 bright teal bags. +shiny silver bags contain 2 mirrored indigo bags, 4 faded silver bags, 2 dark lavender bags. +bright olive bags contain 5 drab turquoise bags. +striped teal bags contain 1 vibrant tan bag. +dotted yellow bags contain 1 clear tomato bag, 5 muted orange bags, 3 striped turquoise bags, 3 dim lime bags. +posh white bags contain no other bags. +plaid red bags contain 3 dotted teal bags, 2 light brown bags, 4 vibrant teal bags. +drab purple bags contain 5 pale purple bags, 1 shiny blue bag, 2 shiny orange bags. +vibrant maroon bags contain 3 shiny cyan bags, 5 striped lavender bags. +striped brown bags contain 5 faded salmon bags, 4 clear violet bags, 1 plaid salmon bag, 5 dotted tomato bags. +muted blue bags contain 1 drab chartreuse bag. +striped blue bags contain 4 dark cyan bags. +striped plum bags contain 2 wavy violet bags. +clear violet bags contain 2 dotted crimson bags, 3 plaid magenta bags. +clear teal bags contain 2 bright gold bags, 4 plaid black bags. +dim gold bags contain 5 pale gray bags, 3 drab orange bags, 3 plaid black bags. +wavy violet bags contain 3 dull beige bags. +wavy lime bags contain 2 bright lavender bags. +muted purple bags contain 3 wavy brown bags, 4 muted blue bags. +shiny indigo bags contain 1 shiny aqua bag, 4 bright aqua bags, 2 clear turquoise bags. +dim orange bags contain 5 striped lime bags. +clear bronze bags contain 4 pale black bags, 4 bright olive bags. +wavy gray bags contain 3 dotted teal bags, 2 striped lavender bags, 2 wavy aqua bags. +dull tan bags contain 5 vibrant violet bags, 2 muted maroon bags, 5 vibrant plum bags, 3 shiny red bags. +drab chartreuse bags contain 4 striped gray bags, 4 pale bronze bags, 5 dim aqua bags. +plaid gray bags contain 1 shiny blue bag, 4 clear brown bags, 4 shiny tan bags, 4 plaid beige bags. +drab plum bags contain 5 vibrant cyan bags, 3 vibrant aqua bags, 5 dim coral bags, 1 dull orange bag. +clear gold bags contain 1 drab olive bag, 5 drab orange bags, 4 shiny tan bags. +dull tomato bags contain 3 bright teal bags, 1 muted chartreuse bag. +bright silver bags contain 1 dull chartreuse bag, 5 bright gold bags, 4 faded silver bags. +clear black bags contain 5 dull orange bags, 3 dim black bags, 1 posh beige bag. +striped olive bags contain 2 pale maroon bags. +light fuchsia bags contain 5 pale silver bags, 4 dark olive bags, 1 clear magenta bag. +posh indigo bags contain 2 wavy purple bags, 3 striped beige bags, 4 vibrant white bags. +dark aqua bags contain 5 drab tomato bags, 4 faded red bags, 4 light magenta bags, 4 striped tomato bags. +plaid olive bags contain 2 posh brown bags. +wavy plum bags contain 3 shiny blue bags, 4 dark lavender bags, 5 pale violet bags. +vibrant teal bags contain 4 dull purple bags, 4 dull plum bags. +dotted gold bags contain 3 wavy maroon bags. +drab brown bags contain no other bags. +dull teal bags contain 5 wavy beige bags, 1 muted tomato bag, 1 drab aqua bag. +mirrored plum bags contain 4 muted chartreuse bags, 5 dull orange bags, 3 clear black bags. +wavy beige bags contain 4 pale violet bags, 5 dim tan bags, 3 pale fuchsia bags, 2 wavy tan bags. +plaid lime bags contain 3 pale crimson bags. +plaid brown bags contain 2 dull green bags. +light black bags contain 1 faded gold bag, 1 bright tan bag. +dim cyan bags contain 2 clear yellow bags, 3 plaid blue bags, 1 dull purple bag. +drab coral bags contain 1 bright gray bag, 1 muted magenta bag, 5 mirrored lime bags, 1 mirrored olive bag. +bright coral bags contain 3 plaid blue bags. +mirrored silver bags contain 5 clear white bags. +plaid tomato bags contain 5 dull red bags, 3 shiny green bags, 5 drab fuchsia bags, 3 dull tomato bags. +faded plum bags contain 5 dark violet bags, 3 dim brown bags. +light white bags contain 5 dotted teal bags, 2 dim tan bags. +dull bronze bags contain 3 vibrant turquoise bags. +vibrant coral bags contain 3 faded bronze bags. +posh silver bags contain 5 wavy olive bags, 3 dotted red bags, 3 faded violet bags. +dim yellow bags contain 4 pale tomato bags, 4 dim tan bags, 3 vibrant gold bags, 2 bright gold bags. +bright salmon bags contain 5 shiny orange bags, 2 dark yellow bags, 5 muted gold bags, 4 dark fuchsia bags. +light yellow bags contain 3 clear cyan bags. +dim red bags contain 3 clear lavender bags, 1 muted bronze bag, 4 vibrant salmon bags. +dark silver bags contain 1 dull brown bag, 1 wavy lavender bag, 2 shiny crimson bags, 1 clear tan bag. +dull fuchsia bags contain 5 striped cyan bags, 4 mirrored violet bags. +drab gold bags contain 5 posh lavender bags, 4 mirrored olive bags, 2 dark tan bags, 3 dotted olive bags. +muted gray bags contain 1 striped magenta bag, 2 dull tomato bags, 5 plaid olive bags, 1 faded gray bag. +bright bronze bags contain 1 clear silver bag, 4 dim lime bags. +dark cyan bags contain 5 dark maroon bags, 3 dull red bags, 1 bright gold bag. +dark plum bags contain 1 vibrant turquoise bag. +wavy maroon bags contain 5 shiny gold bags, 1 drab black bag. +light crimson bags contain 2 light plum bags, 3 plaid purple bags. +wavy chartreuse bags contain 2 pale gray bags, 5 dim purple bags, 2 drab turquoise bags. +plaid yellow bags contain 5 muted tan bags, 2 wavy cyan bags, 3 light gold bags, 1 dim gold bag. +mirrored violet bags contain no other bags. +wavy yellow bags contain 2 dim aqua bags, 1 dark fuchsia bag, 5 faded coral bags, 1 faded silver bag. +plaid bronze bags contain 1 striped bronze bag. +vibrant green bags contain 3 striped chartreuse bags, 3 pale lavender bags, 4 dotted lime bags, 4 plaid lavender bags. +muted crimson bags contain 3 dim blue bags, 1 dull lime bag, 3 plaid indigo bags, 1 pale plum bag. +posh cyan bags contain 5 drab brown bags, 5 faded blue bags. +vibrant black bags contain 3 pale silver bags. +light aqua bags contain 2 faded crimson bags, 3 dark bronze bags, 1 dim orange bag. +mirrored red bags contain 3 light violet bags. +dark lime bags contain 1 striped turquoise bag. +mirrored olive bags contain 1 faded bronze bag, 1 drab aqua bag, 1 dark indigo bag, 3 posh white bags. +striped chartreuse bags contain 2 mirrored gold bags. +dotted lime bags contain 1 vibrant turquoise bag, 2 dotted turquoise bags, 5 dull red bags. +vibrant bronze bags contain 1 posh green bag, 3 posh tan bags, 5 light salmon bags. +dark teal bags contain 4 shiny lavender bags, 5 dull orange bags. +shiny green bags contain 2 bright lavender bags, 3 shiny olive bags, 4 mirrored violet bags, 5 posh white bags. +light magenta bags contain 2 pale maroon bags. +pale magenta bags contain 5 dull aqua bags. +dull plum bags contain 2 vibrant violet bags, 5 pale red bags, 2 wavy fuchsia bags. +muted olive bags contain 5 bright teal bags. +vibrant fuchsia bags contain 3 posh brown bags. +dark olive bags contain 5 dim coral bags, 4 pale red bags, 5 drab aqua bags. +posh purple bags contain 2 bright red bags, 4 pale coral bags, 1 dotted bronze bag. +dark lavender bags contain 2 striped blue bags, 5 posh blue bags, 2 plaid green bags. diff --git a/day7/src/main.zig b/day7/src/main.zig new file mode 100644 index 0000000..6306bc7 --- /dev/null +++ b/day7/src/main.zig @@ -0,0 +1,188 @@ +const std = @import("std"); + +pub fn main() anyerror!void { + var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + defer arena.deinit(); + var gpa = &arena.allocator; + + var f = try std.fs.cwd().openFile("input", .{}); + var contents = try f.readToEndAlloc(gpa, std.math.maxInt(u32)); + + var next_id : u32 = 0; + var map = std.hash_map.StringHashMap(u32).init(gpa); + var it = std.mem.tokenize(contents, "\n"); + var bag_rules = std.ArrayList(*BagType).init(gpa); + defer bag_rules.deinit(); + + while (it.next()) |line| { + //std.log.debug("{}", .{line}); + var bag = try gpa.create(BagType); + bag.*.contains = std.ArrayList(*BagRule).init(gpa); + + var need_desc = true; + var desc = std.ArrayList(u8).init(gpa); + defer desc.deinit(); + var need_count = true; + var count: u32 = 0; + for (line) |a| { + if (need_desc) { + try desc.append(a); + if (desc.items.len > 5) { + if (std.mem.eql(u8, " bag", desc.items[desc.items.len-4..])) { + //std.log.debug("'{}'", .{desc.items}); + if (!need_count) { + var key = try std.mem.dupe(gpa, u8, std.mem.trim(u8, desc.items[0..desc.items.len-4], " ")); + var bag_id : u32 = 0; + //std.log.debug("'{} {} bags'", .{count, key}); + if (map.contains(key)) { + bag_id = map.get(key).?; + //std.log.debug("Bag '{}': {}", .{key, bag_id}); + } + else { + bag_id = next_id; + //std.log.debug("Assigned ID {} to '{}'", .{bag_id, key}); + try map.putNoClobber(key, next_id); + next_id += 1; + } + var br = try gpa.create(BagRule); + br.count = count; + br.bag_type = bag_id; + std.log.debug("Bag {} should contain {} of {}", .{bag.desc, br.count, br.bag_type}); + try bag.contains.append(br); + } + else { + var key = try std.mem.dupe(gpa, u8, desc.items[0..desc.items.len-4]); + var bag_id : u32 = 0; + bag.desc = key; + //std.log.debug("'{}'", .{bag.desc}); + if (map.contains(key)) { + bag_id = map.get(key).?; + //std.log.debug("Bag '{}': {}", .{key, bag_id}); + } + else { + bag_id = next_id; + //std.log.debug("Assigned ID {} to '{}'", .{bag_id, key}); + try map.putNoClobber(key, next_id); + next_id += 1; + } + bag.type_id = bag_id; + } + need_desc = false; + need_count = true; + desc.deinit(); + desc = std.ArrayList(u8).init(gpa); + } + } + } + else if (need_count) { + if (std.ascii.isDigit(a)) { + count = @as(u32, a - 48); + need_count = false; + need_desc = true; + } + } + } + //std.log.debug("{}", .{bag}); + try bag_rules.append(bag); + } + // for (bag_rules.items) |rule| { + // std.log.debug("{} ({})", .{rule.desc.?, rule.type_id}); + // for(rule.contains.items) |r| { + // std.log.debug("\t{} of {}", .{r.count, r.bag_type}); + // } + // } + var shiny_gold_id = map.get("shiny gold"); + std.log.debug("shiny gold: {}", .{shiny_gold_id}); + + //var types_that_can_contain_shiny_gold = try types_that_can_contain(gpa, &bag_rules, shiny_gold_id.?); + //std.log.info("{} bag types can contain shiny gold bags ({})", .{types_that_can_contain_shiny_gold.len, shiny_gold_id}); + + var shiny_gold_type = get_type_by_id(&bag_rules, shiny_gold_id.?).?; + std.log.debug("shiny gold type has {} contain rules", .{shiny_gold_type.*.contains.items.len}); + //std.log.debug("{}", .{shiny_gold_rule}); + var n_bags_needed = bag_type_has_how_many_bags_needed(shiny_gold_type, &bag_rules); + std.log.info("{} needs {} bags purchased, including itself", .{shiny_gold_type.*.desc, n_bags_needed}); +} + +fn bag_type_has_how_many_bags_needed(self: *BagType, list: *std.ArrayList(*BagType)) u32 { + var count : u32 = 1; + if (self.contains.items.len == 0) { + // We just need our self + std.log.debug("{} just has itself", .{self.type_id}); + return count; + } + std.log.debug("{}", .{self.contains.items.len}); + for (self.contains.items) |i| { + if (i.*.count == 0) { + continue; + } + var bagtype = get_type_by_id(list, i.*.bag_type).?; + var extra = (i.*.count * bag_type_has_how_many_bags_needed(bagtype, list)); + std.log.debug("{} needs {}x {} --> adding {} bags", .{self.*.desc, i.*.count, bagtype.*.desc, extra}); + count += extra; + } + return count; +} + +fn get_type_by_id(list: *std.ArrayList(*BagType), id: u32) ?*BagType { + for (list.items) |r| { + if (r.*.type_id == id) { + return r; + } + } + return null; +} + +// fn types_that_can_contain(allocator: *std.mem.Allocator, list: *std.ArrayList(BagType), id: u32) anyerror![]u32 { +// var search_ids = std.ArrayList(u32).init(allocator); +// defer search_ids.deinit(); +// for (list.items) |r| { +// if (r.can_contain(id)) { +// //std.log.debug("{} can contain {}", .{r.type_id, id}); +// try search_ids.append(r.type_id); +// } +// } +// var count : usize = search_ids.items.len; +// //std.log.debug("{} bag types can directly contain a {}", +// // .{count, id}); +// var types = std.ArrayList(u32).init(allocator); +// for (search_ids.items) |i| { +// var t = try types_that_can_contain(allocator, list, i); +// //std.log.debug("Adding {} to types that can hold {}", .{i, id}); +// try types.append(i); +// for (t) |tid| { +// var already_in_types = false; +// for (types.items) |asdf| { +// if (asdf == tid) { +// already_in_types = true; +// break; +// } +// } +// if (!already_in_types) { +// //std.log.debug("Adding {} to types that can hold {}", .{tid, id}); +// try types.append(tid); +// } +// } +// } +// return types.items[0..]; +// } + +const BagRule = struct { + bag_type: u32 = 0, + count: u32 = 0, +}; + +const BagType = struct { + type_id: u32 = 0, + desc: ?[]u8 = null, + contains: std.ArrayList(*BagRule), + + pub fn can_contain(self: *const BagType, type_id: u32) bool { + for (self.contains.items) |rule| { + if (rule.*.bag_type == type_id and rule.*.count > 0) { + return true; + } + } + return false; + } +}; diff --git a/day8/build.zig b/day8/build.zig new file mode 100644 index 0000000..f21dc9c --- /dev/null +++ b/day8/build.zig @@ -0,0 +1,27 @@ +const Builder = @import("std").build.Builder; + +pub fn build(b: *Builder) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard release options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. + const mode = b.standardReleaseOptions(); + + const exe = b.addExecutable("day8", "src/main.zig"); + exe.setTarget(target); + exe.setBuildMode(mode); + exe.install(); + + const run_cmd = exe.run(); + run_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); +} diff --git a/day8/src/main.zig b/day8/src/main.zig new file mode 100644 index 0000000..d29869f --- /dev/null +++ b/day8/src/main.zig @@ -0,0 +1,5 @@ +const std = @import("std"); + +pub fn main() anyerror!void { + std.log.info("All your codebase are belong to us.", .{}); +}