Theater

AtCoder
IDabc073_b
Time2000ms
Memory256MB
Difficulty
Joisino is working as a receptionist at a theater. The theater has $100000$ seats, numbered from $1$ to $100000$. According to her memo, $N$ groups of audiences have come so far, and the $i$\-th group occupies the consecutive seats from Seat $l_i$ to Seat $r_i$ (inclusive). How many people are sitting at the theater now? ## Constraints * $1≤N≤1000$ * $1≤l_i≤r_i≤100000$ * No seat is occupied by more than one person. * All input values are integers. ## Input Input is given from Standard Input in the following format: $N$ $l_1$ $r_1$ $:$ $l_N$ $r_N$ [samples]
Samples
Input #1
1
24 30
Output #1
7

There are $7$ people, sitting at Seat $24,25,26,27,28,29$ and $30$.
Input #2
2
6 8
3 3
Output #2
4
API Response (JSON)
{
  "problem": {
    "name": "Theater",
    "description": {
      "content": "Joisino is working as a receptionist at a theater. The theater has $100000$ seats, numbered from $1$ to $100000$. According to her memo, $N$ groups of audiences have come so far, and the $i$\\-th group",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc073_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Joisino is working as a receptionist at a theater.\nThe theater has $100000$ seats, numbered from $1$ to $100000$.\nAccording to her memo, $N$ groups of audiences have come so far, and the $i$\\-th group...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments