Problem:
Three Meals
You are running a restaurant that serves dishes only three times a day. Each of your customer has his/her own separate timeframes for eating breakfast, lunch and supper. Thus, your customer enjoys your dish only when he/she visits your restaurant to meet your serving time settings. Your wish is to modify your serving time arrangement so that as many as possible of your customers can enjoy your meals three times a day.
Write a program to enable as many as possible of customers can enjoy your service three times a day, i.e. breakfast, lunch, and supper. A list of customers eating timeframes is given, which you cannot change. Settings of your service time are your option. Coincidence between your service time and either edge of customer’s timframe (start or end time) does not hinder you to provide your service.
Input
The input is given in the following format.
N
ast_1
aet_1
hst_1
het_1
bst_1
bet_1
ast_2
aet_2
hst_2
het_2
bst_2
bet_2
:
ast_N
aet_N
hst_N
het_N
bst_N
bet_N
The first line provides the number of customers
N
(1≤
N
≤50). Each of subsequent
N
lines provides timeframe information of
i
-th customer: start and end time of breakfast timzeframe (
ast_i
,
aet_i
), those of lunch timeframe (
hst_i
,
het_i
) and those of supper timeframe (
bst_i
,
bet_i
). The end time must be later in time as the start time. Timeframes do not overlap, i.e.
hst_i
is later in time than
aet_i
, and so on. Each time settings must not cross 0:00 midnight.
h
m
Each time information is given by hour
h
(0≤
h
≤23) and minute
m
(0≤
m
≤59).
Output
Output the maximum number of customers that can be served all three meals (breakfast, lunch, and supper).
Sample Input 1
5
1 0 2 0 3 30 4 30 6 0 7 0
2 30 3 0 4 0 5 0 5 30 6 30
1 30 2 30 4 30 5 0 6 30 7 0
2 30 3 0 5 0 6 0 6 30 7 0
1 0 2 0 3 0 3 30 4 0 5 0
Sample Output 1
3

Submitted solutions:

code_snippet: #pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#define int long long
int N;
int A[50], B[50], C[50], D[50], E[50], F[50];
signed main(){
    set<int> st;
    cin>>N;
    for(int i=0;i<N;i++){
        int a,b;
        cin>>a>>b;
        A[i] = 60*a+b;
        st.insert(60*a+b);
        cin>>a>>b;
        B[i] = 60*a+b;
        st.insert(60*a+b);
        cin>>a>>b;
        C[i] = 60*a+b;
        st.insert(60*a+b);
        cin>>a>>b;
        D[i] = 60*a+b;
        st.insert(60*a+b);
        cin>>a>>b;
        E[i] = 60*a+b;
        st.insert(60*a+b);
        cin>>a>>b;
        F[i] = 60*a+b;
        st.insert(60*a+b);
    }
    {
        map<int,int> m;
        int now = 0;
        for(int x:st){
            m[x] = now;
            now++;
        }
        for(int i=0;i<N;i++){
            A[i] = m[A[i]];
            B[i] = m[B[i]];
            C[i] = m[C[i]];
            D[i] = m[D[i]];
            E[i] = m[E[i]];
            F[i] = m[F[i]];
        }
    }
    int ans = 0;
    for(int i=0;i<=300;i++)for(int j=i+1;j<300;j++)for(int k=j+1;k<=300;k++){
        int c = 0;
        for(int l=0;l<N;l++){
            c += (A[l] <= i && i <= B[l] && C[l] <= j & j <= D[l] && E[l] <= k && k <= F[l]);
        }
        ans = max(ans,c);
    }
    cout<<ans<<endl;
}
accuracy: 1
time_ms: 160
memory_kb: 3380
final_rank: 11

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	
	int N;
	cin >> N;
	vector t(N, vector<int>(6));
	vector<int> k(N * 6);
	rep(i, 0, N) rep(j, 0, 6) {
		int h, m;
		cin >> h >> m;
		t[i][j] = h*60 + m;
		k[i*6 + j] = t[i][j];
	}
	
	sort(k.begin(), k.end());
	
	int ans = 0;
	rep(a, 0, N*6) rep(b, a, N*6) rep(c, b, N*6) {
		int now = 0;
		rep(i, 0, N) {
			bool ok = true;
			if (!(t[i][0] <= k[a] && k[a] <= t[i][1])) ok = false;
			if (!(t[i][2] <= k[b] && k[b] <= t[i][3])) ok = false;
			if (!(t[i][4] <= k[c] && k[c] <= t[i][5])) ok = false;
			if (ok) ++now;
		}
		ans = max(ans, now);
	}
	cout << ans << '\n';
}
accuracy: 1
time_ms: 300
memory_kb: 3436
final_rank: 13

