about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-12-05 17:09:30 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-12-05 17:09:30 +0100
commit68ee54cfaa49f438bb7ad93e7c595e72c64dfbbd (patch)
tree69851f9e3e59944d64a1e25db212f1082b852878
parentfe9b273cc83c4b6448c0e78c76b6dd2060522f14 (diff)
downloadadventofcode2022-68ee54cfaa49f438bb7ad93e7c595e72c64dfbbd.tar.gz
adventofcode2022-68ee54cfaa49f438bb7ad93e7c595e72c64dfbbd.tar.xz
adventofcode2022-68ee54cfaa49f438bb7ad93e7c595e72c64dfbbd.zip
day04
-rw-r--r--day041000
-rw-r--r--day04.k3
-rw-r--r--day04.rkt31
-rw-r--r--day04.zig26
4 files changed, 1060 insertions, 0 deletions
diff --git a/day04 b/day04
new file mode 100644
index 0000000..8719d89
--- /dev/null
+++ b/day04
@@ -0,0 +1,1000 @@
+37-87,36-87
+3-98,3-84
+33-73,33-33
+3-65,1-3
+59-72,41-59
+15-82,29-84
+9-98,97-99
+32-32,31-77
+85-86,85-93
+7-26,26-26
+21-78,21-22
+22-70,33-99
+8-8,8-52
+39-57,39-57
+29-60,28-59
+2-76,2-76
+3-96,1-2
+57-59,29-62
+34-77,34-81
+22-70,26-70
+24-25,24-24
+40-43,39-61
+23-40,23-39
+92-93,41-94
+84-84,9-84
+3-77,1-6
+35-35,1-99
+17-32,18-63
+67-98,68-97
+67-91,36-90
+51-97,96-98
+22-91,3-91
+17-17,16-30
+4-90,8-91
+8-39,8-40
+11-93,12-94
+45-57,4-56
+37-98,38-38
+44-45,24-44
+28-60,53-60
+37-74,17-38
+40-63,40-62
+8-94,11-95
+78-78,54-78
+43-57,43-53
+63-65,8-64
+8-83,30-84
+39-51,48-52
+32-59,32-66
+11-89,11-88
+38-78,39-98
+14-61,15-61
+4-97,9-97
+63-77,62-95
+4-39,2-68
+13-97,84-98
+1-96,1-97
+1-1,1-94
+49-95,46-92
+2-40,2-39
+34-77,35-35
+59-59,58-61
+14-14,13-92
+37-60,37-61
+1-94,2-2
+37-78,23-99
+62-92,61-92
+85-85,45-85
+27-89,57-87
+34-81,81-81
+13-69,8-68
+2-99,2-2
+14-95,14-94
+78-87,87-87
+66-91,36-92
+45-46,45-47
+56-60,56-90
+44-58,44-57
+6-52,4-52
+2-97,6-98
+18-91,92-92
+16-81,80-81
+21-39,21-21
+10-58,10-59
+65-91,64-91
+27-77,77-77
+2-80,79-79
+17-85,62-84
+1-15,14-84
+6-95,95-95
+27-93,28-92
+25-70,24-36
+30-31,30-68
+2-98,2-97
+7-94,85-97
+27-68,24-69
+2-70,2-71
+47-90,6-89
+76-92,71-90
+83-88,83-94
+70-76,73-77
+65-68,23-92
+65-70,69-89
+29-55,6-29
+26-79,21-21
+6-65,7-7
+2-43,2-3
+21-37,21-60
+4-73,2-93
+4-95,4-89
+28-60,40-61
+2-80,67-93
+4-92,5-5
+5-99,5-97
+3-24,6-99
+58-58,58-63
+8-67,7-82
+26-26,25-26
+55-59,46-60
+58-78,22-77
+15-79,15-78
+13-54,12-46
+6-25,6-26
+38-85,37-85
+44-98,11-98
+93-93,37-93
+9-16,16-19
+27-69,27-28
+34-92,92-96
+11-19,11-26
+12-77,11-77
+30-30,7-30
+71-92,71-92
+2-92,1-93
+78-96,57-95
+1-60,59-61
+33-69,27-33
+5-95,1-94
+37-87,58-87
+11-11,10-99
+87-87,86-95
+67-81,82-82
+12-94,91-93
+9-72,19-73
+8-46,25-41
+16-68,15-68
+31-47,23-39
+73-90,80-91
+22-94,22-22
+77-92,6-91
+30-84,30-84
+3-79,6-72
+81-85,81-99
+54-93,54-92
+6-97,3-97
+24-68,23-69
+49-81,50-80
+43-88,19-42
+15-16,15-74
+6-84,83-83
+3-89,10-16
+16-31,15-32
+8-14,7-94
+3-17,3-17
+97-99,32-98
+18-94,17-17
+76-96,20-95
+36-85,26-84
+7-78,25-78
+41-55,41-42
+5-47,4-35
+3-7,3-55
+20-94,9-34
+14-21,15-55
+27-71,32-72
+14-21,19-21
+44-46,13-45
+37-95,36-95
+5-89,5-88
+85-85,9-85
+24-88,25-95
+30-87,30-68
+54-87,87-87
+9-47,9-47
+33-77,27-49
+58-58,11-60
+26-26,28-92
+79-89,10-80
+5-63,62-63
+8-9,9-47
+94-94,89-94
+3-59,4-4
+48-93,48-83
+29-57,29-57
+20-91,20-92
+30-88,84-89
+27-74,1-90
+53-69,22-68
+36-45,36-46
+16-82,16-81
+38-57,39-73
+14-68,41-68
+78-80,63-78
+3-23,1-24
+1-96,46-67
+68-68,64-70
+5-99,6-99
+6-98,8-94
+12-91,5-93
+11-95,11-96
+66-67,65-66
+9-95,9-30
+56-93,32-94
+14-73,15-72
+34-34,34-84
+7-20,5-8
+44-83,64-84
+24-42,7-42
+25-25,22-26
+34-35,35-76
+45-94,33-69
+1-4,4-78
+51-84,50-92
+2-3,3-3
+61-96,74-96
+1-94,21-99
+22-92,64-98
+33-33,32-34
+8-80,13-79
+41-45,44-66
+6-17,3-17
+15-20,16-17
+10-18,10-19
+28-67,27-56
+41-92,23-92
+8-97,21-98
+35-90,35-89
+6-79,7-80
+74-84,16-73
+9-87,4-95
+10-87,66-91
+55-77,7-99
+6-76,15-76
+66-68,17-67
+5-83,4-84
+32-63,64-97
+77-99,54-83
+59-62,63-80
+1-98,1-99
+90-98,88-98
+2-88,88-95
+13-92,24-87
+61-63,6-62
+9-86,8-87
+21-45,2-45
+27-71,28-71
+2-2,1-97
+58-91,7-90
+18-64,39-58
+35-43,15-36
+37-87,36-44
+4-90,89-89
+65-92,66-91
+14-14,13-38
+9-86,92-97
+8-93,12-92
+34-35,35-35
+24-49,37-49
+45-93,45-67
+13-97,2-97
+20-97,20-29
+24-37,24-38
+41-75,47-76
+3-3,3-61
+26-35,1-26
+80-94,82-94
+82-93,83-83
+1-97,2-26
+63-89,15-99
+2-31,3-87
+18-45,17-20
+87-97,2-87
+28-74,54-77
+93-95,2-94
+11-71,39-40
+12-85,60-85
+85-85,4-86
+5-70,14-71
+15-94,10-28
+93-98,96-99
+38-66,39-67
+5-98,98-98
+23-54,23-92
+18-47,18-76
+5-25,12-26
+84-90,80-85
+17-99,17-98
+8-96,2-96
+43-88,43-62
+78-89,60-89
+76-93,93-93
+13-24,13-79
+19-27,9-26
+19-88,19-87
+8-30,9-63
+33-66,67-97
+35-78,36-79
+67-82,66-94
+3-11,3-69
+58-75,74-76
+32-96,2-96
+18-71,19-19
+24-35,24-36
+16-80,17-80
+48-84,49-49
+66-87,3-66
+14-14,2-16
+12-35,11-12
+41-49,40-48
+7-25,7-7
+52-52,51-68
+3-57,2-4
+11-42,6-49
+19-39,9-19
+1-83,5-84
+5-87,8-87
+7-72,8-71
+25-56,24-66
+28-54,53-89
+42-45,43-46
+65-97,66-96
+15-86,85-87
+74-74,28-74
+36-59,36-85
+13-86,6-96
+10-59,58-60
+23-26,6-24
+22-95,29-95
+32-33,33-33
+20-39,20-20
+6-93,6-6
+3-98,3-3
+41-57,41-56
+39-54,39-53
+45-99,44-44
+45-56,28-86
+3-65,6-66
+4-38,5-73
+54-58,2-66
+19-73,19-74
+8-96,48-96
+6-46,6-47
+7-89,7-88
+21-71,21-72
+1-40,39-39
+36-75,37-37
+1-96,5-95
+31-93,31-92
+29-39,40-40
+95-98,14-95
+8-14,9-67
+81-97,82-95
+59-61,15-60
+42-51,34-51
+73-83,23-73
+63-77,63-63
+8-38,37-39
+40-54,41-41
+13-15,14-71
+10-29,11-11
+10-43,11-44
+38-54,38-48
+20-86,18-20
+15-98,13-15
+22-40,3-97
+95-95,3-96
+39-98,40-80
+10-91,14-90
+10-19,9-10
+34-40,35-43
+91-92,5-92
+26-46,26-45
+34-90,34-34
+30-47,61-64
+5-37,5-5
+28-29,28-77
+76-76,38-77
+10-65,2-65
+27-95,19-84
+77-99,70-95
+79-84,49-80
+8-46,37-46
+4-55,16-69
+45-94,34-94
+18-18,19-65
+44-85,43-83
+43-67,20-34
+2-98,2-15
+79-90,62-91
+35-58,36-58
+36-47,14-47
+4-94,31-95
+91-91,88-91
+9-31,30-32
+63-78,79-79
+8-94,4-98
+18-32,18-33
+76-76,26-76
+54-97,12-96
+2-91,2-2
+76-76,75-98
+8-13,8-80
+30-51,42-51
+1-55,4-54
+53-88,6-88
+92-94,85-93
+41-85,41-86
+56-86,55-72
+21-97,21-98
+6-6,7-10
+3-79,3-90
+57-67,58-99
+42-46,32-41
+2-75,5-74
+34-35,33-33
+10-77,77-77
+7-9,7-11
+34-92,34-91
+4-26,9-93
+43-88,70-89
+7-36,36-36
+6-99,6-6
+23-82,22-85
+13-89,85-89
+63-79,26-63
+15-94,14-94
+41-94,42-95
+5-60,3-72
+96-97,96-98
+5-95,80-97
+18-78,18-77
+57-85,56-84
+76-90,82-89
+56-56,56-92
+49-86,77-85
+4-33,8-18
+17-47,17-46
+46-62,24-61
+6-93,60-92
+18-94,18-98
+59-67,65-67
+5-99,7-99
+8-71,21-37
+14-97,70-97
+18-91,19-92
+29-45,29-88
+1-97,1-64
+8-54,16-53
+98-99,78-97
+29-94,26-99
+66-76,18-75
+15-91,20-76
+43-51,43-51
+74-76,53-75
+91-97,93-96
+5-93,5-92
+23-65,23-50
+5-94,93-98
+42-82,41-43
+47-76,47-77
+14-49,20-29
+22-31,30-56
+55-71,55-88
+39-75,86-99
+23-90,21-89
+65-65,39-64
+17-92,4-91
+22-60,22-87
+27-27,26-32
+18-75,16-74
+22-50,22-99
+70-90,71-89
+63-64,63-77
+33-67,67-67
+20-39,20-31
+5-5,5-79
+23-78,74-79
+66-86,67-88
+2-76,25-75
+70-97,11-96
+18-37,18-29
+38-73,46-72
+2-4,4-98
+2-47,2-47
+14-70,14-71
+35-96,6-95
+63-64,63-63
+5-83,5-83
+33-97,2-99
+62-72,72-99
+26-79,18-80
+14-67,46-54
+12-74,13-79
+3-57,3-59
+44-92,45-93
+70-73,69-78
+5-76,36-41
+52-79,52-72
+5-82,3-81
+85-87,35-86
+8-19,18-20
+19-36,18-33
+72-74,21-73
+36-60,35-45
+10-75,3-76
+77-85,34-77
+18-82,17-82
+11-46,20-45
+74-94,74-84
+1-97,4-81
+60-89,89-90
+22-27,27-56
+25-92,25-26
+13-75,66-72
+35-50,51-51
+2-99,1-98
+51-51,50-88
+41-92,1-92
+3-29,4-28
+61-95,3-94
+45-70,8-71
+6-20,2-21
+3-91,91-97
+7-94,21-95
+81-83,80-96
+87-89,8-87
+8-9,8-12
+9-79,8-79
+4-46,2-45
+9-34,10-33
+1-72,2-72
+7-65,7-81
+24-31,30-45
+75-76,9-75
+71-76,22-75
+43-87,8-87
+5-94,4-94
+42-71,64-72
+45-52,47-48
+2-99,3-78
+53-75,53-82
+23-67,28-67
+33-49,31-48
+48-96,11-49
+33-33,33-71
+19-19,18-93
+93-95,40-94
+34-82,82-97
+39-39,39-80
+79-81,47-80
+2-9,6-21
+69-77,10-20
+18-92,11-92
+20-85,84-84
+34-88,89-89
+2-95,3-96
+43-62,43-44
+2-24,23-25
+36-36,36-72
+19-71,6-19
+72-93,11-93
+1-96,95-95
+24-62,24-61
+41-45,42-44
+8-69,37-55
+3-9,10-29
+22-60,19-40
+6-6,5-93
+46-72,27-72
+8-74,8-75
+35-89,90-90
+30-66,31-31
+16-85,20-86
+76-78,30-77
+64-86,60-86
+1-66,6-65
+20-36,36-36
+27-35,27-34
+1-6,2-9
+95-98,84-96
+79-82,6-80
+15-95,95-99
+64-94,63-96
+17-34,45-87
+17-76,5-75
+87-87,73-87
+33-42,32-43
+66-87,66-93
+97-98,97-97
+90-90,21-90
+4-93,93-95
+12-74,1-41
+98-98,29-99
+51-91,51-82
+76-77,76-78
+6-53,7-54
+3-44,12-14
+5-23,18-18
+20-20,20-99
+24-88,24-89
+10-23,7-12
+15-40,9-62
+4-4,3-94
+29-45,29-44
+71-71,16-71
+47-83,47-48
+53-75,53-76
+57-92,11-66
+49-60,12-78
+38-99,4-99
+8-99,88-99
+21-59,41-67
+53-91,54-90
+5-84,5-8
+45-77,45-78
+14-92,91-93
+41-48,41-47
+37-74,38-73
+16-29,15-15
+43-89,43-90
+2-95,94-94
+10-74,9-71
+25-89,42-90
+88-93,88-92
+38-49,33-48
+31-97,52-97
+12-12,12-92
+11-98,11-12
+43-76,75-77
+39-91,40-82
+34-73,72-86
+4-46,3-94
+43-46,42-56
+2-90,89-90
+93-93,6-92
+35-98,36-98
+4-22,12-23
+2-96,95-97
+2-60,4-60
+3-3,3-10
+92-94,47-93
+71-83,41-82
+8-82,3-95
+73-90,73-89
+35-92,36-36
+25-68,26-68
+32-60,32-61
+37-97,5-97
+41-81,24-40
+37-37,36-88
+5-98,1-99
+7-34,14-34
+13-80,17-79
+91-97,5-92
+6-7,6-44
+19-92,19-93
+59-91,91-92
+39-60,59-94
+70-71,5-70
+44-44,1-45
+70-85,70-87
+15-43,15-27
+1-9,9-9
+25-27,5-26
+58-91,57-91
+18-86,13-85
+23-69,4-69
+10-56,8-10
+99-99,5-99
+97-97,91-98
+12-41,11-45
+65-72,66-72
+58-70,57-71
+1-22,1-17
+31-31,1-32
+14-58,58-58
+15-16,15-21
+31-68,30-41
+43-45,39-53
+21-25,16-27
+86-87,87-87
+19-93,10-20
+39-97,38-98
+21-84,22-87
+46-79,46-47
+28-33,34-79
+37-88,37-87
+70-72,36-71
+1-88,2-87
+4-94,4-93
+34-76,35-35
+54-89,54-87
+13-24,8-13
+8-8,8-51
+3-80,2-28
+32-54,33-65
+17-25,17-24
+1-98,2-95
+4-55,3-54
+69-72,69-69
+55-81,68-82
+7-25,6-65
+7-91,8-8
+66-87,65-86
+18-76,18-77
+1-86,4-85
+96-96,37-96
+27-98,26-90
+50-50,10-49
+1-1,2-76
+55-86,56-63
+3-47,2-48
+4-77,48-51
+1-91,3-88
+63-77,63-77
+8-94,9-94
+87-94,40-98
+17-34,33-81
+20-76,7-19
+11-65,64-73
+60-94,93-94
+39-98,39-99
+2-79,68-96
+4-4,3-4
+60-95,60-97
+21-70,20-20
+9-93,18-92
+29-57,29-29
+44-76,45-77
+14-78,10-78
+51-70,52-56
+18-19,19-19
+6-66,6-96
+7-7,6-34
+38-94,16-93
+86-87,53-86
+75-92,11-92
+1-86,23-85
+72-94,72-95
+46-54,40-55
+1-37,1-66
+40-54,19-40
+9-26,9-27
+78-78,20-79
+15-83,20-77
+7-92,36-68
+64-77,38-78
+25-84,26-83
+14-94,29-93
+20-20,19-73
+15-94,15-95
+2-88,87-87
+11-81,4-17
+23-99,25-96
+14-84,84-84
+4-81,27-81
+3-92,3-91
+21-97,21-97
+6-70,6-69
+26-78,19-74
+24-80,25-93
+30-72,55-71
+44-67,28-44
+64-71,64-73
+6-12,9-13
+4-4,3-56
+20-86,59-87
+21-96,20-96
+2-2,2-31
+9-41,24-41
+42-94,94-99
+35-68,34-83
+1-3,2-96
+24-84,25-83
+26-27,26-69
+1-89,2-88
+59-96,59-95
+6-69,2-63
+4-99,4-98
+41-66,41-80
+66-66,53-67
+44-45,44-67
+10-76,76-77
+22-69,69-96
+5-7,6-72
+10-34,11-48
+16-58,18-32
+15-98,16-16
+54-86,54-85
+2-21,20-96
+53-85,53-86
+11-80,68-80
+10-10,9-92
+6-61,60-62
+26-89,25-90
+3-97,2-82
+16-47,15-46
+21-48,21-47
+2-10,2-6
+18-32,31-90
+43-43,44-92
+10-88,82-84
+19-92,91-91
+6-20,5-20
+93-95,1-94
+29-99,16-86
+70-76,60-82
+50-90,50-51
+65-97,65-81
+33-42,15-41
+42-67,28-46
+82-93,92-94
+1-99,2-79
+4-98,2-99
+19-36,19-37
+14-91,54-90
+8-9,8-28
+15-82,15-89
+10-32,30-30
+6-53,1-7
+33-48,34-48
+4-24,5-23
+98-98,5-93
+41-85,79-83
+58-79,57-96
+19-63,20-99
+19-19,1-19
+77-80,75-78
+12-34,4-40
+16-85,15-89
+17-55,37-47
+39-77,36-99
+4-42,15-42
+27-98,27-63
+6-81,5-82
+67-82,7-92
+34-42,35-49
+36-91,37-68
+34-57,8-57
+70-91,69-92
+69-87,70-95
+30-81,31-80
+63-97,1-97
+29-96,95-97
+57-93,9-92
+6-82,5-56
+66-67,65-68
+1-92,92-97
+77-89,88-90
+95-97,11-96
+15-33,3-20
+29-93,24-92
+36-37,36-73
+5-57,5-5
+23-72,12-74
+43-95,43-96
+2-98,94-99
+8-8,7-96
+21-65,20-60
+21-29,22-87
+95-95,4-96
+55-55,43-56
+48-58,47-60
+7-71,3-70
+26-66,45-66
+2-37,37-77
+42-81,43-43
+26-30,31-93
+77-93,75-91
+27-93,39-94
+5-22,5-21
+68-70,49-69
+11-92,56-74
+15-79,46-78
+4-27,24-26
+87-87,15-88
+8-14,8-15
+47-48,44-60
+10-49,11-23
+33-93,32-93
+69-69,16-69
+15-82,39-83
+8-91,8-92
+78-89,78-93
+11-12,11-52
+97-99,1-98
+22-86,22-87
+63-95,94-97
+6-50,6-85
+18-47,3-77
+54-54,53-92
+49-71,62-71
+12-98,12-98
+83-86,3-86
+93-98,98-98
+52-86,8-86
+5-67,6-6
+63-98,1-97
+4-70,8-71
+24-25,23-95
+22-50,23-49
+73-84,74-76
+4-93,78-93
+32-32,32-44
+67-87,25-76
+28-74,20-28
+89-89,15-90
+23-83,22-82
+19-49,19-85
+42-43,42-42
+38-38,19-38
+21-98,20-89
+39-65,14-40
+4-34,5-5
+7-45,44-46
+48-99,2-88
+42-82,42-42
+44-90,44-45
+16-71,42-71
+10-95,96-97
+13-97,2-99
+15-50,4-51
+28-44,28-28
+87-89,1-88
+68-84,66-70
+71-71,2-72
+22-94,22-93
+40-40,40-66
+97-97,3-97
+60-99,56-99
+92-99,92-98
+14-95,14-96
+32-32,32-38
+3-98,10-98
+12-99,28-97
+5-31,5-32
+1-87,1-98
+7-89,8-90
+19-80,73-80
+2-93,2-27
+91-93,12-92
+71-73,3-72
+21-81,21-82
+1-62,6-62
+96-96,10-96
+19-88,20-76
+12-21,13-21
+2-10,9-9
+40-95,40-96
+8-43,12-76
+48-84,85-96
+55-82,55-97
+6-99,3-6
+52-56,48-56
+14-63,4-63
+11-36,12-79
+10-91,9-92
+86-98,87-91
+19-98,19-97
+14-92,14-91
+16-80,15-81
+5-80,1-80
+70-85,19-84
+50-78,51-64
+15-69,15-15
+6-77,7-67
+14-56,1-61
+9-89,81-89
+10-99,9-58
+31-38,31-38
+62-75,75-75
+47-96,46-96
+48-64,49-63
+10-82,60-89
+28-69,69-69
+66-68,66-70
+31-58,11-57
+4-84,2-85
+4-94,4-93
+3-97,3-99
+2-62,1-63
+28-93,55-92
+63-80,60-81
+52-78,22-77
+5-98,88-88
+28-82,28-81
+36-36,35-55
+55-90,89-89
+9-51,1-51
+3-98,1-2
diff --git a/day04.k b/day04.k
new file mode 100644
index 0000000..0fd8d7a
--- /dev/null
+++ b/day04.k
@@ -0,0 +1,3 @@
+(a;b;c;d):+(.',/"-"\'","\)'0:"day04"
++/1>(c-a)*d-b
++/1>(d-a)*c-b
diff --git a/day04.rkt b/day04.rkt
new file mode 100644
index 0000000..4f9ba21
--- /dev/null
+++ b/day04.rkt
@@ -0,0 +1,31 @@
+#lang racket
+(require (for-syntax syntax/for-body)
+         syntax/parse/define)
+
+(define-syntax-parse-rule (for/count clauses body ... tail-expr)
+  #:with original this-syntax
+  #:with ((pre-body ...) (post-body ...))
+         (split-for-body this-syntax #'(body ... tail-expr))
+  (for/fold/derived original
+    ([count 0])
+    clauses
+    pre-body ...
+    (define maybe-count (let () post-body ...))
+    (if maybe-count
+      (+ count 1)
+      count)))
+
+
+(for/count ([line (file->lines "day04")])
+  (match-let ([(list a b c d) (map string->number
+                                   (string-split line #px"[^0-9]"))])
+    (or (<= a c d b)
+        (<= c a b d))))
+; 651
+
+(for/count ([line (file->lines "day04")])
+  (match-let ([(list a b c d) (map string->number
+                                   (string-split line #px"[^0-9]"))])
+    (and (<= c b)
+         (<= a d))))
+; 956                       
diff --git a/day04.zig b/day04.zig
new file mode 100644
index 0000000..3c621b8
--- /dev/null
+++ b/day04.zig
@@ -0,0 +1,26 @@
+const std = @import("std");
+const data = @embedFile("day04");
+
+pub fn main() !void {
+    var part1: i32 = 0;
+    var part2: i32 = 0;
+
+    var lines = std.mem.split(u8, data, "\n");
+
+    while (lines.next()) |line| {
+        if (line.len == 0)
+            break;
+
+        var parts = std.mem.tokenize(u8, line, ",-");
+
+        var a = try std.fmt.parseInt(i32, parts.next().?, 10);
+        var b = try std.fmt.parseInt(i32, parts.next().?, 10);
+        var c = try std.fmt.parseInt(i32, parts.next().?, 10);
+        var d = try std.fmt.parseInt(i32, parts.next().?, 10);
+
+        if ((c - a) * (d - b) <= 0) part1 += 1;
+        if ((d - a) * (c - b) <= 0) part2 += 1;
+    }
+
+    std.debug.print("{} {}\n", .{ part1, part2 });
+}