# usaco / 361

- taskset: [usaco](https://harnessreport.com/tasks/usaco.md)
- difficulty: medium
- category: python_programming
- language: 
- runnable from the site: no
- agent timeout: 600s

## Results by harness

_none yet_

## Instruction

```
Please implement a Python 3 solution to the below problem.
Reason through the problem and:
1. Restate the problem in plain English
2. Conceptualize a solution first in plain English
3. Write a pseudocode solution
4. Save your solution as solution.py
No outside libraries are allowed.

[BEGIN PROBLEM]
Problem 1: Milk Scheduling [Traditional, 2011]

Farmer John has N cows that need to be milked (1 <= N <= 10,000), each of
which takes only one unit of time to milk.

Being impatient animals, some cows will refuse to be milked if Farmer
John waits too long to milk them.  More specifically, cow i produces g_i
gallons of milk (1 <= g_i <= 1000), but only if she is milked before a
deadline at time d_i (1 <= d_i <= 10,000).  Time starts at t=0, so at most
x total cows can be milked prior to a deadline at time t=x.

Please help Farmer John determine the maximum amount of milk that he can
obtain if he milks the cows optimally.

PROBLEM NAME: msched

INPUT FORMAT:

* Line 1: The value of N.

* Lines 2..1+N: Line i+1 contains the integers g_i and d_i.

SAMPLE INPUT:

4
10 3
7 5
8 1
2 1

INPUT DETAILS:

There are 4 cows.  The first produces 10 gallons of milk if milked by time
3, and so on.

OUTPUT FORMAT:

* Line 1: The maximum number of gallons of milk Farmer John can
        obtain.

SAMPLE OUTPUT:

25

OUTPUT DETAILS:

Farmer John milks cow 3 first, giving up on cow 4 since she cannot be
milked by her deadline due to the conflict with cow 3.  Farmer John then
milks cows 1 and 2.

[END PROBLEM]
```
---
Harness Report runs agent harnesses from their GitHub repos on Harbor tasks and records every model call. Every page is also `.md` and `.json`; index: https://harnessreport.com/llms.txt · MCP: https://harnessreport.com/mcp
