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 {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)
	}
}

		fmt.Println(0)
	}
}

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};

const int M=1005;
bool a[M];
int n,l,r;

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int a,b;
	int n;
	int s,f;
	int flg;
	int i;
	
	cin>>a>>b>>n;
	
	flg=0; //重複しない
	for(i=0;i<n;i++){
		cin>>s>>f;
		if(flg==1) continue;
		if((a>=s&&b<=f)||(a<=s&&b>=f)||(a>s&&a<f)||(b>s&&b<f)){
			flg=1; //重複する
			//cout<<"i="<<i<<endl;
		}
		//sとfの間にaかbがあれば重複する
	}
	
	if(flg==0) cout<<"0"<<endl;
	else cout<<"1"<<endl;
	
	return 0;
}

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



int main(){

  int a[10000]={};
  int n,s,l;
  cin>>s>>l;
  a[s]++;
  a[l]--;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s>>l;
      a[s]++;
      a[l]--;
  }

  bool j=true;
  int count=0;
  for(int i=0;i<1010;i++){
    count+=a[i];
    if(count>1){j=false; break;}
  }
  if(j){cout<<"0"<<endl;}
  else{cout<<"1"<<endl;}
  

  
  return 0;
}

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

int main(){
    bool times[1001];
    int a, b, n;
    cin >> a >> b >> n;

    for(int i=0;i<n;i++){
        int s, f;
        cin >> s >> f;
        for(int j=s;j<f;j++)
            times[j] = true;
    }

    bool reserve = false;
    for(int i=a;i<b;i++){
        if(times[i])
            reserve = true;
    }

    cout << reserve << endl;
    return 0;
}

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

int main(){
    int a,b,n;
    cin >> a >> b >> n;

    bool time[1001];

    for(int i=0;i<=1000;i++){
        time[i] = true;
    }

    for(int i=0;i<n;i++){
        int s,f;
        cin >> s >> f;
        for(int j=s;j<f;j++){
            time[j] = false;
        }
    }

    for(int i=a;i<b;i++){
        if(!time[i]){
            cout << 1 << endl;
            return 0;
        }
    }

    cout << 0 << endl;
}

C++: #include<set>
#include<iostream>
#include<ctime>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<random>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<functional>
#include<string.h>
#include<limits.h>
using namespace std;

signed main() {
	int a, b, n; cin >> a >> b >> n;
	for (int i = 0; i < n; i++) {
		int c, d; cin >> c >> d;
		int e = min(b, d) - max(a, c);
		if (e > 0) { puts("1"); return 0; }
	}
	puts("0");
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
/*int p = 998244353;*/
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define end_pr(s) cout << s <<endl;return 0
signed main(){
	int lim = 10000;
	int a, b; cin >> a >> b;
	int n; cin >> n;
	rep(ind, n) {
		int s, f; cin >> s >> f;
		if (f <= a || b <= s) { f++; f--; }
		else {
			cout << 1 << endl; return 0;
		}
	}
	cout << 0 << endl;
}

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

template<class like_bool> inline void YES(like_bool condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class like_bool> inline void Yes(like_bool condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class like_bool> inline void POSS(like_bool condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class like_bool> inline void Poss(like_bool condition){ if(condition)cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class like_bool> inline void First(like_bool condition){ if(condition)cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

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

C++: #include <iostream>
using namespace std;
int main(){
  int a,b,n,s,f,i=0;
  cin >> a >> b >> n;
  do{
    cin >> s >> f;
    i++;
  }while((a != s && b != f) && (s <= a || s >= b) && (f <= a || f >= b) && i<=n);
  if(n == i-1){
    cout << '0' << endl;
  } else {
    cout << '1' << endl;
  }
}