VP 52: Checksum (15 pts + 15 extra)

What You Need

Any computer with Python 3. You can also use an online Python environment, such as https://colab.research.google.com

Problem Statement

Your input is a spreadsheet, with rows of apparently-random numbers, like this:
5 1 9 5
7 5 3
2 4 6 8
For each row, determine the difference between the largest value and the smallest value.

The checksum is the sum of all of these differences.

For the spreadsheet above, here is the calculation:

The spreadsheet's checksum is 8 + 4 + 6 = 18.

VP 52.1: Checksum (15 pts)

Use this data:
https://samsclass.info/COMSC122/proj/VP52
What is the checksum for the spreadsheet in your puzzle input?

That number is the flag.

Hint: split() is helpful.

VP 52.2: Divisible (15 pts)

Use the same data:
https://samsclass.info/COMSC122/proj/VP52
Find the only two numbers in each row where one evenly divides the other.

find those numbers on each line, divide them, and add up each line's result.

For example, given the following spreadsheet:

5 9 2 8
9 4 7 3
3 8 6 5
  • In the first row, the only two numbers that evenly divide are 8 and 2; the result of this division is 4.
  • In the second row, the two numbers are 9 and 3; the result is 3.
  • In the third row, the result is 2.
In this example, the sum of the results would be 4 + 3 + 2 = 9.

What is the sum of each row's result in your puzzle input?

That number is the flag.

Source

Adapted from the Advent of Code.

Posted 8-28-25