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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import copy
import sys
import numpy as np

from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    count = 0
    for i in range(N):
        input_raw = read_func().strip().split()
        [l, r] =[int(input_raw[0]), int(input_raw[1])]
        count += r - l + 1
    print count

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def B_Theater(N, C):
    people = 0
    for i in range(0, len(C), 2):
        people += C[i + 1] - C[i] + 1
    return people

N = int(input())
C = [[int(i) for i in input().split()] for i in range(N)]
x = []
for s in C:
    x.extend(s)
C=x
print(B_Theater(N, C))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = set([])
for i in range(N):
    strs = [int(s) for s in input().split(' ')]
    for j in range(strs[0],strs[1]+1):
        ans.add(j)

print(len(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

how = []
for i in seat:
    how.append(i[1] - i[0] + 1)

how = sum(how)
print(how)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(n):
    x = input()
    a , b = map(int,x.split())
    ans += b - a + 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:
if __name__ == '__main__':
    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:
# coding: utf-8
N = int(input())
sum = 0

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N= int(input())

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

Q=[]
P=0
for x in range(N):
    P=R[x]-L[x]+1
    Q.append(P)
    
print(sum(Q))

Submission status: Accepted

Solution code:
N = int(input())
res = 0
for _ in range(N):
    group = [int(x) for x in input().split(' ')]
    res += (group[1] - group[0]) + 1
print(res)

Submission status: Accepted

Solution code:
#Nをセットする
N = int(input())
people = 0
for i in range(N):
    l,r = map(int,input().split())
    people = people + (r - l + 1)
print(people)

Submission status: Accepted

Solution code:
N = int(input())

s = 0

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

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
l=[]
r=[]
p=[]
for x in range(n):
    L,R=map(int,input().split())
    l.append(L)
    r.append(R)

def hito(x):
    return r[x]-l[x]+1
for x in range(n):
    p.append(hito(x))
print(sum(p))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC073 B

N = int(input())
sum_visitor = 0
for i in range(N):
    input_str = input()
    nums = input_str.split(' ')
    sum_visitor += (int(nums[1]) - int(nums[0]) + 1)
print(sum_visitor)

Submission status: Accepted

Solution code:
#!/usr/bin/python

import sys

def main(argv):
    line = sys.stdin.readline()
    while line:
        N = int(line)
        total = 0
        for i in xrange(N):
            l, r = map(lambda x: int(x), sys.stdin.readline().split(" ", 2))
            total += (r - l) + 1
        print(total)
        line = sys.stdin.readline()
        

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(answer)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import sys
if __name__ == '__main__':
    line = sys.stdin.readline()
    N = int(line)
    count = 0
    for i in range(N):
    	line = sys.stdin.readline().split(" ")
    	count += int(line[1]) - int(line[0]) + 1
    print(count)

Submission status: Accepted

Solution code:
inp = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(sum_num)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()
a=[]
for i in range(N):
	a.append(map(int, raw_input().split()))
#print N
#print a

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

print sum

Submission status: Accepted

Solution code:
N=int(input())
people=0
for i in range(N):
    left,right=map(int,input().split())
    number = right - left +1
    people += number
print(people)

Submission status: Accepted

Solution code:
num=int(raw_input())
output=0
for i in range(num):
    tmp=map(int, raw_input().split(" "))
    output+=tmp[1]-tmp[0]+1

print output

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

import os
import sys
import math
import numpy as np


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

print(np.sum(seat[:,1] - seat[:,0]+1))

Submission status: Accepted

Solution code:
n=int(raw_input())
number=0
while n !=0:
    a ,b=map(int, raw_input().split())
    number+=b-a+1
    n-=1
print(number)

Submission status: Accepted

Solution code:
l=int(input())

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

Submission status: Accepted

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

for i in range(N):
    group = input().split()
    start, end = int(group[0]), int(group[1])
    total += end - start + 1

print(total)

Submission status: Accepted

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

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:
num = int(input())
ans = 0
for a in range(num):
    temp = input().split(" ")
    for b in range(len(temp)):
        temp[b] = int(temp[b])
    ans += (temp[1] - temp[0]) + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [0]*100005
n = int(raw_input())
for x in xrange(n):
	a = map(int,raw_input().strip().split())
	for y in xrange(a[0],a[1]+1):
		l[y] = 1
ans = 0
for x in l:
	if x == 1:
		ans += 1
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

res = 0
while lr:
    tlr = lr.pop()
    res += tlr[1] - tlr[0] + 1

print(res)

Submission status: Accepted

Solution code:
#coding:utf-8

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


def solve(data):
    total = 0
    for b, e in data:
        num = e - b + 1
        total += num
    return total


def main():
    N = int(input())
    data = []
    for _ in range(N):
        data.append([int(x) for x in input().split(' ')])
    result = solve(data)
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    LR = tuple(tuple(map(int, input().split())) for _ in range(N))

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

    print(people)

main()

Submission status: Accepted

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

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

nsum = 0
for j in range(N):
    nsum += lis[j][1] - lis[j][0] +1

print(nsum)

Submission status: Accepted

Solution code:
# coding=utf-8
N = int(raw_input().rstrip())
num = 0
for i in range(N):
    s = map(int, raw_input().split())
    num += s[1] - s[0] + 1
print num

Submission status: Accepted

Solution code:

N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
j1=0
j2=0
res=0
for i in x:
    res += i[1]-i[0]+1

print(res)

Submission status: Accepted

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

import sys


def main():
    count = 0
    for line in sys.stdin:
        if len(line.rstrip().split(" ")) == 1:
            continue
        start, end = map(int, line.rstrip().split(" "))
        count += end - start + 1
    print(count)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
seat = [0 for i in range(100000+1)]
for i in range(N):
    l, r = [int(i) for i in input().split()]
    for j in range(l, r+1):
        seat[j] = 1
print(sum(seat))

Submission status: Accepted

Solution code:
N = int(input())
array = []
sum = 0

for i in range(N):
	a = list(map(int,input().split()))
	sum += (a[1] - a[0] + 1)
	#array.append(a)

#print(array)
print(sum)

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your 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())
sum = 0
for i in range(N):
    i, j = list(map(int, input().split(' ')))
    sum += j - i + 1
print(sum)

Submission status: Accepted

Solution code:
def solution():
	n = int(input())
	ans = 0
	for i in range(n):
		x,y = [int(x) for x in input().split(' ')]
		ans+=y-x+1

	print(ans)

solution()

Submission status: Accepted

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

print(p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
N = int(input())
ans = 0
for tmp 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 = list(map(int, input().split(' ')))
    res += r - l + 1

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

b()

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))




