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 <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

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

inline bool IsLeap(const int year) {
  return (year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0));
}

int main() {
  int y1, m1, d1, y2, m2, d2;
  while (scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2)) {
    // printf("%d %d\n", y1, y2);
    if (y1 == -1) break;
    int dist = 0;
    if (y1 != y2) {
      dist += days[m1] - d1 + 1;
      if (m1 != 12) {
        for (int i = m1+1; i <= 12; ++i) {
          dist += days[i];
          if (i == 2 && IsLeap(y1)) dist++;
        }
      }
      d1 = m1 = 1;
      y1++;
      for (; y1 < y2; ++y1) {
        dist += 365;
        if (IsLeap(y1)) dist++;
      }
    } else {
      if (m1 == m2) {
        cout << d2 - d1 << endl; continue;
      } else {
        dist += days[m1] - d1 + 1;
        m1++;
      }
    }
    // same year
    for (; m1 < m2; ++m1) {
      dist += days[m1];
    }
    dist += d2 - 1;
    printf("%d\n", dist);
  }
  return 0;
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
vector<int>year(1, 0), month{ 0,0,31,28,31,30,31,30,31,31,30,31,30,31 }, day;
int YEAR(int n) {
	if (n < year.size())return year[n];

	int x = year.size() - 1;
	while (year.size() <= n) {
		if (x % 4 == 0 && (x % 100 != 0 || x % 400 == 0))year.push_back(year[x] + 366);
		else year.push_back(year[x] + 365);
		x++;
	}

	return year[n];
}
int Month(int y, int m) {
	int res = month[m];
	if (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) {
		if(m>=3)res++;
	}
	return res;
}
signed main() {
	rep(i, 1, month.size())month[i] += month[i - 1];
	while (1) {
		int y1, y2, m1, m2, d1, d2;
		if (y1 < 0 || y2 < 0 || m1 < 0 || m2 < 0 || d1 < 0 || d2 < 0)break;
		cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;

		cout << YEAR(y2) - YEAR(y1) + Month(y2, m2) - Month(y1, m1) + d2 - d1 << endl;;
	}
	return 0;
}

C++: #include <cstdio>
bool isLeap(int year)
{
	if (year % 400 == 0) return true;
	if (year % 100 == 0) return false;
	return (year % 4 == 0);
}
long long dateserial(int year, int month, int day)
{
	static int days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	long long res = day;
	for (int i = 0; i < month-1; ++i) {
		res += days[i];
		if (isLeap(year) && i == 1) res++;
	}
	for (int i = 1; i < year; ++i) {
		res += 365;
		if (isLeap(i)) res++;
	}
	return res;
}
int main()
{
	while (true) {
		int y1, m1, d1, y2, m2, d2;
		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;

		long long date1 = dateserial(y1, m1, d1);
		long long date2 = dateserial(y2, m2, d2);
		printf("%d\n", date2 - date1);
	}
	return 0;
}

C++: #include<stdio.h>
#include<time.h>

int main(void)
{
  while(1)
    {
      struct tm car[2]={};
      time_t tim[2];
      int judge=0;
      int i;
      
      for(i=0;i<2;i++)
	{
	  scanf("%d", &car[i].tm_year);
	  if(car[i].tm_year==-1)
	    judge=1;
	  scanf("%d", &car[i].tm_mon);
	  if(car[i].tm_mon==-1)
	    judge=1;
	  scanf("%d", &car[i].tm_mday);
	  if(car[i].tm_mday==-1)
	    judge=1;
	  car[i].tm_year-=1900;
	  car[i].tm_mon-=1;
	  tim[i]=mktime(&car[i]);
	}
      if(judge)break;

      printf("%ld\n",(tim[1]-tim[0])/86400);
    }

  return 0;
}

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int f(int y){
  if(y%4)
    return 0;
  else if(y%100)
    return 1;
  else if(y%400)
    return 0;
  else
    return 1;
}
int main(){
  int i;
  int y1,m1,d1,y2,m2,d2,c;
  int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
  for(;;){
    cin>>y1>>m1>>d1>>y2>>m2>>d2;
    if(y1==-1||m1==-1||d1==-1||y2==-1||m2==-1||d2==-1)
      break;
    c=0;
    if(y1==y2){
      if(m1==m2)
	c=d2-d1;
      else{
	c+=a[m1]-d1+1+(m1==2&&f(y1));
	c+=d2-1;
	for(i=m1+1;i<m2;i++)
	  c+=a[i]+(i==2&&f(y1));
      }
    }else{
      c+=a[m1]-d1+1+(m1==2&&f(y1));
      c+=d2-1;
      for(i=m1+1;i<13;i++)
	c+=a[i]+(i==2&&f(y1));
      for(i=1;i<m2;i++)
	c+=a[i]+(i==2&&f(y2));
      for(i=y1+1;i<y2;i++)
	c+=365+f(i);
    }
    cout<<c<<endl;
  }
  return 0;
}

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

const int n_day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
 
struct Date {
  // year, month[1,12], day(1 origin), a day of the week[0,6]
  int y, m, d, e;
  Date() {}
  Date(int y, int m, int d, int e = -1) : y(y), m(m), d(d), e(e) {}
 
  bool operator < (const Date &o) const {
    if(y != o.y) return y < o.y;
    if(m != o.m) return m < o.m;
    return d < o.d;
  }
 
  bool isLeapYear() {
    if(y % 400 == 0) return true;
    if(y % 100 == 0) return false;
    if(y % 4 == 0) return true;
    return false;
  }

  int getDays() {
    int nd = n_day[m];
    if(m == 2) nd += isLeapYear();
    return nd;
  }

  void next() {
    e = (e+1)%7;
    if(d == getDays()) {
      d = 1;
      if(m == 12) {
        m = 1;
        ++y;
      } else {
        ++m;
      }
    } else {
      ++d;
    }
  }
 
  void back() {
    e = (e+6)%7;
    if(d == 1) {
      if(m == 1) {
        m = 12;
        --y;
      } else {
        --m;
      }
      d = getDays();
    } else {
      --d;
    }
  }
};

// AOJ 0125
int 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;
    Date d(y1,m1,d1), end(y2,m2,d2);
    int res = 0;
    while(d < end) {
      ++res;
      d.next();
    }
    cout << res << endl;
  }
  return 0;
}