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: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
#https://atcoder.jp/contests/abc073/tasks/abc073_b
N = int(input())
ans = 0
for i in range(N):
    st,sp = map(int,input().split())
    ans += abs(sp-st)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
li = np.zeros(100000)
for _ in range(n):
  l, r = rm()
  li[l:r+1] = 1
print(sum(li))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = [0]*100010
n = int(input())
for i in range(n):
    l,r = map(int,input().split())
    for j in range(l,r+1):
        a[j] += 1
ans = 0
for i in range(10010):
    if a[i] != 0: ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
o = [0]*(100002)

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

for i in range(1, 100001):
    o[i] += o[i-1]

ans = 0
for i in o:
    if i:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=0
for i in range(N):
    l,r=map(int,input().split())
    if ans >= 10*5:
        print(100000)
        exit()
    ans+=abs(l-r)+1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
ans = 0
for i in range(n):
    l,r = iim()
    ans += l-r+1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=-n
for i in range(n):
  a-=eval(input().replace(" ","-"))
print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 1
for i in range(N):
    l,r = map(int,input().split())
    if r>l:
        count += r-l
    else:
        count += 1 
print(count)

Submission status: Wrong Answer

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

nop = [s[-1] - s[0] + 1 for s in seats]
r = sum(nop)

print(seats)
print(nop)
print(r)

Submission status: Wrong Answer

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

nop = [s[-1] - s[0] + 1 for s in seats]
r = sum(nop)
print(r)

Submission status: Wrong Answer

Solution code:
ans=0
for _ in range(int(input())):
  ans+=eval("-"+input().replace(" ","+"))-1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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]

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N=int(input())
S=np.zeros((100000,),np.int) # 席

for _ in range(N):
    l,r=list(map(int,input().split(" ")))
    print("l, r = ",l,r)
    S[l-1]+=1 # 始点

    if r<len(S): # 終点+1
        S[r]+=-1

Scum=np.cumsum(S) # 累積和をとる
print((Scum>0).sum()) # 1以上のところ

Submission status: Wrong Answer

Solution code:
import numpy as np

N=int(input())
S=np.zeros((100000,)) # 席

for _ in range(N):
    l,r=list(map(int,input().split(" ")))
    S[l-1]=1

    if r<len(S):
        S[r]=-1

Scum=np.cumsum(S) # 累積和をとる
print((Scum>0).sum()) # 1以上のところ

Submission status: Wrong Answer

