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

Submission status: Accepted

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(" ")))
    S[l-1]+=1 # 始点

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
from sys import stdin
from itertools import accumulate

n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]

point = 0

for i in li:
    point += i[1]-i[0]+1

print(point)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
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
input = sys.stdin.readline
N = int(input())
res = 0
for _ in range(N):
  l, r = map(int, input().split())
  res += r - l + 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
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)

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:
dantai = int(input())
lis = []
for _ in range(1, dantai+1):
  lis.append(input())
cus = 0
for a in lis:
  b1, b2= a.split()
  cus = cus + (int(b2)-int(b1)) + 1
print(cus)

Submission status: Accepted

Solution code:
def examB():
    N = I()
    cur =  0
    for _ in range(N):
        l, r = LI()
        cur += (r-l+1)
    print(cur)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

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:
# ABC 073: B – Theater
n = int(input())

l = []
r = []
for i in range(n):
    tmp = [int(s) for s in input().split()]
    l.append(tmp[0])
    r.append(tmp[1])

audiences = 0

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

print(audiences)

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
l=[0]*n
r=[0]*n
ans=0
for i in range(n):
    l[i],r[i]=map(int,input().split())
for j in range(n):
    ans+=r[j]-l[j]+1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

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

i = 0
result = 0
ans = 0
while i < int(N):
    l = []
    l = input().split()
    result = int(l[1]) - int(l[0]) + 1
    ans = ans + result
    i += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
cnt = 0
for i in range(n):
    l,r = inpl()
    cnt += r-l+1
print(cnt)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
# B - Theater
print(sum(1-eval(input().replace(" ","-"))for i in range(int(input()))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n, *s = (int(x) for x in stdin.read().split())

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

print(seats)

Submission status: Accepted

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

Submission status: Accepted

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

print(summary)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    sheets = list(map(string_to_int, inputs))
    count = 0
    for s in sheets:
        count += s[1] - s[0] + 1
    return count


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    N = int(input())
    ret = solve(inputs(N))
    print(ret)

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 = []
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: Accepted

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

sum = 0

for i in range(n):
    sum += lst[i][-1] - lst[i][0] + 1

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
def count(s):
  l, r = map(int, s.split())
  return r - l + 1

N = int(input())
audiences = [ count(input()) for _ in range(N) ]

print(sum(audiences))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
lr = [list(map(int, input().split())) for _ 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:
# ABC073 B - Theater
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 n in range(N):
  l,r=map(int,input().split())
  ans+=(r-l+1)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC073B - Theater
def main():
    N, *LR = map(int, open(0).read().split())
    ans = sum(r - l + 1 for l, r in zip(*[iter(LR)] * 2))
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

count = 0
for g in group:
    count += g[1]-g[0]+1

print(count)

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
group = [[0,0]for _ in range(N)]
sum=0
for i in range(N):
    group[i] = list(map(int, input().split()))
    sum += abs(group[i][1]-group[i][0])+1
print(sum)

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    t = 0
    for i in range(n):
        l, r = list(map(int, input().rstrip('\n').split()))
        t += (abs(r - l) + 1)
    print(t)


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n=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())
s = 0
a = [input().split() for i in range(n)]

l = [0]
r = [0]
for m in range(n):
    l.append(a[m][0])
    r.append(a[m][1])

for p in range(1,n+1):
    s += int(r[p])-int(l[p])+1

print(s)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#2019/10/01
N, *l_r = [list(map(int, i.rstrip("\n").split())) for i in open(0).readlines()]
#print(N, l_r)

print(sum([l_r[i-1][1] - l_r[i-1][0] + 1 for i in range(N[0])]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0

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

print(cnt)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
total = 0
for _ in range(n):
    l, r = map(int, input().split())
    val = (r+1) - l
    total += val
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:
import sys
input = sys.stdin.readline


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

    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    l_temp, r_temp = map(int, input().split())
    ocu_temp = r_temp - l_temp + 1
    ocu = ocu + ocu_temp

print(ocu)

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

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
print(sum([-eval(input().replace(' ', '-')) + 1 for _ in range(int(input()))]))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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 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-1:r] = 1
print(sum(seat))

Submission status: Accepted

Solution code:
N = int(input())

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

cnt = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
n=int(input())
cnt=0
for i in range(n):
	l,r=map(int,input().split())
	cnt+=r-l+1
	
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
lr=[]
ans=0
for i in range(n):
    lr.append(list(map(int,input().split())))
    ans+=lr[-1][1]-lr[-1][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:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
ans = 0
for i in range(N):
    a, b = ISI()
    ans += b - a + 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC073b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = input()
ni = lambda: int(N)
nm = lambda: map(int, input().split())
li = lambda: [nl() for _ in range(ni())]
nl = lambda: list(nm())
lx = lambda: [x[1] - x[0] + 1 for x in li()]
print(sum(lx()))

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
def input():
  return stdin.readline().strip()
print(sum(s[1] - s[0] + 1 for s in [list(map(int, input().split())) for _ in range(int(input()))]))

Submission status: Accepted

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