summaryrefslogtreecommitdiff
path: root/2022/01
diff options
context:
space:
mode:
Diffstat (limited to '2022/01')
-rw-r--r--2022/01/calories.py12
-rw-r--r--2022/01/calories2.py12
-rw-r--r--2022/01/example14
-rw-r--r--2022/01/input2248
4 files changed, 2286 insertions, 0 deletions
diff --git a/2022/01/calories.py b/2022/01/calories.py
new file mode 100644
index 0000000..8fddecf
--- /dev/null
+++ b/2022/01/calories.py
@@ -0,0 +1,12 @@
+cur_cal = 0
+max_cal = 0
+with open("input", encoding="utf-8") as f:
+ foods = f.readlines()
+for food in foods:
+ if food == "\n":
+ if cur_cal > max_cal:
+ max_cal = cur_cal
+ cur_cal = 0
+ else:
+ cur_cal += int(food)
+print(f"highest calories is {max_cal}")
diff --git a/2022/01/calories2.py b/2022/01/calories2.py
new file mode 100644
index 0000000..bba30a2
--- /dev/null
+++ b/2022/01/calories2.py
@@ -0,0 +1,12 @@
+elf_cals = [0]
+with open("input", encoding="utf-8") as f:
+ foods = f.readlines()
+i = 0
+for food in foods:
+ if food == "\n":
+ elf_cals.append(0)
+ i += 1;
+ else:
+ elf_cals[i] += int(food)
+top3 = sum(sorted(elf_cals, reverse=True)[:3])
+print(f"sum of top 3 calories is {top3}")
diff --git a/2022/01/example b/2022/01/example
new file mode 100644
index 0000000..2094f91
--- /dev/null
+++ b/2022/01/example
@@ -0,0 +1,14 @@
+1000
+2000
+3000
+
+4000
+
+5000
+6000
+
+7000
+8000
+9000
+
+10000
diff --git a/2022/01/input b/2022/01/input
new file mode 100644
index 0000000..342079f
--- /dev/null
+++ b/2022/01/input
@@ -0,0 +1,2248 @@
+7844
+1892
+10928
+4800
+9730
+3485
+7293
+
+11956
+2767
+12893
+2757
+3026
+9979
+
+4507
+4199
+2855
+1792
+2041
+4162
+3855
+2650
+2165
+5464
+2125
+4979
+4878
+6301
+
+2546
+3750
+1192
+4692
+6809
+2808
+6505
+2811
+6448
+4270
+2919
+1297
+1678
+
+2006
+6163
+5949
+2074
+5917
+5796
+3456
+1161
+6843
+3988
+4064
+5591
+
+17062
+14531
+5297
+
+16033
+18054
+25935
+
+3621
+3121
+5884
+5199
+4584
+4796
+1325
+3374
+5789
+2545
+5842
+1760
+5766
+1882
+3084
+
+10364
+1136
+2256
+5654
+7065
+5990
+3621
+8063
+
+4334
+1865
+4485
+4741
+2591
+2594
+2991
+3928
+5849
+6864
+4932
+
+6627
+8318
+11410
+18778
+
+14870
+13264
+8777
+2567
+15388
+
+11837
+11042
+12115
+11169
+8021
+4206
+8637
+
+2955
+2115
+2292
+2759
+6464
+2843
+3817
+1628
+6486
+2499
+3935
+4944
+1427
+4870
+
+14800
+13942
+2563
+18543
+
+8415
+5943
+6117
+3863
+7123
+8666
+9834
+7437
+
+12318
+5577
+8108
+11695
+2720
+3413
+
+4765
+2805
+2850
+5241
+3910
+4837
+5770
+4998
+3358
+5141
+1052
+2281
+4405
+1714
+
+7984
+4685
+12922
+11579
+4278
+
+14877
+4676
+4571
+9279
+11337
+
+1782
+3009
+14712
+
+5936
+5243
+3849
+1001
+10728
+3847
+9986
+
+1531
+3707
+3599
+5533
+4025
+4651
+3934
+4205
+2481
+3462
+1672
+1806
+3833
+4072
+1497
+
+16920
+25420
+17042
+
+43927
+
+8193
+3107
+2831
+4122
+16336
+
+7507
+1665
+8553
+3231
+2528
+1046
+3491
+4631
+3574
+
+35988
+29345
+
+3520
+4006
+6327
+1658
+4714
+1123
+1938
+3667
+3807
+1824
+4808
+4586
+3275
+4548
+
+9989
+32096
+
+52470
+
+1188
+7694
+7875
+6114
+6189
+4343
+6974
+4812
+1776
+4794
+8065
+
+2364
+4111
+3663
+4182
+3667
+5440
+5482
+2657
+3931
+5871
+5403
+5956
+2659
+2320
+
+10249
+13770
+
+6331
+7262
+1498
+1329
+8943
+1563
+8197
+6898
+2300
+
+5116
+5930
+8363
+8908
+6063
+8325
+1070
+
+7829
+8877
+5631
+6100
+1007
+4754
+7353
+8363
+
+13160
+16304
+6155
+15418
+
+18068
+24378
+16529
+
+8216
+1918
+3305
+7698
+5936
+2012
+2053
+3575
+5705
+
+5372
+3627
+2860
+3742
+4117
+5514
+2590
+4503
+2494
+4418
+1908
+4109
+5255
+5749
+5061
+
+14547
+31905
+
+4691
+4268
+3887
+4136
+5724
+4507
+2298
+6660
+5243
+4719
+5145
+2949
+1460
+
+6324
+1211
+2329
+4872
+5530
+1645
+2989
+3687
+3925
+2578
+1153
+4364
+
+1864
+8160
+9219
+6479
+1098
+9364
+7442
+9665
+1522
+
+3185
+3657
+5730
+7979
+8956
+2138
+8288
+3524
+7910
+
+20487
+
+4948
+4419
+3363
+6742
+1536
+3809
+4289
+1861
+2490
+4842
+1005
+2083
+3115
+
+5872
+2895
+2163
+6140
+4962
+1566
+1502
+6407
+6241
+7154
+
+8910
+5483
+10358
+10448
+5912
+9133
+1919
+5768
+
+7887
+1592
+3503
+6182
+10088
+12143
+
+3897
+4813
+2087
+2953
+5308
+1587
+7320
+4947
+1366
+6723
+2720
+
+16484
+15947
+2582
+11421
+
+2457
+1498
+4113
+5639
+3930
+4950
+4130
+5475
+6156
+4966
+1322
+5749
+5892
+2257
+
+24070
+
+2634
+2784
+5289
+1472
+5770
+4442
+1733
+2003
+2281
+4283
+4183
+3183
+5405
+5055
+4089
+
+6167
+5650
+6531
+8255
+11103
+12421
+
+8499
+15327
+4714
+
+52582
+
+8000
+4408
+4744
+7665
+3565
+6676
+4983
+3282
+1095
+8269
+
+6893
+4008
+2512
+5249
+6578
+2231
+7044
+7903
+3901
+2480
+1832
+
+2278
+5805
+7783
+1497
+4503
+5569
+4260
+7618
+3310
+8083
+
+8025
+17429
+14782
+12645
+
+5914
+1865
+9622
+4014
+9577
+1812
+8287
+10720
+
+3848
+12978
+12735
+3860
+
+5562
+11339
+9051
+6703
+13290
+10611
+
+1232
+1116
+2620
+2495
+4198
+4751
+6099
+3727
+3111
+2493
+3780
+2379
+3042
+4395
+6100
+
+62606
+
+13357
+13984
+11428
+18201
+
+33875
+5610
+
+2504
+19711
+17021
+5985
+
+3759
+5522
+8815
+2113
+2333
+9169
+4805
+2870
+6419
+
+6210
+4186
+3763
+5633
+5159
+5116
+4448
+4570
+5894
+4045
+1994
+3044
+
+10366
+6706
+11448
+1927
+10647
+11786
+11927
+
+1350
+10908
+9325
+2455
+
+10527
+8300
+1312
+1403
+8155
+8803
+9663
+7780
+
+2118
+5436
+5909
+4083
+3714
+3001
+2226
+2915
+5627
+6476
+3578
+6112
+
+36649
+6648
+
+17271
+23884
+15032
+
+16967
+17931
+2443
+
+2520
+1468
+2779
+6020
+4477
+4798
+1894
+2429
+4645
+5053
+6478
+5899
+5824
+2554
+
+12614
+11252
+25055
+
+3435
+1317
+5073
+3082
+4576
+5006
+2238
+3055
+4867
+5079
+4385
+5723
+2084
+4307
+
+6609
+1556
+2351
+2301
+4913
+1820
+1122
+5398
+4738
+2377
+2843
+4704
+
+1201
+1092
+1622
+6094
+1793
+6521
+8237
+2848
+5617
+6585
+
+3561
+8072
+3941
+4432
+4740
+9292
+8115
+3586
+5464
+
+2926
+6812
+5551
+3104
+4369
+7421
+3774
+1272
+1492
+1842
+6058
+1815
+
+5555
+2688
+8859
+8517
+3338
+1500
+7276
+8130
+5984
+
+6597
+5544
+4944
+6402
+1336
+4243
+4333
+6374
+6770
+5346
+
+7225
+33323
+
+17863
+9174
+21966
+
+4835
+4359
+6074
+4069
+5984
+11934
+2577
+
+1738
+2317
+6844
+1672
+4213
+3930
+4658
+5785
+8074
+5695
+
+3063
+6287
+7248
+5656
+1571
+5468
+1512
+5555
+3192
+7892
+5664
+
+5819
+28895
+
+4407
+5072
+4733
+2964
+4073
+5739
+2423
+6131
+3999
+1454
+1221
+1243
+
+26391
+
+35896
+26888
+
+1171
+4136
+1050
+5788
+1049
+5686
+5297
+6035
+2968
+2274
+2771
+5596
+4478
+3401
+5860
+
+6699
+15009
+4368
+13135
+13609
+
+6033
+3972
+1214
+1549
+3996
+2251
+3213
+5217
+5525
+3656
+2585
+2710
+6035
+1903
+1586
+
+8651
+
+4494
+7096
+7913
+1024
+1334
+1353
+2705
+5405
+1601
+7386
+
+18756
+19801
+24646
+
+8490
+5254
+1932
+3706
+1980
+6058
+1961
+3150
+5200
+1337
+
+2846
+6123
+3274
+4632
+3068
+5384
+5842
+2688
+1307
+3279
+2424
+4783
+3932
+
+2720
+7808
+5871
+1416
+7979
+6594
+7325
+4214
+5444
+2132
+
+2626
+6949
+6034
+4887
+6773
+1111
+3317
+3388
+4209
+2809
+2730
+6578
+2700
+
+8995
+10064
+
+2134
+5564
+5889
+3719
+6357
+3523
+4600
+2138
+5976
+6025
+5689
+5950
+3745
+1542
+
+5545
+5789
+4295
+6717
+8612
+3847
+7911
+3367
+6867
+5975
+
+23119
+18834
+3134
+
+7080
+2729
+4118
+1407
+7022
+4796
+8459
+8530
+7721
+7333
+
+5245
+3739
+1338
+1245
+2926
+2695
+4571
+1492
+4794
+4380
+3726
+2225
+2098
+5942
+6081
+
+2192
+2866
+4690
+4240
+6512
+1881
+5789
+1641
+6017
+4327
+3688
+6622
+3555
+
+12879
+2468
+13146
+8534
+10525
+4590
+
+8451
+8697
+11858
+5657
+4893
+
+14019
+13301
+7206
+13988
+
+17234
+22191
+13894
+
+6383
+3682
+5281
+6335
+5412
+5474
+8723
+9536
+8864
+
+14888
+9953
+
+2464
+5875
+2484
+1693
+3441
+5883
+7835
+
+34085
+
+1997
+9058
+7144
+6222
+2930
+3661
+4107
+8058
+4938
+
+3033
+2420
+5196
+5152
+1364
+2192
+3442
+1149
+3575
+6916
+6856
+1995
+6259
+
+1331
+1731
+10757
+3486
+8823
+2450
+8018
+9197
+
+64329
+
+25450
+
+6652
+4972
+5085
+1881
+5555
+1521
+3723
+1158
+3260
+1532
+3131
+2904
+
+1088
+14166
+4490
+15880
+6439
+
+19789
+5274
+7770
+11329
+
+64877
+
+4256
+5811
+3538
+8943
+
+6164
+7843
+5400
+14856
+2882
+
+2781
+3829
+8689
+6347
+8239
+4232
+8606
+5770
+
+10061
+6576
+19346
+15720
+
+9071
+6842
+5147
+8570
+4175
+3801
+6512
+
+21045
+29371
+
+5646
+1786
+11347
+11957
+4226
+12836
+
+1786
+1117
+2905
+5545
+2759
+3168
+5993
+1050
+4096
+1812
+1036
+3048
+1602
+
+5694
+4123
+4940
+8115
+8877
+2063
+7222
+
+5281
+5676
+5429
+5198
+1480
+7224
+6453
+2535
+1894
+2730
+5489
+6674
+
+6091
+3148
+4124
+5837
+1575
+4028
+5943
+2374
+3307
+4535
+2008
+2981
+1251
+1902
+1689
+
+1154
+4931
+1030
+6793
+9190
+6920
+6588
+4759
+5502
+
+23727
+
+1716
+2529
+6082
+5333
+2555
+3710
+4174
+1747
+1506
+2434
+2343
+4019
+5704
+1253
+3978
+
+13129
+11913
+9504
+11759
+5353
+9152
+
+7685
+7469
+2376
+2221
+3446
+2576
+7992
+2538
+3572
+1715
+7268
+
+15241
+4735
+10421
+9976
+1717
+
+3460
+5386
+1806
+3764
+3019
+4349
+6319
+6635
+6608
+7641
+
+3249
+2254
+4624
+2495
+3325
+1502
+2347
+1544
+2806
+2844
+5702
+3594
+3448
+4378
+5474
+
+4447
+1251
+1088
+2070
+4109
+1029
+5779
+3795
+1080
+3589
+3016
+2793
+2636
+5946
+4953
+
+52518
+
+5836
+6177
+4873
+2860
+4545
+2793
+3492
+6810
+2330
+2067
+3626
+
+14370
+14242
+8644
+16054
+7313
+
+8547
+6827
+1264
+8991
+1306
+3829
+6188
+
+1566
+6239
+4931
+5359
+7314
+7493
+2898
+4429
+5609
+3329
+
+6747
+3945
+9283
+10312
+2925
+11240
+
+9133
+14062
+15257
+12353
+
+12534
+17806
+5580
+7262
+
+4311
+3933
+3798
+4932
+3040
+1819
+4434
+5705
+1293
+4348
+4241
+3050
+4471
+4445
+
+21451
+9368
+
+5252
+6300
+3548
+7323
+2328
+2721
+5001
+1261
+7357
+1350
+7024
+5193
+
+15832
+15934
+17497
+7846
+
+1647
+6717
+1323
+5420
+5063
+2488
+3298
+1163
+1205
+3104
+3644
+4177
+2730
+
+6851
+4735
+2851
+7015
+2836
+4052
+6511
+2413
+4049
+6620
+1205
+3131
+
+8028
+6431
+8863
+
+3411
+3434
+1509
+4907
+5244
+2022
+5347
+2648
+5479
+1668
+3461
+1380
+2991
+4789
+1003
+
+3584
+3947
+2670
+2718
+7380
+1243
+2124
+2825
+5907
+7608
+4592
+
+7236
+3836
+2137
+1824
+3283
+4702
+6791
+6370
+4781
+1647
+5176
+6373
+
+2526
+5660
+5065
+1103
+5031
+1394
+1948
+2812
+1240
+4727
+5359
+3119
+2511
+2913
+2763
+
+25820
+24769
+
+2645
+1917
+5280
+1864
+5772
+2984
+1410
+3052
+3599
+2034
+4122
+3678
+1502
+1107
+
+3385
+2149
+2758
+1895
+6232
+3858
+6266
+2861
+6624
+1078
+6721
+5652
+
+6842
+4520
+4919
+6678
+3890
+1823
+6488
+2575
+5245
+3696
+4294
+6071
+5158
+
+38153
+
+4245
+4359
+6283
+3510
+2610
+2592
+4843
+2179
+1218
+
+1895
+3676
+4307
+1886
+2495
+2143
+6751
+6498
+1546
+4454
+2203
+6640
+3713
+
+6943
+2324
+3284
+2277
+1234
+2005
+1168
+3585
+1931
+4371
+5547
+1237
+6250
+
+2722
+6827
+7366
+7001
+8320
+8560
+10331
+
+7759
+11634
+4006
+9406
+12116
+1403
+10477
+
+6213
+6458
+5178
+9407
+5651
+5743
+4120
+
+9958
+18260
+9126
+
+6239
+3466
+2939
+4775
+1326
+6307
+4255
+2843
+7634
+5993
+4585
+
+6607
+8754
+9714
+9844
+12936
+
+20048
+24368
+16320
+
+6152
+1868
+2057
+6981
+6244
+6557
+2858
+4943
+2261
+7241
+6353
+
+3362
+1989
+4154
+6154
+4409
+5546
+1202
+6484
+2812
+4690
+6080
+2564
+6001
+1379
+
+4859
+7852
+4538
+1495
+6904
+7849
+4937
+2986
+8593
+4164
+
+2338
+1139
+4118
+2916
+2087
+2180
+1476
+1669
+6375
+2689
+3890
+6928
+
+2032
+2582
+3926
+2966
+4326
+1334
+4264
+1151
+1513
+3098
+2618
+4087
+5318
+5287
+4176
+
+2012
+3358
+12673
+15745
+13638
+
+18797
+6045
+12915
+
+10036
+10932
+11869
+6686
+2505
+4998
+2545
+
+9353
+24442
+15660
+
+1563
+6832
+6212
+7249
+5815
+3135
+4260
+1632
+1105
+2628
+1693
+4728
+
+5564
+3863
+2269
+1623
+3527
+2445
+4823
+2271
+1102
+2110
+3765
+1731
+4149
+2924
+3807
+
+3049
+8544
+2753
+1454
+6543
+2379
+6571
+3467
+5347
+
+4430
+6186
+8128
+6013
+8050
+6688
+5697
+5250
+3077
+4775
+
+5639
+1567
+4651
+2362
+1676
+2033
+2843
+1577
+5838
+5545
+5803
+2561
+1774
+5371
+4177
+
+2934
+4347
+5400
+1017
+1907
+5367
+3233
+3201
+6389
+3857
+1884
+2082
+5091
+1362
+
+3574
+1873
+5995
+3908
+6154
+5350
+1856
+5219
+5865
+4628
+4904
+1988
+3336
+3602
+
+17499
+8319
+8975
+
+4570
+8463
+8389
+5896
+6657
+5300
+2953
+5541
+3791
+8065
+
+2177
+7674
+10338
+6861
+7176
+12012
+5930
+
+11051
+4024
+11264
+7017
+7432
+3699
+6920
+
+5220
+3483
+7075
+5240
+2156
+2838
+7600
+7522
+3647
+3466
+1903
+
+2400
+6060
+3414
+1852
+6822
+5793
+4895
+2960
+6642
+1477
+1240
+3047
+6426
+
+11128
+22839
+20660
+
+5889
+3600
+7076
+4431
+3604
+4256
+2548
+5482
+3501
+5278
+
+3410
+3519
+9965
+12953
+9463
+6493
+
+3949
+5992
+2986
+2886
+1598
+3393
+5766
+3427
+3750
+2125
+2819
+2818
+3033
+5536
+4458
+
+9958
+8583
+3283
+6782
+10683
+3178
+4486
+
+7674
+1680
+2315
+7486
+3096
+4386
+1553
+3675
+4100
+7705
+3479
+
+6402
+3133
+3192
+3227
+2933
+6881
+3088
+8628
+2271
+
+3697
+4072
+4962
+6101
+4711
+2184
+5168
+3172
+1076
+4206
+4876
+6040
+1844
+2792
+2138
+
+5141
+6671
+7291
+8327
+9200
+1479
+2338
+9402
+4860
+
+12944
+3176
+1343
+
+8561
+4339
+4569
+5435
+4568
+10420
+6843
+
+2642
+11252
+3981
+7926
+9800
+
+6046
+3747
+3534
+5597
+1487
+2726
+3469
+4202
+5847
+3297
+6666
+3832
+
+10609
+2492
+1269
+2012
+5583
+7277
+4471
+9874
+
+4697
+3030
+3002
+6541
+1895
+1254
+2032
+6218
+2624
+4494
+3822
+
+1077
+5664
+2566
+2028
+6227
+5342
+6013
+5994
+6331
+5290
+4154
+1985
+3748
+3666
+
+5745
+1780
+6074
+5641
+2102
+5400
+2585
+6776
+1732
+6493
+4095
+2228
+4647
+
+5283
+6675
+6784
+1759
+6256
+5952
+2476
+4176
+3949
+3097
+5127
+6465
+2571
+
+4670
+5896
+3916
+8881
+6058
+10440
+9862
+10596
+
+10471
+7667
+2665
+10829
+6934
+2179
+5155
+
+3258
+4634
+6263
+2398
+6452
+1536
+3066
+2195
+3431
+1245
+2672
+2692
+1056
+3313
+
+7418
+1070
+2436
+5831
+4648
+3358
+2808
+4966
+5358
+3868
+2124
+
+4779
+5703
+3827
+4386
+6424
+4582
+4501
+2325
+1586
+1450
+5306
+6237
+1210
+
+4882
+4275
+1094
+3855
+5611
+5650
+2271
+1769
+5764
+5895
+2891
+2344
+5228
+6017
+4763
+
+20686
+14164
+24547
+
+26116
+2047
+
+64931
+
+11106
+11298
+3236
+2998
+3995
+10523
+
+1230
+3999
+2775
+2882
+4474
+2490
+5185
+3853
+6045
+1786
+3372
+3548
+2217
+1424
+
+4424
+2982
+3616
+1397
+4217
+3084
+2641
+2703
+1247
+1131
+3372
+1664
+1351
+2609
+4200
+
+10258
+1295
+10597
+5712
+8643
+7976
+5578
+2924
+
+1514
+8050
+4828
+8746
+5551
+8739
+1382
+8218
+6875
+6039
+
+45328
+
+18784
+21739
+
+2884
+7165
+8039
+3978
+6701
+2646
+6171
+3899
+2700
+
+6461
+4227
+7052
+1458
+6367
+4403
+2232
+7085
+
+3490
+4126
+6334
+2320
+4354
+5981
+4319
+2031
+1629
+
+5536
+3182
+6285
+1561
+1215
+2367
+5133
+2720
+3062
+6456
+6160
+3248
+5430
+3354
+
+2124
+7143
+6779
+2022
+2034
+9093
+4122
+1303
+5054