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

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 s,f;
    cin>>s>>f;
    if(s<b&&a<f){
      cout<<1<<endl;
      return 0;
    }
  }
  cout<<0<<endl;   
  return 0;
}

C++: #include "bits/stdc++.h"
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)

using namespace std;

int main(){
	
	int a,b,n,s,f;
	
	cin >> a >> b >> n;
	
	int l[1010] = {0};
	
	rep(i,0,n){
		cin >> s >> f;
		
		rep(j,s,f){
			l[j] = 1;
		}
		
	}
	
	rep(i,a,b){
		if(l[i]){
			cout << 1 << endl;
			return 0;
		}
	}
	cout << 0 << endl;
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int a,b,n,s,f,i=0;
  cin >> a >> b >> n;
  do{
    cin >> s >> f;
    i++;
  }while((a != s && b != f) && (s <= a || s >= b) && (f <= a || f >= b) && i<n);
  if(n == i){
    cout << '0' << endl;
  } else {
    cout << '1' << endl;
  }
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int n;
    cin >> n;
    int d[1010] = {};
    rep(i, 0, n){
        int s, t;
        cin >> s >> t;
        d[s]++; d[t]--;
    }
    rep(i, 1, 1010){
        d[i] += d[i - 1];
    }
    bool f = true;
    rep(i, a, b){
        if(d[i] != 0) f = false;
    }
    cout << !f << endl;
}

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

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;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;
		}
	}
	cout<<"0"<<endl;
	return 0;
}

C++: #include<cstdio>

int main(void){
	int a, b, N, i, s, f, isWrong=0;
	scanf("%d %d %d", &a, &b, &N);
	for(i=0; i<N; ++i){
		scanf("%d %d", &s, &f);
		if(((a>=s)&&(a<f))||((b>s)&&(b<=f))||((a<s)&&(b>f))){isWrong=1;}
	}
	printf("%d\n", isWrong);
	
	return(0);
}

C++: #define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=0;i<b;i++)
#define REP(i,a,b) for(int i=0;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout <<(f?"Yes":"No")<<endl//fが真の場合Yesを出力、偽の場合Noを出力
#define yes(f) cout <<(f?"yes":"no")<<endl
#define YES(f) cout <<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())

using namespace std;

const int mod=1e9+7;



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

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

C++: #include <iostream>
using namespace std;
int main(){
  int a,b,n,s,f,i=0;
  cin >> a >> b >> n;
  while(1){
    cin >> s >> f;
    i++;
    if((a != s && b != f) && (s <= a || s >= b) && (f <= a || f >= b)){
      cout << '1' << endl;
      break;
    }
    if(++i == n){
      cout << '0' << endl;
      break;
    }
  }
}

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 && a+b > s)
      flag = 1;
  }
  cout << flag;
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
#define INF = 1000000000;
#define LLINF = 1LL << 62;
#define mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int v[1001];
int main() {
    int a, b, n;
    cin >> a >> b >> n;
    int s, f;
    FOR(i, n){
        cin >> s >> f;
        v[s]++, v[f]--;
    }
    FOR(i, 1000)v[i + 1] += v[i];
    int ans = 0;
    for (int i = a; i < b; i++)if (v[i])ans = 1;
    cout << ans << endl;
}

C++: #include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=1005;
bool a[M];
int n,l,r;

int main(){
	fill(a,a+M,0);
	cin>>l>>r>>n;
	for(int i=0;i<n;i++){
		int L,R;
		cin>>L>>R;
		while(L<R) a[L++]=1;
	}
/*	while(l<r){
		if(a[l]){
			cout<<1<<endl;
			return 1;
		}
		l++;
	}*/
	cout<<0<<endl;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c, d[100] = { 0 }, e[100] = { 0 };
	cin>>a>>b>> c;
	for (int j = 0; j < c; j++){
		cin >> d[j] >> e[j];
		if (b < d[j] || a < e[j]){
			cout << 1;
		}
	}
	cout << 0;
	return 0;
}