Go: package main

import (
	"bufio"
		"os"
	"strings"
	"strconv"
		"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)))
		fmt.Println(ut2jd(ele_t2[0], ele_t2[1], ele_t2[2])-ut2jd(ele_t1[0], ele_t1[1], ele_t1[2]))
	}
}

func ut2jd(year, month, day int) int {
	if month <= 2 {
		year--
		month += 12
	}
	s := 3 + year/4 - year/100 + year/400
	s += 1720994 + year*365 + (month+1)*30 + (month+1)*3/5 + day
	return s
}

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

int month[13]={
  0,
  31,//1
  28,//2
  31,//3
  30,//4
  31,//5
  30,//6
  31,//7
  31,//8
  30,//9
  31,//10
  30,//11
  31//12
};

int day(int y,int m,int d){
  int base = (y-1)*365+d;
  REP(i,1,m)base+=month[i];
  int lim = m > 2 ? y+1:y;
  REP(i,1,y){
    if ( i %400 == 0 ||
	 (i % 100 !=0 && i % 4 == 0))base++;
  }
  return base;
}



/*
  correct version

int day2(int y,int m,int d){
  y += 4800;
  if (m < 3) --y, m += 12;
  return 365L*y+y/4-y/100+y/400+(153*m-457)/5+d-32045;
}
*/

main(){
  int y1,m1,d1,y2,m2,d2;
  while(cin>>y1>>m1>>d1>>y2>>m2>>d2 ){
    if ( y1 < 0 || m1 < 0 || d1 < 0 || 
	 y2 < 0 || m2 < 0 || d2 < 0)break;
    int a=day(y1,m1,d1),b=day(y2,m2,d2);
    //cout << day(y1,m1,d1)<<" " << day2(y1,m1,d1)<<" " << 
    //  day(y2,m2,d2)<<" " << day2(y2,m2,d2) << endl;
    
    cout << b-a << endl;
  }
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

//verified
class date{
public:
    int y,m,d;
    
    date(int _y=0, int _m=0, int _d=0):y(_y),m(_m),d(_d){};
    
    bool isLeap(){ return y%400==0||(y%4==0&&y%100); }
    
    date operator + (const int day)const{
        int days_of_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
        date t = *this;
        t.d+=day;
        if(  days_of_month[t.m]+(t.isLeap()&&t.m==2) >= t.d  )return date(t.y,t.m,t.d);
        int dom;
        while(  (dom = days_of_month[t.m]+(t.isLeap()&&t.m==2)) < t.d  ){
            t.d -= dom;
            if(t.m==12) t.y++,t.m=1;
            else        t.m++;
        }
        return t;
    }
    
    bool operator > (const date &date)const{
        int ymd1[] = {y,m,d};
        int ymd2[] = {date.y,date.m,date.m};
        rep(i,3){
            if(ymd1[i]>ymd2[i])return true;
            if(ymd1[i]<ymd2[i])return false;
        }
        return false;
    }
    
    bool operator == (const date &date)const{ return (y==date.y && m==date.m && d==date.d); }
    bool operator != (const date &date)const{ return !(*this==date); }
    bool operator <  (const date &date)const{ return ( !(*this>date) && !(*this==date) ); }
};



int main(){
    while(1){
        date ymd[2];
        rep(i,2)cin>>ymd[i].y>>ymd[i].m>>ymd[i].d;
        if(ymd[0].y==-1)break;
        if(ymd[0]>ymd[1])swap(ymd[0],ymd[1]);
        
        int c=0;
        while(ymd[0]!=ymd[1]){
            c++;
            ymd[0] = ymd[0]+1;
        }
        cout<<c<<endl;
    }
    
}

C++: #include <bits/stdc++.h>
using namespace std;

// infty
#define ULLINF (ULLONG_MAX)
#define LLINF  (LLONG_MAX)
#define IINF   (INT_MAX)
#define INF    (1<<29)

// math
#define Sq(x) ((x)*(x))

// container utility
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair
#define PB push_back
#define EACH(it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();it++)

// rep
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;

typedef long long ll;

// pair util
#define FST first
#define SND second

// range validator
#define CK(n,a,b) (a<=n && n<b)

// conversion
template<class T> inline string toStr(T a) { ostringstream oss_; oss_ << a; return oss_.str(); }
inline int toInt(string s) { return atoi(s.c_str()); }

// prime
bool isPrime(int a) { for(int i=2; i*i <=a; i++) if(a%i == 0) return false; return true; }

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

//////////////////////////////////////////////////////////////


int FairField(int y,int m,int d)
{
  // adjust
  if(m <= 2) {
    y --;
    m += 12;
  }
  
  int U = y/4 - y/100 + y/400;
  return 365*y + U + 153*(m+1)/5 + d - 428;
}

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

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


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

int main(){

	const int md[]={0,31,28,31,30,31,30,31,31,30,31,30,31};

	int y1,m1,d1,y2,m2,d2;
	while(cin>>y1>>m1>>d1>>y2>>m2>>d2&&(y1>=0&&m1>=0&&d1>=0&&y2>=0&&m2>=0&&d2>=0)){
		int sum=0;
		if(y1!=y2){
			for(int y = y1+1; y < y2; y++){
				if(checkUru(y)){
					sum+=366;
				}
				else
					sum+=365;
			}
			// y1ツづ2ツづ可づつつ「ツづ計ツ算
			if(checkUru(y1)){
				sum+=(md[m1]-d1);
				if(m1==2)
					sum++;
				for(int m=m1+1; m<=12; m++){
					if(m==2)
						sum++;
					sum+=md[m];
				}
			}
			else{
				sum+=(md[m1]-d1);
				for(int m=m1+1; m<=12; m++){
					sum+=md[m];
				}
			}
			
			if(checkUru(y2)){
				sum+=(d1);

				for(int m=1; m<m2; m++){
					if(m==2)
						sum++;
					sum+=md[m];
				}
			}
			else{
				sum+=(d1);
				for(int m=1; m<m2; m++){
					sum+=md[m];
				}
			}
		}
		else{
			if(m1!=m2){
				for(int m=m1+1; m < m2; m++){
					if(checkUru(y1)&&m==2){
						sum+=29;
					}
					else
						sum+=md[m];
				}
				// m1ツづ2ツづ可づつつ「ツづ計ツ算
				if(checkUru(y1)&&m1==2){
					sum+=(md[m1]-d1)+1;
				}
				else
					sum+=(md[m1]-d1);

				// m2
				sum+=d2;

			}
			else{
				sum+=d2-d1;
			}
		}
		cout<<sum<<endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

bool is_leap(int y)
{
	return y % 4 == 0 && y % 100 || y % 400 == 0;
}
int main()
{
	int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int y[2], m[2], d[2];
	while (scanf("%d %d %d %d %d %d", &y[0], &m[0], &d[0], &y[1], &m[1], &d[1]),
		y[0] >= 0 && m[0] >= 0 && d[0] >= 0 && y[1] >= 0 && m[1] >= 0 && d[1] >= 0)
	{
		int dd[2];
		for (int i = 0; i < 2; ++i)
		{
			dd[i] = d[i];
			for (int j = 0; j < m[i]-1; ++j)
				dd[i] += days[j];
		}
		int ans = dd[1] - dd[0];
		ans += (y[1] - y[0]) * 365;
		for (int i = y[0]; i < y[1]; ++i)
		{
			if (is_leap(i))
				++ans;
		}
		if (is_leap(y[0]) && m[0] > 2)
			--ans;
		if (is_leap(y[1]) && m[1] > 2)
			++ans;

		printf("%d\n", ans);
	}

	return 0;
}