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>
using namespace std;

int main()
{
	int i, a, b, N, s[100], f[100], F = 0;
	cin >> a >> b;
	cin >> N;
	for (i = 0; i<N; i++) { cin >> s[i]; cin >> f[i]; }
	for (i = 0; i<N; i++) {
		if (s[i]<a && a<f[i]) {
			F = 1;
		}
		else if (s[i]<b && b<f[i]) {
			F = 1;
		}
		else if (a <= s[i] && f[i] <= b) {
			F = 1;
		}
	}
	cout << F << endl;
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define rrep(i,n) for(int i = n-1;i >=0;i--)
#define ALL(a) a.begin(),a.end()
#define PI  acos(-1)
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 }, sum = 0,h,w;
int main() {
    int n,A,B,x,y; cin >>A>>B>> n;
    vector<int> a(1010, 0);
    rep(i, n) {
        cin >> x >> y;
        for (int j = x; j < y; j++)a[j]++;
    }for (int j = A; j < B; j++)a[j]++;
    rep(i, 1005) {
        if (a[i] > 1) {
            cout << 1 << endl;
            return 0;
        }
    }cout << 0 << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans, cnt, mx, mn;
string s, t;
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};
string alphabet = "abcdefghijklmnopqrstuvwxyz";

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> a >> b >> n){
        rep(i, n){
            cin >> x >> y;
            if(x < b && y > a){
                print(1);
                return 0;
            }
        }
        print(0);
    }
}

C++: #include<algorithm>
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
int main(void){
	int a,b,N,s,f,ans=0;
	cin>>a>>b>>N;
	for(int i=0;i<N;i++)
	{
		cin>>s>>f;
		if(a<=s&&s<b)
		{
			ans=1;
		}
		if(a<f&&f<=b)
		{
			ans=1;
		}
		if(s<=a&&a<f)
		{
			ans=1;
		}
		if(s<b&&b<=f)
		{
			ans=1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

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

    int a, b, N;
    cin >> a >> b >> N;
    vector<int> s(N), f(N);
    REP(i, N) cin >> s[i] >> f[i];

    REP(i, N)
    {
        FOR(j, s[i], f[i])
        {
            if(a <= j && j < b)
            {
                cout << 1 << endl;
                return 0;
            }
        }
    }

    cout << 0 << endl;

    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int a,b,n;
	cin >> a >> b >> n;
	for(int i=0; i<n; i++){
		int s,f;
		cin >> s >> f;

		if(a>=s && a<f){
			cout << 1 << endl;
			return 0;
		}
		if(b>s && b<=f){
			cout << 1 << endl;
			return 0;
		}
		
	}
	cout << 0 << endl;
	return 0;
}

C++: #include<iostream>
#include<stdbool.h>
using namespace std;
int main(){
  int a,b;
  int n;
  cin>>a>>b;
  cin>>n;
  bool flag=false;
  for(int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    if((a<x&&x<b)||(a<y&&y<b)||(x<=a&&b<=y)){
      flag=true;
    }
  }
  if(flag){
    cout<<1<<endl;
  }else{
    cout<<0<<endl;
  }
  return(0);
}

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

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