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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n=int(input())
x=0
for i in range(0,n):
  l,r = map(int, input().split())
  x=x+(r-l+1)
print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


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


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


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())
    m = b - a + 1
    ans += m

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
c=0
for i in range(n):
    x,y=map(int,input().split())
    c+=y-x+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)
l = [abs(L[i]-R[i])+1 for i in range(N)]
print(sum(l))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

goukei = []
for i in range(N):
    l,r = map(int,input().split())
    goukei.append(abs(l - r) + 1)
    
print(sum(goukei))

Submission status: Accepted

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

print(sum([r_i-l_i for l_i, r_i in l_r]) + n)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
# coding:utf-8

INF = float('inf')


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


N = int(input())
seat = [False] * 100000
for i in range(N):
    l, r = inpl()
    for j in range(l - 1, r):
        seat[j] = True

ans = 0
for s in seat:
    if s: ans += 1

print(ans)

Submission status: Accepted

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


def main():
    n = int(input())
    seats = [0] * 100000
    count = 0

    for i in range(n):
        left, right = map(int, input().split())

        for j in range(left - 1, right):
            seats[j] = 1

    for seat in seats:
        if seat == 1:
            count += 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

sum=0
index=0
while index < n:
    st, en = map(int, input().split())
    sum+=(en-st)+1
    index+=1

print(sum)

Submission status: Accepted

Solution code:
n = int(input())

l = [i for i in range(n)]
r = [i for i in range(n)]

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

ans = 0

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

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
num = 0
while count < n:
  l, r = map(int, input().split())
  num += r - l + 1
  count += 1
print(num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(raw_input())
#a,b = map(int, raw_input().split())
c = 0

for i in range (n):
  a,b = map(int, raw_input().split())
  c += b-a+1

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
for j in line:
    count += j[1] - j[0] + 1
print(count)

Submission status: Accepted

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

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


print(sum)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=0
for _ in[0]*int(input()):a,b=map(int,input().split());s+=b-a+1
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
#73b
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 = input()
ans = 0
for i in range(int(N)):
  n = input().split(" ")
  ans += int(n[1]) - int(n[0]) + 1
print(ans)

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8 :
n = int(raw_input())
kyaku = 0

for _ in range(n):
    l, r = map(int, raw_input().split())
    kyaku += r - l + 1

print(kyaku)

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

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

N = int(input())
ans = 0
for i in range(N):
	l,r = inpl()
	ans += r-l+1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(seats)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

def main():
    n = int(input())
    seat_list = []
    for _ in range(n):
        seat_list.append(list(map(int, input().split())))
    ans = 0

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

    print(ans)

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):
    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):
  a = list(map(int, input().split()))
  ans += a[1] - a[0] + 1
print(ans)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

print(total)

Submission status: Accepted

Solution code:
a =int( input())
d = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
ans=0
for i in range (a):
  x,y=[int(x) for x in str(input()).split()]
  ans+=abs(y-x)+1
print(ans)

Submission status: Accepted

Solution code:
"""
https://abc073.contest.atcoder.jp/tasks/abc073_b
"""
n=int(input())
a=0
lr=[]
for i in range(n):
    lr.append([j for j in input().split()])
#print(lr)

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

Submission status: Accepted

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

ans = 0
for j in s:
    ans += j[1] - j[0] + 1
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = []
tmp = []
for i in range(N):
    tmp = [int(i) for i in input().split()]
    a.append(tmp)

res = 0
for i in a:
    if i[1] - i[0] == 0:
        res += 1
    else:
        res += i[1] - i[0] + 1

print(res)

Submission status: Accepted

Solution code:
N=int(input())

ans=0

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

print ans

Submission status: Accepted

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

N = int(input())

ans = 0
for i in range(N):

    L, R = map(int, input().split())
    ans += (R - L + 1)
print(ans)

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

Solution code:
n=int(input())

ans=0

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

print(ans)

Submission status: Accepted

Solution code:
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):
    x,y= map(int,input().split())
    ans+=y-x+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:
