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

const int M=1005;
bool a[M];
int n,l,r;

int main(){
	cin>>l>>r>>n;
	for(int i=0;i<n;i++){
		int L,R;
		cin>>L>>R;
		while(L<R) a[L++]=1;
	}
	for(int i=l;i<r;i++){
		if(a[i]){
			cout<<1<<endl;
			return 1;
		}
	}
	cout<<0<<endl;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
#define INF = 1000000000;
#define LLINF = 1LL << 62;
#define mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int v[1001];
int main() {
    int a, b, n;
    cin >> a >> b >> n;
    int s, f;
    FOR(i, n){
        cin >> s >> f;
        v[s]++, v[f]--;
    }
    FOR(i, 1000)v[i + 1] += v[i];
    int ans = 0;
    for (int i = a; i < b; i++)if (v[i])ans = 1;
    cout << ans << endl;
}

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>
#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;
    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(){
    bool res[1001];
    int a, b, N;
    bool ans = false;

    cin >> a >> b;
    for(int i=a;a<b;a++)
        res[a] = true;

    cin >> N;
    for(int i=0;i<N;i++){
        int s,f;
        cin >> s >> f;
        for(int j=s;j<f;j++){
            if(res[s])
                ans = true;
        }
    }

    cout << ans << endl;

    return 0;
}

C++: #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;


int main(){
  
  int a,b,N;
  cin>>a>>b;
  cin>>N;
  int s[100],f[100];
  for(int i=0;i<N;i++){
    cin>>s[i]>>f[i];
  }
  int judge=0;
  for(int i=0;i<N;i++){
      if(s[i]<=a && f[i]>a){
        judge=judge+1;
      }
      if(s[i]<b && f[i]>=b){
        judge=judge+1;
      }
      if(a<=s[i] && b>s[i]){
        judge=judge+1;
      }
      if(a<f[i] && b>=f[i]){
        judge=judge+1;
      }
  }
  if(judge==0){
    cout<<0<<endl;
  }
  else{
    cout<<1<<endl;
  }
  
 /* int X;
  cin>>X;
  if(X%7==0){
    cout<<"thu"<<endl;
  }
  if(X%7==1){
    cout<<"fri"<<endl;
  }
  if(X%7==2){
    cout<<"sat"<<endl;
  }
  if(X%7==3){
    cout<<"sun"<<endl;
  }
  if(X%7==4){
    cout<<"mon"<<endl;
  }
  if(X%7==5){
    cout<<"tue"<<endl;
  }
  if(X%7==6){
    cout<<"wed"<<endl;
  }
 */
	
	/*int m,f,b;
	cin>>m>>f>>b;
	if(b-m<=0){
		cout<<0<<endl;
	}
	if(b-m>0 && b-m<=f){
		cout<<b-m<<endl;
	}
	if(b-m>0 && b-m>f){
		cout<<"NA"<<endl;
	}*/
	/*int a,b;
	cin>>a>>b;
	cout<<(a+b)/2<<endl;*/
	
	/*random_device rnd;
	mt19937 mt(rnd());
	uniform_int_distribution<> rnd3(1, 3);
	
	string p1, p2, p3, p4;
	cin >> p1 >> p2 >> p3 >> p4;
	
	int t = rnd()%3;
	
	if(t == 0){
		cout << "1:" << p1 << ',' << p2 << endl;
		cout << "2:" << p3 << ',' << p4 << endl;
	}
	if(t == 1){
		cout << "1:" << p1 << ',' << p3 << endl;
		cout << "2:" << p2 << ',' << p4 << endl;
	}
	if(t == 2){
		cout << "1:" << p1 << ',' << p4 << endl;
		cout << "2:" << p2 << ',' << p3 << endl;
	}*/
	
	/*
	switch(type){
		case 0:
			cout << "1:" << p1 << ',' << p2 << endl;
			cout << "2:" << p3 << ',' << p4 << endl;
			break;
		case 1:
			cout << "1:" << p1 << ',' << p3 << endl;
			cout << "2:" << p2 << ',' << p4 << endl;
			break;
		case 2:
			cout << "1:" << p1 << ',' << p4 << endl;
			cout << "2:" << p2 << ',' << p3 << endl;
			break;
	}
	*/
	
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a, b, n, i, z = 0;
	int x[100], y[100];
	cin >> a >> b >> n;
	for (i = 0; i < n; i++){
		cin >> x[i] >> y[i];
		if (x[i] < a&&y[i] > a){
			z = 1;
		}
		if (x[i] < b&&y[i] > b){
			z = 1;
		}
	}
	cout << z << endl;
	return 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;
}