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>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

int main()
{
	int a, b;
	cin >> a >> b;
	int n;
	cin >> n;
	pair<int, int> s;
	bool flag = true;
	REP(i, n){
		cin >> s.first >> s.second;
		if (s.first <= a && a < s.second) flag = false;
		else if (s.first < b && b <= s.second) flag = false;
		else if (a <= s.first && s.second <= b) flag = false;
	}

	if (flag) cout << 0 << endl;
	else cout << 1 << 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(){
  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<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int a,b;
  int n;
  cin>>a>>b>>n;
  int dp[1010]={};
  for(int i=0;i<n;i++){
    int s,f;
    cin>>s>>f;
    for(int j=s;j<=f;j++)
      dp[i]=1;
    dp[s]=2;
    dp[f]=3;
  }
  int flag=1;
  //cout<<flag<<endl;
  for(int i=0;i<1010;i++){
    if(dp[i]==2){
      while(dp[i+1]==1){
	i++;
	dp[i]=1;
      }
      dp[i+1]=3;
    }
  }
  for(int i=a;i<=b;i++)
    if(dp[i]==1){
      flag=0;
      break;
    }
  /*for(int i=0;i<1010;i++)
  cout<<dp[i]<<" ";
  cout<<endl;*/
  if(flag==0)
    cout<<1<<endl;
  //  else if(dp[a]==3)
  //cout<<0<<endl;
  //else if(dp[b]==2)
  //cout<<0<<endl;
  else 
    cout<<0<<endl;
  return 0;
}

C++: #include <iostream>

using namespace std;

int main ()
{
	long a,b,n,aa[100],bb[100];

	cin >> a >> b >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> aa[i] >> bb[i];
	}

	for (int i = 0; i < n; i++)
	{
		if (aa[i] <= a && bb[i] > a)
		{
			cout << '1' << endl;
			break;
		}
		else if (aa[i] < b && bb[i] >= b)
		{
			cout << '1' << endl;
			break;
		}
		else if (a <= aa[i] && bb[i] <= b)
		{
			cout << '1' << endl;
			break;
		}
		else if (i == n - 1)
		{
			cout << '0' << endl;
		}
	}
}

C++: #include<stdio.h>
int main(){
int a,b,n,w[1001]={0},s,f,x=0;
scanf("%d%d%d",&a,&b,&n);
w[a]++;
w[b]--;
for(int i=0;i<n;i++){
scanf("%d%d",&s,&f);
w[s]++;
if(x<f)x=f;
w[f]--;
}
int k=0;
for(int i=0;i<=x;i++){
k+=w[i];
if(k>1){
printf("1\n");
break;
}
if(i==x)printf("0\n");
}
return 0;
}

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

using namespace std;

int N;

int main() {
	int a, b, s, f;

	cin >> a >> b >> N;
	for (int i = 0; i < N; ++i) {
		cin >> s >> f;
		if (a>=f || b<=s) {
			continue;
		}
		cout << "1" << endl;
		return 0;
	}
	cout << "0" << endl;
	
	return 0;
}

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;i<b;i++)
        res[i] = 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[j])
                ans = true;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  int a, b, N;
  cin >> a >> b >> N;
  int ans=0;
  for(int i=0; i<N; i++){
    int s, f;
    cin >> s >> f;
    if(s < b && a < f) ans=1;
  }
  cout << ans << endl;
}

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

// #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
// #define FORR(i, a, b) for (int i = (a); i > (b); --i)
// #define REP(i, n) for (int i = 0; i < (n); ++i)
// #define REPR(i, n) for (int i = n; i >= 0; i--)
// #define FOREACH(x, a) for (auto &(x) : (a))
// #define VECCIN(x)            \
// 	for (auto &youso_ : (x)) \
// 	cin >> youso_
// #define mp make_pair
// #define bitcnt __builtin_popcount
// #define All(a) (a).begin(), (a).end()
// template <typename T = long long>
// inline T IN()
// {
// 	T x;
// 	cin >> x;
// 	return (x);
// }
// inline void CIN() {}
// template <class Head, class... Tail>
// inline void CIN(Head &&head, Tail &&... tail)
// {
// 	cin >> head;
// 	CIN(move(tail)...);
// }
// #define CINT(...)    \
// 	int __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define LCIN(...)   \
// 	ll __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define SCIN(...)       \
// 	string __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define Yes(a) cout << (a ? "Yes" : "No") << "\n"
// #define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
// typedef vector<int> V;
// typedef vector<ll> VL;
// typedef pair<int, int> P;
// typedef pair<ll, ll> PL;
// typedef priority_queue<int> PQ;
// typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int a, b;
int n;
vector<ll> sum;

int main()
{
	cin >> a >> b >> n;
	sum.resize(1001);
	for (int i = 0; i < n; i++)
	{
		int s, f;
		cin >> s >> f;
		sum[s]++;
		sum[f]--;
	}
	for (int i = 0; i < 1001; i++)
	{
		sum[i + 1] += sum[i];
	}
	for (int i = a; i < b; i++)
	{
		if (sum[i] > 0)
		{
			cout << 1 << "\n";
			return 0;
		}
	}
	cout << 0 << "\n";
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main (){
int a,b;
int n;
cin >> a >> b >> n;
int s[200],t[200],x[2000];
x[a]=1;
x[b+1]=-1;
for(int i=1;i<=n;i++){
    cin >> s[i] >> t[i];
    x[s[i]]=1;
    if(a>=s[i]&&a<t[i]){
        cout << 1 << endl;
        return 0;
    }
}
for(int i=a+1;i<b;i++){
   
     if(x[i]==1){
        cout << 1 << endl;
        return 0;
    }
   
   
}
cout << 0 << endl;
    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
bool func(vector<int> &check){
	int N;
	cin>>N;
	for(int i=0;i<N;++i){
		int a,b;
		cin>>a>>b;
		for(int i=a;i<b;++i){
			if(check[i]){
				return false;
			}
		}
	}
	return true;
}
int main(){
	int a,b;
	cin>>a>>b;
	vector<int> check(1001,false);
	for(int i=a;i<b;++i){
		check[i]=true;
	}
	cout<<(func(check)?0:1)<<endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a, b, n;
    cin >> a >> b >> n;
    for (int i = 0; i < n; ++i) {
        int c, d;
        cin >> c >> d;
        if(max(a, c) < min(b, d)) {
            puts("1");
            return 0;
        }
    }
    puts("0");
    return 0;
}