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>
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>
#include <string>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;
int n, m, o, a, b, ans = 0, A[1010], B[1010];
int main() {
	cin >> n >> m >> o;
	rep(i, o) {
		cin >> A[i] >> B[i];
		if (n > A[i] && n < B[i]) ans = 1;
		else if (m > A[i] && m < B[i]) ans = 1;
		else if (n < A[i] && m > B[i]) ans = 1;
		else if (n == A[i] && m < B[i]) ans = 1;
		else if (m == B[i] && n > A[i]) ans = 1;
	}
	cout << ans << endl;
	return 0;
}

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]&&b<f[i]){
      dup = 1;
    }
    if(a>s[i]&&a<f[i]){
      dup = 1;
    }
    if(a<s[i]&&b>f[i]){
      dup = 1;
    }
  }

  cout << dup << endl;

  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<cstdio>
#include<string>
using namespace std;
int main(){
	int a, b, N;
	cin >> a >> b >> N;
	while (N--){
		int s, f;
		cin >> s >> f;
		if (a < s&& f < b){
			cout << 1 << endl;
			abort;
		return 0;
		}
		
	}
	cout << 0 << endl;
	
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

// 1

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

    int i, a, b, n, s, f;
    cin >> a >> b >> n;
    rep(i, n){
        cin >> s >> f;
        if(a < f && b > s){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

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

int main()
{
    int a,b,N;
    cin>>a>>b>>N;
    bool Z=0;
    for(int i=0;i<N;i++)
    {
        int x,y;
        cin>>x>>y;
        if((a<y&&x<b)||(a<y&&x<b))
        Z=1;
    }
    cout<<Z<<endl;
    return 0;
}

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

int main() {
	int a, b, N;
	cin >> a >> b;
	cin >> N;
	vector<int> s(N);
	vector<int> f(N);
	for (int i = 0; i < N; i++)
		cin >> s.at(i) >> f.at(i);

	for (int i = 0; i < N; i++){
		if (a < s.at(i) && s.at(i) < b&&a < f.at(i) && f.at(i) < b){
			cout << '1';
			break;
		}
		if (i == N - 1)
			cout << '0';
	}
}

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

int main() {
    int n;
    int s, t;
    int a, b;
    int f = 0;

    cin >> a >> b;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s >> t;

        if (!(t <= a || b <= s)) {
            f = 1;
        }
    }

    cout << f << endl;
    
    return 0;
}

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

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

int s[101], t[101];
int main(){
	int a, b, n, ans = 0;
	scanf("%d%d%d", &a, &b, &n);
	for(int i = 0;i < n;i++)scanf("%d%d", &s[i], &t[i]);
	for(int i = 0;i < n;i++){
		if(b <= s[i] || t[i] <= a);
		else ans = 1;
	}
	printf("%d\n", ans);
	return 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};

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<stdio.h>
int main()
{
	int i,a,b,n,s,f;
	scanf("%d%d",&a,&b);
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&s,&f);
		if((s<a&&a<f)||(a<s&&b>f)||(s<b&&f>b)||(s<a&&b<f)){
			printf("1\n");
			return 0;
		}
	}
	printf("0\n");
    return 0;
}