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

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <bitset>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;


int main(){
    vector<int> v(1001,0);
    int a,b;
    cin>>a>>b;
    v[a]++; v[b]--;
    int n;cin>>n;
    rep(i,0,n){
        int x,y;
        cin>>x>>y;
        v[x]++; v[y]--;
    }
    
    rep(i,1,1001){
        v[i]+=v[i-1];
        if(v[i]>1 || v[0]>1){
            cout<<1<<endl;
            return 0;
        }
    }
    
    cout<<0<<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);
    }
    for(int i=0;i<1001;i++){
        if(rsw.at(i) == 2){
            cout << 1 << endl;
            break;
        }else if(i==1000){
            cout << 0 << endl;
        }
    }


}

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<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<bitset>
#include <cstdio>
#include <cmath>

using namespace std;

typedef long long ll;
#define put(n) cout<<(n)<<"\n"
#define FOR(i,num,N) for(int(i)=(num);(i)<(N);++(i))
#define RFOR(i,num,N) for(int (i)=(num);(i)>(N);--(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()

int A,B,N,S,F;
vector<bool> sub(1001,false);
vector< pair<int,int> > n;
void dfs(int s,int f){
    FOR(i,s+1,f) sub[i] = true;
    FOR(i,0,N){
        if(n[i].first == f) dfs(f,n[i].second);
    }

}

int main(){
    cin>>A>>B>>N;
    n.resize(N);
    FOR(i,0,N){
        cin>>n[i].first>>n[i].second;
    }
    sort(n.begin(),n.end());
    FOR(i,0,N) dfs(n[i].first,n[i].second);
    FOR(i,A,B+1){
        if(sub[i]){
            cout<<1<<endl;
            return 0;
        } 
    }
    cout<<0<<endl;
}

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

#define FOR( i, m, n )   for( int i = m; i < n; i++ )
#define REP( i, n )      FOR( i, 0, n )
#define ALL( a )         (a).begin(), (a).end()

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

  vector<int> s( n );
  vector<int> f( n );

  REP( i, n ){
    cin >> s[i] >> f[i];
    if( ( s[i] <= a && f[i] >= b ) || ( s[i] == a && f[i] > a ) || ( s[i] < b && f[i] == b ) || ( s[i] > a && s[i] < b ) || ( f[i] > a && f[i] < b ) ){
      cout << 1 << endl;
      return 0;
    }
    
  }
  cout << 0 << endl;
}

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

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

  int N;
  cin >> N;

  int s,f;
  int ans[1000];
  for(int i=0;i<N;i++){
    cin >> s >> f;
    for(int j=s;j<=f;j++){
      if(j==s){
        ans[j]=2;
      }else if(j==f){
        ans[j]=3;
      }else{
        ans[j]=1;
      }
    }
  }

  int an=0;
  for(int i=a;i<=b;i++){
    if(ans[i]==1){
      an++;
    }
  }

  if(an>0){
    cout << '1' << endl;
  }else{
    cout << '0' << endl;
  }


  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int a,b,n,s,f,i=0;
  cin >> a >> b >> n;
  while(1){
    cin >> s >> f;
    i++;
    if((a == s && b == f) || (s > a && s < b) || (f > a && f < b)){
      cout << '1' << endl;
      break;
    }
    if(++i == n-1){
      cout << '0' << endl;
      break;
    }
  }
}

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

int main(){
    int a,b;
    cin >> a >> b;
    int n;
    cin >> n;
    int frg=0;
    for(int i=0;i<n;i++){
        int s,f;
        cin >> s >> f;
        if((s<a&&a<f)||(s<b&&b<f)){
            frg=1;
            break;
        }
    }
    cout << frg << endl;
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;

int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c;
	for (int i = 0; i < c; ++i) {
		cin >> d >> e;
		if (d < b&&a < e) {
			cout << 1 << endl;
			return 0;
		}
	}
	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;
	}
	cout << ans << endl;
	return 0;
}