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:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]


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())
ppl = 0
for i in range(N):
  tmp = input().split(" ")
  ppl += int(tmp[1]) - int(tmp[0]) + 1

print(ppl)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
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())
ans=0
for i in range(n):
    l,r=map(int,input().split())
    ans+=r-l+1
print(ans)

Submission status: Accepted

Solution code:
print(sum(1-eval(input().replace(" ","-")) for _ in range(int(input()))))

Submission status: Accepted

Solution code:
n = int(input())
sum = 0
for _ in range(n):
    a, b = map(int, input().split())
    sum += b-a+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:
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())
people=0
for i in range(N):
    l,r=map(int,input().split())
    people+=r-l+1
print(people)

Submission status: Accepted

Solution code:
lr = []
l = []
r = []
n = int(input())
c = 0
for i in range(0,n):
    lr = input().split()
    l.append(int(lr[0]))
    r.append(int(lr[1]))

for i in range(0,n):
    if l[i] == r[i]:
        c += 1
    else:
        c += (1 + r[i] - l[i])

print(c)

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    num_list = i_row_list(n)

    count = 0

    for l, r in num_list:
        count += r - l + 1

    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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 i in range(n):
    l,r = map(int,input().split())
    ans += r-l+1
print(ans)

Submission status: Accepted

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


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



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
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
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
import numpy as np
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

N = INT()
ans = 0
for i in range(N):
    l, r = MAP()
    ans = ans + (r - l + 1)
print(ans)

Submission status: Accepted

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

    print(ans)

if __name__ == "__main__":
    solve()

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())
lr = [list(map(int,(input().split()))) for _ in range(N)]
ans = []
for i in range(N):
    ans.append(lr[i][1]-lr[i][0]+1)
print(sum(ans))

Submission status: Accepted

Solution code:
N=int(input())

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

ans = 0
for s in Seat:
	ans += s[1] - s[0] + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Num = 0
for T in range(int(input())):
    L,R = (int(X) for X in input().split())
    Num += R-L+1
print(Num)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *LR = map(int, read().split())

    ans = 0
    for l, r in zip(*[iter(LR)] * 2):
        ans += r - l + 1

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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:
ans=0
for i in range(int(input())):
    l,r=map(int,input().split())
    ans+=r+1-l
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:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
ans = 0
for _ in range(N):
    l, r = M()
    ans += (r-l)+1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(int, input().split())))
res=0
for i in range(Row):
  res += List[i][1]-List[i][0]+1
print(res)

Submission status: Accepted

Solution code:
n = int(input())
rl = [0]*n

for i in range(n):
  rl[i] = input().split()
  
ans = []

for i in range(n):
  c = 0
  c = int(rl[i][1]) - int(rl[i][0]) + 1
  ans.append(c)
  
print(sum(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())

sum = 0
for _ 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:
N = int(input())
total = 0
for i in range(N):
  MM = input().split()
  a = int(MM[0])
  b = int(MM[1])
  total += b-a +1
print(total)

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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n = int(input())
    L = []
    R = []
    for _ in range(n):
        l,r = map(int, input().split())
        L.append(l)
        R.append(r)

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


if __name__ == '__main__':
    main()

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:
s = input()

n = int(s)

answer = 0

for i in range(n):
    p = input().split()
    x = int(p[0])
    y = int(p[1])
    answer += (y - x) + 1

print(answer)

Submission status: Accepted

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

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())
ans = 0
for i in range(N):
    l , r = list(map(int, input().split())) 
    ans += r - l +1 

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
def minus(x):
    return int(x[1])-int(x[0])+1
lr = [minus(input().split()) for i in range(n)]
print(sum(lr))

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:
seat = [0] * 100000
n = int(input())
result = 0
for i in range(n):
    t1,t2 = map(int,input().split())
    if t2 - t1 != 0: result += t2 - t1 + 1
    else: result += 1
print(result)

Submission status: Accepted

Solution code:
n = int(input())
c = [0]*10**5
for i in range(n):
    a, b = map(int, input().split())
    for j in range(a, b+1):
        c[j-1] = 1
print(sum(c))

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())
c = [False]*(10**5+1)
for i in range(N):
    l, r = map(int, input().split())
    for j in range(l, r+1):
        c[j] = True

print(c.count(True))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(res)

Submission status: Accepted

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

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 = sum([r - l + 1 for l, r in [[int(x) for x in input().split()] for _ in range(n)]])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for _ in range(n):
    l, r = [int(x) for x in 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())
out=0
for i in range(n):
  a,m=map(int,input().split())
  out+=m-a+1
print(out)

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):
    a,b = map(int,input().split())
    count += b-a+1
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

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 n in range(N):
  l,r = map(int,input().split())
  ans+=(r-l+1)
  
print(ans)

