#include <iostream>
using namespace std;
double max(double a, double b) { 
    return a>b?a:b;
}
int n, Ly[2], Lm[2], Ld[2], LD[2], mon[]={0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int y[110], m[110], d[110], res=0;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    
    for(int i=0; i<2; i++) {
        cin >> Ly[i] >> Lm[i] >> Ld[i];
        LD[i]=365*Ly[i]+Ld[i];
        for(int j=1; j<Lm[i]; j++) LD[i]+=mon[j];
    }
    
    cin >> n;
    for(int i=0; i<n; i++) {
        int date=0;
        cin >> y[i] >> m[i] >> d[i];

        date=365*y[i]+d[i];
        for(int j=1; j<m[i]; j++) date+=mon[j];

        for(int j=0; LD[1]>=date+365*j; j++) {
            int ndate=date+365*j;
            if(LD[0]<ndate&&ndate<=LD[1]) {res++;
            cout << ndate << '|';}
        }
        cout << res << '\n';
    }
    cout << res;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: