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:
# coding: utf-8
# Your code here!
N = int(input())
n = 0
for i in range(N):
    l, r = map(int, input().rstrip().split())
    m = r - l + 1
    n += m
print(n)

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(input().split())
    return li

# --------------------------------------------

dp = None

def main():
    seats = 0
    N = int(input())

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

    print(seats)


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = raw_input()

people = 0
for i in range(int(a)):
  number_list = raw_input().split()
  people += int(number_list[1])-int(number_list[0]) +1
  
print(people)

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

M = 0
for n in range(N):
    l, r = [int(n) for n in input().split()]
    m = r - l + 1
    M += m

print(M)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(t)

Submission status: Accepted

Solution code:
n = int(input())
x = [[int(i) for i in input().split()] for i in range(n)]
ans = 0;

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

Submission status: Accepted

Solution code:
n = int(input())

xs = [tuple(map(int, input().split())) for i in range(n)]

print(sum([r - l + 1 for l, r in xs]))

Submission status: Accepted

Solution code:
att = 0
num = raw_input()
for i in range(int(num)):
    ppl = raw_input().split()
    att += 1 + (int(ppl[1])-int(ppl[0]))
print att

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:
first = int(raw_input())
k = [map(int, raw_input().split()) for i in range(first)]
audience = 0
for i in range(len(k)):
    audience = audience + k[i][1] - k[i][0] + 1

print audience

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

res = 0

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

Submission status: Accepted

Solution code:
n=int(input())
l=[]
for i in range(n):
    li,ri=map(int, input().split())
    l.append(ri-li+1)

print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())

c=0
for i in range(a):
    b=input().split()

    d=int(b[0])
    f=int(b[1])

    g=f-d+1
    c=g+c

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input());total = 0
for i in range(0,N):
    row = input().split()
    total = total + int(row[1])-int(row[0])+1
print(total)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 19 09:36:44 2017