code_snippet: #include<bits/stdc++.h>

using namespace std;

#define rep(i, l, n) for(int i = int(l); i < int(n); i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

template<class T> bool chmin(T &a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T &a, T b) {if(a < b) {a = b; return true;} return false;}
template<class T> using spq = priority_queue<T, vector<T>, greater<T>>;

// bool -> Yes/No
string answer(bool b) {return b ? "Yes" : "No";}

void fix(int k) {cout << fixed << setprecision(k);}

const int inf = 2e9;
const long long INF = 2e18;
const long double eps = 1e-12;
const long double pi = 3.14159265358979323846264338;
int dx[] = {0, -1, 0, 1, -1, -1, 1, 1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

void main_program() {
    int n; cin >> n;
    int st[n][3], fin[n][3];
    rep(i, 0, n) {
        rep(j, 0, 3) {
            int h, m; cin >> h >> m;
            int t = h * 60 + m;
            st[i][j] = t;
            cin >> h >> m;
            t = h * 60 + m + 1;
            fin[i][j] = t;
        }
    }
    int ans = 0;
    rep(a, 0, 1440) {
        // 朝食
        rep(b, 0, 1440) {
            // 昼食
            vector<int> idx;
            vector<pair<int, int>> t;
            rep(i, 0, n) {
                if(a < st[i][0] || a >= fin[i][0]) continue;
                if(b < st[i][1] || b >= fin[i][1]) continue;
                idx.emplace_back(i);
                t.emplace_back(st[i][2], 1);
                t.emplace_back(fin[i][2], -1);
            }
            sort(all(t));
            int mx = 0, cur = 0;
            rep(i, 0, t.size()) {
                auto[k, s] = t[i];
                if(s == -1) cur--;
                else cur++;
                if(i + 1 < int(t.size()) && t[i + 1].first == k) continue;
                chmax(mx, cur);
            }
            chmax(ans, mx);
        }
    }
    cout << ans << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    //cin >> T;
    while(T--) {
        main_program();
    }
}
accuracy: 1
time_ms: 160
memory_kb: 3452
final_rank: 12

code_snippet: #include <algorithm>
#include <iostream>
#include <vector>

struct Info {
  int mornint_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};

int calc(int hour, int minute) { return 60 * hour + minute; }

int main() {
  int N;
  std::cin >> N;

  std::vector<Info> info(N);
  std::vector<int> MORNING, LUNCH, DINNER;
  MORNING.reserve(2 * N);
  LUNCH.reserve(2 * N);
  DINNER.reserve(2 * N);

  for (int i = 0; i < N; i++) {
    int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
        d_st_m, d_ed_h, d_ed_m;
    std::cin >> m_st_h >> m_st_m >> m_ed_h >> m_ed_m >> l_st_h >> l_st_m >>
        l_ed_h >> l_ed_m >> d_st_h >> d_st_m >> d_ed_h >> d_ed_m;

    info[i].mornint_start = calc(m_st_h, m_st_m);
    info[i].morning_end = calc(m_ed_h, m_ed_m);
    MORNING.push_back(info[i].mornint_start);
    MORNING.push_back(info[i].morning_end);

    info[i].lunch_start = calc(l_st_h, l_st_m);
    info[i].lunch_end = calc(l_ed_h, l_ed_m);
    LUNCH.push_back(info[i].lunch_start);
    LUNCH.push_back(info[i].lunch_end);

    info[i].dinner_start = calc(d_st_h, d_st_m);
    info[i].dinner_end = calc(d_ed_h, d_ed_m);
    DINNER.push_back(info[i].dinner_start);
    DINNER.push_back(info[i].dinner_end);
  }

  std::sort(MORNING.begin(), MORNING.end());
  std::sort(LUNCH.begin(), LUNCH.end());
  std::sort(DINNER.begin(), DINNER.end());

  int ans = 0;
  for (int a = 0; a < MORNING.size(); a++) {
    for (int b = 0; b < LUNCH.size(); b++) {
      for (int c = 0; c < DINNER.size(); c++) {
        int tmp = 0;
        for (int i = 0; i < N; i++) {
          if (info[i].mornint_start <= MORNING[a] &&
              info[i].morning_end >= MORNING[a] &&
              info[i].lunch_start <= LUNCH[b] &&
              info[i].lunch_end >= LUNCH[b] &&
              info[i].dinner_start <= DINNER[c] &&
              info[i].dinner_end >= DINNER[c]) {
            tmp++;
          }
        }
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }

  std::cout << ans << std::endl;
  return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 3156
final_rank: 2

code_snippet: #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int calc(int hour, int minute) {
  return 60 * hour + minute;
}

int main() {
  int N;
  cin >> N;

  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h, d_st_m, d_ed_h, d_ed_m;
  vector<int> morning_start, morning_end, lunch_start, lunch_end, dinner_start, dinner_end;

  for (int i = 0; i < N; i++) {
    cin >> m_st_h >> m_st_m >> m_ed_h >> m_ed_m >> l_st_h >> l_st_m >> l_ed_h >> l_ed_m >> d_st_h >> d_st_m >> d_ed_h >> d_ed_m;

    morning_start.push_back(calc(m_st_h, m_st_m));
    morning_end.push_back(calc(m_ed_h, m_ed_m));
    lunch_start.push_back(calc(l_st_h, l_st_m));
    lunch_end.push_back(calc(l_ed_h, l_ed_m));
    dinner_start.push_back(calc(d_st_h, d_st_m));
    dinner_end.push_back(calc(d_ed_h, d_ed_m));
  }

  sort(morning_start.begin(), morning_start.end());
  sort(morning_end.begin(), morning_end.end());
  sort(lunch_start.begin(), lunch_start.end());
  sort(lunch_end.begin(), lunch_end.end());
  sort(dinner_start.begin(), dinner_start.end());
  sort(dinner_end.begin(), dinner_end.end());

  int ans = 0;
  int tmp;
  for (int a = 0; a < morning_start.size(); a++) {
    for (int b = 0; b < lunch_start.size(); b++) {
      for (int c = 0; c < dinner_start.size(); c++) {
        tmp = 0;
        for (int i = 0; i < N; i++) {
          if (morning_start[i] <= morning_start[a] && morning_end[i] >= morning_start[a] &&
              lunch_start[i] <= lunch_start[b] && lunch_end[i] >= lunch_start[b] &&
              dinner_start[i] <= dinner_start[c] && dinner_end[i] >= dinner_start[c]) {
            tmp++;
          }
        }
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }

  cout << ans << endl;
  return 0;
}
accuracy: 0.21875
time_ms: 10
memory_kb: 3152
final_rank: 14

code_snippet: #include <bits/stdc++.h>
using namespace std;
int main(){
    int a;
    cin>>a;
    vector<vector<int> > r(a,vector<int> (6));
    vector<int> asa(a*2);
    vector<int> hiru(a*2);
    vector<int> ban(a*2);
    vector<int> hito(a);
    for(int i=0;i<a;i+=1){
        int c,d;
        for(int j=0;j<6;j+=1){
            cin>>c>>d;
            r.at(i).at(j)=c*60+d+j%2;
            if(j<2){
                asa.at(2*i+j%2)=c*60+d+j%2;
            }else
            if(j<4){
                hiru.at(2*i+j%2)=c*60+d+j%2;
            }else{
                ban.at(2*i+j%2)=c*60+d+j%2;
            }
        }
    }
    int ans=0;
    for(int i=0;i<a*2;i+=1){
        for(int j=0;j<a*2;j+=1){
        for(int k=0;k<a*2;k+=1){
        int t1=asa.at(i);
        int t2=hiru.at(j);
        int t3=ban.at(k);
        int w=0;
        if(t1<t2&&t2<t3){
            for(int i2=0;i2<a;i2+=1){
                if(r.at(i2).at(0)<=t1&&r.at(i2).at(1)>t1&&r.at(i2).at(2)<=t2&&r.at(i2).at(3)>t2&&r.at(i2).at(4)<=t3&&r.at(i2).at(5)>t3){
                w+=1;    
                }
            }
            ans=max(ans,w);
        }
    }
    }
    }
    cout<<ans<<endl;
}
accuracy: 1
time_ms: 80
memory_kb: 3180
final_rank: 4

code_snippet: #include <algorithm>
#include <vector>
#include <cstdio>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
struct Info {
  int mornint_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};
int calc(int hour, int minute) { return 60 * hour + minute; }
int main() {
  int N;
  scanf("%d", &N);
  Info info[N];
  std::vector<int> MORNING, LUNCH, DINNER;
  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
      d_st_m, d_ed_h, d_ed_m;
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d %d %d %d %d %d %d %d %d %d", &m_st_h, &m_st_m, &m_ed_h,
          &m_ed_m, &l_st_h, &l_st_m, &l_ed_h, &l_ed_m, &d_st_h, &d_st_m,
          &d_ed_h, &d_ed_m);
    info[i].mornint_start = calc(m_st_h, m_st_m);
    info[i].morning_end = calc(m_ed_h, m_ed_m);
    MORNING.push_back(info[i].mornint_start);
    MORNING.push_back(info[i].morning_end);
    info[i].lunch_start = calc(l_st_h, l_st_m);
    info[i].lunch_end = calc(l_ed_h, l_ed_m);
    LUNCH.push_back(info[i].lunch_start);
    LUNCH.push_back(info[i].lunch_end);
    info[i].dinner_start = calc(d_st_h, d_st_m);
    info[i].dinner_end = calc(d_ed_h, d_ed_m);
    DINNER.push_back(info[i].dinner_start);
    DINNER.push_back(info[i].dinner_end);
  }
  sort(MORNING.begin(), MORNING.end());
  sort(LUNCH.begin(), LUNCH.end());
  sort(DINNER.begin(), DINNER.end());
  int ans = 0, tmp;
  for (int a = 0; a < MORNING.size(); a++) {
    for (int b = 0; b < LUNCH.size(); b++) {
      for (int c = 0; c < DINNER.size(); c++) {
        tmp = 0;
        for (int i = 0; i < N; i++) {
          if (info[i].mornint_start <= MORNING[a] &&
              info[i].morning_end >= MORNING[a] &&
              info[i].lunch_start <= LUNCH[b] &&
              info[i].lunch_end >= LUNCH[b] &&
              info[i].dinner_start <= DINNER[c] &&
              info[i].dinner_end >= DINNER[c]) {
            tmp++;
          }
        }
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 2764
final_rank: 1

code_snippet: #include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
struct Info {
  int mornint_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};
int calc(int hour, int minute) { return 60 * hour + minute; }
int main() {
  int N;
  scanf("%d", &N);
  Info info[N];
  vector<int> MORNING, LUNCH, DINNER;
  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
      d_st_m, d_ed_h, d_ed_m;
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d %d %d %d %d %d %d %d %d %d", &m_st_h, &m_st_m, &m_ed_h,
          &m_ed_m, &l_st_h, &l_st_m, &l_ed_h, &l_ed_m, &d_st_h, &d_st_m,
          &d_ed_h, &d_ed_m);
    info[i].mornint_start = calc(m_st_h, m_st_m);
    info[i].morning_end = calc(m_ed_h, m_ed_m);
    MORNING.push_back(info[i].mornint_start);
    MORNING.push_back(info[i].morning_end);
    info[i].lunch_start = calc(l_st_h, l_st_m);
    info[i].lunch_end = calc(l_ed_h, l_ed_m);
    LUNCH.push_back(info[i].lunch_start);
    LUNCH.push_back(info[i].lunch_end);
    info[i].dinner_start = calc(d_st_h, d_st_m);
    info[i].dinner_end = calc(d_ed_h, d_ed_m);
    DINNER.push_back(info[i].dinner_start);
    DINNER.push_back(info[i].dinner_end);
  }
  sort(MORNING.begin(), MORNING.end());
  sort(LUNCH.begin(), LUNCH.end());
  sort(DINNER.begin(), DINNER.end());
  int ans = 0, tmp, morning_size = MORNING.size(), lunch_size = LUNCH.size(), dinner_size = DINNER.size();
  for (int a = 0; a < morning_size; a++) {
    for (int b = 0; b < lunch_size; b++) {
      for (int c = 0; c < dinner_size; c++) {
        tmp = 0;
        for (int i = 0; i < N; i++) {
          if (info[i].mornint_start <= MORNING[a] &&
              info[i].morning_end >= MORNING[a] &&
              info[i].lunch_start <= LUNCH[b] &&
              info[i].lunch_end >= LUNCH[b] &&
              info[i].dinner_start <= DINNER[c] &&
              info[i].dinner_end >= DINNER[c]) {
            tmp++;
          }
        }
        ans = max(ans, tmp);
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
accuracy: 1
time_ms: 60
memory_kb: 3260
final_rank: 5

code_snippet: #include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
struct Info {
  int mornint_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};
int calc(int hour, int minute) { return 60 * hour + minute; }
int main() {
  int N;
  scanf("%d", &N);
  Info info[N];
  vector<int> MORNING, LUNCH, DINNER;
  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
      d_st_m, d_ed_h, d_ed_m;
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d %d %d %d %d %d %d %d %d %d", &m_st_h, &m_st_m, &m_ed_h,
          &m_ed_m, &l_st_h, &l_st_m, &l_ed_h, &l_ed_m, &d_st_h, &d_st_m,
          &d_ed_h, &d_ed_m);
    info[i].mornint_start = calc(m_st_h, m_st_m);
    info[i].morning_end = calc(m_ed_h, m_ed_m);
    MORNING.push_back(info[i].mornint_start);
    MORNING.push_back(info[i].morning_end);
    info[i].lunch_start = calc(l_st_h, l_st_m);
    info[i].lunch_end = calc(l_ed_h, l_ed_m);
    LUNCH.push_back(info[i].lunch_start);
    LUNCH.push_back(info[i].lunch_end);
    info[i].dinner_start = calc(d_st_h, d_st_m);
    info[i].dinner_end = calc(d_ed_h, d_ed_m);
    DINNER.push_back(info[i].dinner_start);
    DINNER.push_back(info[i].dinner_end);
  }
  sort(MORNING.begin(), MORNING.end());
  sort(LUNCH.begin(), LUNCH.end());
  sort(DINNER.begin(), DINNER.end());
  MORNING.erase(unique(MORNING.begin(), MORNING.end()), MORNING.end());
  LUNCH.erase(unique(LUNCH.begin(), LUNCH.end()), LUNCH.end());
  DINNER.erase(unique(DINNER.begin(), DINNER.end()), DINNER.end());
  int ans = 0, tmp;
  for (int a = 0; a < MORNING.size(); a++) {
    for (int b = 0; b < LUNCH.size(); b++) {
      for (int c = 0; c < DINNER.size(); c++) {
        tmp = 0;
        for (int i = 0; i < N; i++) {
          if (info[i].mornint_start <= MORNING[a] &&
              info[i].morning_end >= MORNING[a] &&
              info[i].lunch_start <= LUNCH[b] &&
              info[i].lunch_end >= LUNCH[b] &&
              info[i].dinner_start <= DINNER[c] &&
              info[i].dinner_end >= DINNER[c]) {
            tmp++;
          }
        }
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
accuracy: 1
time_ms: 40
memory_kb: 3256
final_rank: 3

code_snippet: #include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
struct Info {
  int mornint_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};
int calc(int hour, int minute) { return 60 * hour + minute; }
int main() {
  int N;
  scanf("%d", &N);
  Info info[N];
  vector<int> MORNING, LUNCH, DINNER;
  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
      d_st_m, d_ed_h, d_ed_m;
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d %d %d %d %d %d %d %d %d %d", &m_st_h, &m_st_m, &m_ed_h,
          &m_ed_m, &l_st_h, &l_st_m, &l_ed_h, &l_ed_m, &d_st_h, &d_st_m,
          &d_ed_h, &d_ed_m);
    info[i].mornint_start = calc(m_st_h, m_st_m);
    info[i].morning_end = calc(m_ed_h, m_ed_m);
    MORNING.push_back(info[i].mornint_start);
    MORNING.push_back(info[i].morning_end);
    info[i].lunch_start = calc(l_st_h, l_st_m);
    info[i].lunch_end = calc(l_ed_h, l_ed_m);
    LUNCH.push_back(info[i].lunch_start);
    LUNCH.push_back(info[i].lunch_end);
    info[i].dinner_start = calc(d_st_h, d_st_m);
    info[i].dinner_end = calc(d_ed_h, d_ed_m);
    DINNER.push_back(info[i].dinner_start);
    DINNER.push_back(info[i].dinner_end);
  }
  sort(MORNING.begin(), MORNING.end());
  sort(LUNCH.begin(), LUNCH.end());
  sort(DINNER.begin(), DINNER.end());
  int ans = 0, tmp;
  for (int a = 0; a < MORNING.size(); a++) {
    for (int b = 0; b < LUNCH.size(); b++) {
      for (int c = 0; c < DINNER.size(); c++) {
        tmp = 0;
        for (int i = 0; i < N; i++) {
          if (info[i].mornint_start <= MORNING[a] &&
              info[i].morning_end >= MORNING[a] &&
              info[i].lunch_start <= LUNCH[b] &&
              info[i].lunch_end >= LUNCH[b] &&
              info[i].dinner_start <= DINNER[c] &&
              info[i].dinner_end >= DINNER[c]) {
            tmp++;
          }
        }
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 3260
final_rank: 7

code_snippet: #include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
struct Info {
  int mornint_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};
int calc(int hour, int minute) { return 60 * hour + minute; }
int main() {
  int N;
  scanf("%d", &N);
  Info info[N];
  vector<int> MORNING, LUNCH, DINNER;
  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
      d_st_m, d_ed_h, d_ed_m;
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d %d %d %d %d %d %d %d %d %d", &m_st_h, &m_st_m, &m_ed_h,
          &m_ed_m, &l_st_h, &l_st_m, &l_ed_h, &l_ed_m, &d_st_h, &d_st_m,
          &d_ed_h, &d_ed_m);
    info[i].mornint_start = calc(m_st_h, m_st_m);
    info[i].morning_end = calc(m_ed_h, m_ed_m);
    MORNING.push_back(info[i].mornint_start);
    MORNING.push_back(info[i].morning_end);
    info[i].lunch_start = calc(l_st_h, l_st_m);
    info[i].lunch_end = calc(l_ed_h, l_ed_m);
    LUNCH.push_back(info[i].lunch_start);
    LUNCH.push_back(info[i].lunch_end);
    info[i].dinner_start = calc(d_st_h, d_st_m);
    info[i].dinner_end = calc(d_ed_h, d_ed_m);
    DINNER.push_back(info[i].dinner_start);
    DINNER.push_back(info[i].dinner_end);
  }
  sort(MORNING.begin(), MORNING.end());
  sort(LUNCH.begin(), LUNCH.end());
  sort(DINNER.begin(), DINNER.end());
  int ans = 0, tmp;
  for (int a = 0; a < MORNING.size(); a++) {
    for (int b = 0; b < LUNCH.size(); b++) {
      for (int c = 0; c < DINNER.size(); c++) {
        tmp = 0;
        for (int i = 0; i < N; i++) {
          if (info[i].mornint_start <= MORNING[a] &&
              info[i].morning_end >= MORNING[a] &&
              info[i].lunch_start <= LUNCH[b] &&
              info[i].lunch_end >= LUNCH[b] &&
              info[i].dinner_start <= DINNER[c] &&
              info[i].dinner_end >= DINNER[c]) {
            tmp++;
          }
        }
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 3276
final_rank: 8

code_snippet: #include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info {
  int mornint_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};

int calc(int hour, int minute) { return 60 * hour + minute; }

int main() {
  int N;
  scanf("%d", &N);
  Info info[N];
  vector<int> MORNING, LUNCH, DINNER;
  
  // Declare variables outside the loop to avoid reallocating memory in each iteration
  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
      d_st_m, d_ed_h, d_ed_m;
  
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d %d %d %d %d %d %d %d %d %d", &m_st_h, &m_st_m, &m_ed_h,
          &m_ed_m, &l_st_h, &l_st_m, &l_ed_h, &l_ed_m, &d_st_h, &d_st_m,
          &d_ed_h, &d_ed_m);
    info[i].mornint_start = calc(m_st_h, m_st_m);
    info[i].morning_end = calc(m_ed_h, m_ed_m);
    MORNING.push_back(info[i].mornint_start);
    MORNING.push_back(info[i].morning_end);
    info[i].lunch_start = calc(l_st_h, l_st_m);
    info[i].lunch_end = calc(l_ed_h, l_ed_m);
    LUNCH.push_back(info[i].lunch_start);
    LUNCH.push_back(info[i].lunch_end);
    info[i].dinner_start = calc(d_st_h, d_st_m);
    info[i].dinner_end = calc(d_ed_h, d_ed_m);
    DINNER.push_back(info[i].dinner_start);
    DINNER.push_back(info[i].dinner_end);
  }
  sort(MORNING.begin(), MORNING.end());
  sort(LUNCH.begin(), LUNCH.end());
  sort(DINNER.begin(), DINNER.end());
  int ans = 0, tmp;
  
  // Declare variables outside the loop to avoid reallocating memory in each iteration
  int morning_size = MORNING.size(), lunch_size = LUNCH.size(), dinner_size = DINNER.size();
  
  for (int a = 0; a < morning_size; a++) {
    for (int b = 0; b < lunch_size; b++) {
      for (int c = 0; c < dinner_size; c++) {
        tmp = 0;
        
        // Declare variables outside the loop to avoid reallocating memory in each iteration
        int morning_a = MORNING[a], lunch_b = LUNCH[b], dinner_c = DINNER[c];
        
        for (int i = 0; i < N; i++) {
          if (info[i].mornint_start <= morning_a &&
              info[i].morning_end >= morning_a &&
              info[i].lunch_start <= lunch_b &&
              info[i].lunch_end >= lunch_b &&
              info[i].dinner_start <= dinner_c &&
              info[i].dinner_end >= dinner_c) {
            tmp++;
          }
        }
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
accuracy: 1
time_ms: 60
memory_kb: 3264
final_rank: 6

code_snippet: #include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
struct Info {
  int morning_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};
int calc(int hour, int minute) { return 60 * hour + minute; }
int main() {
  int n;
  scanf("%d", &n);
  Info info[n];
  vector<int> morning, lunch, dinner;
  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
      d_st_m, d_ed_h, d_ed_m;
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d %d %d %d %d %d %d %d %d %d", &m_st_h, &m_st_m, &m_ed_h,
          &m_ed_m, &l_st_h, &l_st_m, &l_ed_h, &l_ed_m, &d_st_h, &d_st_m,
          &d_ed_h, &d_ed_m);
    info[i].morning_start = calc(m_st_h, m_st_m);
    info[i].morning_end = calc(m_ed_h, m_ed_m);
    morning.push_back(info[i].morning_start);
    morning.push_back(info[i].morning_end);
    info[i].lunch_start = calc(l_st_h, l_st_m);
    info[i].lunch_end = calc(l_ed_h, l_ed_m);
    lunch.push_back(info[i].lunch_start);
    lunch.push_back(info[i].lunch_end);
    info[i].dinner_start = calc(d_st_h, d_st_m);
    info[i].dinner_end = calc(d_ed_h, d_ed_m);
    dinner.push_back(info[i].dinner_start);
    dinner.push_back(info[i].dinner_end);
  }
  sort(morning.begin(), morning.end());
  sort(lunch.begin(), lunch.end());
  sort(dinner.begin(), dinner.end());
  int ans = 0, tmp;
  for (int a = 0; a < morning.size(); a++) {
    for (int b = 0; b < lunch.size(); b++) {
      for (int c = 0; c < dinner.size(); c++) {
        tmp = 0;
        for (int i = 0; i < n; i++) {
          if (info[i].morning_start <= morning[a] &&
              info[i].morning_end >= morning[a] &&
              info[i].lunch_start <= lunch[b] &&
              info[i].lunch_end >= lunch[b] &&
              info[i].dinner_start <= dinner[c] &&
              info[i].dinner_end >= dinner[c]) {
            tmp++;
          }
        }
        if (tmp > ans) {
          ans = tmp;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 3276
final_rank: 8

code_snippet: #include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <time.h>
#include <vector>
#include <bitset>

typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info {
  int mornint_start, morning_end, lunch_start, lunch_end, dinner_start,
      dinner_end;
};

int main() {
  int N;
  scanf("%d", &N);
  Info info[N];
  vector<int> MORNING, LUNCH, DINNER;
  int m_st_h, m_st_m, m_ed_h, m_ed_m, l_st_h, l_st_m, l_ed_h, l_ed_m, d_st_h,
      d_st_m, d_ed_h, d_ed_m;
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d %d %d %d %d %d %d %d %d %d", &m_st_h, &m_st_m, &m_ed_h,
          &m_ed_m, &l_st_h, &l_st_m, &l_ed_h, &l_ed_m, &d_st_h, &d_st_m,
          &d_ed_h, &d_ed_m);
    info[i].mornint_start = 60 * m_st_h + m_st_m;
    info[i].morning_end = 60 * m_ed_h + m_ed_m;
    MORNING.push_back(info[i].mornint_start);
    MORNING.push_back(info[i].morning_end);
    info[i].lunch_start = 60 * l_st_h + l_st_m;
    info[i].lunch_end = 60 * l_ed_h + l_ed_m;
    LUNCH.push_back(info[i].lunch_start);
    LUNCH.push_back(info[i].lunch_end);
    info[i].dinner_start = 60 * d_st_h + d_st_m;
    info[i].dinner_end = 60 * d_ed_h + d_ed_m;
    DINNER.push_back(info[i].dinner_start);
    DINNER.push_back(info[i].dinner_end);
  }
  sort(MORNING.begin(), MORNING.end());
  sort(LUNCH.begin(), LUNCH.end());
  sort(DINNER.begin(), DINNER.end());
  int ans = 0, tmp;
  for (int a = 0; a < MORNING.size(); a++) {
    for (int b = 0; b < LUNCH.size(); b++) {
      for (int c = 0; c < DINNER.size(); c++) {
        tmp = 0;
        bitset<50> enabled;
        for (int i = 0; i < N; i++) {
          if (info[i].mornint_start <= MORNING[a] &&
              info[i].morning_end >= MORNING[a] &&
              info[i].lunch_start <= LUNCH[b] &&
              info[i].lunch_end >= LUNCH[b] &&
              info[i].dinner_start <= DINNER[c] &&
              info[i].dinner_end >= DINNER[c]) {
            enabled.set(i);
          }
        }
        if (enabled.count() > ans) {
          ans = enabled.count();
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
accuracy: 1
time_ms: 80
memory_kb: 3276
final_rank: 10