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 <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int times[1001] = {0};
    int a, b, N;
    cin >> a >> b >> N;
    for (int i = a; i < b; i++)
    {
        times[i] = 1;
    }

    rep(x, N) {
        cin >> a >> b;
        for (int i = a; i < b; i++)
        {
            if (!times[i]) {
                times[i] = 1;
            } else {
                cout << 1 << endl;
                return 0;
            }
        }
    }
    
    cout << 0 << endl;
}

C++: #include<iostream>
int a, b;
int n;
int s, f;
bool data[1010];
int main(){
	std::cin >> a >> b;
	std::cin >> n;
	for(int i = 0; i < n; i++){
		std::cin >> s >> f;
		for(; s < f; s++){
			data[s] = true;
		}
	}
	for(; a < b; a++){
		if(data[a]){
			std::cout << 1 << std::endl;
			return 0;
		}
	}
	std::cout << 0 << std::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 (a < s.at(i) && s.at(i) < b&&a < f.at(i) && f.at(i) < b){
			cout << '1' << endl;
			break;
		}
		if (i == N - 1)
			cout << '0' << endl;
	}
}

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<bits/stdc++.h>
using namespace std;
int main(){
  int flag=0,a,b,s,f,n;
  cin>>a>>b>>n;
  for(int i=0;i<n;++i){
    cin>>s>>f;
    if(!(f<=a||s>=b)) flag=1;
  }
  cout<<flag<<endl;
  return 0;
}

C++: #include <iostream>

using namespace std;

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

    int schedule[b + 1];
    fill(schedule, schedule + b + 1, 0);

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

        if (s <= b) schedule[s]++;
        if (f <= b) schedule[f]--;
    }

    for (int j = 0; j < b + 1; ++j) {
        int f = (j > 0 ? schedule[j - 1] : 0);
        schedule[j] += f;
    }

    for (int i = a; i < b; ++i) {
        if (schedule[i] > 0) {
            cout << 1 << endl;
            return 0;
        }
    }

    cout << 0 << endl;
}

C++: #include<stdio.h>
int main(void)
{
	int n,m[1001],i,a,b,h[101],k[101],flg=0,j;
	scanf("%d %d",&a,&b);
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d %d",&h[i],&k[i]);
	for(i=0;i<n;i++){
		if(a<=h[i]&&b>=k[i]) flg=1;
		if(h[i]<a&&b<k[i]) flg=1;
		if(h[i]<=a&&a<k[i]) flg=1;
		if(h[i]<b&&b<=k[i]) flg=1;
	}
	//for(i=0;i<=10;i++) printf("%d %d\n",i,m[i]);
	if(flg==1) printf("1\n");
	else printf("0\n");
	return 0;
}

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

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

  int N;
  cin >> N;

  int s,f;
  int ans[1000];
  for(int i=0;i<N;i++){
    cin >> s >> f;
    for(int j=s;j<=f;j++){
      if(j==s){
        ans[j]=2;
      }else if(j==f){
        ans[j]=3;
      }else{
        ans[j]=1;
      }
    }
  }

  int an=0;
  for(int i=a;i<=b;i++){
    for(int j=a;j<=b;j++){
      if((ans[j]==1) || (ans[i]==2 && ans[j]==3)){
        an++;
      }
    }
  }

  if(an>0){
    cout << '1' << endl;
  }else{
    cout << '0' << endl;
  }


  return 0;
}

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

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

  int N;
  cin >> N;

  int s,f;
  int ans[1000];
  for(int i=0;i<N;i++){
    cin >> s >> f;
    for(int j=s;j<=f;j++){
      if(j==s){
        ans[j]=2;
      }else if(j==f){
        ans[j]=3;
      }else{
        ans[j]=1;
      }
    }
  }

  int an=0;
  for(int i=a;i<=b;i++){
    if((ans[i]==1) ||(ans[a]==2 && ans[b]==3)){
      an++;
    }
  }

  if(an>0){
    cout << '1' << endl;
  }else{
    cout << '0' << endl;
  }


  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
    int a,b,n;
    cin >>a >>b >>n;
    vector<vector<int>> vec(n,vector<int>(2));
    for(int i=0;i<n;i++){
        cin>>vec.at(i).at(0)>>vec.at(i).at(1);
    }
    vector<int> cat(1000,0);
    for(int i=0;i<n;i++){
        cat.at(vec.at(i).at(0)-1) ++;
        cat.at(vec.at(i).at(1)-1) --;
    }
    cat.at(a-1) ++;
    cat.at(b-1) --;
    vector<int> rsw(1001);
    rsw.at(0) =0;
    for(int i=1;i<1001;i++){
        rsw.at(i) = rsw.at(i-1) + cat.at(i-1);
        if(rsw.at(i)==2){
            cout <<1;
            break;
        }else if(i==1000){
            cout <<0;
        }
    }
    cout << 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++: #include <bits/stdc++.h>

using namespace std;

using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


signed main(){
    int a, b, n;
    cin >> a >> b >> n;
    vector<int> table(2000, 0);
    for(int i = 0; i < n; ++i){
        int l, r;
        cin >> l >> r;
        for(int j = l; j < r; ++j)
            table[j] = 1;
    }
    int fl = 0;
    for(int j = a; j < b; ++j)
        fl |= (table[j]);

    cout << fl << endl;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b;   //a,bは新しい予約の開始時刻と終了時刻
    int N;      //元々ある予約の個数
    int s[100], f[100];
    //while(true){
        int c=0;
        cin >> a >> b;
        cin >> N;
        for(int i=0; i<N; i++){
            cin >> s[i] >> f[i];
            if((s[i]<=a&&a<f[i])||(s[i]<b&&b<f[i])||(a<=s[i]&&f[i]<=b))
                c++;
        }
        if(c>=1)
            cout << "1" << endl;
        else
            cout << "0" << endl;
    //}

}

C++: #include<iostream>
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;
}
 
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 <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<=7);
  if(n == i-1){
    cout << '0' << endl;
  } else {
    cout << '1' << endl;
  }
}

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

bool filled[1005];
int main() {
  int a, b, N;
  cin >> a >> b >> N;
  for(int i=0; i<1005; i++) filled[j]=false
  for(int i=0; i<N; i++){
    int s, f;
    cin >> s >> f;
    for(int j=s; j<f; j++) filled[j]=true;
  }
  int ans=0;
  for(int i=a; i<b; i++){
    if(filled[i]) ans=1;
  }
  cout << ans << endl;
}