Go: package main

import (
	"bufio"
		"os"
	"strings"
	"strconv"
	"time"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		input := strings.Split(scanner.Text(), " ")
		ele_t1 := [3]int{}
		ele_t2 := [3]int{}
		for i := range ele_t1 {
			ele_t1[i], _ = strconv.Atoi(input[i])
			ele_t2[i], _ = strconv.Atoi(input[i+3])
		}
		if ele_t1[0] < 0 || ele_t1[1] < 0 || ele_t1[2] < 0 ||
			ele_t2[0] < 0 || ele_t2[1] < 0 || ele_t2[2] < 0 {
				break
		}
		t1 := time.Date(ele_t1[0], time.Month(ele_t1[1]), ele_t1[2], 0, 0, 0, 0, time.UTC)
		t2 := time.Date(ele_t2[0], time.Month(ele_t2[1]), ele_t2[2], 0, 0, 0, 0, time.UTC)
		diff := t2.Sub(t1)
		fmt.Printf("%v\n", int64(diff/(time.Hour*24)))
	}
}

C++: #include<iostream>
using namespace std;
int x[1000000], day[13][32], day2[13][32], cnt, a, b, c, d, e, f, daya1, daya2;
int days[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
int days2[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };
int main() {
	for (int i = 1; i < 1000000; i++) {
		if ((i % 4 == 0 && i % 100>0) || i % 400 == 0) {
			x[i] = x[i - 1] + 366;
		}
		else {
			x[i] = x[i - 1] + 365;
		}
	}
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= days[i]; j++) {
			day[i][j] = cnt;
			cnt++;
		}
	}
	cnt = 0;
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= days2[i]; j++) {
			day2[i][j] = cnt;
			cnt++;
		}
	}
	while (true) {
		cin >> a >> b >> c >> d >> e >> f;
		if (a < 0) { break; }
		if (b < 0) { break; }
		if (c < 0) { break; }
		if (d < 0) { break; }
		if (e < 0) { break; }
		if (f < 0) { break; }
		daya1 = 0; daya2 = 0;
		daya1 += x[a - 1];
		daya2 += x[d - 1];
		if (a % 4 == 1) {
			daya1 += day2[b][c];
		}
		else {
			daya1 += day[b][c];
		}
		if (d % 4 == 1) {
			daya2 += day2[e][f];
		}
		else {
			daya2 += day[e][f];
		}
		cout << daya2 - daya1 << endl;
	}
}

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

int main(){
  int i,j,y[2],m[2],d[2],ans,f;
  while(1){
    f = 0;
    for(i=0;i<2;i++){
      cin >> y[i] >> m[i] >> d[i];
      if(y[i] == -1 && m[i] == -1 && d[i] == -1) f++;
    }
    if(f == 2) break;

    ans = (y[1] - y[0]) * 365 + (m[1] - m[0]) * 30 + d[1] - d[0];

    for(i=m[0];i<=m[1];i++){
      if((i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12) && i != m[1]) ans++;
    }

    for(i=y[0];i<=y[1];i++){
      if(i%4 == 0 && (i != y[1] || m[i] > 2)){
	if(i%400 == 0);
	else if(i%100 == 0) continue;
	ans++;
      }
    }

    cout << ans << endl;

  }
  return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int N, K;
struct Edge {
    int to, cost;
    Edge(int to, int cost): to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

const int INF = 100000000;

vi dist;
int d[110][110];

bool bellman_ford(int n, int s) { // nは頂点数、sは開始頂点
    dist = vector<int>(n, INF);
    dist[s] = 0; // 開始点の距離は0
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int u = 0; u < n; u++) {
                if (dist[v] != INF && dist[u] > dist[v] + d[v][u]) {
                    dist[u] = dist[v] + d[v][u];
                    if (i == n - 1) return true; // n回目にも更新があるなら負の閉路が存在
                }
            }
        }
    }
    return false;
}
bool cmp(const pair<int,string>& a, const pair<int,string>& b){
    return a.first < b.first;
}

const int uruu = 366;

int days[13]={0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int calc(int y, int m, int d) {
    static const int DAYS[13] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int ans = 0;
    ans += (y-1) * 365 + (y-1)/4 - (y-1)/100 + (y-1)/400;
    for(int i = 1; i < m; ++i) ans += DAYS[i];
    if(m > 2 && (y%4 == 0 && (y%100 != 0 || y%400 == 0))) ++ans;
    ans += d;
    return ans;
}
int main() {
    //cout << fixed << setprecision(15);

    
    int y1, m1, d1, y2, m2, d2;
    while(cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2){
        if(y1 <= -1 || m1 <= -1 || d1 <= -1 || y2 <= -1 || m2 <= -1 || d2 <= -1) break;
       
        cout << calc(y2, m2, d2) - calc(y1, m1, d1) << endl;
    }
    return 0;
}

C++: #include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int cal[100000];
	int month[13];
	month[1]=month[3]=month[5]=month[7]=month[8]=month[10]=month[12]=31;
	month[4]=month[6]=month[9]=month[11]=30;
	loop(i,0,100000){
		if(i%4==0){
			if(i%100==0){
				if(i%400==0){
					cal[i]=1;
				}else cal[i]=0;
			}else cal[i]=1;

		}else cal[i]=0;
	}
	int ay,am,ad,by,bm,bd;
	while(1){
		cin>>ay>>am>>ad>>by>>bm>>bd;
		if(ay<0 || am<0 || ad<0 || by<0 || bm<0 || bd<0)break;
		long long ans=0;
		loop(j,ay+1,by){
			if(cal[j]==1){
				ans+=366;
			}else ans+=365;
		}
		if(ay!=by){
			loop(j,am+1,13){
				if(j==2){
					if(cal[ay]=1)ans+=29;
					else ans+=28;
				}else ans+=month[j];
			}
			loop(j,1,bm){
				if(j==2){
					if(cal[by]==1)ans+=29;
					else ans+=28;
				}else ans+=month[j];
			}
		}else{
			loop(j,am+1,bm){
				if(j==2){
					if(cal[am]==1)ans+=29;
					else ans+=28;
				}else ans+=month[j];
			}
		}
		if(am!=bm){
			ans+=(month[am]-ad);
			ans+=bd;
		}else if(ay==by){
			ans+=(bd-ad);
		}else{
			ans+=(month[am]-ad);
			ans+=bd;
		}
		cout<<ans<<endl;
	}
	return 0;
}