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

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

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

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

Solution (Python):
n = int(input())
e = [[int(i) for i in input().split()] for i in range(n)]

count = 0
for x in e:
    count += x[1]-x[0]+1
print(count)

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

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

Solution (Python):
N = int(input())

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

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

Solution (Python):
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()

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

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

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

Solution (Python):
"""AtCoder"""
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)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

s = 0
N = int(input())

for _ in range(N):
    a, b = map(int, input().split())
    s += (b-a+1)
print(s)

Solution (Python):
N = int(input())
sum = 0

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

Solution (Python):
import numpy as np

INF=1e18
MOD=1e9+7

N=int(input())

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

print(ans)

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

ans = 0
for i in S:
    ans += i[1] - i[0] + 1

print( ans )

Solution (Python):

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

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

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

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

Solution (Python):
n = int(input())
li = []
for _ in range(n):
    li.append(list(map(int, input().split())))

ans = 0
for i in range(len(li)):
    ans = ans + abs(li[i][0]-li[i][1]) +1
print(ans)

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

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

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

Solution (Python):
n = int(input())
ans = []

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

print(sum(ans))

Solution (Python):

n=int(input())
cnt=0
for idx in range(n):
    st,en=map(int, input().split())
    cnt+= en-st+1
print(cnt)

Solution (Python):
n = int(input())
ans = 0
for _ in range(n):
    tmp = list(map(int, input().split()))
    ans += tmp[1] - tmp[0] + 1
print(ans)

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

Solution (Python):
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


N = int(input())

ans = 0

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


print("%d"%(ans))

Solution (Python):
N = int(input())
A = 0
for i in range(N) :
    i = input().split()
    A += int(i[1]) - int(i[0]) + 1
print(A)

Solution (Python):
N = int(input())
list_l = []
list_r = []
ans = 0
for time in range(N) :
    A = [int(i) for i in input().split()]
    list_l.append(A[0])
    list_r.append(A[1])
    ans += list_r[time] - list_l[time] + 1
print(ans)

Solution (Python):
print(sum(1-eval(s.replace(' ','-'))for s in open(0).readlines()[1:]))

Solution (Python):
print(sum(1-eval(s.replace(' ','-'))for s in open(0).readlines()[1:]))

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

def swap(s,pos):
    s[pos]-=1
    s[pos+1]+=1
    print(s)
    if pos == n-2: return s
    if s[pos+2] == 0: swap(s,pos+1)
    return s


n = ip()                              











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

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

ans = sum(r - l + 1 for l, r in lr)

print(ans)

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

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

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

Solution (Python):
N = int(input())
n = 0

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

Solution (Python):

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

Solution (Python):
N = int(input())
lr = set()
for i in range(N):
    l,r = map(int,input().split())
    for j in range(l,r+1):
        lr.add(j)
print(len(lr))

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

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

Solution (Python):
N = int(input())

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

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

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

Solution (Python):
N = int(input())

ans = 0

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

print(ans)

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

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

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

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

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

print(ans)

Solution (Python):
abs_lst=[]
for i in range(int(input())):
    a,b=map(int,input().split())
    abs_lst.append(b-a+1)
print(sum(abs_lst))

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

Solution (Python):
N=int(input())
a=0
for i in range(0,N):
    l1,r1=map(int,input().split())
    a=a+r1-l1+1
print(a)

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

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

Solution (Python):
int_n = int(input())

counter = 0
for i in range(int_n):
    int_s, int_e = map(int, input().split())
    counter += (int_e - int_s + 1)

print(counter)

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

Solution (Python):
N = int(input())
ans = 0
for _ in range(N):
  x,y = map(int,input().split())
  ans += y - x + 1
print(ans)

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

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

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

Solution (Python):
N = int(input())
L = [list(map(int, input().split())) for i in range(N)]

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

Solution (Python):
def main():
    n = int(input())
    lr = []
    for i in range(n):
        l, r = map(int, input().split())
        lr.append((l, r))

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


if __name__ == '__main__':
    main()

Solution (Python):

def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
N = getInt()
count = 0
for i in range(N):
    r,l = getIntList()
    count += l-r+1
print(count)

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

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

Solution (Python):
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)

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

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

print(ans)

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

Solution (Python):
N = int(input())

cnt = []
for i in range(N):
    _l, _r = list(map(int, input().split()))
    cnt.append(_r - _l + 1)

print(sum(cnt))

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

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

Solution (Python):
N = int(input())
L = [[int(i) for i in input().split()] for i in range(N)]
A = []
for i in range(N):
    A.append(L[i][1] - L[i][0] +1)
