Mark the stale issues

A stale bot marks issues that have been quiet for too long. Write its core rule.

What to build

A program that lists the issues with no activity for more than 60 days.

Requirements

  • Each line is ID DAYS: the issue number and the days since its last activity.
  • An issue is stale if DAYS is greater than 60. Print #ID: stale for each stale issue, in input order.
  • Finally print COUNT stale.

Input

The first line has n (1 to 100). Each of the next n lines is ID DAYS.

Output

One line per stale issue, then the count line.

Constraints

1 ≤ n ≤ 100, 0 ≤ DAYS ≤ 3650.

Example

Input:

4
101 3
87 75
64 140
120 20

Output:

#87: stale
#64: stale
2 stale

Why it works

The rule is one comparison per issue, and the strict comparison means an issue on exactly 60 days still has time; printing in input order and counting along the way gives the whole report in one pass.

Examples

Example 1 · Input
4
101 3
87 75
64 140
120 20
Expected output
#87: stale
#64: stale
2 stale
Example 2 · Input
2
5 10
6 60
Expected output
0 stale

Prompts inside input() are ignored when checking, so input("n: ") is fine.

Hints

Hint 1

Split each line into two numbers with the split() method.

Hint 2

An issue is stale if days is greater than 60 (60 itself is not stale).

Hint 3

Print the stale ones in input order, then count them.

Solution

Show one correct solution (try it yourself first)
n = int(input())
count = 0
for _ in range(n):
    issue, days = input().split()
    if int(days) > 60:
        count += 1
        print(f"#{issue}: stale")
print(f"{count} stale")

▶ Open this solution in the compiler, then press Visualize to watch it run step by step

Lesson: Maintaining a project →