@author: kotania
"""

N = int(input())
lrList = [""]*N
for n in range(0,N):
    lrList[n] = input()

sum = 0
for lr in lrList:
    sum += (int(lr.split()[1]) - int(lr.split()[0]) + 1)
    
print(sum)

Submission status: Accepted

Solution code:
N = int(input())

val = 0
for num in range(0,N):
    row = input().split()
    val = val + int(row[1]) - int(row[0])

val = val + N
print(val)

Submission status: Accepted

Solution code:
# coding: utf-8

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

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

print(count)

Submission status: Accepted

Solution code:
num =int(input())
res = 0
for i in range(num):
    val = [int(x) for x in input().split()]
    res += (val[1]-val[0]+1)
print(res)

Submission status: Accepted

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

Ans = 0

for i in range(n):
	Ans += e[i][1] - e[i][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())
P = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    ans += P[i][1] - P[i][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())
total = 0
for i in range(n):
    seats = [int(j) for j in input().split()]
    total = total + seats[1] - seats[0] + 1
print(total)

Submission status: Accepted

Solution code:
# coding:utf-8

N=input()
sum=0
a = []
for i in range(N):
    a.append(map(int, raw_input().split()))

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

print sum

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    N = int(input())
    res = 0
    for x in range(N):
        a,b = map(int, input().split())
        res += b - a + 1
    print (res)

Submission status: Accepted

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

Submission status: Accepted

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

print(s)

Submission status: Accepted

Solution code:
N = int(input())

seat_sum=0
for i in range(N):
    li,ri=[int(i) for i in input().split()]
    seat_sum+=(ri-li+1)

print(seat_sum)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

def main():
    N = int(input())

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

if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
N = int(raw_input())
sum = 0
for i in xrange(N):
	s,e = map( int,raw_input().split() )
	sum += e-s+1
print sum

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
for i in L:
    sum += i[1] - i[0] + 1
print(sum)

Submission status: Accepted

Solution code:
n = input()
a = [0] * 100010
for i in xrange(n):
	l, r = [int(x) for x in raw_input().split()]
	a[l:r + 1] = [1] * (r - l + 1)
print a.count(1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def countNum(num):
	count = 0
	for x in range(0,num):
		count += int(inputSeats[x][1]) - int(inputSeats[x][0]) + 1		
	return count

inputSeats = [[]]
if __name__ == '__main__':
	inputNum = int(input())
	# print(type(inputNum))

	for x in range(0,inputNum):
		inputSeat = input()
		inputSeats.append(inputSeat.split())
		# print(inputSeats[x])

	inputSeats.pop(0)
	print(countNum(inputNum))

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

print(total)

Submission status: Accepted

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

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:
#!/usr/bin/python3

n = int(input())

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

print(t)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lr_list= []

count =0
for _ in range(n):
#     lr_list.append([int(x) for x in input().split()])
    x, y = [int(x) for x in input().split()]
#     print(x,y)
    count += y-x+1

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

s = 0
for _ in range(N):
    l, r = [int(x) for x in input().split(' ')]
    s += r - l + 1

print(s)

Submission status: Accepted

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

for i in range(N):
    n.append(input().split())

for j in range(1,N+1):
    #print(n)
    ans+=int(n[j][1])-int(n[j][0])
    ans+=1

print(ans)

Submission status: Accepted

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

seats = []

for i in range(N):
    inputs = input().split()
    seats.append([int(inputs[0]), int(inputs[1])])

ans = 0
for i in seats:
    ans += i[1] - i[0] + 1

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

seat = [0] * 100000
n = input()
for _ in xrange(n):
    l, r = map(int, raw_input().split())
    for j in xrange(l-1, r):
        seat[j] = 1

print seat.count(1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    ans = 0
    for _ in range(n):
        x, y = map(int, input().split(" "))
        ans += (y - x + 1)
    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for seat in seats:
    sum += seat[1] - seat[0]

print(sum)

Submission status: Accepted

Solution code:
def B_Theater():
    groups = []
    try:
        LOCAL_FLAG
        # N = 1
        # groups = [[24, 30]]
        N = 2
        groups = [[6, 8], [3, 3]]
    except NameError:
        N = int(input())
        for i in range(N):
            groups.append(list(map(int, input().split())))

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

B_Theater()

Submission status: Accepted

Solution code:
N = int(raw_input())
temp = 0
for i in range(0,N):
 a = raw_input().split(" ")
 temp += int(a[1]) - int(a[0])+1
print temp

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
c=[0]*100010
N=int(input())
for _ in range(N):
  a,b=map(int,input().split())
  c[a] += 1
  c[b+1] -= 1
for i in range(len(c)-1):
  c[i+1] += c[i]
print(sum(c))

Submission status: Accepted

Solution code:
print(sum([(lambda x:int(x[1])+1-int(x[0]))(input().split())for _ in[0]*int(input())]))

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

Submission status: Accepted

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

sum_n = 0
for i in range(N):
	s_input = raw_input()
	s_input = s_input.split(' ')
	s_input = [int(d) for d in s_input]
	sum_n += s_input[1] - (s_input[0] - 1)

print(sum_n)

Submission status: Accepted

Solution code:
# デバッグ用
DEBUG = False
# DEBUG = True

# 宣言
result = 0
ELEM_MAX = 100000 
seat_list = []

# 入力部
if DEBUG:
    N = '3'
    a = '1 2'

else:
    N = input()
    N = int(N)
    for i in range(N):
        seat = input()
        seat = seat.split(' ')
        seat = list(map(int, seat))
        seat_list.append(seat)

# 処理部
for seat in seat_list:
    result += seat[1] - seat[0] + 1

# 出力部
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

sum = 0

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

    sum += r - l + 1

print(sum)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
n = raw_input()

n = int (n)

ans=0

for i in range(0,n):
    a,b=raw_input().split(' ')
    a = int (a)
    b = int (b)
    ans+=b-a;
    ans+=1

print ans

Submission status: Accepted

Solution code:
ans = 0
for i in range(input()):
    l, r = map(int, raw_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:

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

print(num)

Submission status: Accepted

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

count = 0
for j in range(N):
    count += list_seki[j][1]+1-list_seki[j][0]

print(count)

Submission status: Accepted

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

for i in range(N):
    n.append(input().split())

for j in range(1,N+1):
    #print(n[j][0])
    ans+=int(n[j][1])-int(n[j][0])
    ans+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(count)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np


def getInput():
    """

    :return: list of list of str. 1st dim: row, 2nd dim: column.
    """
    separator = ' '
    ret_array = []
    while True:
        try:
            row = input().split(sep=separator)
            ret_array.append(row)
        except EOFError:
            break
    return ret_array


g = getInput()

# number
N = np.array(list(map(int, g[0])), dtype=np.int32)
# l,r
l = []
r = []
for row_idx in range(1, len(g)):
    l.append(int(g[row_idx][0]))
    r.append(int(g[row_idx][1]))

l = np.array(l, dtype=np.int32)
r = np.array(r, dtype=np.int32)

s = r-l+1

print(s.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=input()
num=0
for i in range(N):
    x=map(int,raw_input().split())
    temp_num=len(range(x[0],x[1]+1))
    num=num+temp_num
print num

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
cus = 0

for i in range(N):
    l = (map(int, raw_input().split()))
    cus += (l[1] - l[0] + 1)

print cus

Submission status: Accepted

Solution code:
audience = []
total = 0
groups = int(raw_input())

for line in xrange(groups):
    audience.append(raw_input())

for line in audience:
    group = map(int, line.split())
    total += group[1] - group[0] + 1

print total

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

Submission status: Accepted

Solution code:
#ABC073B

n=int(raw_input())
res=0
for i in xrange(n):
 l,r=map(int,raw_input().split())
 res+=r-l+1
print res

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N=input()
now=0
for i in range(0,(int)(N)):
    lr=(input()).split(' ')
    now=now+((int)(lr[1])-(int)(lr[0])+1)

print(now)

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:
def read(): return list(map(int, input().split()))

M = 100000
n = int(input())
seat = [0 for i in range(M)]

for i in range(n):
    l, r = read()
    l -= 1
    r -= 1
    for j in range(l, r+1):
        seat[j] = 1

print(sum(seat))

Submission status: Accepted

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

Submission status: Accepted

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

count = [0] * N
for i in range(N):
    count[i] = r[i] - l[i] + 1

print(sum(count))

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys


def main():

    NumCount = 0

    lines = sys.stdin.readlines()
    for i,line in enumerate(lines):
        if i==0:
            continue
        else:
            value = line.split()
            if len(value)==1:
                NumCount += 1
            else:
                NumCount += int(value[1])-int(value[0]) + 1
    print(NumCount)
    return


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

Submission status: Accepted

Solution code:
print(sum([1+len(range(*list(map(int,input().split())))) for i in range(int(input()))]))

Submission status: Accepted

Solution code:
import functools, operator, math

res = 0
for _ in range(int(input())):
    res += abs(functools.reduce(operator.__sub__, map(int, input().split())))+1

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import atexit
import io
import sys

temp_buffer = io.BytesIO()
sys.stdout = temp_buffer


@atexit.register
def write():
    sys.__stdout__.write(temp_buffer.getvalue())


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

Submission status: Accepted

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

ans = 0
for i in range(n):
    a, b = map(int, raw_input().split())
    ans += b - a + 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:
from sys import stdin
ans = 0
n = int(stdin.readline())
for _ in xrange(n):
 l,r = map(int,stdin.readline().split())
 ans += r-l+1
print ans

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !
ans = 0
N = int(input())
for i in range(N):
    a , b = map(int,input().split())
    ans = ans + b - a +1
print(ans)

Submission status: Accepted

Solution code:
import sys

written = set()

s = 0
N = int(sys.stdin.readline())
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())
ans = 0
for i in range(N):
    L,R = map(int,input().split())
    ans += R-L +1

print(ans)

Submission status: Accepted

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

for i in range(0, itera):
	var1, var2 = input().split()
	var1 = int(var1)
	var2 = int(var2)
	total += (var2+1)-var1

print(total)

Submission status: Accepted

Solution code:
value = int(input())
people = 0
while True:
	try:
		seat = input()
		if seat:
			string_seat = seat.split()
			seat_list = []
			seat_list = [int(x) for x in (string_seat)]
			people += seat_list[len(seat_list)-1] - seat_list[0]+1
	except EOFError:
		break
# while True:
# 	seat = input()
# 	if seat:
# 		string_seat = seat.split()
# 		seat_list = []
# 		seat_list = [int(x) for x in (string_seat)]
# 		people += aaa(seat_list)
# 	else:
# 		break
print(people)

Submission status: Accepted

Solution code:
import sys

# sys.stdin = open('b1.in')


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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    res = 0
    for i in range(n):
        l, r = read_int_list()
        r0 = r - l + 1
        res += r0
    print(res)


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

n=int(input())
sum=0
for i in range(0, n):
    l_r=input()
    l=int(l_r.split(" ")[0])
    r=int(l_r.split(" ")[1])
    sum+=r-l+1

print(sum)

Submission status: Accepted

Solution code:
import sys

def main():
    N = int(input())

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


    count = 0

    for b in a:
        count = count + (b[1]-b[0]+1)

    print(count)


if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
def solve(): # 073B- Theater
    N = int(input())
    sum_seat = 0

    for _ in range(N):
        l, r = [int(x) for x in input().split(" ")]
        sum_seat += r + 1 - l

    print(sum_seat)
    
    
solve()

Submission status: Accepted

Solution code:
import numpy as np
hoge = input()
N = int(hoge)
data = np.zeros((N,2))
num = 0
for i in range(N):
    hoge = input()
    hoge = hoge.strip().split(" ")
    num += int(hoge[1])-int(hoge[0])+1
print(num)

Submission status: Accepted

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

count = 0

for _ in range(n):
    l, r = read_line(int, int)
    count += r - l +  1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

print(result + n)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

for num in range(N):
	a, b = (int(_) for _ in raw_input().split()) 
	sum += b - a + 1

print(sum)

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())

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

print(res)