Solution code:
N = int(input())
x = []
y = []
for i in range(0,N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
total=0
for j in range(0,N):
    if x[j]<y[j]:
        total=total+y[j]-x[j]+1
    elif x[j]==y[j]:
        total+=1    
print(total)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [0 for _ in range(10**5)]
for i in range(N):
    l,r = map(int,input().split())
    a[l-1:r+1] = [1 for _ in range(r-l+1)]
print(sum(a))

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [0 for _ in range (10**5)]
for i in range(N):
    l,r = map(int,input().split())
    a[l-1:r+1] = [1 for _ in range(r-l+1)]
print(sum(a))

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [0 for _ in range (10**5)]
for i in range(N):
    l,r = map(int,input().split())
    a[l-1:r+1] = [1]*(r-l+1)
print(sum(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
lr = [list(map(int,input().split())) for _ in range(N)]
seat = np.zeros(100000,dtype=int)
for l,r in lr:
  seat[l:r+1] = 1
print(sum(seat))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def read_input():
    n = int(input())

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

    return n, sheets

def submit():
    n, sheets = read_input()

    watcher = 0
    for sheet in sheets:
        watcher += sheet[1] - sheet[0] + 1

    print(watcher)


if __name__ == '__main__':
    submit

Submission status: Wrong Answer

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: Wrong Answer

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

cnt = 0
for i in range(n):
    cnt += int(box[-1]) - int(box[0]) + 1

print(cnt)

Submission status: Wrong Answer

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

print(m)

Submission status: Wrong Answer

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

print(m)

Submission status: Wrong Answer

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

print(l)

Submission status: Wrong Answer

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

print(100000-l)

Submission status: Wrong Answer

Solution code:
N = int( input() )
S = [ list( map( int, input().split() ) ) ]

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

print( ans )

Submission status: Wrong Answer

Solution code:
import collections
list = [0] * 100001
N = int(input())
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    for j in range(L-1,R):
        list[j] = 1
CC = collections.Counter(list)
print(CC.most_common()[1][1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

ans=0

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

print(ans)

Submission status: Wrong Answer

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

print ans

Submission status: Wrong Answer

Solution code:
a=input()
ans=0
for i in range(a):
    s=raw_input().split()
    b,c=int(s[0]),int(s[1])
    c=c-b
    c=c+1
    ans=ans+c
print c

Submission status: Wrong Answer

Solution code:
a=input()
for i in range(a):
	s=raw_input().split()
	b,c=int(s[0]),int(s[1])
	c=c-b
	c=c+1
	print c

Submission status: Wrong Answer

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    group_count = int(input())

    seated_numbers = [list(map(int, input().split())) for _ in range(group_count)]
    print(seated_numbers)

    total_person = 0

    for line in seated_numbers:
        total_person += max(line) - min(line) + 1

    print(total_person)

Submission status: Wrong Answer

Solution code:
a = raw_input()
list = a.splitlines()

people = 0
for i in list[1:]:
  numbers = i.split()
  people += int(numbers[1])-int(numbers[0])+1
  
  
print(people)

Submission status: Wrong Answer

Solution code:
a = raw_input()
list = a.splitlines()

people = 0
for i in list[1:]:
  numbers = i.split()
  people += int(numbers[1])-int(numbers[0])+1
  
  
print(str(people))

Submission status: Wrong Answer

Solution code:
N = int(input())

val = 0
for num in range(0,N):
    row = input().split()
    val = val + int(row[1]) - int(row[0])

val = val - N
print(val)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N= int(input())
n=[[]]
ans=0
ans1=0
ans2=0

for i in range(N):

    n.append(input().split())

for j in range(1,N+1):
    #print(n[j][0])
    ans+=int(n[j][1])-int(n[j][0])

print(ans)

Submission status: Wrong Answer

Solution code:
c=[0]*100010
N=int(input())
for _ in range(N):
  a,b=map(int,input().split())
  c[a] += 1
  c[b+1] -= -1
for i in range(len(c)-1):
  c[i+1] += c[i]
print(sum(c))

Submission status: Wrong Answer

Solution code:
c=[0]*100010
N=int(input())
for _ in range(N):
  a,b=map(int,input().split())
  c[a] = 1
  c[b+1] = -1
for i in range(len(c)-1):
  c[i+1] += c[i]
print(sum(c))

Submission status: Wrong Answer

Solution code:

value = int(input())
seat_list = []
people = 0
while True:
	try:
		seat = input()
		seat_list.append(seat.split(" "))
	except EOFError:
		break

def aaa(seat_list, people):
		people = seat_list[len(seat_list)-1] - seat_list[0]

print(people)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from typing import List


def answer(n: int, lrs: List[List[int]]) -> int:
    number_of_people_sitting = 0
    for lr in lrs:
        l, r = lr
        number_of_people_sitting += r - l + 1

    return number_of_people_sitting


def main():
    n = int(input())
    lrs = [map(int, input().split()) for _ in range(n)]
    print(answer(n, lrs))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for _ in range(n):
    l,r = list(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:
#!/usr/bin/env python3

def main():
    n = int(input())
    ans = 0
    for i 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+1-l
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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 _ 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 = input().split()
   ans += int(L[1]) - int(L[0]) + 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ll=[]
rr=[]
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 = list(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:
with open(0) as f:
    N, *lr = map(int, f.read().split())
print(sum(lr[1::2])-sum(lr[::2])+N)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
# seat = [0] * 10 ** 6
seat = [0] * 10 ** 5
for i in range(n):
    l, r = map(int, input().split())
    for j in range(l, r + 1):
        seat[j - 1] = 1

res = 0
# for i in range(10 ** 6):
for i in range(10 ** 5):
    if seat[i] == 1:
        res += 1
print(res)

Submission status: Accepted

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

for i in range(1, 10 ** 5):
    seat[i] += seat[i - 1]

res = 0
for i in range(10 ** 5):
    if seat[i] == 1:
        res += 1
print(res)

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] * 10 ** 6
for i in range(n):
    l, r = map(int, input().split())
    for j in range(l, r + 1):
        seat[j - 1] = 1

res = 0
for i in range(10 ** 6):
    if seat[i] == 1:
        res += 1
print(res)

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

Submission status: Accepted

Solution code:
N, *_LR = map(int, open(0).read().split())
LR = list(zip(*[map(int, iter(_LR))]*2))

ans = 0

for l,r in LR:
    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())
l=[0]*N
r=[0]*N
sum=0
for i in range(N) :
  l[i],r[i]=map(int,input().split())
  sum+=r[i]-l[i]+1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
l = [0] * n
r = [0] * n
for i in range(n):
    l[i],r[i] = map(int, input().split())
res = 0

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

print(res)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    seq = [False] * 100000

    for _ in range(N):
        l, r = map(int, readline().split())
        l -= 1
        for i in range(l, r):
            seq[i] = True

    print(seq.count(True))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(n):
  l, r = [int(x) for x in input().split()]
  cnt+=r-l+1
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:
# ABC073
N = int(input())
L_R = [map(int, input().split()) for _ in range(N)]
ans = 0
for l, r in L_R:
    ans += r - l + 1
print(ans)

Submission status: Accepted

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

n = int(input())

ans = 0

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

print(ans)

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())
  ans+=r-l+1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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]))
print(c+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())
ans = 0
for _ in range(N):
  a, b = map(int, input().split())
  ans += b - a + 1
print(ans)

Submission status: Accepted

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

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:
def main():
    n = int(input())
    ans = 0
    for _ in range(n):
        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
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())

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())
l=[]
for i in range(n):
    d=list(map(int,input().split()))
    l+=list(range(d[0],d[1]+1))
s=set(l)
print(len(s))

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

num = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
lr=[]
A=[]
for i in range(N):
    lr.append(list(map(int,input().split())))
for i in range(N):
    A.append(lr[i][1]-lr[i][0]+1)
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())
tmp = 0
num_person = []
for _ in range(n):
    l, r = map(int, input().split())
    tmp =  r-l+1
    num_person.append(tmp)

ans = 0
for i in num_person:
    ans += i

print(ans)

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())
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 ())
x = 0
for i in range (N):
  s,g = map (int, input ().split ())
  le = g-s+1
  x += le
print (x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding = SJIS

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
l = [0] * N
r = [0] * 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)

Submission status: Accepted

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

cnt = 0
for i in l:
    cnt += (i[1] - i[0] + 1)
print(cnt)

Submission status: Accepted

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

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:
#https://atcoder.jp/contests/abc073/tasks/abc073_b
N = int(input())
ans = 0
for i in range(N):
    st,sp = map(int,input().split())
    ans += abs(sp-st+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())
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())
num = 0
for i in range(n):
    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:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
li = np.zeros(200000)
for _ in range(n):
  l, r = rm()
  li[l:r+1] = 1
print(int(sum(li)))

Submission status: Accepted

Solution code:
n =int(input())

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

print(total)

Submission status: Accepted

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

print(ans)

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