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>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

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

int ytoi(int y){
	return (y*365+y/4-y/100+y/400);
}

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

int daycount(int y, int m, int d){
	int res = 0;
	res += ytoi(y-1);
	res += md[m-1];
	res += d;
	res += (((y%4 == 0 && y%100) || y%400 == 0) && m >= 3);

	return res;
}

int main(){
	for(int i = 1; i <= 12; i++) md[i] += md[i-1];

	int y1, m1, d1, y2, m2, d2;
	while(cin >> y1 >>m1 >> d1 >> y2 >> m2 >> d2, y1 >= 0){
		cout << daycount(y2, m2, d2) - daycount(y1, m1, d1) << endl;
	}

	return 0;
}

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

#define pb push_back
#define fr first
#define sc second
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> pip; 
const int INF = (1<<25);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

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;
    int total1=0,total2=0;
    for(int i=0;i<y1;i++){
      if(i%4==0 && (i%100!=0 || i%400==0)){
	total1+=366;
	 
      }else {
	total1+=365;
      }
    }

    for(int i=0;i<y2;i++){
      if(i%4==0 && (i%100!=0 || i%400==0)){
	total2+=366;
	  
      }else {
	total2+=365;
      }
    }

    for(int i=1;i<m1;i++){
      if(i==2){
	if(y1%4==0 &&( i%100!=0 || i%400==0)){
	  total1+=29;
	  
	}
	else total1+=28;
      }
      else if(i==4 || i==6 || i==9 || i==11){
	total1+=30;
      }
      else total1+=31;
    }
    
    for(int i=1;i<m2;i++){
      if(i==2){
	if(y2%4==0 &&( i%100!=0 || i%400==0)){
	    total2+=29;
	  
	}
	else total2+=28;
      }
      else if(i==4 || i==6 || i==9 || i==11){
	total2+=30;
      }
      else total2+=31;
    }

    total1+=d1;
    total2+=d2;
    cout<< total2-total1<< endl;
  }
}

C++: #include <cstdio>
int y1, m1, d1, y2, m2, d2;
int day[2][12]={
{31,28,31,30,31,30,31,31,30,31,30,31,31},
{31,29,31,30,31,30,31,31,30,31,30,31,31}
};
bool uruu(int year) {
    if (year%400==0) return true;
    else if (year%100==0) return false;
    else if (year%4==0) return true;
    else return false;
}
int main() {
    while (scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2)) {
        if (y1==-1&&m1==-1&&d1==-1&&y2==-1&&m2==-1&&d2==-1) break;
        int res = 0, flag;
        if (y1==y2) {
            if (uruu(y1)) flag = 1;
            else flag = 0;
            if (m1==m2) res = d2-d1;
            else {
                for (int i=m1; i<m2; i++) res += day[flag][i];
                res += day[flag][m1-1] - d1;
                res += d2;
            }
        } else {
            if (uruu(y1)) flag = 1;
            else flag = 0;
            for (int i=m1; i<12; i++) res += day[flag][i];
            res += day[flag][m1-1] - d1;
            for (int i=y1+1; i<y2; i++) {
                if (uruu(i)) res += 366;
                else res += 365;
            }
            if (uruu(y2)) flag = 1;
            else flag = 0;
            for (int i=0; i<m1-1; i++) res += day[flag][i];
            res += d2;
        }
        printf("%d\n", res);
    }
}

C++: #include <iostream>
#include <boost/date_time/gregorian/gregorian.hpp>

using namespace boost::gregorian;
using namespace std;

int main() {
	while (true) {
		int y1, m1, d1, y2, m2, d2;
		cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
		if (y1 == -1 && m1 == -1 && d1 == -1 && y2 == -1 && m2 == -1 && d2 == -1)break;
		date da1(y1, m1, d1), da2(y2, m2, d2);
		cout << da2 - da1 << endl;
	}
}

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

int main(){
  while(1){
    int day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int uruday[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    int i,j,y1,m1,d1,y2,m2,d2;
  int total=0;
  cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
  if(y1<0 || m1<0 || d1<0 || y2<0 || m2<0 || d2<0)break;
  for(i = y1; i < y2; i++){
    if(i%4==0){
      total += 366;
      if(i%100==0)total-=1;
      if(i%400==0)total+=1;
    }
    else total+=365;
  }
  
  for(i = 1; i < m2; i++){
    if(i==2 && (y2%4==0)){
      total+=uruday[i];
      if(y2%100==0)total-=1;
      if(y2%400==0)total+=1;
    }
    else total+=day[i];
  }

  for(i = 1; i < m1; i++){
  if(i==2 && (y1%4==0)){
      total-=uruday[i];
      if(y1%100==0)total+=1;
      if(y1%400==0)total-=1;
    }
    else total-=day[i];
  }
  
  total+=d2-d1;

  cout << total << endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

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] : month[i] + 1;
	}

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