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>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int main(){
	int a,b;
	int N,tp0,tp1;
	int ct;
	bool ans=false;
	vector<int> s;
	
	scanf("%d %d",&a,&b);
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%d %d",&tp0,&tp1);
		s.push_back(tp0);
		s.push_back(tp1);
	}
	sort(s.begin(),s.end());
	if(N==1||N==0){
		if(b<=tp0||tp1<=a)
		printf("0\n");
		else
		printf("1\n");
	}
	else{
		ct=0;
		for(auto i=s.begin();i!=s.end();i++){
			if(*i<=a&&ct%2!=0){
				i++;
				if(b<=*i||i==s.end()){
					printf("0\n");
					ans=true;
				}
				if(ans==true)
				break;
				i--;
			}
			ct++;
		}
		if(ans==false)
		printf("1\n");
	}
}

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

C++: 
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iomanip>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	int a, b,n;
	cin >> a >> b >> n;

	bool ans = true;
	rep(i, n) {
		int s, f;
		cin >> s >> f;
		if ((s <= a && a < f) || (s < b && f >= b) || 
			(a <= s && f <= b) || (s <= a && b <= f))ans = false;
	}
	if (ans)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 s,f;
  for(int i=0;i<N;i++){
    cin>>s>>f;
    if(a<=f && b>=s){
      cout<<1<<endl;
      return 0;
    }
  }
  cout<<0<<endl;
  return 0;
}

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

int main() {
  int l,r,n;
  cin >> l >> r >> n;
  int d[1111];
  memset(d,0,sizeof(d));
  for(int i=0; i<n; i++) {
    int x,y;
    cin >> x >> y;
    for(int j=x; j<y; j++) d[j]=1;
  }
  for(int i=l; i<r; i++) {
    if(d[i]) {
      cout << 1 << endl;
      return 0;
    }
  }
  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 x,y;
    cin>>x>>y;
    if(x<b&&a<y){
      cout<<1<<endl;
      return 0;
    }
  }
  cout<<0<<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;
			break;
		}
	}

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

	return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;

    int n;
    cin >> n;

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

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

int main() {
    int a, b; cin >> a >> b;
    int n; cin >> n;
    bool ans = false;
    for(int i = 0; i < n; ++i) {
        int s, f; cin >> s >> f;
        ans |= (a <= s && s < b) || (s <= a && a < f);
    }
    cout << ans << endl;
}

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

C++: #include<stdio.h>
int main(void)
{
	int a,b,n,c,d,i,flg;
	scanf("%d %d %d",&a,&b,&n);
	flg=0;
	for(i=0;i<n;i++){
		scanf("%d %d",&c,&d);
		if((c>=a||d>a)&&(c<b||d<=b)) flg=1;
	}
	printf("%d\n",flg);
	return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  int N;
  cin >> N;
  //いもす！！
  vector<int> P(1000, 0);

  for(int i = 0; i < N; i++) {
    int s, e;
    cin >> s >> e;
    P[s]++;
    P[e]--;
  }
  //るいせきわ(=いたにんずう) 1ひいてつかう
  vector<int> S(1001);
  S[0] = 0;
  for(int i = 0; i < N; i++) {
    S[i + 1] = S[i] + P[i];
  }
  bool flag = true;
  for(int i = a; i <= b; i++) {
    if(S[i - 1] > 0) { flag = false; }
  }

  if(flag)
    cout << 0 << endl;
  else
    cout << 1 << 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 (s.at(i) < a && a < f.at(i) && s.at(i) < b && b < f.at(i) || a == s.at(i) && b == f.at(i)){
			cout << '1' << endl;
			break;
		}
		if (i == N - 1)
			cout << '0' << endl;
	}
}

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

bool used[100009];
int N, A, B, L[1 << 18], R[1 << 18];

int main() {
	cin >> A >> B >> N;
	for (int i = 0; i < N; i++) {
		cin >> L[i] >> R[i];
		for (int j = L[i]; j < R[i]; j++) used[j] = true;
	}

	int ret = 0;
	for (int i = A; i < B; i++) {
		if (used[i] == true) ret = 1;
	}
	cout << ret << 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 ff=true;
    int n;cin>>n;
    for(int i=0;i<n;i++){
        int s,f;
        cin>>s>>f;
        if(b<=s||a>=f){
            continue;
        }else{
            ff=false;
        }
    }
    if(ff){
        cout<<0<<endl;
    }else{
        cout<<1<<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>
using namespace std;
int main(void){
    int a,b;
    int N;
    int s,f;
    cin>>a>>b>>N;
    int check=0;
    
    for(int i=0;i<N;i++){
        cin>>s>>f;
        if(a<f&&s<b)check++;
    }
    
    if(check==0)cout<<0<<endl;
    else cout<<1<<endl;
    
    return 0;
}