Submission status: Accepted

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

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:
def resolve():
    n = int(input())
    lr_list = list()
    for i in range(n):
        a = list(map(int, input().split()))
        lr_list.append(a)

    ans = 0
    for i in range(n):
        groupe = lr_list[i][1] - lr_list[i][0] + 1
        ans += groupe
    print(ans)
resolve()

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())
a = 0
for i in range(n):
    l, r = map(int, input().split())
    a += (r-l)+1
print(a)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

ans = 0

for i in range(N):
    l, r = map(int, input().split())
    ans = 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())

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

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())
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 i in range(n)]

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = i()
ans = 0
for i in range(N):
    l,r = I()
    ans += r-l+1
print(ans)

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())
people=0
for i in range(n):
  a,b=map(int, input().split())
  people+=b-a+1
print(people)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N = int(input())
array_list = []
for I in range(N):
    array_list.append(list(map(int,input().split())))

if N < 1 or N > 1000:
    sys.exit()

number = 0
for J in array_list:
    number += (J[1] - J[0] + 1)

print(number)

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:
def resolve():
    record =[]
    for i in range(int(input())):
        l,r = map(int,input().split())
        record+=list(range(l,r+1))
    print(len(set(record)))

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = 0

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

print(a)

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())
res = 0
for i in range(n):
  l, r = map(int, input().split())
  res = res + (r - l + 1)
print(res)

Submission status: Accepted

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

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    ans = 0
    for i in range(N):
        l, r = mi()
        ans += r-l+1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
seat = [0]*100000
for i in range(N):
    a,b = map(int,list(input().split()))
    for j in range(a,b+1):
        seat[j-1] = 1
print(sum(seat))

Submission status: Accepted

Solution code:
N = int(input())

summ = 0

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

print(summ)

Submission status: Accepted

Solution code:
n=int(input())
count=0
for _ 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 _ in range(n):
    n,m = map(int,input().split())
    ans += m-n+1

print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

total = 0
for i in range(n):
  s,e = list(map(int,input().strip().split()))
  total += (e-s+1)

print(total)

Submission status: Accepted

Solution code:
N = int(input())
a = []

for i in range(N):
    x,b = map(int,input().split())
    sa = b-x+1
    a.append(sa)
    

print(sum(a))

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):
  x,y=map(int,input().split())
  ans+=y-x+1
print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
ans=0
for i in range(n):
    l,r=mp()
    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())
lr = [list(map(int, input().split())) for i in range(n)]
sum = 0
for i in range(n):
    sum += lr[i][1] - lr[i][0] + 1
print(sum)

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:
print(sum(1-eval(input().replace(" ","-")) for i in range(int(input()))))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    print(ans)


if __name__ == "__main__":
    main()

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())
n=[list(map(int,input().split())) for _ in range(N)]
print(sum([max(i)-min(i)+1 for i in n]))

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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=map(int,input().split())
  ans+=r-l+1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


N = int(input())

print(sumnumber(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

LR = [list(map(int, input().split())) for i in range(n)]

j = 0
for i in range(n):
  j += (LR[i][1]-LR[i][0] + 1)
  
print(j)

Submission status: Accepted

Solution code:
def resolve():
    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)
resolve()

Submission status: Accepted

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

person = 0
for i in range(N):
    a = l[i][1] - l[i][0] + 1
    person += a

print(person)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    count = 0
    for _ in range(N):
        l, r = map(int, readline().split())
        count += r-l+1
    print(count)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# N
# l1 r1
# lN rN
print(sum(1-eval(input().replace(' ', '-')) for _ in range(int(input()))))

Submission status: Accepted

Solution code:
# N
# l1 r1
# lN rN
N = int(input())
N_sum = 0
for _ in range(N):
    l, r = map(int, input().split())
    N_sum += (r - l + 1)
print(N_sum)

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):
  l, r = map(int, input().split())
  ans += r-l+1
print(ans)

Submission status: Accepted

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

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())
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):
    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 _ in range(N):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    n = II()
    cnt = 0
    for _ in range(n):
        l, r = MII()
        cnt += r-l+1
    print(cnt)

if __name__ == '__main__':
    main()

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:

if __name__ == '__main__':
    a = int(input())
    count = 0

    for i in range(a):
        b, c = map(int, input().split())
        count += c-b+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())
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-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:
ans = set()
for q in range(int(input())):
    l, r = map(int, input().split())
    ans |= set(range(l, r + 1))
print(len(ans))

Submission status: Accepted

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

sa =0
ea = 0

for i in range(n):
    sa +=ab[i][0]
    ea +=ab[i][1]
    
print(ea-sa+n)

Submission status: Accepted

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

for i in range(0,N):
  R, L = list(map(int,input().split()))
  cnt = cnt + L - R + 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-l+1
print(sum)