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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


// [N©Ç¤©Æ¤}N : }NÉ·éÓ¡Í ÜèÈ¢ªK&RÉ»¤ÈÁÄ¢éÌÅB
#define leap(y) ((y)%4 == 0 && ((y)%100 != 0 || (y)%400 == 0))

// êNÌÌútÌÝvf[^
static int md[2][12] =
{
	0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
	0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 
};



// ¼ï1N11ú©çÌÝvú : 7ÅÁ½ ÜèªjúÉÈé (0:sun)
int TotalDays(int y, int m, int d)
{
	int ty = y-1;
	int t = ty*365 + ty/4 - ty/100 + ty/400;
	
	t += md[leap(y)][m-1];
	return t + d;
}

int main()
{
	int y1, y2, m1, m2, d1, d2;
	while(cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2 && y1 != -1)
	{
		int d = abs(TotalDays(y1, m1, d1) - TotalDays(y2, m2, d2));
		
		cout << d << endl;
		
	}
}

C++: #include<stdio.h>
#define N (++m1>12?(++y1,m1-=12):0)
int U(int y)
{
	if(y%100==0)return y%400==0;
	return y%4==0;
}
int main()
{
	int D[2][13]={0,31,28,31,30,31,30,31,31,30,31,30,31},y1,y2,m1,m2,d1,d2,i,r;
	for(i=0;i<13;++i)D[1][i]=D[0][i];++D[1][2];
	while(scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2),d1>0)
	{
		if(y1==y2&&m1==m2)r=d2-d1;
		else for(r=D[U(y1)][m1]-d1+d2,N;y1<y2||m1<m2;N)
			r+=D[U(y1)][m1];
		printf("%d\n",r);
	}
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define MAX_v 100
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int Lcalendar[] = {366,31,29,31,30,31,30,31,31,30,31,30,31};
const int Ncalendar[] = {365,31,28,31,30,31,30,31,31,30,31,30,31};
int GetTotalDays(int y,int m,int d){
    long long int sum = 0;
    sum = y * 365 + ((y-1)/4) - ((y-1)/100) + ((y-1)/400);
    if(y % 4 == 0 &&(y % 400 == 0 || y % 100 != 0)){
        for(int i = 1; i <= m-1; i++)sum += Lcalendar[i];
    }

    else{
        for(int i = 1; i <= m-1; i++) sum += Ncalendar[i];
    }
    sum += d;
    return sum;
}
int main(){
	int y1,m1,d1,y2,m2,d2;

	while(true){
		scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2);
		if(y1 == m1 && d1 == y2 && m2 == d2 && m2 == -1)break;
		printf("%d\n",GetTotalDays(y2,m2,d2)-GetTotalDays(y1,m1,d1));
	}

	return 0;
}

C++: #include <iostream>

const int DAYS[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

struct Date {
	int y;
	int m;
	int d;
	Date() {}
	Date(int y, int m, int d) : y(y), m(m), d(d) {}
};

bool isLeap(int y)
{
	if (y % 400 == 0) return true;
	else if (y % 100 == 0) return false;
	else if (y % 4 == 0) return true;
	else return false;
}

int countRestDays(int y, int m, int d)
{
	int res = DAYS[m-1] - d + 1;
	for (int i=m; i<12; i++) {
		res += DAYS[i];
	}
	if (isLeap(y) && m <= 2) res++;
	return res;
}

int main()
{
	int y1, m1, d1, y2, m2, d2;
	while (std::cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2) {
		if (y1==-1) break;
		int res = countRestDays(y1, m1, d1);
		for (int y=y1+1; y<=y2; y++) {
			res += isLeap(y) ? 366 : 365;
		}
		res -= countRestDays(y2, m2, d2);
		std::cout << res << std::endl;
	}
	return 0;
}

C++: #include <iostream>

#include <vector>

#include <algorithm>

#include <sstream>

#include <string>

#include <cmath>

#include <list>

#include <set>
using namespace std;

int in() {int x; cin >> x; return x;}

template <typename T> class SegTree

{

public:

	int n;

	T T_max;

	vector<T> dat;

	SegTree(int n_, T t_max)

	{

		int n = 1;

		T_max = t_max;

		while (n < n_)n *= 2;

		for (int i = 0; i < 2 * n - 1; i++)dat.push_back(t_max);

	}

	void update(int k, T a)

	{

		k += n - 1;

		dat[k] = a;

		while (k > 0)

		{

			k = (k - 1) / 2;

			dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);

		}

	}



	//[a,b)

	T query(int a, int b)

	{

		return _query(a, b, 0, 0, n);

	}



private:

	T _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l)return T_max;

		if (a <= l && r <= b)return dat[k];

		else

		{

			T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);

			T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);

			return min(vr, vl);

		}

	}

};

bool uruu(int y)
{
	if (y % 4 == 0)
	{
		if (y % 100 == 0 && y % 400 == 0)return true;
		if (y % 100 == 0)return false;
		return true;
	}
	return false;
}

int main()
{
	int dat[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int y, m, d, Y, M, D;
	while (cin >> y >> m >> d >> Y >> M >> D && y != -1)
	{
		int ans = 0;
		ans -= d - 1; d = 1;
		for (; m >= 1; m--)
		{
			ans -= dat[m - 1];
			if (uruu(y) && m == 2)
			{
				ans -= 1;
			}
		}

		ans += D - 1; D = 1;
		for (; M >= 1; M--)
		{
			ans += dat[M - 1];
			if (uruu(Y) && M == 2)
			{
				ans += 1;
			}
		}
		for (; y < Y; y++)
		{
			ans += 365;
			if (uruu(y))
			{
				ans += 1;
			}
		}

		cout << ans << endl;
	}
}

C++: #include <iostream>

using namespace std;

int day(int, int, int);

int main() {

	struct P {
		int y, m, d;
	} a, b;

	while(cin >> a.y >> a.m >> a.d >> b.y >> b.m >> b.d) {
		if(a.y<0) {
			break;
		}
		int d1, d2;
		if(a.m<3) {
			a.m+=12;
			a.y--;
		}
		if(b.m<3) {
			b.m+=12;
			b.y--;
		}
		d1=day(a.y, a.m, a.d);
		d2=day(b.y, b.m, b.d);
		cout << d2-d1 << endl;
	}

	return 0;

}


int day(int y, int m, int d) {
	return (365*y+y/4-y/100+y/400+(306*(m+1))/10+d-428);
}

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