Go: package main

import "fmt"

func main() {
	var sTime, fTime, exists, eSTime, eFTime int

	fmt.Scan(&sTime, &fTime)
	fmt.Scan(&exists)

	var flag bool

	for i := 0; i < exists; i++ {
		fmt.Scan(&eSTime, &eFTime)

		if sTime > eSTime && sTime < eFTime {
			flag = true
		}
		if fTime > eSTime && fTime < eFTime {
			flag = true
		}
		if eSTime >= sTime && eFTime <= fTime {
			flag = true
		}
	}

	if flag {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}

C++: #include <iostream>
using namespace std;

int main(){
    int a,b,n;
    cin >> a>> b >> n;
    int ans=0;
    for(int i=0; i<n; i++){
        int s,f;
        cin >> s >> f;
        if((a<s && s<b) || (s<=a && a<f)){
            ans=1;
        }
    }
    cout << ans << endl;
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  int n;
  cin >> n;
  pair <int,int> s[n];
  for(int i = 0;i<n;i++){
    int x,y;
    cin >> x >> y;
    s[i].first = x;
    s[i].second = y;
  }
  sort(s,s+n);
  int f = 0;
  while(s[f].first < a){
    
    f++;
  }
  f--;
  if(s[f].second <= a && s[f+1].first >= b)
    cout << '0'<< endl;
  else
    cout << '1' << endl;
}

C++: #include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

vi a(10000);
int n,l,r;

int main(){
	cin>>l>>r>>n;
	for(int i=0;i<n;i++){
		int L,R;
		cin>>L>>R;
		for(int j=L;j<R;j++) a[j]=1;
	}
	for(int i=l;i<r;i++){
		if(a[i]){
			cout<<1<<endl;
			return 1;
		}
	}
	cout<<0<<endl;
}

C++: #include <iostream>
using namespace std;
int main(){
	int a,b,c,d[1001]={0},m=0;
	cin>>a>>b>>c;
	for (int A=a;A<b;A++)d[A]=1;
	for (int A=0;A<c;A++){
		cin>>a>>b;
		for (int B=a;B<b;B++){
			if (d[B]!=1) d[B]=1;
			else m=1;
		}
	}
	if (m==0) cout<<0<<endl;
	else cout<<1<<endl;
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int main(){
	int a,b;scanf("%d%d",&a,&b);
	int n;scanf("%d",&n);
	rep(i,n){
		int s,f;scanf("%d%d",&s,&f);
		if(!(b<=s||f<=a)){
			puts("1");
			return 0;
		}
	}
	puts("0");
}

C++: #include <iostream>
#include <vector>

using namespace std;

int main(){
    int a;
    int b;
    cin >> a >> b;
    int n;
    cin >> n;
    vector<int> s(n);
    vector<int> f(n);
    for(int i = 0; i < n; i++){
        cin >> s[i];
        cin >> f[i];
    }
    for(int i = 0; i < n; i++){
        if(b > s[i] && a < f[i]){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}

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

int main(){
  int a,b,n,e=0;
  cin>>a>>b>>n;
  for(int i=0;i<n;i++){
    int c,d;
    cin>>c>>d;
    if(a<=c && d<=b){
      e++;
    }else if(a<=c && c<b){
      e++;
    }else if(a<d && d<=b){
      e++;
    }else if(c<=a && b<=d){
      e++;
    }
   
  }
  if(e>0){
    cout<<1<<endl;
  }else{
    cout<<0<<endl;
  }
  return 0;
}

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

int main(){
    int a, b; cin >> a >> b;
    int n; cin >> n;
    bool d = false;
    for(int i = 0; i < n; i++){
        int s,t; cin >> s >> t;
        if(a<s && s<b) d=true;
        if(a<t && t<b) d=true;
        if(a<=s && t<=b) d=true;
        if(s<=a && b<=t) d=true;
    }
    cout << (d ? 1 : 0) << endl;
    return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;

int main() {
	int a, b, N, s, f;
	cin >> a >> b >> N;
	vector<int> tmp(1001);
	for (int i = a; i < b; ++i) ++tmp[i];
	for (int i = 0; i < N; ++i) {
		cin >> s >> f;
		for (int j = s; j < f; ++j) ++tmp[j];
	}
	int i;
	for (i = 0; i < 1001; ++i) {
		if (tmp[i] > 1) break;
	}
	if (i == 1001) cout << 0;
	else cout << 1;
	cout << endl;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
	int a=0;
	int b=0;
	int N=0;
	scanf("%d %d",&a,&b);
	scanf("%d",&N);
if(N!=0)
{
	int s[N]={0};
	int f[N]={0};
	for(int i=0;i<N;i++)
	{
		scanf("%d %d",&s[i],&f[i]);
	}
        
	for(int i=0;i<N;i++)
	{
		if(a>s[i])
		{
		  if(a<f[i])
		  {
			  printf("1\n");
			  break;
		  }
		}
		if(b>s[i])
		{
		  if(b<=f[i])
		  {
			  printf("1\n");
			  break;
		  }
		}
		if(a<=s[i])
		{
			if(b>f[i])
			{
			  printf("1\n");
			  break;
			}
		}
		if(i==N-1){printf("0\n");}
	}
}else{printf("0\n");}

	return 0;
}

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

int main(){
    int A,B,N;
    cin >> A >> B >> N;
    for(int i=0;i<N;i++){
        int a,b;
        cin >> a >> b;
        if(b <= A || a >= B){}
        else{
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}

C++: #include<iostream>
#include<stdio.h>
#include<cstdio>
#include<string>
using namespace std;
int main(){
	int a, b, N;
	int s[1000], f[100];
	int x, y, z;
	
	cin >> a >> b;
	cin >> N;
	
	x = 1;
	y = 1;
	while (x <= N){
		cin >> s[x] >> f[x];
		x + 1;
	}
	while(y <= N){
		if (s[y] < a && f[y] > b){
			cout << "1" << endl;
			break;
		}
		else{
			y++;
			if (y == N){
				cout << "0" << endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int a, b, N, s, f, re=0;
    cin>>a>>b;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>s>>f;
        if(s<=a&&f>=b){
            re=1;
            break;
        }if(s<=a&&a<f){
            re=1;
            break;
        }
        if(i==(N-1)&&a>s&&a<f&&f<b&&a!=f){
            re=1;
            break;
        }
        for(int j=a;j<b;j++){
            if(j==s){
                re=1;
                break;
            }
        }
    }
    if(re==0){
        cout<<"0"<<endl;
    }else{
        cout<<"1"<<endl;
    }
    
}

C++: #include<iostream>
using namespace std ;
int main()
{
	int a=0 , b=0 , N=0 , s=0 , f=0 , A=0 ;
	cin >> a >> b >> N ;
	for(int i=0;i<N;i++)
	{
		cin >> s >> f ;
		if(a<s&&s<b) A=1 ;

		if(s<=a&&a<=f&&s<=b&&b<=f) A=1 ;

		if(a<f&&f<b) A=1 ;
	}
	cout << A << endl ;
	return 0 ;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a, b, N, s[1000] = {}, f[1000] = {},co=0;
	cin >> a >> b >> N;
	for (int i = 0; i < N; i++){
		cin >> s[i] >> f[i];
		if ((s[i]<=a&&f[i]>=b) || (s[i]>=a&&s[i]<=b) || (f[i]>=a&&f[i]<=b) || (s[i]>=a&&f[i] <= b)){
			co++;
		}
	}
	if (co>0){
		co = 1;
	}
	cout << co << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a;
	int b;
	int N;
	int e;
	int r;
	int t;
	cin >> a >> b;
	cin >> N;
	t=0;
	for (int p=0;p<N;p++){
		cin >> e >> r;
		if (b>e){
			if (a<=e){
				t++;
			}else if (a>=e)
				if (a<r)
					t++;
		}
	}
	if (t>0){
		cout << "1" << endl;
	}else if (t==0){
		cout << "0" << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int j=1,i,u,o[15]={0},a,b,n,s[3],f[3];
    cin>>a>>b>>n;
    for(i=a+1;i<=b-1;i++)
    o[i]=1;
    for(i=0;i<3;i++){
        cin>>s[i]>>f[i];
        for(u=s[i]+1;u<=f[i]-1;u++)
        o[i]=0;
    }
    for(i=a+1;i<=b-1;i++){
        if(o[i]==1)
        j=0;
    }
    if(j==1)
    cout<<j;
    else if(j==0)
    cout<<j;
    return 0;
}

C++: #include<stdio.h>
int main()
{
	int i,a,b,n,s,f;
	scanf("%d%d",&a,&b);
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&s,&f);
		if((s<a&&a<f)||(a<s&&b>f)||(s<b&&f>b)){
			printf("1\n");
			return 0;
		}
	}
	printf("0\n");
    return 0;
}