commit 5104f5b0d65bab5b35ee0dd800b0916b9a56e30a
parent cb1be5546961a385df7e06ade4d286e8ca2f6b5e
Author: Jake Bauer <jbauer@paritybit.ca>
Date: Sun, 4 Dec 2022 15:22:39 -0500
Day 4 challenge complete
Diffstat:
A | day4/input.txt | | | 1000 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | day4/main.c | | | 82 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 1082 insertions(+), 0 deletions(-)
diff --git a/day4/input.txt b/day4/input.txt
@@ -0,0 +1,1000 @@
+8-41,8-79
+1-71,2-71
+11-74,74-75
+44-96,43-96
+79-79,3-78
+67-86,50-93
+15-42,41-93
+21-98,20-99
+42-53,13-41
+51-80,38-79
+13-13,13-93
+14-20,20-66
+34-64,33-34
+93-94,56-93
+28-59,58-90
+9-58,4-8
+39-79,32-87
+60-62,48-61
+1-76,21-75
+1-11,2-12
+7-85,4-7
+5-69,26-69
+10-95,11-96
+73-99,65-97
+6-67,1-35
+26-48,29-44
+3-85,1-3
+51-53,14-52
+38-64,37-70
+19-30,30-55
+73-77,72-73
+28-65,28-66
+30-60,47-87
+32-32,30-34
+82-96,3-97
+12-63,13-63
+42-91,19-91
+38-45,45-80
+4-98,14-76
+22-91,23-90
+9-84,10-41
+79-98,48-92
+41-45,41-46
+15-94,30-89
+13-84,25-83
+60-68,37-69
+35-86,7-87
+32-78,31-78
+4-98,4-99
+20-20,20-93
+5-88,87-88
+9-42,4-12
+44-97,54-86
+32-82,6-26
+39-41,40-42
+10-76,10-75
+5-99,2-99
+48-48,47-99
+1-1,1-91
+60-75,59-61
+31-32,32-33
+21-88,22-88
+11-42,11-11
+57-75,74-95
+94-94,94-94
+60-84,58-86
+18-87,11-18
+14-34,29-33
+64-90,22-69
+33-95,71-96
+10-93,9-93
+18-18,18-68
+3-94,93-93
+38-38,38-78
+79-81,67-86
+24-73,3-73
+93-94,46-94
+10-97,11-35
+5-93,4-98
+3-99,47-97
+31-60,59-86
+1-67,45-68
+22-84,59-83
+24-72,23-73
+15-78,16-77
+90-90,85-92
+43-91,44-92
+2-88,86-89
+4-38,4-37
+43-87,44-87
+4-91,5-91
+23-37,27-46
+1-4,3-99
+77-77,78-81
+33-35,33-37
+80-87,81-81
+5-52,6-99
+66-66,52-66
+6-96,16-92
+16-89,4-98
+60-60,60-97
+5-62,1-6
+38-91,38-38
+4-14,13-57
+7-53,7-54
+1-97,13-97
+2-90,3-46
+19-19,20-96
+3-33,33-33
+28-42,29-42
+25-76,47-76
+16-24,25-44
+55-71,55-71
+29-76,28-89
+17-90,17-89
+1-98,10-99
+6-43,22-42
+7-95,67-95
+4-97,97-98
+62-94,62-95
+4-86,5-87
+6-83,6-89
+18-26,26-69
+95-98,10-95
+7-86,1-7
+91-92,27-91
+3-75,8-87
+38-53,30-52
+11-85,9-12
+39-83,39-83
+62-94,10-63
+12-35,35-97
+15-17,16-87
+2-93,1-92
+33-86,34-87
+4-19,19-92
+5-70,69-90
+10-97,5-97
+82-83,41-82
+16-29,16-29
+1-82,5-81
+62-71,61-72
+6-99,8-99
+10-44,6-10
+14-45,13-92
+36-37,37-91
+11-41,22-68
+51-78,79-95
+19-36,28-36
+4-91,9-92
+3-98,3-3
+1-44,2-43
+4-22,4-22
+24-89,42-89
+72-98,57-73
+28-92,4-29
+60-91,25-61
+2-89,5-88
+71-73,3-71
+17-99,24-98
+88-96,3-88
+39-74,75-75
+52-92,4-93
+18-56,53-97
+27-75,16-71
+81-94,1-82
+65-67,15-66
+77-79,77-79
+16-33,17-34
+83-87,29-84
+84-84,20-85
+26-28,27-82
+6-66,66-66
+8-72,9-59
+9-99,10-97
+48-48,47-47
+7-58,6-57
+46-58,23-70
+2-2,2-93
+20-33,20-20
+7-20,8-15
+17-67,16-17
+2-21,1-99
+5-5,4-72
+79-95,9-96
+7-38,7-38
+8-98,6-99
+68-84,10-68
+19-35,2-34
+5-43,3-9
+15-62,14-14
+82-95,48-96
+75-77,34-76
+33-65,65-66
+95-95,19-95
+12-88,13-87
+28-68,25-30
+12-37,8-91
+38-63,16-63
+41-58,53-57
+12-42,29-71
+68-96,68-96
+6-77,78-78
+22-37,23-36
+65-74,64-75
+36-88,35-99
+3-49,13-32
+84-91,1-84
+13-66,13-66
+9-92,10-91
+26-26,26-27
+10-17,15-35
+68-82,59-83
+27-69,26-58
+82-92,10-81
+12-18,12-18
+29-35,29-46
+60-71,71-71
+6-80,79-95
+2-12,1-3
+19-77,20-77
+95-97,88-95
+55-79,21-54
+3-4,9-97
+23-98,23-98
+1-4,3-47
+2-26,1-2
+22-72,9-22
+3-84,13-83
+43-45,18-44
+49-53,51-51
+15-85,16-85
+7-21,4-21
+1-24,1-25
+16-86,16-16
+79-87,80-86
+1-95,57-97
+4-99,29-99
+97-98,6-98
+46-78,53-83
+28-82,51-93
+59-95,32-96
+11-32,23-33
+13-29,24-47
+7-74,11-73
+28-36,36-89
+17-83,18-82
+2-85,10-66
+4-79,4-78
+36-62,61-79
+50-52,28-51
+22-48,3-28
+51-92,68-91
+29-91,28-92
+9-52,8-53
+7-97,55-96
+16-59,15-92
+98-98,3-97
+67-72,15-72
+15-52,5-77
+1-78,3-79
+6-66,3-3
+48-64,63-63
+6-97,6-97
+27-27,19-27
+2-72,1-71
+47-59,48-79
+12-61,13-65
+50-57,38-62
+30-73,65-70
+79-94,79-93
+81-97,98-98
+26-78,17-26
+46-57,29-89
+86-95,29-95
+57-64,43-64
+14-93,71-97
+4-99,66-98
+77-87,17-78
+25-26,26-96
+34-73,33-73
+36-57,35-62
+41-73,55-91
+41-48,12-47
+21-83,20-82
+15-35,14-73
+19-93,93-99
+50-69,51-95
+59-66,66-66
+5-93,92-92
+37-37,37-94
+38-39,38-54
+8-49,27-57
+43-83,79-82
+64-66,13-70
+40-92,92-97
+13-67,51-73
+29-88,30-71
+16-96,17-97
+25-37,27-77
+20-57,3-36
+91-96,63-99
+21-84,44-83
+4-87,2-4
+9-31,31-79
+33-82,33-33
+4-65,3-64
+18-71,19-22
+18-63,10-18
+87-92,88-93
+62-63,61-72
+20-49,49-68
+77-83,64-84
+10-79,8-11
+33-59,34-49
+5-85,11-85
+95-96,7-96
+59-60,35-59
+19-90,7-13
+16-84,16-47
+61-89,88-90
+24-52,51-51
+51-51,50-93
+39-77,18-96
+49-90,90-92
+37-76,75-76
+12-20,21-83
+2-94,3-95
+83-83,83-88
+3-99,2-97
+48-72,72-78
+14-99,13-99
+10-11,1-10
+4-99,5-92
+4-81,71-81
+5-5,5-93
+17-53,5-53
+38-91,37-37
+27-71,26-70
+1-98,73-82
+13-96,7-14
+14-82,14-14
+5-36,4-46
+9-75,9-93
+83-83,44-82
+34-95,23-35
+58-87,58-88
+70-98,69-69
+1-15,2-14
+22-22,22-24
+8-93,8-92
+50-60,2-55
+39-78,40-78
+55-92,31-92
+3-88,1-50
+23-65,23-66
+63-64,17-64
+15-31,11-91
+19-97,18-96
+12-89,12-88
+6-26,7-10
+45-70,45-69
+53-79,77-79
+31-63,30-30
+66-68,7-67
+22-85,43-85
+9-9,9-82
+1-30,4-80
+36-58,36-37
+15-84,14-83
+41-42,40-71
+38-73,37-98
+1-61,2-91
+71-73,71-73
+31-80,31-80
+12-99,13-99
+1-83,1-83
+9-92,9-93
+3-35,4-34
+15-64,19-63
+36-36,36-84
+15-43,14-57
+96-98,4-97
+36-46,45-79
+27-71,27-27
+6-6,6-53
+2-55,10-19
+8-48,2-53
+17-99,16-97
+13-64,12-65
+75-86,76-85
+63-64,3-63
+5-87,3-5
+56-91,41-91
+7-23,7-22
+3-88,3-86
+3-5,5-53
+1-94,2-95
+83-85,81-84
+98-98,82-99
+31-68,4-68
+5-95,12-96
+22-35,35-91
+1-93,3-93
+33-86,28-39
+24-95,95-95
+89-91,10-90
+5-77,4-76
+2-49,21-49
+67-91,54-91
+51-76,51-51
+70-74,59-74
+22-32,31-31
+22-53,21-84
+39-63,25-27
+5-95,2-5
+56-66,67-89
+60-60,58-61
+9-36,1-36
+16-35,15-34
+34-69,69-70
+52-84,54-97
+10-84,36-83
+96-97,24-95
+4-99,2-5
+34-90,33-35
+87-97,97-99
+29-38,30-39
+67-97,66-67
+64-83,76-94
+4-94,2-5
+67-87,14-96
+3-94,7-86
+69-80,74-79
+67-82,66-66
+3-85,29-85
+95-97,94-96
+81-85,3-81
+13-78,19-77
+5-35,16-35
+14-42,14-91
+21-81,3-88
+1-7,7-89
+18-70,17-18
+47-96,96-97
+69-93,73-92
+48-48,11-48
+36-95,35-35
+67-67,11-66
+3-86,5-85
+48-89,2-7
+9-58,10-57
+69-70,69-95
+36-97,96-98
+9-43,9-92
+10-69,12-69
+17-76,76-77
+2-99,98-98
+30-31,29-33
+38-64,41-64
+1-91,1-92
+7-16,2-16
+1-99,1-1
+11-96,12-95
+14-93,13-93
+10-87,2-10
+10-66,10-96
+17-87,16-16
+14-58,57-59
+19-95,20-94
+43-59,22-44
+84-97,84-98
+14-77,34-77
+45-69,44-46
+52-87,51-68
+3-7,6-56
+14-51,46-50
+44-66,49-67
+9-12,1-11
+86-90,86-90
+32-41,29-42
+53-80,11-73
+93-93,13-94
+39-84,40-73
+16-71,71-72
+9-94,9-94
+44-91,3-98
+18-78,18-98
+19-48,18-47
+23-77,68-77
+20-68,63-67
+48-90,48-97
+40-49,39-71
+4-15,15-99
+76-77,60-76
+12-56,17-57
+27-92,28-93
+13-74,12-14
+4-97,5-66
+50-50,50-51
+66-66,44-66
+58-68,23-52
+47-76,48-76
+8-96,48-98
+43-92,7-92
+33-54,15-97
+72-99,71-98
+13-76,31-36
+2-14,11-13
+8-70,7-9
+8-54,8-55
+93-96,94-96
+31-74,73-73
+65-74,53-74
+46-93,45-94
+31-99,8-99
+6-37,10-37
+21-82,22-83
+55-73,17-20
+65-79,66-72
+15-43,14-44
+1-96,6-97
+3-98,5-99
+24-80,18-71
+56-92,57-80
+12-54,40-83
+31-80,16-81
+35-48,22-85
+2-90,1-89
+2-2,2-59
+87-96,51-87
+36-99,37-99
+8-90,37-70
+14-14,14-76
+39-99,20-71
+52-65,52-65
+31-48,31-48
+57-57,57-88
+68-92,68-81
+5-98,6-98
+87-96,25-88
+6-86,87-87
+69-88,33-84
+39-86,40-40
+77-82,77-87
+11-88,97-97
+29-87,87-89
+40-55,39-40
+96-97,47-95
+5-85,85-85
+11-93,93-94
+29-96,89-95
+6-69,26-92
+20-76,15-20
+39-40,38-39
+7-33,6-34
+34-78,35-37
+18-67,9-67
+7-99,6-99
+64-88,47-64
+17-96,18-93
+6-84,4-85
+21-21,21-96
+6-42,5-98
+35-97,38-85
+31-94,9-57
+59-73,62-73
+5-97,5-97
+16-53,16-32
+8-42,7-43
+10-94,11-60
+42-50,17-80
+54-57,57-77
+37-89,88-96
+24-79,20-79
+7-91,24-96
+24-89,88-94
+28-82,10-81
+3-3,3-94
+89-93,92-92
+34-99,34-34
+22-22,23-63
+10-92,3-10
+77-77,77-84
+32-59,28-42
+54-86,55-71
+42-50,11-46
+88-88,6-90
+70-74,72-72
+1-1,1-50
+46-50,9-47
+95-95,3-96
+93-95,12-94
+22-85,14-15
+23-73,22-92
+4-86,4-86
+75-90,75-75
+56-56,55-55
+31-91,32-80
+64-78,3-79
+16-85,15-53
+61-64,62-65
+86-86,23-87
+27-96,68-80
+18-98,18-51
+6-92,49-98
+23-23,23-28
+13-74,5-14
+15-93,16-91
+2-97,12-97
+23-92,17-24
+56-76,75-75
+38-82,39-83
+15-97,97-98
+44-86,45-69
+79-85,35-86
+19-98,20-92
+59-59,7-59
+27-91,28-88
+11-71,66-70
+3-79,5-78
+22-77,21-76
+92-94,12-93
+6-85,6-6
+14-81,14-81
+5-6,8-44
+34-37,36-36
+1-53,29-87
+40-72,67-72
+4-81,1-97
+27-76,10-58
+32-75,2-40
+15-86,86-86
+42-90,2-90
+21-73,20-73
+84-99,3-97
+21-81,2-22
+75-99,53-76
+5-96,5-99
+68-70,21-69
+24-24,23-47
+7-8,7-73
+6-6,6-66
+31-37,30-36
+4-91,5-90
+16-76,18-47
+44-97,25-97
+48-92,47-95
+45-62,45-62
+62-93,48-93
+53-91,77-98
+54-70,12-69
+6-20,17-39
+46-46,12-47
+4-4,5-61
+9-42,43-88
+97-99,1-97
+11-90,89-89
+9-15,4-14
+15-81,4-80
+31-43,44-68
+4-9,1-10
+47-48,32-47
+22-47,46-55
+10-12,11-86
+3-4,4-41
+64-84,18-85
+15-39,14-47
+15-51,11-12
+10-57,9-56
+16-29,15-30
+38-57,10-39
+20-87,20-82
+1-43,3-43
+9-90,7-89
+23-88,25-89
+50-92,51-91
+13-94,94-96
+2-92,47-91
+22-95,1-23
+22-73,21-22
+3-5,4-33
+13-75,12-76
+18-26,17-39
+6-72,10-71
+17-76,3-41
+24-96,17-96
+50-57,51-55
+97-99,80-98
+5-66,5-78
+8-57,14-56
+20-21,20-97
+22-79,21-79
+2-99,99-99
+95-95,38-96
+34-95,35-94
+14-27,6-13
+19-87,18-88
+64-66,60-66
+38-85,37-38
+88-97,4-87
+1-99,2-92
+8-12,12-92
+25-60,26-59
+38-74,19-38
+45-76,15-46
+60-91,60-91
+81-81,12-82
+19-20,20-61
+22-97,19-98
+13-57,28-65
+15-90,12-15
+40-40,23-40
+27-92,17-92
+7-99,8-77
+6-83,16-83
+53-70,37-69
+66-93,42-71
+73-92,89-92
+5-87,6-39
+9-99,99-99
+27-80,81-81
+7-58,58-58
+9-85,50-86
+39-94,14-88
+13-40,2-39
+2-89,1-28
+43-89,72-88
+23-41,24-24
+23-34,34-83
+19-64,19-20
+60-97,61-89
+4-57,56-56
+8-89,40-90
+30-48,17-30
+3-93,2-92
+1-10,10-74
+1-24,5-56
+19-19,18-47
+3-10,5-83
+50-52,48-51
+13-75,13-13
+10-10,16-61
+27-92,27-88
+45-93,46-94
+47-61,16-61
+76-77,76-83
+32-84,84-87
+86-86,87-87
+7-95,8-73
+8-69,20-68
+44-95,44-95
+11-39,12-40
+63-99,70-99
+36-45,35-49
+6-55,55-75
+91-93,91-93
+61-75,49-75
+86-98,87-99
+46-98,10-14
+95-95,74-96
+5-92,91-99
+2-92,2-2
+1-57,11-56
+97-97,14-98
+8-74,74-83
+19-67,61-66
+94-94,24-95
+5-9,69-90
+30-66,30-65
+2-99,1-98
+38-94,63-73
+1-2,1-99
+43-93,20-90
+42-89,40-42
+22-88,52-87
+78-79,23-77
+22-89,21-89
+12-94,11-80
+2-7,6-84
+20-99,20-20
+8-93,38-99
+16-60,17-61
+41-41,41-83
+17-47,4-57
+18-56,18-56
+1-57,1-57
+77-87,1-77
+62-91,63-92
+6-90,10-91
+2-4,3-97
+53-67,54-62
+29-30,5-30
+51-51,7-50
+2-87,1-88
+13-73,55-87
+8-29,7-29
+64-97,15-98
+23-84,22-23
+7-10,3-11
+19-35,35-78
+49-96,50-97
+16-94,17-94
+24-71,9-82
+29-88,9-29
+24-52,43-51
+69-73,8-82
+1-3,2-91
+6-85,7-7
+4-86,16-79
+4-4,6-50
+17-83,82-88
+27-81,28-67
+82-85,56-84
+39-40,40-86
+2-48,8-49
+8-79,7-8
+62-86,61-85
+65-67,47-66
+48-97,49-97
+41-86,66-85
+18-41,17-40
+40-85,67-76
+77-95,58-91
+39-66,31-40
+4-7,7-98
+33-96,44-96
+3-11,3-3
+69-70,8-70
+97-97,3-97
+32-94,81-93
+21-70,20-69
+47-56,28-55
+1-1,1-33
+36-71,35-86
+18-88,19-88
+4-99,8-96
+13-79,14-62
+11-71,11-79
+69-92,68-92
+18-88,88-94
+26-92,26-92
+15-69,16-68
+59-95,95-98
+40-53,39-54
+53-64,32-53
+17-97,16-84
+28-99,7-88
+49-81,49-69
+22-98,97-98
+66-94,5-97
+3-70,1-76
+5-93,2-25
+46-66,65-65
+69-70,11-99
+55-93,56-77
+11-92,12-93
+34-96,95-96
+1-3,3-15
+49-88,19-88
+80-84,63-85
+7-83,56-99
+14-62,55-67
+22-84,23-66
+35-89,31-35
+33-81,7-81
+78-85,77-86
+38-44,46-80
+72-83,12-73
+62-92,65-92
+60-89,26-60
+48-59,41-57
+55-83,56-84
+27-89,48-50
+5-66,5-84
+30-84,21-84
+23-62,22-62
+55-93,37-94
+6-47,15-46
+28-28,29-39
+2-3,13-13
+46-81,18-81
+37-88,38-89
+7-53,17-52
+32-67,18-81
+22-22,22-24
+2-71,15-45
+1-92,1-92
+14-89,10-91
+9-79,12-78
+4-15,3-92
+49-68,29-69
+1-2,3-51
+27-45,28-44
+22-99,21-99
+66-70,64-69
+97-98,67-98
+47-98,47-57
+47-98,48-79
+7-31,9-34
+8-84,8-8
+20-92,6-20
+14-90,5-22
+23-68,29-87
+3-42,41-71
+80-80,81-96
+59-80,79-95
+17-86,35-86
+32-92,91-91
+72-77,53-78
+20-23,23-95
+94-97,8-94
+25-34,26-33
+12-96,13-98
+73-95,73-73
+43-50,44-50
+5-99,1-5
+63-94,63-94
+40-52,41-42
+25-25,25-78
+6-10,9-97
+23-26,26-77
+48-79,48-48
+26-96,88-90
+6-11,9-27
+34-42,43-92
+15-83,16-87
+9-93,82-93
+45-77,76-85
+74-98,18-99
+7-95,8-94
+46-98,97-99
+18-42,42-60
+15-17,16-35
+44-88,64-87
+60-61,56-62
+46-48,49-58
+90-97,6-90
+19-20,15-20
+1-1,1-61
+34-75,33-76
+1-90,5-90
+51-61,5-52
+40-91,90-95
+17-77,1-77
+77-77,17-77
+32-81,33-76
+12-41,13-41
+61-91,59-92
+44-67,44-81
+31-63,31-71
+8-97,6-79
+7-98,6-99
+4-38,3-4
+2-95,94-99
+3-28,1-3
+50-56,3-98
+24-76,24-24
+5-10,4-78
+30-75,30-76
+41-47,40-66
+4-37,3-4
+72-98,71-99
+7-19,8-19
+64-64,19-64
+7-58,7-58
+35-45,36-45
+1-99,99-99
+6-68,2-69
+52-75,53-72
+11-91,38-91
+6-17,6-17
+16-57,17-57
+6-16,7-15
+18-86,17-85
+13-35,7-74
+35-40,34-40
+20-85,37-84
+89-89,21-89
+2-24,21-25
+25-73,3-47
+7-7,7-93
+15-20,14-95
+10-83,11-82
+10-95,9-96
+17-86,47-87
+14-80,78-80
+47-50,53-92
+74-76,63-75
+8-44,3-9
+80-91,16-92
+11-11,12-89
+35-97,34-98
+28-98,98-99
+20-58,58-80
+21-71,8-40
+14-77,14-14
+28-73,27-73
+58-83,59-83
+12-96,44-59
diff --git a/day4/main.c b/day4/main.c
@@ -0,0 +1,82 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <err.h>
+
+void
+splitString(char *string, char delim, char **result)
+{
+ int index = 0;
+ for (int i = 0; i < strlen(string); i++)
+ {
+ if (string[i] == delim)
+ index++;
+ else
+ strncat(result[index], &string[i], 1);
+ }
+}
+
+int
+main (void)
+{
+ FILE *fp = fopen("input.txt", "r");
+ if (fp == NULL)
+ {
+ err(1, "Failed to open input.txt");
+ exit(EXIT_FAILURE);
+ }
+
+ int fullOverlaps = 0;
+ int overlaps = 0;
+
+ char *line = NULL;
+ size_t linesize = 0;
+ ssize_t linelen = 0;
+ while ((linelen = getline(&line, &linesize, fp)) != -1)
+ {
+ line[linelen-1] = '\0'; // cut off the newline
+
+ // Is there a better way to allocate memory for this?
+ char *ranges[2]; ranges[0] = malloc(8); ranges[1] = malloc(8);
+ char *range1[2]; range1[0] = malloc(8); range1[1] = malloc(8);
+ char *range2[2]; range2[0] = malloc(8); range2[1] = malloc(8);
+
+ splitString(line, ',', ranges);
+ splitString(ranges[0], '-', range1);
+ splitString(ranges[1], '-', range2);
+
+ // Simple comparisons. I wonder if there's a mathematically
+ // clever way to solve this...
+ if (atoi(range1[0]) >= atoi(range2[0])
+ && atoi(range1[1]) <= atoi(range2[1]))
+ {
+ fullOverlaps++;
+ overlaps++;
+ }
+ else if (atoi(range1[0]) <= atoi(range2[0])
+ && atoi(range1[1]) >= atoi(range2[1]))
+ {
+ fullOverlaps++;
+ overlaps++;
+ }
+ else if (atoi(range1[0]) <= atoi(range2[1])
+ && atoi(range1[1]) >= atoi(range2[0]))
+ {
+ overlaps++;
+ }
+ else if (atoi(range1[0]) >= atoi(range2[1])
+ && atoi(range1[1]) <= atoi(range2[0]))
+ {
+ overlaps++;
+ }
+ }
+ free(line);
+ if (ferror(fp))
+ err(1, "getline");
+ fclose(fp);
+
+ printf("PART 1: There are %d pairs in which one range fully contains the other.\n", fullOverlaps);
+ printf("PART 2: There are %d pairs which overlap.\n", overlaps);
+
+ exit(EXIT_SUCCESS);
+}