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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
x_set = set()
x = [[int(i) for i in input().split()] for j in range(N)]
for i, j in enumerate(x):
    for k in range(j[0], j[1]+1):
        x_set.add(k)
print(len(x_set))

Submission status: Accepted

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

for i in range(n):
  a,b = [int(j) for j in input().split()]
  sum += b-a+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:
def main():
    N = int(input())
    count = 0
    for _ in range(N):
        l, r = map(int, input().split())
        count += r-l+1
    return count



if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
c = 0
for i in range(n):
    l, r = na()
    c += (r - l) + 1

print(c)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
groups = int(input())
total = 0

for _ in range(groups):
  (l, r) = (int(tok) for tok in input().split())
  total += r - l + 1
  
print(total)

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

Submission status: Accepted

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

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())
List=[]
for i in range(N):
    List.append(list(map(int,input().split())))

Gokei=0
for j in range(N):
    Gokei+=List[j][1]-List[j][0]+1

print(Gokei)

Submission status: Accepted

Solution code:
n=int(input())
l=[]
total=0
for _ 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())

count = 0

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

print(count)

Submission status: Accepted

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

print(c)

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:
# -*- coding: utf-8 -*-

# input
N = int(input())
lr = [list(map(int, input().split())) for i in range(N)]

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

# output
print(ans)

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

Submission status: Accepted

Solution code:
# Theater
# input
N = int(input())

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

# output
print(total)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
while N > 0:
    l,r = map(int, input().split())
    count += r-l+1
    N -= 1
print(count)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

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

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

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())
LIST=[input() for _ in range(N)]

count=0
for i in range(N):
    A,B=map(int,LIST[i-1].split(" "))
    count+=abs(A-B)+1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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=[list(map(int,input().split())) for _ in range(int(input()))]
ans=0
for x,y in n:
  ans+=(y-x)+1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Theater
n = int(input())
max_seat = 100000
cnt = 0
for _ in range(n):
    l, r = map(int, input().split())
    cnt += (r-l+1)

print(cnt)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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]+1
print(ans)

Submission status: Accepted

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

print(sum( [ lr[1] - lr[0] + 1 for lr in LR]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
_,*l=map(int,open(0).read().split())
print(sum(j-i+1 for i,j in zip(l[::2],l[1::2])))

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

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:
N = int(input())
a = 0
for _ in range(N):
  a = a + abs(eval(input().replace(" ", "-"))) + 1
print (a)

Submission status: Accepted

Solution code:
n = int(input())
seats = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for s in seats:
    ans += s[1]-s[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())
res=0
for n in range(N):
  l,r=[int(x) for x in input().split()]
  res+=r-l+1
else:
  print(res)

Submission status: Accepted

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

cnt = 0
for i in l:
    if i[0] == i[1]:
        cnt += 1
    else:
        cnt += i[1] - i[0] + 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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())
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__':

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
d = {}
for i in range(len(l)):
    for j in range(l[i][0], l[i][1] + 1):
        d[j] = 1
print(len(d))

Submission status: Accepted

Solution code:
N = int(input())

nAns = 0
Tmp = []

for i in range(N):
  Tmp = input().rstrip().split(' ')
  nS = int(Tmp[0])
  nE = int(Tmp[1])
  nAns += (nE-nS+1)
print(nAns)

Submission status: Accepted

Solution code:
N=int(input())
lrN=[list(map(int,input().split()[:2])) for _ in range(N)]
ret=0
for lri in lrN:
    ret+=lri[1]-lri[0]+1

print(ret)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def main():

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

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








    
if __name__== "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]
sum = 0
for l in li:
    sum += (l[1] - l[0] + 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:
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:
n = int(input())
rows = [list(map(int,input().split())) for i in range(n)]

ans_count = 0
for row in rows:
    ans_count += row[1] - row[0] + 1

print(ans_count)

Submission status: Accepted

Solution code:
N = int(input())
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

count = 0

for i in range(N):
    count += y[i] - x[i] + 1 

print(count)

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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
import sys
INF = float("inf")


def solve(N: int, l: "List[int]", r: "List[int]"):
    counter = 0
    for i in range(N):
        counter += r[i]-l[i]+1
    print(counter)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    l = [int()] * (N)  # type: "List[int]"
    r = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(N, l, r)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 73, B - theater
n = int(input())
total = 0
for i in range(n):
    l, r = [int(el) for el in input().split(' ')]
    total += r - l + 1
print(total)

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:
n = int(input())
li = [0]*100000

for i in range(n):
    l,r = map(int,input().split())
    for j in range(l-1,r):
        #print(j)
        li[j] = 1
    
print(sum(li))

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
L, R = [], []

for i in range(n):
  l, r = map(int, input().split())
  L.append(l)
  R.append(r)

s = sum([r-l+1 for (l, r) in zip(L, R)])
print(s)

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())
a = []
for i in range(N):
    a.append(list(map(int, input().split())))
    
number = 0
    
for i in range(N):
  abc = a[i-1]
  first = abc[0]
  last = abc[1]
  abc_number = last - first + 1
  number += abc_number

print(int(number))

Submission status: Accepted

Solution code:
N = int(input())
A = 0
for _ in range(N):
  l, r = [int(x) for x in input().split()]
  A+=r-l+1
print(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:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    lr = []
    for _ in range(N):
        l,r = inputMap()
        lr.append((l,r))
        
    ans = 0
    for i in lr:
        l,r = i
        ans += r-l+1
    
    print(ans)
            	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(a)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    s = S()
    if "9" in s:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    n = II()
    ans = 0
    for i in range(n):
        l, r = LI()
        ans += r - l + 1
    print(ans)
    return

#C
def C():
    n = II()
    A = {}
    for _ in range(n):
        k = II()
        if not k in A:
            A[k] = 1
        else:
            A[k] += 1
    ans = 0
    for item in A.values():
        ans += item % 2
    print(ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()

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())
cnt = 0
for i in range(n):
    cnt += r[i] - l[i] + 1
print(cnt)

Submission status: Accepted

Solution code:
x,*y=map(int,open(0).read().split())
print(sum(y[1::2])-sum(y[0::2])+x)

Submission status: Accepted

Solution code:
n=int(input())
s=0
for _ in [0]*n:s-=eval(input().replace(' ','-'))-1
print(s)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

s = 0

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

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
arr = [list(map(int, input().split())) for i in range(N)]
ctr = 0

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

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())
nums = [ list(map(int, input().split())) for _ in range(N)]

s = 0
for n in range(N):
    s += nums[n][1] - nums[n][0] + 1

print(s)

Submission status: Accepted

Solution code:
N = int(input())
result = 0
for _ in range(N):
    f, t = map(int, input().split())
    result += t - f + 1
print(result)

Submission status: Accepted

Solution code:
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())
l=[]

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

print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(sum([sum([int(x[0]) * -1, int(x[1]), 1]) for x in [input().split() for i in range(int(input()))]]))