print(sum(A))

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

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

Solution (Python):
n = int(input())

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

count = 0
for a in ln:
  count += a[1] - a[0] + 1
  
print(count)

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

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

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

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

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

Solution (Python):
def abc073_b():
    n = int(input())
    tot = 0
    for _ in range(n):
        l, r = map(int, input().split())
        tot += (r - l) + 1
    print(tot)


abc073_b()

Solution (Python):
N = int(input())
sum=0
for i in range(N):
    a, b = map(int, input().split())

    sum += b-a+1

print(sum)

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

Solution (Python):

a = int(input())
s = 0
for i in range(a):
    t1,t2 = map(int, input().split())
    s += t2 - t1 +1
print(s)

Solution (Python):
N = int(input())
ans = 0
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    ans += R - L + 1
print(ans)

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

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

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

print(ans)

Solution (Python):



def main():
    """Function."""
    n = int(input())

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

    print(total)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
ans=0
for i in range (0,n):
    s=input().split()
    ans+=int(s[1])-int(s[0])+1
print(ans)

Solution (Python):
n=int(input())
ans=0
while n>0:
    n-=1
    s=input().split()
    ans+=int(s[1])-int(s[0])+1
print(ans)

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys

def solve(N, ls_ct):
    
    
    
    y = 0
    for i in ls_ct:
        y += abs((i[0]-i[1]))+1
    print(y)

def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    ls_ct = [list(map(int, sys.stdin.readline().strip().split())) for j in range(N)]
    return (N, ls_ct)

def main():
    solve(*readQuestion())


main()

Solution (Python):


import sys

def solve(n, ls_lr):
    print(sum([r - l + 1 for (l,r) in ls_lr]))


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    n = int(ws[0])
    ls_lr = [list(map(int, sys.stdin.readline().strip().split())) for j in range(n)]
    return (n, ls_lr,)

def main():
    solve(*readQuestion())

main()

Solution (Python):
n = int(input())
_sum = 0
for _ in range(n):
    l, r = [int(i) for i in input().split()]
    _sum += r - l + 1
print(_sum)

Solution (Python):
n=int(input(''))
ans=0;a=[];b=[]
for i in range(0,n):
    s=input().split()
    ans+=int(s[1])-int(s[0])+1
print(ans)

Solution (Python):
N = int(input())
sum = 0
for i in range(N) :
    seats = [int(i) for i in input().split()]
    sum += seats[-1] - seats[0] + 1

print(sum)

Solution (Python):
N = int(input())
lr = [[int(_) for _ in input().split()] for i in range(N)]

result = sum(r - l + 1 for l, r in lr)

print(result)

Solution (Python):

N = int(input())

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

Solution (Python):
N=int(input())
Sum=0

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


print(Sum)

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

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

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

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

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

Solution (Python):
N = int(input())
people = 0

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

Solution (Python):
n = int(input())
num_list = []
ans = 0

for _ in range(n):
    num_list.append(list(map(int,input().split())))

for num in num_list:
    ans += abs(num[0]-num[1])+1
print(ans)

Solution (Python):
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]

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

Solution (Python):
n = int(input())
s = []
for i in range(n):
    s.append([int(m) for m in input().split()])
count = 0
for j in range(n):
    count += s[j][1] - s[j][0] + 1
print(count)

Solution (Python):
n = int(input())

num=0

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

print(num)

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

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

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

Solution (Python):
N = int(input())
A = [[int(i) for i in input().split()] for j in range(N)]
sum = 0
for i in A:
  sum += i[1] - i[0] + 1
print(sum)

Solution (Python):
a = int(input())
count = 0
for i in range(a):
    b,c = map(int,input().split(" "))
    for j in range(b,c+1):
        count += 1
print(count)

Solution (Python):
N = int(input())

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

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

Solution (Python):
N = int(input())

R = 0

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

print(R)

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

Solution (Python):
times = int(input())
count = 0

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

for item in li:
        count += 1 + item[1] - item[0]

print(count)

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

Solution (Python):
a = int(input())
b = [input().split() for i in range(a)]
c = 0

for i in range(a):
  c = c + int(b[i][1]) - int(b[i][0]) + 1
print(c)

Solution (Python):
N = int(input().rstrip())

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

print(sum)

Solution (Python):
n = int(input())

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

print(ans)

Solution (Python):
n = int(input())
x = 0
for _ in range(n):
  s, e = map(int, input().split())
  x += e - s + 1
print(x)

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

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

Solution (Python):


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

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

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

