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;

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

C++: #include<iostream>
#include<vector>
#include<cmath>
#define _GLIBCXX_DEBUG
using namespace std;
bool overlap(int a, int b, int c, int d){
  if ( d <= a ) return false;
  if ( b <= c ) return false;
  return true;
}
 
int main(){
  int a, b, s, f, n;
  cin >> a >> b >> n;
  for ( int i = 0; i < n; i++ ){
    cin >> s >> f;
    if ( overlap(a, b, s, f) ){
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}

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

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,n;
    cin>>a>>b>>n;
    int c[1000]={};
    for(int i=0;i<n;i++){
       int d,e;
       cin>>d>>e;
       for(int j=d;j<e;j++){
          c[j]=1;
       }
    }
    for(int i=a;i<b;i++){
       if(c[i]!=1){}
       else{
           cout<<1<<endl;
           goto loop;
       }
    }
    cout<<0<<endl;
    loop:;
    return 0;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

int schedule[1024];

bool check(int a, int b) {
    for (int i = a; i < b; i++) {
        if (schedule[i] != 0) return false;
    }
    return true;
}

int main() {
    int a, b;
    int N;
    cin >> a >> b;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int s, f;
        cin >> s >> f;
        schedule[s]++;
        schedule[f]--;
    }

    for (int i = 1; i < 1024; i++) {
        schedule[i] += schedule[i-1];
    }
    puts(check(a, b) ? "0" : "1");

    return 0;
}

C++: #include<bits/stdc++.h>
#define loop(times) for(int i=0;i<times;i++)
using namespace std;


int main()
{
    int a,b,N,t=1;
    cin>>a>>b>>N;
    
    int s[N],f[N];
    int p[1001];
    int c[1001];
    
    loop(1000)p[i]=0,c[i]=0;

    loop(N){
        cin>>s[i]>>f[i];
        p[s[i]]+=1;
        p[f[i]]-=1;
    }
    p[a]+=1;
    p[b]-=1;
    if(c[0]==2){
    cout<<1<<endl;
    t=0;
    }
    loop(1000){
    c[i+1]=c[i]+p[i];
        if(c[i+1]==2){
        cout<<1<<endl;
        t=0;
        break;
    }
    }
    if(t==1)cout<<0<<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};

vi a(10000);
int n,l,r;

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

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

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

int main(){
  int a,b,n,t=0;
  cin >> a >> b >> n;
  for(int i=0; i<n*2; i=i+2){
    int num,num2;
    cin >> num >> num2;
    if(num<a&&num2>a){
      t=1;
    }
    if(num<b&&num2>b){
      t=1;
    }
    if(num==a&&num2==b)t=1;
    if(a<num&&b>num2)t=1;
  }
  cout << t << endl;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int a,b;
    cin>>a>>b;
    int N;cin>>N;
    rep(i,N){
        int l,r;
        cin>>l>>r;
        if(r<=a||b<=l)continue;
        cout<<1<<endl;
        return 0;
    }
    cout<<0<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int a, b; scanf("%d%d", &a, &b);
	int n; scanf("%d", &n);
	std::vector<int> latte(1000, 0);
	while(n--) {
		int l, r; scanf("%d%d", &l, &r);
		
		for(int i = l; i < r; i++) latte[i] = 1;
	}
	
	bool ans = false;
	for(int i = a; i < b; i++) ans |= latte[i];
	printf("%d\n", ans);	
	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] || b<d[i] && a>d[i]){
			cout << 1 << endl;
		}
	}
	cout << 0 << endl;
	return 0;
}

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

int main()
{
	int a, b, n;
	int g = 0;

	cin >> a >> b >> n;

	for (int i = 0; i < n; i++) {
		int s, f;
		cin >> s >> f;
		if (!(s >= b || f <= a))
			g = 1;
	}

	cout << g << endl;
	
	return 0;
}

C++: #include <stdio.h>

int main(){
  int a, b, n, i, j;
  scanf("%d%d%d",&a,&b,&n);
  int s[n],f[n];
  bool used[1024];
  for (i = 0; i < 1024; i++) used[i] = false;
  for (i = 0; i < n; i++) {
    scanf("%d%d",&s[i],&f[i]);
    for (j = s[i]; j < f[i]; j++) used[j] = true;
  }
  for (i = a; i < b; i++) {
    if(used[i]) {printf("1\n");
    return 0;}
  }
  printf("0\n");
  return 0;
}