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 <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

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

C++: #include<iostream>
using namespace std;
 
bool overlap(int a, int b, int c, int d){
  if ( d <= a ) return false;
  if ( b <= c ) return false;
  return true;
}
 
int main(void){
  int a, b, s, f, n;
  cin >> a >> b >> n;
  for ( int i = 0; i < n; i++ ){
    cin >> s >> f;
    if ( overlap(a, b, s, f) ){
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}

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

int main() {
  int a, b, n, s, f, t[1001] = {0};

  cin >> a >> b >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s >> f;
    t[s] = 1;
    t[f] = 3;
    for (int j = s + 1; j < f; ++j) {
      t[j] = 2;
    }
  }
  for (int i = 0; i <= 10; ++i) cout << t[i];
  cout << endl;
  if (t[a] != 2 && t[b] != 2) {
    for (int i = a + 1; i < b; ++i) {
      if (t[i] != 0) {
        cout << "1" << endl;
        return 0;
      }
    }
    cout << "0" << endl;
    return 0;
  }
  cout << "1" << endl;
}

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

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

  int N;
  cin >> N;

  int s[100], f[100];
  for(int i=0; i<N; i++){
    cin >> s[i] >> f[i];
  }

  int dup = 0;
  for(int i=0; i<N; i++){
    if(b<=s[i] || a>=f[i]){
      dup++;
    }
  }
  
  if(dup==N){
    cout << 0 << endl;
  }
  else{
    cout << 1 << endl;
  }

  return 0;
}

C++: #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;

int a,b;
int N;
int A[1000];
int main(void)
{
	fill(A,A+1000,0);
	cin>>a>>b;
	cin>>N;
	for(int i=0;i<N;i++){
		int k,s;
		cin>>k>>s;
		for(int q=k;q<s;q++){
			A[q]=1;
		}
	}
	for(int i=a;i<b;i++){
		if(A[i]==1){
			cout<<1<<endl;
			break;
		}
		if(i==(b-1)){
			cout<<0<<endl;
		}
	}

	


	return 0;
}

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

bool filled[1005];
int main() {
  int a, b, N;
  cin >> a >> b >> N;
  for(int i=0; i<1005; i++) filled[i]=false;
  for(int i=0; i<N; i++){
    int s, f;
    cin >> s >> f;
    for(int j=s; j<f; j++) filled[j]=true;
  }
  int ans=0;
  for(int i=a; i<b; i++){
    if(filled[i]) ans=1;
  }
  cout << ans << endl;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int a,b;
  int n;
  cin>>a>>b>>n;
  int dp[1010]={};
  for(int i=0;i<n;i++){
    int s,f;
    cin>>s>>f;
    for(int i=s;i<=f;i++)
      dp[i]=1;
  }
  int flag=1;
  for(int i=a;i<b;i++)
    if(dp[i]){
      flag=0;
      break;
    }
  if(flag)
    cout<<1<<endl;
  else
    cout<<0<<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"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

vector<string>sts{

"mon"
,"tue"
, "wed"
, "thu"
, "fri"
, "sat"
, "sun"
};

int main() {	
	int a,b;cin>>a>>b;
	int N;cin>>N;
	vector<int>oks(1010);
	for (int i = 0; i < N; ++i) {
		int l,r;cin>>l>>r;
		for (int j = l; j < r; ++j) {
			oks[j]=true;
		}
	}
	bool ans=true;
	for (int j = a; j < b; ++j) {
		if(oks[j])ans=false;
	}
	if (ans) {
		cout<<0<<endl;
	}
	else {
		cout<<1<<endl;
	}
}

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


int main()
{
    int a,b,N,t=1;
    cin>>a>>b>>N;
    
    int s[N],f[N];
    int p[1001];
    int c[1001];
    loop(1000)p[i]=0,s[i]=0;
    
    loop(N){
        cin>>s[i]>>f[i];
        p[s[i]]+=1;
        p[f[i]]-=1;
    }
    p[a]+=1;
    p[b]-=1;
    if(c[0]==2){
    cout<<1<<endl;
    t=0;
    }
    loop(1000){
    c[i+1]=c[i]+p[i];
    if(c[i+1]==2){
    cout<<1<<endl;
    t=0;
    break;
    }
    }
    if(t==1)cout<<0<<endl;
}

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

C++: 
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int i = 0; i < (n); i++)

template <class T = int>
T in() { T x; std::cin >> x; return x; }
#define output(e) std::cout << e << '\n'

#ifdef LOCAL
#define db std::cout << "L" << __LINE__
#define de << "\n"
#define dv(x) << " " << #x << "->" << x
#else
#define db
#define de
#define dv(x)
#endif

//
// Implementation
//

int main() {
  int a = in();
  int b = in();
  int N = in();

  rep(i, N) {
    int s = in();
    int e = in();
    if (e > a && s < b) {
      output("1");
      return 0;
    }
  }
  output("0");
}

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

using namespace std;

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