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

C++: #include<bits/stdc++.h>
using namespace std;
int flg[1001]={0};
int main(void)
{
	int a,b,n,s,f;
	int i,j;
	
	cin>>a>>b>>n;
	
	flg[a]=1,flg[b]=-1;
	
	for(i=0;i<n;i++){
		cin>>s>>f;
		flg[s]++;
		flg[f]--;
	}
	
	int sum=0,max=-1;
	for(i=0;i<1000;i++){
		sum+=flg[i];
		if(max<sum) max=sum;
	}	
	
	if(max==1) cout<<"0"<<endl;
	else cout<<"1"<<endl;
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
    int a, b;
    cin>>a>>b;
    int N;
    cin>>N;
    int flg = 0;
    for (int i = 0; i < N; i++)
    {
        int s,f;
        cin>>s>>f;
        if(f<=a||b<=s) continue;
        else flg = 1;

        /* code */
    }
    cout<<flg<<endl;
    return 0;
    
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<n;++i)

using ll = long long;
using namespace std;
ll n, m, o, ans = 0, a, b;
int main() {
	cin >> n >> m >> o;
	rep(i, o) {
		cin >> a >> b;
		if (a > n&&a < m) ans = 1;
		else if (b > n&&b < m) ans = 1;
	}
	cout << ans << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a,b;
  cin>>a>>b;
  int n;
  cin>>n;
  int imos[2000];
  memset(imos,0,sizeof(imos));
  for(int i=0;i<n;i++){
    int s,f;
    cin>>s>>f;
    imos[s]++;
    imos[f]--;
  }
  for(int i=1;i<2000;i++) imos[i]+=imos[i-1];
  cout<<(*max_element(imos+a,imos+b)>0)<<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;
		    return 0;
		}
		
	}
	cout << 0 << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=10000;
const ll INF=1000000010;
const int MAX=100001;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int a,b;cin>>a>>b;
    bool f=true;
    int n;cin>>n;
    for(int i=0;i<n;i++){
        int s,f;
        cin>>s>>f;
        if(b<=s||a>=f)continue;
        f=false;
    }
    if(f){
        cout<<0<<endl;
    }else{
        cout<<1<<endl;
    }
    return 0;
}

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