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 h[1010] = {0};
    int a, b;
    cin >> a >> b;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int s, f;
        cin >> s >> f;
        for(int j = s; j < f; j++) {
            h[j]++;
        }
    }
    for(int i = a; i < b; i++) {
        if(h[i] > 0) {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    // for(int i = 0; i < 1010; i++) {
    //     cout << h[i] << " ";
    //     if(i % 20 == 0) cout << endl;
    // }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <string.h>
#include <cmath>
#include <set>
#include<list>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int a, b, n;
    cin >> a >> b >> n;
    rep(i, n){
        int s, f;
        cin >> s >> f;
        if(!(b <= s || a >= f)){
            cout << 1 << "\n";
            return 0;
        }
    }
    cout << 0 << "\n";

    return 0;
}

C++: #include<iostream>

using namespace std;



int main(){

    int a,b;

    cin>>a>>b;

    int N;

    cin>>N;

    bool flag=0;

    for(int i=0;i<N;i++){

        int s,f;

        cin>>s>>f;

        if((a<f&&b>s)||(s<b&&f>a))flag=1;

    }

    cout<<flag<<endl;

    return 0;

}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a, b, n;
  cin >> a >> b >> n;
  bool ok = true;
  for(int i = 0; i < n; ++i) {
    int s, f;
    cin >> s >> f;
    
    if((s < a && a < f) || (s < b && b < f) || (a <= s && f <= b)) ok = false;
  }
  if(ok) cout << 0 << endl;
  else cout << 1 << endl;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,n,k[101],l[101],x=0;
    cin>>a>>b>>n;
    for(int i=0;i<=n;i++){
       cin>>k[i]>>l[i];
if(k[i]>a&&l[i]<b){
          x=1;
          break;
       }
    }
    cout<<x<<endl;
    return 0;
}

C++: //============================================================================
// Name        : tokuteigai.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

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

C++: #include<iostream>
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	int n; cin >> n;
	int b00l = 0;
	for (int i = 0; i < n; i++) {
		int c, d; cin >> c >> d;
		if (c < b&&a < d) {
			b00l = 1;
		}
	}
	cout << b00l << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll a,b;cin>>a>>b;
    ll n;cin>>n;
    rep(i,n){
        ll s,t;cin>>s>>t;
        if(s<b&&a<t)dame(1);
    }
    out(0);
}

C++: #include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <queue>
using namespace std;
int main(void){
	int d[1000]={0},a,b,s,t,n,ans=0;
	cin>>a>>b>>n;
	for(int i=0;i<n;i++){
		cin>>s>>t;
		for(int j=s;j<t;j++) d[j]=1;
	}
  
	for(int i=a;i<b;i++){
		if(d[i]==1){
          
			ans=1;
			break;
		}
	}
	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(n != 0){
    if(s[f].second <= a && s[f+1].first >= b)
      cout << '0'<< endl;
    else
      cout << '1' << endl;
  }
  else{
    cout << '0'  << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,n,k[102],l[102],x=0;
    cin>>a>>b>>n;
    for(int i=0;i<=n;i++){
       cin>>k[i]>>l[i];
       if(l[i]<=a){
          x=0;
       }
       else if(b<=k[i]){
          x=0;
       }
       else{
          x=1;
          break;
       }
    }
    cout<<x<<endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
void showResevation(int *arr){
    for(int i=0; i<10; i++){
        cout << arr[i] << " ";
    }
    cout << endl;
}
int main(void){
    int elRes[10] = {};
    int resStart, resEnd;
    cin >> resStart >> resEnd;
    for(int i=resStart-1; i<=resEnd-2; i++){
        elRes[i] = 1;
    }

    int loops, rs, re;
    cin >> loops;
    for(int i=0; i<loops; i++){
        cin >> rs >> re;
        for(int j=rs-1;j<=re-2;j++){
            if(elRes[j] == 1){
                cout << 1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
    return 0;
}