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<vector>
#include<cmath>
#define _GLIBCXX_DEBUG
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(){
  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<stdio.h>
int main(void)
{
	int a,b,n,a1,b1;
	int i,j,flg;
	scanf("%d %d %d",&a,&b,&n);
	flg=0;
	for(i=0;i<n;i++){
		scanf("%d %d",&a1,&b1);
		if(a<a1&&b>b1) flg=1;
	}
	printf("%d\n",flg);
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,n;
    cin>>a>>b>>n;
    int c[1000]={};
    for(int i=0;i<n;i++){
       int d,e;
       cin>>d>>e;
       for(int j=d;j<e;j++){
          c[j]=1;
       }
    }
    for(int i=a;i<b;i++){
       if(c[i]!=1){}
       else{
           cout<<1<<endl;
           goto loop;
       }
    }
    cout<<0<<endl;
    loop:;
    return 0;
}

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

using namespace std;

int schedule[1024];

bool check(int a, int b) {
    for (int i = a; i < b; i++) {
        if (schedule[i] != 0) return false;
    }
    return true;
}

int main() {
    int a, b;
    int N;
    cin >> a >> b;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int s, f;
        cin >> s >> f;
        schedule[s]++;
        schedule[f]--;
    }

    for (int i = 1; i < 1024; i++) {
        schedule[i] += schedule[i-1];
    }
    puts(check(a, b) ? "0" : "1");

    return 0;
}

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,c[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 <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,N,s[105],f[105];
	cin >> a>>b>>N;
	for (int i = 0; i < N; i++){
		cin >> s[i] >> f[i];
		if (f[i]>a&&s[i]<b){
			cout << 1; 
			return 0;
		}
		
	} 
	cout << 0;
	return 0;
}

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

int main(){
  int a,b,n,t=0;
  cin >> a >> b >> n;
  for(int i=0; i<n*2; i=i+2){
    int num,num2;
    cin >> num >> num2;
    if(num<a&&num2>a){
      t=1;
    }
    if(num<b&&num2>b){
      t=1;
    }
    if(num==a&&num2==b)t=1;
    if(a<num&&b>num2)t=1;
  }
  cout << t << endl;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int a,b;
    cin>>a>>b;
    int N;cin>>N;
    rep(i,N){
        int l,r;
        cin>>l>>r;
        if(r<=a||b<=l)continue;
        cout<<1<<endl;
        return 0;
    }
    cout<<0<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int a, b; scanf("%d%d", &a, &b);
	int n; scanf("%d", &n);
	std::vector<int> latte(1000, 0);
	while(n--) {
		int l, r; scanf("%d%d", &l, &r);
		
		for(int i = l; i < r; i++) latte[i] = 1;
	}
	
	bool ans = false;
	for(int i = a; i < b; i++) ans |= latte[i];
	printf("%d\n", ans);	
	return 0;
}

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

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

int main()
{
	int a, b, n;
	int g = 0;

	cin >> a >> b >> n;

	for (int i = 0; i < n; i++) {
		int s, f;
		cin >> s >> f;
		if (!(s >= b || f <= a))
			g = 1;
	}

	cout << g << endl;
	
	return 0;
}

C++: #include <stdio.h>

int main(){
  int a, b, n, i, j;
  scanf("%d%d%d",&a,&b,&n);
  int s[n],f[n];
  bool used[1024];
  for (i = 0; i < 1024; i++) used[i] = false;
  for (i = 0; i < n; i++) {
    scanf("%d%d",&s[i],&f[i]);
    for (j = s[i]; j < f[i]; j++) used[j] = true;
  }
  for (i = a; i < b; i++) {
    if(used[i]) {printf("1\n");
    return 0;}
  }
  printf("0\n");
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,N;
    cin >> a >> b ;
    cin >> N;
    int s[N],f[N];
    for (int i=0; i<N; i++){
        cin >> s[i] >> f[i];
    }
    bool tyohuku=false;
    for (int i=0; i<N; i++){
        if(b>s[i] && f[i]>a){
            tyohuku=true;
        }
    }
    if(tyohuku){
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
    int a,b,n;
    cin >>a >>b >>n;
    vector<vector<int>> vec(n,vector<int>(2));
    for(int i=0;i<n;i++){
        cin>>vec.at(i).at(0)>>vec.at(i).at(1);
    }
    vector<int> cat(1000,0);
    for(int i=0;i<n;i++){
        cat.at(vec.at(i).at(0)-1) ++;
        cat.at(vec.at(i).at(1)-1) --;
    }
    cat.at(a-1) ++;
    cat.at(b-1) --;
    vector<int> rsw(1001);
    rsw.at(0) =0;
    for(int i=1;i<1001;i++){
        rsw.at(i) = rsw.at(i-1) + cat.at(i-1);
        if(rsw.at(i)==2){
            cout <<1;
            break;
        }else if(i==1000){
            cout <<0;
        }
    }
    cout << endl;
    
}