<|instruction|>
Solve the below problem. The solution should start with an abridged problem statement. Then key observations. Then full solution based on the observations. Then C++ and Python implementations with comments.

276. Andrew's Troubles
time limit per test: 0.25 sec.
memory limit per test: 65536 KB
input: standard
output: standard



Famous Berland ACM-ICPC team Anisovka consists of three programmers: Andrew, Michael and Ilya. A long time ago, during the first few months the team was founded, Andrew was very often late to the trainings and contests. To stimulate Andrew to be more punctual, Ilya and Andrew decided to introduce a new rule for team participants. If somebody is late (i.e. comes at least one second after appointed time) he owes a cup of tea to other team members. If he is late for 5 minutes, he owes two cups of tea. If he is late for 15 minutes, he owes three cups of tea. And if he is late for 30 minutes or more, he owes 4 cups of tea.
The training starts at the time S (counted in seconds, from some predefined moment of time) and Andrew comes at the time P (also in seconds, counted from the same moment of time).
Your task is to find how many cups of tea Andrew owes.

Input
The input file contains single line with integer numbers S and P (0 <= S,P <= 10^4).

Output
Write to the output file the number of cups Andrew owes.

Sample test(s)

Input
Test #1
10 10

Test #2
10 11

Test #3
0 300

Output
Test #1
0

Test #2
1

Test #3
2
Author:	Michael R. Mirzayanov
Resource:	ACM ICPC 2004-2005, NEERC, Southern Subregional Contest
Date:	Saratov, October 7, 2004

<|response|>
1. Abridged Problem Statement  
   You are given two integers S and P (0 ≤ S, P ≤ 10⁴), the scheduled start time and Andrew’s actual arrival time, both in seconds. Compute how many cups of tea Andrew owes:  
   - If he is on time or early (P ≤ S): 0 cups  
   - If he is late by at least 1 second but less than 5 minutes: 1 cup  
   - If late by at least 5 minutes but less than 15 minutes: 2 cups  
   - If late by at least 15 minutes but less than 30 minutes: 3 cups  
   - If late by 30 minutes or more: 4 cups  

2. Key Observations  
   • Compute the delay as `delay = P − S`.  
   • If `delay ≤ 0`, the answer is 0.  
   • All thresholds can be compared in seconds:  
     – 5 minutes = 300 seconds  
     – 15 minutes = 900 seconds  
     – 30 minutes = 1800 seconds  
   • Once you have `delay > 0`, you just check which range it falls into and assign 1–4 accordingly.

3. Full Solution Approach  
   Step 1. Read integers S and P.  
   Step 2. Compute `delay = P − S`.  
   Step 3. Initialize `ans = 0`.  
   Step 4. If `delay > 0`, then:  
      – If `delay < 300`, set `ans = 1`.  
      – Else if `delay < 900`, set `ans = 2`.  
      – Else if `delay < 1800`, set `ans = 3`.  
      – Else set `ans = 4`.  
   Step 5. Print `ans`.  

   This runs in O(1) time and uses O(1) memory.

4. C++ Implementation with Detailed Comments  
```cpp
#include <iostream>
using namespace std;

int main() {
    int S, P;
    // Read scheduled time S and arrival time P
    cin >> S >> P;

    // Compute how many seconds late Andrew is
    int delay = P - S;

    int ans = 0;
    if (delay > 0) {
        // Check against thresholds in seconds
        if (delay <  5 * 60)        // less than 5 minutes
            ans = 1;
        else if (delay < 15 * 60)   // 5 to less than 15 minutes
            ans = 2;
        else if (delay < 30 * 60)   // 15 to less than 30 minutes
            ans = 3;
        else                         // 30 minutes or more
            ans = 4;
    }

    // Output the number of cups owed
    cout << ans << "\n";
    return 0;
}
```

5. Python Implementation with Detailed Comments  
```python
# Read scheduled start time S and actual arrival time P
S, P = map(int, input().split())

# Compute the delay in seconds
delay = P - S

# Default answer is 0 (on time or early)
if delay <= 0:
    print(0)
elif delay < 5 * 60:
    # late by 1 to 299 seconds => 1 cup
    print(1)
elif delay < 15 * 60:
    # late by 300 to 899 seconds => 2 cups
    print(2)
elif delay < 30 * 60:
    # late by 900 to 1799 seconds => 3 cups
    print(3)
else:
    # late by 1800 seconds or more => 4 cups
    print(4)
```