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(){

	int a, b, N, s[1000],f[1000];
	int ans = 0;
	cin >> a >> b;
	cin >> N;

	for(int i = 0; i < N; i++){
		cin >> s[i] >> f[i];
	}

	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(s[i] == f[j]) ans = 1;
		}
	}

	cout << ans << endl;

	return 0;
}

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

#define int long long
#define pb push_back 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; 
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

signed main() {
  int a, b, N;
  bool flag = false;
  cin >> a >> b;
  cin >> N;
  Rep(i, N) {
    int c, d;
    cin >> c >> d;
    if ( (a <= c && c < b) || (a < d && d <= b) ) flag = true;
  }

  if ( flag ) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

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(10001, 0);
    for(int i = 0; i < n; i++)
    {
        int s, f;
        cin >> s >> f;
        for(int j = s; j <= f; j++)
        {
            temp[j] = 1;
        }
    }
    if(a == b)
    {
        if(temp[a] == 1)
        {
            cout << "1" << endl;
            return 0;
        }
    }
    for(int i = a + 1; i < b; i++)
    {
        if(temp[i] == 1)
        {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a, b, c, d[100] = { 0 }, e[100] = { 0 };
	cin >> a >> b >> c;
	for (int i = 0; i < c; c++){
		cin >> d[i] >> e[i];
		if (b>d[i] && a < d[i]){
			cout << 1 << endl;
		}
		else if (b<d[i] && a>d[i]){
			cout << 1 << endl;
		}
	}
	cout << 0 << endl;
	return 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;
	}
}