Problem:


Score : 200 points

Problem Statement

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

Output

Print the number of people sitting at the theater.

Sample Input 1

1
24 30

Sample Output 1

7

There are 7 people, sitting at Seat 24,25,26,27,28,29 and 30.

Sample Input 2

2
6 8
3 3

Sample Output 2

4



Sample input:
1
24 30


Sample output:
7

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    ans = 0
    for _ in range(n):
        l, r = mi()
        ans += (r - l + 1) 
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
sums = 0
for _ in range(N):
    l,r=map(int,input().split())
    sums+=r-l+1
print(sums)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
    a, b = map(int, input().split())
    ans += b - a + 1
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(0, N):
    l, r = (int(j) for j in input().split())
    ans += r-l+1
print(ans)

Submission status: Accepted

Solution code:
def solve():
    ans = 0
    N = int(input())
    for i in range(N):
        x,y = map(int, input().split())
        ans += y-x+1
    return ans
print(solve())

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(n):
    l,r=map(int,input().split())
    ans+=(r-l)+1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
l=[]
tmp=0
for i in range(N):
    l.append(list(map(int,input().split())))
for i in range(N):
    tmp+=abs(l[i][0]-l[i][1])+1
print(tmp)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0

for a in range(n):
    l, r = map(int, input().split())

    ans += r - l + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
apple = []
for _ in range(n):
    apple.append(list(map(int, input().split())))
count = 0
for i in apple:
    count += i[1] - i[0] + 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
S = 0
for _ in range(N):
  l, r = map(int, input().split())
  S += r - l + 1
print(S)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
total = 0
for _ in range(N):
  f, t = map(int, input().split())
  total += t - f + 1
print(total)

Submission status: Accepted

Solution code:
N = int(input())

c_list = [list(map(int, input().split())) for _ in range(N)]

ans = 0
for cs in c_list:
    ans += abs((cs[1]+1) - cs[0])

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
seats = 0
for i in range(N):
    l,r = map(int, input().split())
    seats += (r- l+1)
print(seats)

Submission status: Accepted

Solution code:
ans = 0
n = int(input())
for i in range(n):
  l, r = map(int, input().split())
  ans += r - l + 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(n):
    l = list(map(int, input().split()))
    ans += l[-1] - l[0] + 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
for _ in range(N):
    l,r = map(int,input().split())
    cnt += r - l + 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

for _ in range(N):
  l,r = map(int,input().split())
  ans += r-l+1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
ans=0
for l in range(N) :
    ans+=(a[l][1]-a[l][0])+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
sum = 0
for i in range(N):
    l,r = map(int,input().split())
    sum += r-l+1

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for _ in range(n):
    l, r = map(int, input().split())
    ans += (r-l)+1
print(ans)

Submission status: Accepted

Solution code:
円周率 = 0
N = int(input())
for i in range(N):
  l,r= map(int,input().split())
  円周率 += r - l + 1 
print(円周率)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(n):
    a,b=map(int,input().split())
    ans+=b-a+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = []
la = l.append
for _ in range(n): l.append(list(map(int, input().split())))
l = list(map(lambda x: x[1] - x[0] + 1, l))
print(sum(l))

Submission status: Accepted

Solution code:
N=int(input())
lr=[list(map(int,input().split())) for _ in range(N)]

ans=0
for i in range(N):
    ans+=lr[i][1]-lr[i][0]+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lr = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for l, r in lr:
    ans += r - l + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
LR = [list(map(int, input().split())) for _ in range(n)]
ans = [r - l + 1 for (l, r) in LR]
print(sum(ans))

Submission status: Accepted

Solution code:
n=int(input())
list=[]
for i in range(n):
    l,r=map(int,input().split())
    list.append(l)
    list.append(r)
#print(list)
sum=0
for i in range(int(len(list)/2)):
    sum+=list[2*i+1]-list[2*i]+1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
    l,r = map(int,input().split())
    num = r-l+1
    ans += num
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

    res = 0
    for i in range(n):
        l, r = map(int, input().split())
        res += r - l + 1

    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def main():
    ans = 0
    for _ in range(int(input())):
        a, b = map(int, input().split())
        ans += b - a + 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
ans=0
while n>0:
    a,b=map(int,input().split())
    ans+=b-a+1
    n-=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lr=[list(map(int, input().split())) for i in range(n)]
ans=0
for i in range(n):
    ans += lr[i][1] - lr[i][0] + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
m = 0

