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 <iostream>
#include <algorithm>
#include <vector>
using namespace std;

template<class like_bool> inline void YES(like_bool condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class like_bool> inline void Yes(like_bool condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class like_bool> inline void POSS(like_bool condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class like_bool> inline void Poss(like_bool condition){ if(condition)cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class like_bool> inline void First(like_bool condition){ if(condition)cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

int main(){
    int a, b, N;
    cin >> a >> b >> N;
    vector<int> use(1010, 0);
    for(int i = 0; i < N; i++){
        int s, f;
        cin >> s >> f;
        for(int j = s; j < f; j++){
            use[j]++;
        }
    }
    for(int i = a; i < b; i++){
        if(use[i]){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}

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

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