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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	int a, b, N;
	cin >> a >> b >> N;
	
	bool ans = false;
	REP(i, N) {
		int s, f;
		scanf("%d %d", &s, &f);
		
		ans |= a < s && f < b;
		ans |= s < a && a < s;
		ans |= f < b && b < f;
	}
	
	printf("%d\n", (int)ans);
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,n,k[100],l[100],x;
	cin>>a>>b>>n;
	for(int i=0;i<=100;i++){
	cin>>k[i]>>l[i];
	if(k[i]<a&&a<l[i]){
	x=1;
    break;
}
	else if(k[i]<b&&b<l[i]){
	x=1;
	break;
}
	else if(k[i]==a&&l[i]==b){
	x=1;
	break;
}
	else x=0;
}
	cout<<x<<endl;
return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	int n; cin >> n;
	bool b00l = false;
	for (int i = 0; i < n; i++) {
		int c, d; cin >> c >> d;
		if ((a < c&&c < b) || (a < d&&d < b)) {
			b00l = true;
		}
	}
	cout << b00l << endl;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int a, b, n;
    cin >> a >> b >> n;
    pair<int, int> new_record = {a, b};
    vector<int> temp(1001, 0);
    for(int i = 0; i < n; i++)
    {
        int s, f;
        cin >> s >> f;
        for(int j = s; j < f; j++)
        {
            temp[j] = 1;
        }
    }
    bool flag = true;
    for(int i = a; i < b; i++)
    {
        if(temp[i] == 1)
        {
            flag = false;
        }
    }
    if(flag)
    {
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }
    return 0;
}

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

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

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

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

int main()
{
	int sta,end,n;
	cin >> sta >> end >> n;

	bool jud = true;
	int tsta,tend;
	for(int i=0;i<n;i++){
		cin >> tsta >> tend;
		if(!((sta<=tsta&&end<=tend)||(sta>=tend&&end>=tend))){
			jud = false;
		}
	}

	if(jud){
		cout << 0 << endl;
	}else{
		cout << 1 << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int a, b, N;

int main() {
	cin >> a >> b >> N;
	bool f = false;
	for (int i = 0; i < N; i++) {
		int s, e;
		cin >> s >> e;
		if ((s <= a && a < e) || (s < b && b <= e) || (a <= s && e <= b))f = true;

	}
	if (f)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;  //yoyaku
  vector<int> v(1001);
  for (int i = 0; i < n; i++) {
    int s, f; cin >> s >> f;
    for (int j = s; j <= f; j++) {
      v.at(j) = 1;
    }
  }
  int ans = 0;
  if (b - a == 1) {
    if (!(v.at(a) == 1 && v.at(b) == 1)) {
      ans = 0;
    } else {
      ans = 1;
    }
  } else {
    for (int i = a + 1; i < b; i++) {
      if (v.at(i) != 0) {
        ans = 1;
      }
    }
  }
  cout << ans << endl;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

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

C++: //============================================================================
// Name        : tokuteigai.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

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