for _ in range(n):
    a,b = map(int, input().split())
    m += b-a+1

print(m)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 11:38:56 2020

@author: shinba
"""

n = int(input())

ans = 0

for i in range(n):
    l,r = map(int,input().split())
    ans += r-l+1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
lr = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for l,r in lr:
    ans += r - l +1
print(ans)

Submission status: Accepted

Solution code:

import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    ans=0
    for i in range(n):
        a,b=map(int, input().split())
        ans+=b-a+1
    print(ans)
resolve()

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for i in range(N):
    l,r = map(int, input().split())
    cnt += r-l+1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
LR = [list(map(int, input().split())) for _ in range(N)]
cnt = 0

for lr in LR:
  cnt += lr[1] + 1 - lr[0]
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(n):
    a, b = map(int, input().split())
    ans += b - a + 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(N):
  b1, b2 = map(int,input().split())
  c = b2-b1+1
  ans += c

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = [list(map(int,input().split())) for _ in range(N)]
L2 = [l[1] - (l[0] -1) for l in L]
print(sum(L2))

Submission status: Accepted

Solution code:
n=int(input())
result=0
for i in range(0,n):
  l,r=map(int,input().split())
  result=result+r-l+1
print(result)

Submission status: Accepted

Solution code:
N = int(input())
li = []
for _ in range(N):
    a,b= map(int,input().split())
    li.append(b-a+1)
print(sum(li))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    lrs = [list(map(int, input().split())) for _ in range(n)]
    ans = 0
    for l, r in lrs:
        ans += r - l + 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for _ in range(n):
    i, j = map(int, input().split())
    count += j - i +1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
seat_list = [list(map(int,input().split())) for nesya in range(n)]
c = 0
for hoge in seat_list:
  c += (hoge[1]-hoge[0]+1)
print(c)

Submission status: Accepted

Solution code:
N = int(input())
s = [list(map(int, input().split(" "))) for i in range(N)]

seat = []
for i in range(N):
  a = s[i][1]-s[i][0]+1
  seat.append(a)

print(sum(seat))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1

print(ans)

Submission status: Accepted

Solution code:
import sys
import math
n = int(input())
ans=0
for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = [[int(i) for i in input().split()] for i in range(N)]

ans = 0
for n in L:
    ans += n[1] - n[0] + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for _ in range(n):
  a,b = map(int, input().split())
  ans += b-a + 1
print(ans)

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N = ri()
ans = 0
for i in range(N):
    l, r = ri_()
    ans += r - l + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
LR = [[int(x) for x in input().split()] for _ in range(N)]

cnt = 0
for l, r in LR:
    cnt += r - l + 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
lr = [list(map(int, input().split())) for i in range(n)]

ans = 0
for i in range(n):
    ans += lr[i][1] - lr[i][0] + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for _ in range(n):
    l, r = map(int, input().split())
    ans += (r-l) + 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0

for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
count=0
for i in range(n):
    l,r=map(int, input().split())
    count+=r-l+1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
a=0
for i in range(n):
  l,r=map(int,input().split())
  a+=r-l+1
print(a)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for _ in range(N):
    l,r = map(int,input().split())
    cnt += r-l+1
print(cnt)

Submission status: Accepted

Solution code:
num = 0
for _ in range(int(input())):
    l, r = map(int, input().split())
    num += r - l + 1
print(num)

Submission status: Accepted

Solution code:
N=int(input())
ans=0

for i in range(N):
    L,R=map(int,input().split())
    ans+=R-L+1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
  l,r = map(int,input().split())
  ans += r-l+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
res = 0
for i in range(n):
  a,b = map(int, input().split())
  res += b - a + 1
print(res)

Submission status: Accepted

Solution code:
N = int(input())

ans = []
for i in range(N):
  l,r = map(int, input().split())
  ans.append(r-l+1)
print(sum(ans))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
    l,r = map(int,input().split())
    ans +=(r+1-l)

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

n=I()
ans=0
for i in range(n):
    a,b=MI()
    ans+=b-a+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
M = [list(map(int,input().split()))for _ in range(N)]
sum = 0
for i in range(N):
  sum = sum + M[i][1]-M[i][0]+1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range(n):
	l, r = map(int, input().split())
	count = count + (r - l + 1)
print(count)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for _ in range(n):
  s = [int(a) for a in input().split()]
  count += s[1] - (s[0]-1)
  
print(count)

Submission status: Accepted

Solution code:
def resolve():
	n = int(input())
	ans = 0
	for _ in range(n):
		s, e = map(int, input().split())
		ans += e - s + 1
	print(ans)
resolve()

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(n):
    l,r = map(int, input().split())
    ans += abs(r - l) + 1
print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

N = INT()
lr = [LIST() for _ in range(N)]

ans = 0
for i in range(N):
	ans += lr[i][1] - lr[i][0] +1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(n):
    l, r = map(int, input().split())
    cnt += r - l + 1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
count=0
for i in range(n):
  l,r=map(int,input().split())
  count+=r-l+1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(n):
  l,r=map(int,input().split())
  ans+=r-l+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = [0]*n
r = [0]*n
ans = 0
for i in range(n):
    l[i], r[i] = map(int, input().split())
    ans += r[i] - l[i] + 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ans = 0
for i in range(N):
  l,r=map(int,input().split())
  ans+=r-l+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
counter = 0
for i in range(N):
 l,n = map(int,input().split())
 counter += (n-l+1)
print(counter)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for _ in range(N):
    l, r = map(int ,input().split())
    ans += r - l + 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
a=0
for i in range(N):
    l,r=map(int,input().split())
    a+=(r-l+1)
print(a)

Submission status: Accepted

Solution code:
N=int(input())

answer=0
for i in range(N):
  l,r=map(int,input().split())
  answer+=r-l+1

print(answer)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(n):
    a,b=map(int, input().split())
    ans+=abs(a-b)+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += (r - l) + 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=0
for i in range(n):
    l,r=map(int,input().split())
    s+=r-l+1
print(s)

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
for i in range(n):
  a,b=map(int,input().split())
  cnt += b-a+1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for _ in range(N):
    l, r = map(int, input().split())
    count += r - l + 1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
total=0
for i in range(n):
	l,r=map(int,input().split())
	total+=r-l+1
print(total)

Submission status: Accepted

Solution code:
n = int(input())
List = [list(map(int,input().split())) for i in range(n)]
L = []
for i in range(len(List)):
  a = List[i][1] - List[i][0] + 1
  L.append(a)
print(sum(L))

Submission status: Accepted

Solution code:
size = int(input())
ans = 0
for _ in range(size):
    l,r = map(int,input().split())
    ans += r-l+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(N):
    l,r = map(int,input().split())
    ans += r-l+1

print(ans)

Submission status: Accepted

Solution code:

n = int(input())

ans = 0

for i in range(n):
    l, r = [int(i) for i in input().split()]
    ans += abs(l-r) +1
    
print(int(ans))

Submission status: Accepted

Solution code:
N=int(input())
l_r=[]
cnt=0
for i in range(N):
    l,r=map(int,input().split())
    cnt+=r-l+1
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for i in range(N):
    l,r=map(int,input().split())
    ans+=r-l+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
lr = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for one in lr:
    ans += one[1] - one[0] + 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = 0
for i in range(n):
    l, r = map(int, input().split())
    s += r - l +1
print(s)

Submission status: Accepted

Solution code:
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
print(sum(list([A[1]-A[0]+1 for A in l])))

Submission status: Accepted

Solution code:
n = int(input())
s = 0
for i in range(n):
  l = list(map(int, input().split()))
  s += (l[1] - l[0] + 1)
print(s)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    LR = [list(map(int, input().split())) for i in range(N)]
    cnt = 0
    for i in range(N):
        cnt += LR[i][1] - LR[i][0] + 1
    print(cnt)

            

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for _ in range(N):
    l, r = map(int, input().split())
    ans += r - l + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
seat = 0
for i in range(n):
    l, r = map(int ,input().split())
    seat += (r-l+1)
print(seat)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range(n):
  a,b = map(int,input().split())
  count += b-a+1
print(count)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for i in range(N):
    l,r=map(int, input().split())
    ans+=r-l+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
	l , r = map(int, input().split())
	ans += r-l+1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(n):
  l,t=map(int,input().split())
  ans+=abs(l-t)+1
print(ans)

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    LIST = [0] * 100001
    for i in range(n):
        l,r = readInts()
        l -=1
        # いもす法
        LIST[l] +=1
        LIST[r] -=1
    # 累積和
    for i in range(1,100001):
        LIST[i] += LIST[i-1]
    cnt = 0
    for i in range(100001):
        if LIST[i] > 0:
            cnt += 1
    #print(LIST)
    print(cnt)
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range(n):
    l,r = map(int,input().split())
    count += (r-l+1)
print(count)

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    seat =  0
    for _ in range(N):
        l, r = map(int, input().split())
        seat += r - l + 1
    print(seat)
        

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N = int(input())
LR = [tuple(map(int,input().split())) for i in range(N)]
ans = 0
for l,r in LR:
    ans += r-l+1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
seat = np.zeros(1000000, dtype=int)
L, R = np.array([input().split() for _ in range(N)], dtype=int).T

np.add.at(seat, L, 1)
np.add.at(seat, R+1, -1)
np.cumsum(seat, out=seat)
print(seat.sum())

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(n):
    l,r = map(int,input().split())
    cnt += r-l+1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
sum = 0
for i in range(n):
    l,r = map(int, input().split())
    sum += r+1-l
print(sum)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    seats = [0]*(10**5+2)
    LR = [[int(i) for i in input().split()] for j in range(N)]
    for li, ri in LR:
        seats[li] += 1
        seats[ri+1] -= 1
    from itertools import accumulate
    S = list(accumulate(seats))
    print(sum(S))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
K=0
for i in range(N):
    l,r = map(int,input().split())
    K=(r-l+1)+K
print(K)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc073/tasks/abc073_b

n=int(input())
lr=[tuple(map(int,input().split())) for _ in range(n)]
ans=0
for l,r in lr:
    ans+=r-l+1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
K=0
for i in range(N):
    l,r = map(int,input().split())
    K=(r-l+1)+K
print(K)

Submission status: Accepted

Solution code:
n = int(input())
lis = [list(map(int,input().split())) for i in range(n)]
print(sum([lis[i][1]-lis[i][0]+1 for i in range(n)]))

Submission status: Accepted

Solution code:
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]
cnt = 0
for i in range(N):
    l,r = A[i]
    cnt += r-l+1
print(cnt)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    cnt=0
    N=int(input())
    for i in range(N):
        l,r=map(int,input().split())
        cnt+=r-l+1
    print(cnt)

resolve()

Submission status: Accepted

Solution code:
N=int(input())
LR=[tuple(map(int, input().split())) for _ in range(N)]
print(sum(r-l+1 for l,r in LR))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for k in range(N):
    l, r = map(int,input().split())
    ans += r-l+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
lr = [list(map(int, input().split())) for _ in range(N)]

ans = 0
for li, ri in lr:
    ans += (ri - li + 1)

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=0
    for i in range(N):
        l,r=MI()
        ans+=(r-l)+1
        
    print(ans)

main()

Submission status: Accepted

Solution code:
n = int(input())
lr = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for l,r in lr:
  ans += r-l+1
print(ans)

Submission status: Accepted

Solution code:
def resolve():
  n = int(input())
  ans = 0
  for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1
  print(ans)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

for _ in range(N):
    l, r = map(int, input().split())
    ans += r - l + 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for _ in range(n):
  l,r=map(int,input().split())
  ans+=r-l+1
print(ans)

Submission status: Accepted

Solution code:
n=int(input());a=0
for _ in [0]*n:
  d,s=map(int,input().split())
  a+=s-d+1
print(a)

Submission status: Accepted

Solution code:
N=int(input())
cnt=0
for i in range(N):
    l,r=map(int,input().split())
    cnt+=r-l+1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
x= 0
for i in range(n):
  l,r=map(int,input().split())
  x+=r-l+1

print(x)

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math
import functools

n = int(input())
cnt = 0
for i in range(n):
    l,r = map(int,input().split())
    a = r-l + 1
    cnt += a
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
num = 0
for i in range(n):
  a,b=map(int, input().split())
  num = num + b - a + 1
print(num)

Submission status: Accepted

Solution code:

n = int(input())

ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for _ in range(N):
    l, r = map(int,input().split())
    ans += r - l + 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

answer = 0
for _ in range(n):
    l, r = map(int, input().split())
    answer += r - l + 1

print(answer)

Submission status: Accepted

Solution code:
num = int(input())
count=0
for i in range(num):
  a,b=map(int,input().split())
  count = count + b - a + 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0

for i in range(n):
  x, y = map(int,input().split())
  ans += y-x+1
  
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
s = 0

for i in range(N):
  l,r= map(int,input().split())
  s+=r-l+1
print(s)

Submission status: Accepted

Solution code:
n = int(input())
n_list = []
for _ in range(n):
  s,t = map(int,input().split())
  n_list.append(abs(s-t) +1)
  
print(sum(n_list))