stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

using namespace std; //头文件和命名空间

int main(){

    ios::sync_with_stdio(false); //输入输出加速

    int nCount,iStart,iEnd; //nCount-团体个数；iStart-座位号起始；iEnd-座位号结束

    register int i,nTotal=0; //循环计数器和总和

    cin >> nCount; //读入团体数

    for (i = 1; i <= nCount; ++i){ //读入每个团体占用的座位

        cin >> iStart >> iEnd; //读入起始和结束

        nTotal += iEnd - iStart + 1; //计算占用了多少个座位，加总

    }

    cout << nTotal << endl; //输出，勿忘换行

    return 0; //结束

}

// Faster C++ solution for the same problem (measured speedup: 5.310446676256131x):
#include <cstdio>

int main(){

    int n,l,r,ans=0;

    scanf("%d",&n);

    for(int i=0;i<n;++i) scanf("%d %d",&l,&r),ans+=r-l+1;

    printf("%d\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long long z,a,b,n;

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a>>b;

		z+=b-a+1;

	}

	cout<<z<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.241311927772383x):
#include <cstdio>

int main(){

    int n,l,r,ans=0;

    scanf("%d",&n);

    for(int i=0;i<n;++i) scanf("%d %d",&l,&r),ans+=r-l+1;

    printf("%d\n",ans);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <iomanip>

#include <cmath>

#include <string>

#include <cstring>

#include <algorithm>

#include <vector>

#include <sstream>

#include <set>

#include <queue>

#include <stack>

#include <cctype>

#include <map>

#include <climits>

#include <bitset>

using namespace std;

#define MATH_PI 3.14159265358979323846

int main(){

	ios::sync_with_stdio(false);

	int nCount,iStart,iEnd;

	register int i,nTotal=0;

	cin >> nCount;

	for (i = 1; i <= nCount; ++i){

		cin >> iStart >> iEnd;

		nTotal += iEnd - iStart + 1;

	}

	cout << nTotal << endl;

endapp:

	//system("pause > nul");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.315295062357805x):
#include <stdio.h>

int main()

{

	int l,r,n,ans=0,i;

	scanf("%d",&n);

	for(i=0;i<n;i++)

		scanf("%d %d",&l,&r),ans+=r-l+1;

	printf("%d",ans);

}
// Slower C++ solution:
#include<iostream>

#include<iomanip>

#include<cstdio>

#include<cmath>

#include<cstring>

#include<algorithm>

using namespace std;

int main(){

	long long n,a,b,ans=0;

	cin>>n;

	while(n--){

		cin>>a>>b;

		ans+=b-a+1;

	}

	cout<<ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.239143627098656x):
#include <stdio.h>

int main()

{

	int l,r,n,ans=0,i;

	scanf("%d",&n);

	for(i=0;i<n;i++)

		scanf("%d %d",&l,&r),ans+=r-l+1;

	printf("%d",ans);

}
// Slower C++ solution:
#include <iostream>

using namespace std; //头文件和命名空间

int main(){

    ios::sync_with_stdio(false); //输入输出加速

    int nCount,iStart,iEnd; //nCount-团体个数；iStart-座位号起始；iEnd-座位号结束

    register int i,nTotal=0; //循环计数器和总和

    cin >> nCount; //读入团体数

    for (i = 1; i <= nCount; ++i){ //读入每个团体占用的座位

        cin >> iStart >> iEnd; //读入起始和结束

        nTotal += iEnd - iStart + 1; //计算占用了多少个座位，加总

    }

    cout << nTotal << endl; //输出，勿忘换行

    return 0; //结束

}

// Faster C++ solution for the same problem (measured speedup: 5.315295062357805x):
#include <stdio.h>

int main()

{

	int l,r,n,ans=0,i;

	scanf("%d",&n);

	for(i=0;i<n;i++)

		scanf("%d %d",&l,&r),ans+=r-l+1;

	printf("%d",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long long z,a,b,n;

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a>>b;

		z+=b-a+1;

	}

	cout<<z<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2460971945219335x):
#include <stdio.h>

int main()

{

	int l,r,n,ans=0,i;

	scanf("%d",&n);

	for(i=0;i<n;i++)

		scanf("%d %d",&l,&r),ans+=r-l+1;

	printf("%d",ans);

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,ans=0;

	cin>>n;

	while(n--)

	{

		int l,r;

		cin>>l>>r;

		ans+=r-l+1;

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.248965479482118x):
#include <stdio.h>

int main()

{

	int l,r,n,ans=0,i;

	scanf("%d",&n);

	for(i=0;i<n;i++)

		scanf("%d %d",&l,&r),ans+=r-l+1;

	printf("%d",ans);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <iomanip>

#include <cmath>

#include <string>

#include <cstring>

#include <algorithm>

#include <vector>

#include <sstream>

#include <set>

#include <queue>

#include <stack>

#include <cctype>

#include <map>

#include <climits>

#include <bitset>

using namespace std;

#define MATH_PI 3.14159265358979323846

int main(){

	ios::sync_with_stdio(false);

	int nCount,iStart,iEnd;

	register int i,nTotal=0;

	cin >> nCount;

	for (i = 1; i <= nCount; ++i){

		cin >> iStart >> iEnd;

		nTotal += iEnd - iStart + 1;

	}

	cout << nTotal << endl;

endapp:

	//system("pause > nul");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.312741257609716x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<iostream>

#include<iomanip>

#include<cstdio>

#include<cmath>

#include<cstring>

#include<algorithm>

using namespace std;

int main(){

	long long n,a,b,ans=0;

	cin>>n;

	while(n--){

		cin>>a>>b;

		ans+=b-a+1;

	}

	cout<<ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.236626410328216x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std; //头文件和命名空间

int main(){

    ios::sync_with_stdio(false); //输入输出加速

    int nCount,iStart,iEnd; //nCount-团体个数；iStart-座位号起始；iEnd-座位号结束

    register int i,nTotal=0; //循环计数器和总和

    cin >> nCount; //读入团体数

    for (i = 1; i <= nCount; ++i){ //读入每个团体占用的座位

        cin >> iStart >> iEnd; //读入起始和结束

        nTotal += iEnd - iStart + 1; //计算占用了多少个座位，加总

    }

    cout << nTotal << endl; //输出，勿忘换行

    return 0; //结束

}

// Faster C++ solution for the same problem (measured speedup: 5.312741257609716x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long long z,a,b,n;

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a>>b;

		z+=b-a+1;

	}

	cout<<z<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.243576636816833x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,ans=0;

	cin>>n;

	while(n--)

	{

		int l,r;

		cin>>l>>r;

		ans+=r-l+1;

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.246443543671068x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<cmath>

using namespace std;

int main()

{

	int n,l,r,ans;

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>l>>r;

		ans+=r-l+1;

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.24642029567156x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

using namespace std;

int n;

long long ans,a,b;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

        scanf("%lld%lld",&a,&b);

        ans+=b-a;

    }

    printf("%lld\n",ans+n);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.183130784603754x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    int n,a,b,ans=0;

    cin>>n;

    for(int i=1;i<=n;i++){

        cin>>a>>b;

        ans+=b-a+1;

    }

    cout<<ans<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2463673790676575x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstdio>

using namespace std;

int n,a,b;

int ans;

int main()

{

    cin>>n;

    for(int i=1;i<=n;i++)

    {

        cin>>a>>b;

        ans+=b-a+1;

    }

    cout<<ans<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.248008761862085x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int n,i,l,r,ans=0;

	scanf("%d",&n);

	for(i=1;i<=n;i++)

	{

		scanf("%d %d",&l,&r);

		ans+=r-l+1;

    }

    printf("%d",ans);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.180651975553924x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,a,b,ans;

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a>>b;

		ans+=b-a+1;

	}

	cout<<ans;



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2399391150125805x):
#include<cstdio>

using namespace std;

int n,a,b,ans;

int main()

{

  scanf("%d",&n);

  for(int i=1;i<=n;i++)

    scanf("%d%d",&a,&b),ans=ans+b-a+1;

  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main(){

	int a,i,j,s=0,b;

	cin>>a;

	for(b=1;b<=a;b++){

		cin>>i>>j;

		s=s+(j-i)+1;

	}

	cout<<s;

}

// Faster C++ solution for the same problem (measured speedup: 5.243527609392695x):
#include<stdio.h>

int main()

{

	int n;

	scanf("%d",&n);

	int ans=0;

	int i; 

	int a,b; 

	for(i=1;i<=n;i++)

	{

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

		 

	}

	printf("%d",ans); 

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <algorithm>

using namespace std;



int N,L,R,ans;



int main()

{

	scanf("%d",&N);

	for (int i=1; i<=N; i++)

	{

		scanf("%d %d",&L,&R);

		ans+=R-L+1;

	}

	printf("%d",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.184182784197383x):
#include<stdio.h>

int main()

{

	int n;

	scanf("%d",&n);

	int ans=0;

	int i; 

	int a,b; 

	for(i=1;i<=n;i++)

	{

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

		 

	}

	printf("%d",ans); 

}
// Slower C++ solution:
#include <cstdio>

#include <iostream>

#include <cstdlib>

using namespace std;

int main()

{

int n,k,i,j,t;

int a,b;

cin>>n;

t=0;

for (i=1; i<=n; i++)

  {

  cin>>a>>b;

  t=t+b-a+1;

  }

cout<<t<<endl;

return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.249818863825187x):
#include<stdio.h>

int main()

{

	int n;

	scanf("%d",&n);

	int ans=0;

	int i; 

	int a,b; 

	for(i=1;i<=n;i++)

	{

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

		 

	}

	printf("%d",ans); 

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main(){

	int a,i,j,s=0,b;

	cin>>a;

	for(b=1;b<=a;b++){

		cin>>i>>j;

		s=s+(j-i)+1;

	}

	cout<<s;

}

// Faster C++ solution for the same problem (measured speedup: 5.244169884433938x):
#include<cstdio>

int main()

{

    int a,b,ans,ci;

    scanf("%d",&ci);

    for(int i=0;i<ci;i++)

    {

        scanf("%d%d",&a,&b);

        ans+=b-a+1;

    }

    printf("%d",ans);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <algorithm>

using namespace std;



int N,L,R,ans;



int main()

{

	scanf("%d",&N);

	for (int i=1; i<=N; i++)

	{

		scanf("%d %d",&L,&R);

		ans+=R-L+1;

	}

	printf("%d",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.18481779014368x):
#include<cstdio>

int main()

{

    int a,b,ans,ci;

    scanf("%d",&ci);

    for(int i=0;i<ci;i++)

    {

        scanf("%d%d",&a,&b);

        ans+=b-a+1;

    }

    printf("%d",ans);

    return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <iostream>

#include <cstdlib>

using namespace std;

int main()

{

int n,k,i,j,t;

int a,b;

cin>>n;

t=0;

for (i=1; i<=n; i++)

  {

  cin>>a>>b;

  t=t+b-a+1;

  }

cout<<t<<endl;

return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.250461909476599x):
#include<cstdio>

int main()

{

    int a,b,ans,ci;

    scanf("%d",&ci);

    for(int i=0;i<ci;i++)

    {

        scanf("%d%d",&a,&b);

        ans+=b-a+1;

    }

    printf("%d",ans);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n,a[1005],b[1005],ans=0;

int main()

{

    cin>>n;

    for(int i=0; i<n; i++)

    {    

        cin>>a[i]>>b[i];

        ans+=b[i]-a[i]+1;

    }

    cout<<ans<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.211044366077882x):
#include<cstdio>

int main()

{

    int a,b,ans,ci;

    scanf("%d",&ci);

    for(int i=0;i<ci;i++)

    {

        scanf("%d%d",&a,&b);

        ans+=b-a+1;

    }

    printf("%d",ans);

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main(){

	int a,i,j,s=0,b;

	cin>>a;

	for(b=1;b<=a;b++){

		cin>>i>>j;

		s=s+(j-i)+1;

	}

	cout<<s;

}

// Faster C++ solution for the same problem (measured speedup: 5.239677409706719x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <algorithm>

using namespace std;



int N,L,R,ans;



int main()

{

	scanf("%d",&N);

	for (int i=1; i<=N; i++)

	{

		scanf("%d %d",&L,&R);

		ans+=R-L+1;

	}

	printf("%d",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.180376160028569x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <iostream>

#include <cstdlib>

using namespace std;

int main()

{

int n,k,i,j,t;

int a,b;

cin>>n;

t=0;

for (i=1; i<=n; i++)

  {

  cin>>a>>b;

  t=t+b-a+1;

  }

cout<<t<<endl;

return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.245964044618223x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n,a[1005],b[1005],ans=0;

int main()

{

    cin>>n;

    for(int i=0; i<n; i++)

    {    

        cin>>a[i]>>b[i];

        ans+=b[i]-a[i]+1;

    }

    cout<<ans<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.206580268683457x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include<cmath>

#include<iostream>

using namespace std;

long long ans=0,n,x,y;

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>x>>y;

		ans+=y-x+1;

	}

	cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.243546925023083x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cctype>

#include<cstring>

#include<queue>

#include<iostream>

#include<map>

using namespace std;

typedef long long ll;

typedef double lf;

typedef unsigned un;

typedef int in;

#define mian main

#define maxn 10000+10

#define maxm 10000+10

#define _(a) read(a)

#define non void

#define inf 2147483647

#define bre break

#define con continue

#define prq priority_queue

#define re register

#define bu bool

#define cz char

#define cst const

#define ope operator

#define inl inline

#define upp upper_bound

#define low lower_bound

#define next_per next_permutation

inl cz gc(){static cz buf[100000],*L=buf,*R=buf;return L==R&&(R=(L=buf)+fread(buf,1,100000,stdin),L==R)?EOF:*L++;}

template<typename T>inl T Max(T a,T b){return a>b?a:b;}

template<typename T>inl T Min(T a,T b){return a<b?a:b;}

template<typename T>inl T Abs(T a){return a<0?-a:a;}

template<typename T>inl non read(T &a){a=0;T k=1;char c=gc();while(c<'0'||c>'9')k=c=='-'?-1:k,c=gc();while(c>='0'&&c<='9')a=a*10+(c^48),c=gc();if(c!='.'){a*=k;return;}T t=0.1;while(c<'0'||c>'9')c=gc();while(c>='0'&&c<='9')a+=t*(c^48),c=gc(),t*=0.1;a*=k;}

template<typename T>non write(T a,cz t='\n'){if(a==0){putc(48,stdout),putc(t,stdout);return;}if(a<0){a=-a;putc('-',stdout);}cz c[30];in le=0;while(a){c[++le]=a%10+48;a/=10;}for(re in i=le;i>=1;--i)putc(c[i],stdout);putc(t,stdout);}

in n,l,r,sum;

in main()

{

	read(n);

	for(re in i=1;i<=n;++i)read(l),read(r),sum+=r-l+1;

	write(sum);

	//freopen(".in","r",stdin);

	//freopen(".out","w",stdout);

}


// Faster C++ solution for the same problem (measured speedup: 5.147402655926052x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main()

{

	int n;

	cin>>n;

	int ans=0;

	int ai,bi;

	for (int i=1;i<=n;i++)

	{

		cin>>ai>>bi;

		ans+=(bi-ai+1);

	}

	cout<<ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.239631898223055x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int ans=0;

	int l,r;

	int n;

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		scanf("%d%d",&l,&r);

		ans+=r-l+1;

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.260833872023501x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int n,x,y,ans=0,i;

	cin>>n;

	for (i=1;i<=n;i++)

	{

		cin>>x>>y;

		ans+=(y-x+1);

	}

	cout<<ans;

}

// Faster C++ solution for the same problem (measured speedup: 5.239631898223055x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n;

int li,ri,ans;

int main()

{

    cin>>n;

    for(int i=1;i<=n;i++)

	{

        cin>>li>>ri;

        ans+=ri-li+1;

    }

    cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.24775445243457x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int main()

{

	int n,sum=0;

	scanf("%d",&n);

	int l,r;

	for(int i=1;i<=n;i++)

	{

		scanf("%d%d",&l,&r);

		sum+=r-l+1;

	}

	printf("%d",sum);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.180046304980723x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int l[100000],r[100000];

int main() {

	int n,i,sum=0;

	cin>>n;

	for(i=0;i<n;i++){

		cin>>l[i]>>r[i];

	}

	for(i=0;i<n;i++){

		sum+=r[i]-l[i]+1;

	}

	cout<<sum;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2396508886263105x):
#include<stdio.h>

int n,r,l,a;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

	scanf("%d%d",&l,&r);

    a+=r-l+1;

	}

    printf("%d\n",a);

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main(){

	int a,i,j,s=0,b;

	cin>>a;

	for(b=1;b<=a;b++){

		cin>>i>>j;

		s=s+(j-i)+1;

	}

	cout<<s;

}

// Faster C++ solution for the same problem (measured speedup: 5.228849391618081x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <algorithm>

using namespace std;



int N,L,R,ans;



int main()

{

	scanf("%d",&N);

	for (int i=1; i<=N; i++)

	{

		scanf("%d %d",&L,&R);

		ans+=R-L+1;

	}

	printf("%d",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.169670690515729x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include <cstdio>

#include <iostream>

#include <cstdlib>

using namespace std;

int main()

{

int n,k,i,j,t;

int a,b;

cin>>n;

t=0;

for (i=1; i<=n; i++)

  {

  cin>>a>>b;

  t=t+b-a+1;

  }

cout<<t<<endl;

return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.235123034928917x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n,a[1005],b[1005],ans=0;

int main()

{

    cin>>n;

    for(int i=0; i<n; i++)

    {    

        cin>>a[i]>>b[i];

        ans+=b[i]-a[i]+1;

    }

    cout<<ans<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.1958206472562285x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include<cmath>

#include<iostream>

using namespace std;

long long ans=0,n,x,y;

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>x>>y;

		ans+=y-x+1;

	}

	cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.232710910415088x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}