Solution (Python):
from sys import stdin


def main() -> None:
    n = int(next_str())
    ans = 0
    for i in range(n):
        l, r = map(int, input().split())
        ans += r - l + 1
    print(ans)


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

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

print(ans)

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

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

Solution (Python):
n = int(input())
lr = [map(int, input().split()) for x in range(n)]
ans = 0
for l, r in lr:
    ans += len([x for x in range(l, r+1)])
print(ans)

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

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

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

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

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

print(ans)

Solution (Python):
n=int(input())
a=[]
b=[]
for i in  range(n):
    l,r=map(int,input().split())
    a.append(l)
    b.append(r) 
count=0
for i in range(n):
    count=b[i]-a[i]+1+count    
print(count)

Solution (Python):
N = int(input())

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

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

Solution (Python):
n = int(input())
l_r = [[int(m) for m in input().split(" ")] for i in range(n)]

print(sum([r_i-l_i for l_i, r_i in l_r]) + n)

Solution (Python):
N = int(input())

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

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

print(cnt)

Solution (Python):


INF = float('inf')


def inpl(): return list(map(int, input().split()))


N = int(input())
seat = [False] * 100000
for i in range(N):
    l, r = inpl()
    for j in range(l - 1, r):
        seat[j] = True

ans = 0
for s in seat:
    if s: ans += 1

print(ans)

Solution (Python):



def main():
    n = int(input())
    seats = [0] * 100000
    count = 0

    for i in range(n):
        left, right = map(int, input().split())

        for j in range(left - 1, right):
            seats[j] = 1

    for seat in seats:
        if seat == 1:
            count += 1

    print(count)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
ans = 0
for _ in range(n):
    l,r = li()
    ans += (r-l+1)
    
print(ans)

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

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

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

Solution (Python):
n = int(input())

sum=0
index=0
while index < n:
    st, en = map(int, input().split())
    sum+=(en-st)+1
    index+=1

print(sum)

Solution (Python):
n = int(input())

l = [i for i in range(n)]
r = [i for i in range(n)]

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

ans = 0

for i in range(n):
    ans += r[i] - l[i] + 1

print(ans)

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

for i in lr:
    count += i[1] - i[0] + 1

print(count)

Solution (Python):
n = int(input())
count = 0
num = 0
while count < n:
  l, r = map(int, input().split())
  num += r - l + 1
  count += 1
print(num)

Solution (Python):
C=[list(map(int,input().split())) for _ in range(int(input()))]
print(sum([c[1]-c[0]+1 for c in C]))

Solution (Python):
N=int(input())
n=0
for i in range(N):
  x1,y1=[int(i) for i in input().split()]
  n+=y1-x1+1
  
print(n)

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

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

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

Solution (Python):
n=int(input())
l=[list(map(int,input().split())) for x in range(n)]
a=[]
for y in range(len(l)):
  a.append(l[y][1]-l[y][0]+1)
print(sum(a))

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

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

Solution (Python):
n = int(raw_input())

c = 0

for i in range (n):
  a,b = map(int, raw_input().split())
  c += b-a+1

print(c)

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

Solution (Python):
N=int(input())
L=[input() for i in range(N)]
total=0
for i in range(N):
    S=list(map(int,L[i].split()))
    total+=S[1]-S[0]+1
print(total)

Solution (Python):
N = int(input())
line = []
for i in range(N):
    line.append(list(map(int, input().split())))

count = 0
for j in line:
    count += j[1] - j[0] + 1
print(count)

Solution (Python):
N = int(input())
sum = 0

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


print(sum)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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

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

Solution (Python):
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)

Solution (Python):
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)

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

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

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

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

print(cnt)

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

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

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

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

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

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

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

Solution (Python):

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

Solution (Python):
N = input()
ans = 0
for i in range(int(N)):
  n = input().split(" ")
  ans += int(n[1]) - int(n[0]) + 1
print(ans)

Solution (Python):
N = input()
ans = 0
for i in range(int(N)):
  n = input().split(" ")
  ans += int(n[1]) - int(n[0]) + 1
print(ans)

Solution (Python):

n = int(raw_input())
kyaku = 0

for _ in range(n):
    l, r = map(int, raw_input().split())
    kyaku += r - l + 1

print(kyaku)

Solution (Python):
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = int(input())
ans = 0
for i in range(N):
	l,r = inpl()
	ans += r-l+1

print(ans)

Solution (Python):
N=int(input())
count=0
n=2
for i in range (N):
    x=[int(n) for n in input().split()]
    count+=x[1]-x[0]+1
print(count)