N=int(input())
l=list()
for i in range(N):
    l.append(spaceinput())

sum=0
for sl in l:
    sum+= sl[1]-sl[0]+1

print(sum)

Submission status: Accepted

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

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

print(x)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(raw_input())
res = 0
for i in range(n) :
    x,y = map(int,raw_input().split())
    res += y-x+1
print res

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(num)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N=int(raw_input())

s=0
for i in range(N):
    l,r=map(int,raw_input().split(' '))
    s+=(r-l+1)

print s

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(N):
    inlist = [int(_) for _ in input().split()]
    count += inlist[1] - inlist[0] + 1

print(count)

Submission status: Accepted

Solution code:
N = int(raw_input())
answer = 0
for n in xrange(N):
  l, r = map(int, raw_input().split(' '))
  answer += r - l + 1
print answer

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n =int(input())
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/bim/python
#! -*- coding: utf-8 -*-

n = raw_input()
n = int(n)

num = 0

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

print num

Submission status: Accepted

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

for p in people:
    ans += (p[1] - p[0]) + 1

print(ans)

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

Submission status: Accepted

Solution code:
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())
num = 0

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

print(num)

Submission status: Accepted

Solution code:
# coding: utf-8
def get_ln_inputs():
    return input().split()


def get_ln_int_inputs():
    return list(map(int, get_ln_inputs()))


def main():
    N = get_ln_int_inputs()[0]
    l = list()
    r = list()
    for _ in range(N):
        l_i, r_i = get_ln_int_inputs()
        l.append(l_i)
        r.append(r_i)
    print(sum(r) - sum(l) + N)
    return


main()

Submission status: Accepted

Solution code:
N=int(input())

ans=0

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

Submission status: Accepted

Solution code:
# B
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())
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 heapq
import math

num = 0
N = int(input())
for i in range(N):
    tmp = input()
    l, r = [int(a) for a in tmp.split()]
    num += (r-l) + 1

print(num)

Submission status: Accepted

Solution code:
a = int(input())
b = [map(int, input().split()) for x in range(a)]

print(sum(B - A + 1 for A, B in b))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    r = 0
    for _ in range(n):
        a,b = LI()
        r += b-a+1

    return r

print(main())

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

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

Submission status: Runtime Error

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: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N ;
  cin >> N ;
  int l ,r ;
  int p = 0;
  for (int i = 0; i < N; i++ ){
    cin >> l >> r;
    p += r - l + 1 ;
  }
  cout << p << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(res)

Submission status: Runtime Error

Solution code:
a=int(input())
b=[int(input()) for i range(a)]
c=0
for i range(a):
  c=c+(b[i][1]-b[i][2])
print(c+a)

Submission status: Runtime Error

Solution code:
2
6 8
3 3

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
c = [0]*10**5
for i in range(n):
    a, b = map(int, input().split())
    for j in range(a, b+1):
        c[j] = 1
print(sum(c))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
seat = [0]*100000
for i in range(N):
    li,ri = map(int,input().split())
    for j in range(li,ri+1):
        seat[j] = 1
print(sum(seat))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
a = []

for i in range(N):
    a,b = map(int,input().split())
    sa = b-a+1
    a.append(sa)
    
print(sum(a))

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    LIST = [0] * 100000
    for i in range(n):
        l,r = readInts()
        l -=1
        # いもす法
        LIST[l] +=1
        LIST[r] -=1
    # 累積和
    for i in range(1,100000):
        LIST[i] += LIST[i-1]
    cnt = 0
    for i in range(100000):
        if LIST[i] > 0:
            cnt += 1
    #print(LIST)
    print(cnt)
if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
seat = np.zeros(N + 100, dtype=int)
L, R = np.array([input().split() for _ in range(N)], dtype=int).T

np.add.at(seat, L, 1)
np.add.at(seat, R+1, -1)
np.cumsum(seat, out=seat)
print(seat.sum())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
1
24 30

Submission status: Runtime Error

Solution code:
import numpy as np

read = sys.stdin.buffer.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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

while i < N:
    a = int(input())
    b = int(input())

    ans += b - a +1
    i += 1
print(ans)