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<stdio.h>
int main(void){
	int y1,m1,d1,y2,m2,d2;
	int i;
	int y1day,y2day;
	while(1){
		scanf("%d %d %d %d %d %d",&y1,&m1,&d1,&y2,&m2,&d2);
		y1day=0;
		y2day=0;
		if(y1==-1 || m1==-1 || d1==-1 || y2==-1 || m2==-1  || d2==-1) break;
		y1day=y2day=0;
		for(i=1;i<y1;i++){
			y1day+=365;
			if((i%4==0 && i%100!=0) || i%400==0) y1day++;
		}
		for(i=1;i<m1;i++){
			y1day+=31;
			if(i==4 || i==6 || i==9 || i==11) y1day-=1;
			if(i==2){
				y1day-=1;
				if((y1%4==0 && y1%100!=0) || y1%400==0) y1day-=1;
			}
		}
		y1day+=d1;
		for(i=1;i<y2;i++){
			y2day+=365;
			if((i%4==0 && i%100!=0) || i%400==0) y2day++;
		}
		for(i=1;i<m2;i++)	{
			y2day+=31;
			if(i==4 || i==6 || i==9 || i==11) y2day-=1;
			if(i==2){
				y2day-=1;
				if((y1%4==0 && y1%100!=0) || y1%400==0) y2day-=1;
			}
		}
		y2day+=d2;
	//	printf("%d %d\n",y1day,y2day);
		printf("%d\n",y2day-y1day);
	}
	return 0;
}

C++: #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
//#include <utility>
#include <set>
#include <iostream>
//#include <memory>
#include <string>
#include <vector>
#include <algorithm>
//#include <functional>
#include <sstream>
//#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
//#include <cctype>
#include <cstring>
//#include <ctime>
#include <iterator>
#include <bitset>
//#include <numeric>
//#include <list>
//#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
int mo[12]={31,28,31,30,31,30,31,31,30,31,30,31};
bool is_leap(int a){
	if(a%400==0) return true;
	if(a%100==0) return false;
	if(a%4==0) return true;
	return false;
}
int foo2(int y1,int m1,int d1,int y2,int m2,int d2){
	int ret=0;
	while(!(y1==y2&&m1==m2&&d1==d2)){
		ret++;
		// int t;
		// cin>>t;
		// cout<<y1<<" "<<m1<<" "<<d1<<endl;
		if(m1==12&&d1==31){
			y1++;
			m1=1;
			d1=1;
		}
		else if(is_leap(y1)&&m1==2){
			if(d1==29){
				m1++;
				d1=1;
			}
			else{
				d1++;
			}
		}
		else if(mo[m1-1]>d1){
			d1++;
		}
		else{
			m1++;
			d1=1;
		}
	}
	return ret;
}
int foo(int y,int m,int d){
	bool f=is_leap(y);
	int ret=0;
	while(m<=12){
		if(m==2&&f){
			ret+=mo[m-1]-d+2;
		}
		else{
			ret+=mo[m-1]-d+1;
		}
		m++;
		d=1;
	}
	// cout<<"ret "<<ret<<endl;
	return ret;
}


void mainmain(){
	vint a(6);
	while(1){
		rep(i,6){
			cin>>a[i];
			if(a[i]==-1) return;
		}
		cout<<foo2(a[0],a[1],a[2],a[3],a[4],a[5])<<endl;
		continue;
		int ans=0;
		if(a[0]==a[3]){
			cout<<-foo(a[3],a[4],a[5])+foo(a[0],a[1],a[2])<<endl;
			continue;
		}
		rep(i,2) ans+=foo(a[0+i*3],a[1+i*3],a[2+i*3]);
		ans-=365;
		if(is_leap(a[3])&&(a[4]==1||a[4]==2)) ans--;
		a[0]++;
		while(a[0]!=a[3]){
			 if(is_leap(a[0])) ans++;
			 ans+=365;
			 a[0]++;
		}
		cout<<ans<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

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

int main() {

  int m_day[] = {31,28,31,30,31,30,31,31,30,31,30,31};
  int a,b,c,d,e,f;

  while(true) {
    cin>>a>>b>>c>>d>>e>>f;
    if(a==-1&&b==-1&&c==-1&&d==-1&&e==-1&&f==-1) break;
    int ans = 0;

    for(int i=a; i<=d; i++) {
      bool flag = false;
      if(i%4==0) {
        if(i%100==0) {
          if(i%400==0)flag = true;
        } else {
          flag = true;
        }
      }

      if(a == d) {
        if(b == e) {
          ans = f - c;
        } else {
          ans += m_day[b-1] - c;
          for(int j = b+1; j<e; j++) {
            if(j == 2 && flag) ans += m_day[j-1]+1;
            else ans += m_day[j-1];
          }
          ans += f;
        }

      } else {
        if(i == a) {
          for(int j=b+1; j<=12; j++) {
            if(j == 2 && flag) ans += m_day[j-1]+1;
            else ans += m_day[j-1];
          }
          ans += m_day[b-1] - c;
          if(b == 2 && flag) ans++;
        } else if(i == d) {
          for(int j=1; j<e; j++) {
            if(j == 2 && flag) ans += m_day[j-1]+1;
            else ans += m_day[j-1];
          }
          ans += f;
        } else {
          if(flag) ans += 366;
          else ans += 365;
        }
      }
    }
    cout << ans << endl;
  }

}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;

int mm1[] = {0,31,59,90,120,151,181,212,242,273,303,334};
int mm2[] = {0,31,60,91,121,152,182,213,243,274,304,335};
// ¼ïPNPPú©çÌú
ll days(int y, int m, int d) {
  y--;
  ll ret = y*365;
  ret += (y/4)-(y/100)+(y/400); // [N
  if (y%400==0||(y%4==0&&y%100==0))
    ret += mm1[m];
  else
    ret += mm2[m];
  return ret+d;
}

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

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

typedef long long ll;
typedef pair<string,int> P;

bool isLeap(int i){
	return i % 400 == 0
			? true : i % 100 == 0
			? false : i % 4 == 0
			? true : false;
}

int getSum(int y,int m,int d,const int* month){
	int sum=0;
	for(int i=0;i<y;i++){
		sum += isLeap(i) ? 366 : 365;
	}

	for(int i=1;i<m;i++){
		sum += i != 2 ? month[i] :
			isLeap(y) ? month[i] + 1 : month[i];
	}

	sum += d;

	return sum;
}

int main(){
	const int month[] = {-1,31,28,31,30,31,30,31,31,30,31,30,31};
	int y1, m1, d1, y2, m2, d2;
	while(~scanf("%d %d %d %d %d %d",&y1, &m1, &d1, &y2, &m2, &d2)){
		if(y1 < 0 || m1 < 0 || d1 < 0
			|| y2 < 0 || m2 < 0 || d2 < 0) break;

		cout << abs(getSum(y1,m1,d1,month) - getSum(y2,m2,d2,month)) << endl;
	}
}