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

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 0;
		}
	}
	cout<<0<<endl;
}

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

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int N;
  cin >> N;
  int ans = 0;
  FOR(i,0,N){
    int s, f;
    cin >> s >> f;
    if(!(b <= s || a >= f)) ans = 1;
  }
  cout << ans << endl;
}

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

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

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

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};

int main(){
    int a, b; cin>>a>>b;
    vector<bool> v(1010, false);
    for(int i=a; i<b; i++){
        v[i] = true;
    }

    int n; cin>>n;
    int ans = 0;
    for(int i=0; i<n; i++){
        int s, f; cin>>s>>f;
        for(int j=s; j<f; j++){
            if(v[j]) ans = 1;
        }
    }

    cout << ans << endl;
}

C++: #include<iostream>
#include<algorithm>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    int a,b,n;
    bool ok=true;
    cin>>a>>b>>n;
    lol(i,n){
	int x,y;cin>>x>>y;
	if(a<=x&&x<b)ok=false;
	if(a<y&&y<=b)ok=false;
	if(x<=a&&b<=y)ok=false;
    }
    cout<<1-ok<<endl;
    return 0;
}

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

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

typedef long long ll;
using namespace std;

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

	int a,b; cin >> a >> b;
	bool flag[1005];
	memset(flag,0,sizeof(flag));
	int n; cin >> n;
	for (int i = 0;i < n;i++){
		int s,f; cin >> s >> f;
		for (int j = s;j < f;j++){
			flag[j] = true;
		}
	}

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

	cout << 0 << endl;

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

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

int a,b;
int n,ans,s,f;

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

	cin>>a>>b>>n;
	REP(i,n) {
		cin>>s>>f;
		if((s<=a&&f>a)||(s<b&&f>=b)||(a<=s&&f<=b)) ans++;
	}
	cout<<min(1,ans)<<endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int a,b,x[1001],n,sum,flag;
int main(){
	cin>>a>>b>>n;
	x[a]++;
	x[b]--;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		x[a]+=2;
		x[b]-=2;
	}
	for(int i=0;i<1001;i++){
		sum+=x[i];
		if(sum>1&&sum%2)flag++;
	}
	cout<<(flag?1:0)<<endl;
}