# -*- coding: utf-8 -*-

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

cnt = 0
for i in range(len(a)):
    cnt += a[i][1] - a[i][0] + 1

print(cnt)

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

res = 0

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(num)

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

Submission status: Accepted

Solution code:
N=int(input())

G=[None]*N

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

P=0

for i in range(N):
    P+=G[i][1]-G[i][0]+1

print(P)

Submission status: Accepted

Solution code:
N = int(input())
seatingPlaces = []
sum_number_of_people = 0

for i in range(N):
    seatingPlaces.append(list(map(int, input().split())))

for onegroup in seatingPlaces:
    number_of_people = onegroup[1] - onegroup[0] + 1
    sum_number_of_people += number_of_people

print(sum_number_of_people)

Submission status: Accepted

Solution code:
num = int(input())
InA = [input().split() for i in range(num)]
seki_total = 0

for seki in InA:
    seki_total += int(seki[1]) - int(seki[0]) + 1

print (seki_total)

Submission status: Accepted

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

Submission status: Accepted

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

#たしざん
for i in range(dantaisuu):
    a, b = [int(i) for i in input().split()]
    ninnzuu = b - a + 1
    total += ninnzuu

#結果表示
print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

i = 0
cnt = 0

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

char = []
seats = 0
for i in range(N):
    l,r = (int(j) for j in input().split())
    seats = seats + (r-l+1)

print(seats)

Submission status: Accepted

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

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:
kumisu=int(input())
kyaku=0
for i in range(kumisu):
    y1,y2=map(int,input().split())
    kyaku +=y2-y1+1
print(kyaku)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

groups = []
for i in range(N):
    x, y = map(int, input().split())
    groups.append([x, y])

count = 0
for v in groups:
    count += v[1] - v[0] + 1

print(count)

Submission status: Accepted

Solution code:
N = input('')
groups = []
for x in range(int(N)):
  groups.append((input('')).split())
count = 0
for g in groups:
  count += (int(g[1]) - int(g[0]) + 1)
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

print ans

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(cus)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#■標準入力ショートカット


def get_next_int():
    return int(float(input()))


def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])


def get_next_str():
    return input()


def get_next_strs(delim=" "):
    return tuple(input().split(delim))


def get_next_by_types(*value_types, delim=" "):
    return tuple([t(x) for t, x in zip(value_types, input().split(delim))])


def solve():
    N = get_next_int()
    ans = 0
    for i in range(N):
        l, r = get_next_ints()
        ans += r-l+1
    print(ans)
solve()

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:
groups = [list(map(int, input().split())) for _ in range(int(input()))]
print(sum(map(lambda x: x[1] - x[0] + 1 , groups)))

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

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

Submission status: Accepted

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

sum_num = 0
for i in input_list:
    sum_num += (i[1]-i[0]+1)
    
print(sum_num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

sum = 0
for _ in range(loops):
    left, right = map(int, input().split())
    sum += (right - left + 1)
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])

mysum=0

for v in range(1,1+n):


    mysum+= int(arr_data[v][1])-int(arr_data[v][0])+1
#print("Yes"   if "9"  in n else "No")

print(mysum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

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())
a = []
x = 0

for i in range(n):
    a.append(list(map(int,input().split())))

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

print(x)

Submission status: Accepted

Solution code:
s=0
for _ in[0]*int(input()):
    a,b=map(int,input().split());s+=b-a+1
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:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    group_count = int(input())

    seated_numbers = [list(map(int, input().split())) for _ in range(group_count)]
    total_person = 0

    for line in seated_numbers:
        total_person += max(line) - min(line) + 1

    print(total_person)

Submission status: Accepted

Solution code:
N = int(input())


box = []
for i in range(N):
	l,r = map(int,input().split(" "))
	m = r - l + 1
	box.append(m)
n = sum(box)
print(n)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
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())
audience = []
for _ in range(N):
    l, r = map(int, input().split())
    audience.append(r - l + 1)

print(sum(audience))

Submission status: Accepted

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

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

print ans