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

Submission status: Accepted

Solution code:
N=int(input())

total=0

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

print(total)

Submission status: Accepted

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

#----------
N = int(input().strip())
#----------

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    groups = int(input())
    answer = 0
    for _ in range(groups):
        reserved = list(map(int, input().split()))
        answer += reserved[1] - reserved[0] + 1
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    res = 0
    for _ in range(N):
        l, r = [int(x) for x in input().split()]
        res += r - l + 1
    return res

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

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

people = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def theater(n , lt):

    ans = 0

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

    return ans

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
L = [None]*N
for i in range(N):
    L[i] = 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())
res = 0
for i in range(n):
  a,b=map(int,input().split())
  res+=b-a+1
print(res)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for x 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())):
    s = input().split()
    a += (int(s[1]) - int(s[0]) + 1)
print(a)

Submission status: Accepted

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

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

print(r)

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())
min=[]
max=[]
mem=0
for i in range(n):
    min1,max1=[int(i) for i in input().split()]
    min.append(min1)
    max.append(max1)
    mem+=max[i]-min[i]+1
print(mem)

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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
l,r = np.array([0]*N),np.array([0]*N)
for i in range(N):
    l[i],r[i] = map(int, input().split())
rl = r-l+1
print(sum(rl))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
b = []

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

print(ans)

Submission status: Accepted

Solution code:
def main(n, l_r):
    ans = 0

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

    print(ans)


if __name__ == "__main__":
    n = int(input())
    l_r = [list(map(int, input().split())) for _ in range(n)]

    main(n, l_r)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
e = 0
for i in range(a):
	b, c = map(int, input().split())
	d = c - b + 1
	e += d
print(e)

Submission status: Accepted

Solution code:
times = int(input())
i = 0
nums = []
while i < times:
    nums.append(list(map(int, input().split())))
    i += 1

count = 0
for num in nums:
    count += num[1] - num[0] + 1

print(count)

Submission status: Accepted

Solution code:
def theater():
    total = 0
    try:
        N = int(input())
        l_r = (list(map(lambda x: int(x), input().split(' '))) for elem in range(N))
    except:
        return
    if not (1 <= N and N <= 1000): return
    for l, r in l_r:
        if 1 <= l and l <= 100000 or 1 <= r and r <= 100000:
            total += r - l + 1
        else:
            return
    print(total)

if __name__ == "__main__":
    theater()

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
l=[]
r=[]
for i in range(N):
    a,b = map(int,input().split())
    l.append(a)
    r.append(b)

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

if ans<=10**5:
    print(ans)
else:
    print(10**5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def intinput():
    return int(input())

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

def splitintinput():
    return map(int,input().split())

N = intinput()
ans = 0
for i in range(N):
    a,b = splitintinput()
    ans += b-a+1

print(ans)

Submission status: Accepted

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

N = int(input())

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

print(answer)

Submission status: Accepted

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

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

answer = 0
for l, r in LR:
  answer += r - l + 1

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys

# import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
LR= [map(int, readline().split()) for _ in range(N)]


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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(result)

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

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

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:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ans=0
    for i in range(n):
        l,r=INTM()
        ans+=r-l+1
    print(ans)
if __name__ == '__main__':
    do()

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 = map(int, input().split())
    count = r - l + 1
    ans += count

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
X = [map(int, input().split()) for _ in range(N)]
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

s = 0

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

print(s)

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)

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:
import numpy as np

N = int(input())
C = np.array([input().split() for i in range(N)])
sm = 0
for i in range(N):
    sm += int(C[i, 1])-int(C[i, 0])+1

print(sm)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
L = []
ans = 0
for i in range(n):
    a, b = LIST()
    ans += b - a + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sum = 0
N = int(input())
for i in range(N) :
    l,r = [int(i) for i in input().split()]
    sum += abs(r-l) +1
print(sum)

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 = list(map(int,input().split()))
    ans += max(l)-min(l)+1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(people)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
lr = [LIST() for _ in range(N)]

ans = 0

for l, r in lr:
	ans += r-l+1

print(ans)

Submission status: Accepted

Solution code:


import numpy as np

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

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

# はこ
l = []
s = 0

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

Submission status: Accepted

Solution code:
n = int(input())
memo = []
for i in range(n):
   tmp = [int(x) for x in input().split()]
   memo.append(tmp)

seat = [a[1] - a[0] + 1 for a in memo]
print(sum(seat))

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys
input = sys.stdin.readline
N = int(input())
A = []
for _ in range(N):
    A.append([int(x) for x in input().split()])
ans = 0
for i in A:
    ans += i[1] - i[0] + 1
print(ans)

Submission status: Accepted

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

res = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    p += x[i][1]-x[i][0]+1

print(p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    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):
    l,r=map(int,input().split())
    ans += r-l+1
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:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
N = int(input())

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

print (sum)

Submission status: Accepted

Solution code:
print(sum(1-eval(input().replace(' ', '-')) 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())
suma = 0
for i in range(N):
    a,b = map(int,input().split())
    suma += b-a+1
print(suma)

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

Submission status: Accepted

Solution code:
import sys
import numpy as np

n = int(sys.stdin.readline().rstrip())
l, r = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(n, 2).T

def main():
    
    return np.sum(r - l + 1)

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(input())

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
a = []
for i in range(N):
    a.append([int(i) for i in input().split()])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))


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())
chair = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
  left = chair[i][0]
  right = chair[i][1]
  ans += right - left + 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())
chair = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
  left = chair[i][0]
  right = chair[i][1]
  ans += right - left + 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())
m=0
for i in range(N):
    l,r=(int(x) for x in input().split())
    m+=(r-l+1)

print(m)

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())
ls_lr = [[int(_) for _ in input().split()] for _ in range(n)]

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8
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 = list(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):
    a,b = map(int, input().split())
    c += b-a+1
print(c)

Submission status: Accepted

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

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

test = 0

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

print(test)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=int(input())
    ans=0
    for _ in range(n):
        l,r=MI()
        ans+=r-l+1
    print(ans)
main()

Submission status: Accepted

Solution code:
n = int(input())

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

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())
S = 0

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

Submission status: Accepted

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