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

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

Submission status: Accepted

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

ans = set(ans)

print(len(ans))

Submission status: Accepted

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

for i 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())
lr=[list(map(int,input().split())) for a in range(n)]
sum=0
for v in lr:
    sum+=v[1]-v[0]
print(sum+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:
icase=0
if icase==0:
    n=int(input())
    ncnt=0
    for i in range(n):
        li,ri=map(int,input().split())
        ncnt=ncnt+ri-li+1
    print(ncnt)

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:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
lr = [list(map(int, readline().split())) for i in range(n)]
for l, r in lr:
    n += r - l
print(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:
import sys
import numpy as np

read = sys.stdin.read

n = int(input())
p = np.array(read().split(), dtype=np.int64).reshape(-1,2)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    sheet = 0
    for i in range(N):
        l, r = map(int, input().split())
        sheet += (r-l) + 1
    print(sheet)
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())
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 = []
for i in range(N):
    seat.append(input().split())

con = 0
for j in range(N):
    con += int(seat[j][1]) - int(seat[j][0]) + 1

print(con)

Submission status: Accepted

Solution code:
# ABC 073: B – Theater
n = int(input())
groups = [[int(s) for s in input().split()] for _ in range(n)]
members = [groups[i][1] - groups[i][0] + 1 for i in range(n)]
print(sum(members))

Submission status: Accepted

Solution code:
n = int(input())
l = []
r = []

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
# 変数名を"_"にすることで「その変数を使っていません」ということを表現している(Pythonの習慣)
# リストの中にリスト
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())
A = 0
for i in range(N):
  l = list(map(int, input().split()))
  A += l[1] - l[0] + 1
print(A)

Submission status: Accepted

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

ans=0

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

print(ans)

Submission status: Accepted

Solution code:

url = "https://atcoder.jp//contests/abc073/tasks/abc073_b"

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

    count = 0
    for li in t:
        count += (li[1] - li[0]) + 1
    print(count)


if __name__ == '__main__':
    main()

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

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

Submission status: Accepted

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: Accepted

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

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

Submission status: Accepted

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

for i in range(n):
    a,b=[int(i) for i in input().split()]
    ans+=b-a+1
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, *s = map(int, open(0).read().split())
print(sum(s[i+1]-s[i]+1 for i in range(0, n*2, 2)))

Submission status: Accepted

Solution code:
import io
import math

nancy = int(input())
sam = 0

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

print(sam)

Submission status: Accepted

Solution code:
a = 0
for i in range(int(input())):a -= eval(input().replace(' ', '-'))-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())
a = []
b = 0
for i in range(n):
  l,r=map(int, input().split())
  a.append((l,r))
  b = max(b,r)
  
acc = [0 for i in range(b+2)]
for l,r in a:
  acc[l] += 1
  acc[r+1] += -1
for i in range(b+1):
  acc[i+1] += acc[i]
print(sum(acc))

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

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
############################################
n=int(input())
ans=0
for a in range(n):
    l,r=map(int,input().split())
    ans+=r-l+1
print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc073/tasks/abc073_b

N = int(input())
d = 0

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

print(d)

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

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

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

ans = 0
for i, j in lr:
    ans += j - i + 1

print(ans)

Submission status: Accepted

Solution code:
# import sys
# import math #sqrt
# import decimal
import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# import itertools
# import collections # deque
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

sum=0

for i in range(N):
  sum=sum+h[i][1]-h[i][0]+1

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

tmp = [[int(j) for j in input().split()] for i in range(n)]

ans = sum([i[1]-i[0]+1 for i in tmp])
print(ans)

Submission status: Accepted

Solution code:
import operator

n = int(input())

tmp = [[int(j) for j in input().split()] for i in range(n)]

ans = sum([operator.sub(i[1],i[0])+1 for i in tmp])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for n 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 i in range(N)]
cnt = 0
for i in range(N):
    for j in range(1):
        cnt += LR[i][j+1] - LR[i][j] +1
print(cnt)

Submission status: Accepted

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

for _ in range(N):
  b, e = map(int, input().split())
  sum += abs(e - b) + 1

print(sum)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Fri Mar 20 22:48:43 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, l: "List[int]", r: "List[int]"):
    print(sum(ri - li + 1 for li, ri in zip(l, r)))


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

print(customer)

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

ans = 0

for _ in range(n):
    a, b = (int(x) for x in 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 k in range(N):
  i,j = map(int,input().split())
  ans += j - i + 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = int(input())
c = 0
for i in range(a):
  z=list(map(int, input().split()))
  c+=max(z)-min(z)+1
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
lr = []
for _ in range(n):
    a = [int(x) for x in input().split()]
    lr.append(a)

ans = 0

for x in lr:
    ans += x[1] - x[0] + 1
print(ans)

Submission status: Accepted

Solution code:
#abc073 b
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 = list(list(map(int,input().split())) for i 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:
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())
i =0
ans =0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input().strip())
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 = 0
for l in range(N):
    a, b = [int(i) for i in input().split()]
    cnt += abs(b-a) + 1

print(cnt)

Submission status: Accepted

Solution code:
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

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

if __name__ == '__main__':
    main()

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:
# B
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 bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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


resolve()

Submission status: Accepted

Solution code:
N = int(input())
l = [input().split() for i in range(N)] #二次元リストを生成
ans = 0
for j in l:
    num = int(j[1]) - int(j[0]) + 1
    ans += num
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    ret = 0
    for n in range(N):
        l, r = list(map(int, sys.stdin.readline().split()))
        ret += r - l + 1

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
m = [stdin.readline().rstrip().split() for _ in range(n)]
ans = 0
for mi in m:
    ans += int(mi[1]) + 1 - int(mi[0])

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

print(sum)

Submission status: Accepted

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

N = int(input())

seat = []
for _ in range(N):
    l, r = map(int, input().split())
    for x in range(l, r+1):
        seat.append(x)
print(len(seat))

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input().rstrip())

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

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC073

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

print(sum(r))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

def main():
    N = int(input())
    lr_list = [list(map(int, input().split())) for _ in range(N)]
    ans = 0
    for lr in lr_list:
        ans += lr[1] - lr[0] + 1
    print(ans)

if __name__ == '__main__':
    main()

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 = [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:
#073_B
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:
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=0
    for i in range(N):
        l,r=MI()
        ans+=r-l+1
    print(ans)
        

main()

Submission status: Accepted

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

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[i][1] - lr[i][0] + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

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