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<set>
using namespace std;
#include<iostream>
int	main(){

/*	int N, C, c[100], n;
	cin >> N;
	C = 0;
	n = 0;

	for (int i = 0; i <N; i++ ){
		cin >> c[i];
		C+= c[i];
	}

	for (int i = 0; i <N; i++ ){
		if (c[i] <= 0.1*C){
			n+= 30;
		}
	}
	cout << n << endl;
}
	/*
	while(true){
	
	int A,B,C,D,E,F,G,H,I,J,answer;
		
	cin >> A;
	if(A == 0) return 0;
	cin >> B >> C >> D >> E >> F >> G >> H >> I >> J;
	answer = A - B - C - D-E-F-G-H-I-J;
	cout << answer << endl;

	}
	*/
	/*
	int A,B,C,D,E,F;

	cin >> A, B, C, D;
	if(A < B, C, D){ 
		cout << B + C + D << endl;
	}
	
	else if(B < A, C, D){
		cout << A + C + D << endl;
	}

	else if(C < A && C < B && C < D){
		cout << A + B + D << endl;
	}

	else if(D < A && D < B && D < C){
		cout << A + B + C << endl;
	}

	if(E < F){
		cout << F << endl;
	}

	else{
		cout << E << endl;
	}
	
	return 0;
}*/
	/*
	int N, M;
	cin >> N >> M;
	cout << N + M << endl << N - M << endl << N * M << endl << N / M << endl;
}*/

/*int N, M; 
	cin >> N >> M;
	cout << N % M << endl;
}*/

/*	int N;
	cin >> N;
	cout << -(N % 2)+1 ;
}*/

	/*int A, B, C, D, E ;
	cin >> A >> B >> C >> D >> E;
	cout << (A + B + C + D + E) / 5 ;
}*/

	/*int A, B, C, D ;
	cin >> A >> B >> C >> D;
	cout << (A + B + C + D) / 60 << endl << (A + B + C + D) % 60 << endl;
	*/

/*	int A,B;
	cin >> A >> B;
	cout << ( A + B ) / 2 << endl;*/

/*	int m, f, b;
	cin >> m >> f >> b;

	if ( m + f >= b && m <= b ){
		cout << b - m << endl;
	}
	
	if ( m + f > b && m > b ){
		cout << 0 << endl;
	}


	if ( m + f < b ){
		cout << "NA" << endl;
	}*/

/*	int X , x ;
	cin >> X ;

	x = X % 7 ;

	if ( x == 2 ){
		cout << "sat" << endl;
	}

	if ( x == 3 ){
		cout << "sun" << endl;
	}

	if ( x == 4 ){
		cout << "mon" << endl;
	}

	if ( x == 5 ){
		cout << "tue" << endl;
	}

	if ( x == 6 ){
		cout << "wed" << endl;
	}

	if ( x == 0 ){
		cout << "thu" << endl;
	}

	if ( x == 1 ){
		cout << "fri" << endl;
	}*/

	int a , b , N ;
	cin >> a >> b >> N ;

	int s[100] , f[100];
	for ( int i=0 ; i<N ; i++ ){
		cin >> s[i] >> f[i];
	
		if (( s[i] <= a && a < f[i]) || s[i] < b && b <= f[i] || s[i] >= a && f[i] <= b ){
			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 s,f;
  int ans[1000];
  for(int i=0;i<N;i++){
    cin >> s >> f;
    if(s==b || f==a){
      ans[i] = 0;
    }else if(f-s==1 && s<=a && f>=b){
      ans[i] = 1;
    }else{
      for(int j=s+1;j<f;j++){
        if(f-s != 1){
          ans[j] = 1;
        }
      }
    }
  }

  int an=0;

  for(int i=a;i<=b;i++){
    if(ans[i]==1){
      an++;
    }
  }

  if(an>0){
    cout << '1' << endl;
  }else{
    cout << '0' << endl;
  }

  return 0;
}

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

int main(){
    short a,b,n;
    cin>>a>>b>>n;
    bool R[10001];
    for(int i=0;i<=10001;i++){
        R[i]=false;
    }
    for(int i=1;i<=n;i++){
        short s,f;
        cin>>s>>f;
        for(int j=s+1;j<=f-1;j++){
            R[j]=true;
        }
    }
    for(int i=a;i<=b;i++){
        if(R[i]==true){
            cout<<1<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
	return 0;	
}

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

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

C++: #include <iostream>
using namespace std;
int main(){

  int ab[1000]={},n,a,b,r=0;
  cin>>a>>b>>n;
  for(int i=a;i<b;i++) ab[i]++;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    for(int i=a;i<b;i++) ab[i]++;
  }
  for(int i=0;i<1000;i++) if(ab[i]>1) r++;
  if(r) cout<<1<<endl;
  else cout<<0<<endl;


}

C++: /*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int a,b,n,s,f,t[1005]={};
  cin >> a >> b >> n;
  for(int i=0; i<n; i++) {
    cin >> s >> f;
    t[s]++,t[f]--;
  }
  for(int i=1; i<1005; i++) {
    t[i]+=t[i-1];
  }
  for(int i=a; i<b; i++) {
    if(t[i]>0) {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}

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&&b<=f[i]){
			co++;
		}
		else if (a<=s[i]&&s[i]<b){
			co++;
		}
		else if (a<f[i] && f[i] <= b){
			co++;
		}
		else if (a < s[i] && f[i]<b){
			co++;
		}
	}
	if (co>0){
		co = 1;
	}
	cout << co << endl;
	return 0;
}

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

int main()
{
	int sta,end,n;
	cin >> sta >> end >> n;

	bool jud = true;
	int tsta,tend;
	for(int i=0;i<n;i++){
		cin >> tsta >> tend;
		if(!((sta<=tsta&&end<=tend)||(sta>=tend&&end>=tend))){
			jud = false;
                        break;
		}
	}

	if(jud){
		cout << 0 ;
	}else{
		cout << 1 ;
	}

	return 0;
}

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

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

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong a,b,N;
	bool check[1001] = {false};

	cin >> a >> b >> N;
	int s,f;
	for(int i = 0; i < N; i++){
		cin >> s >> f;
		for(int j = s; j < f; j++)
			check[j] = true;
	}

	bool ok = false;
	for(int i = a; i < b; i++)
		if(check[i])
			ok = true;

	cout << ok << endl;

	return 0;
}