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>

using namespace std;

int main() {
    int i,year1,year2,month1,month2,day1,day2,someday=0;
    int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

    while(1){
        cin >> year1 >> month1 >> day1 >> year2 >> month2 >> day2;
        if(year1 == -1 || year2 == -1 || month1 ==-1 || month2 == -1 || day1 == -1 || day2==-1){
            break;
        }

        someday=0;

        if(year1 % 4 == 0 || year2 % 4 == 0){
            if(year1 % 100 == 0 || year2 % 100 == 0){
                if(year1 % 400 == 0 || year2 % 400 == 0){
                    someday += ((year2 - year1) * 365 + 1 + (year2 - year1) / 4);
                }
                else {
                    someday += ((year2 - year1) * 365 + (year2 - year1) / 4);
                }
            }
            else {
                someday += ((year2 - year1) * 365 + 1 + (year2 - year1) / 4);
            }
        }
        else{
            someday += ((year2 - year1) * 365 + (year2 - year1) / 4);
        }

        if(year2 > year1 && month2 < month1){
            if(year1 % 4 == 0 || year2 % 4 == 0){
                if(year1 % 100 == 0 || year2 % 100 == 0){
                    if(year1 % 400 == 0 || year2 % 400 == 0){
                        someday -= 366;
                    }
                    else {
                        someday -= 365;
                    }
                }
                else {
                    someday -= 366;
                }
            }
            else{
                someday -= 365;
            }
            
        }
        
        if(month1 == month2){
            someday += day2 - day1;  
        }
        else if(month1 < month2){
            for(i=1;i<month2 - month1;i++){
                someday += month[month1 + i];
            }
            someday += month[month1] - day1 + day2;
        }
        else {
            for(i=1;i<month2 - month1 + 12;i++){
                if(month1 + i > 12){
                    someday += month[month1 + i -12];
                }
                else {
                    someday += month[month1 + i];
                }
            }
             someday += month[month1] - day1 + day2;
        }

        if(year2 - year1 >= 4){
            someday -= 1;
        }

        cout << someday << endl;
        
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int conpute( int y,int m, int d ){

  int day = 0;

  for( int i = 1 ; i < y ; i++ ){
    day += 365;
    if( i % 100 == 0 ){
      if( i % 400 == 0 ) day++;
    }
    else if( i % 4 == 0 ) day++;
  }
  
for( int i = 1 ; i <  m ; i++ ){

    switch(i){
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
      day += 31;
      break;
    case 2:
      day += 28;
      if( y % 100 == 0 ){
	if( y % 400 == 0 ) day++;
      }
      else if( y % 4 == 0 ) day++;
      break;
    case 4:
    case 6:
    case 9:
    case 11:
      day += 30;
      break;
    }
 }
 day += d;
 return day;
}
int main(void){
  
  int y1,y2;
  int m1,m2;
  int d1,d2;
  
  while( cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2 ){
    if( y1 == m1 && m1 == d1 && d1 == y2 && y2 == m2 && m2 == d2 && d2 == -1 ){
      break;
    }
    int ans = 0;
    ans = conpute( y2, m2, d2 ) - conpute( y1, m1, d1 );
    cout << ans << endl;
  }
  return 0;
}

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

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

int dc(int y,int m,int d) {
    int res = 0;
    for(int i=1; i<y; ++i) res += 365 + isleap(i);
    for(int i=1; i<m; ++i) {
        res += 31;
        if(i == 4 || i == 6 || i == 9 || i == 11) res--;
        if(i == 2) res -= 3 + isleap(y);
    }
    res += d;
    return res;
}

int main() {
    int y1,y2,m1,m2,d1,d2;
    while(cin>>y1>>m1>>d1>>y2>>m2>>d2) {
        if(y1 == -1 && y2 == -1) break;

        if(y1 == y2 && m1 == m2 && d1 == d2) cout<<1<<endl;
        else cout<<dc(y2,m2,d2)-dc(y1,m1,d1)<<endl;
    }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
bool leap(int Y){
  if(Y%4==0)
    return( (Y%100==0)?( (Y%400==0)?true:false ):true ); 
  else return false;
}
int days(int Y,int M){
  if(M==2){
    if( leap(Y) ) return 29;
    else return 28;
  }
  else if(M==4 || M==6 || M==9 || M==11) return 30;
  else return 31;
}
int main(){
  int Y,M,D,aY,aM,aD;
  int cont=0;
  while(cin>>Y>>M>>D>>aY>>aM>>aD){
    if(Y<0 || M<0 || D<0 || aY<0 || aM<0 || aD<0) break;
    for(;;){
      if(Y==aY && M==aM && D==aD) break;
      D += 1;
      if(D > days(Y,M) ){
	D = 1;
	M += 1;
      }
      if(M > 12){
	M = 1;
	Y += 1;
      }
      cont++;
	}
    cout<<cont<<endl;
    cont = 0;
  }
}

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

int main()
{
	while (1)
	{
		int L, R; L = R = 0;
		int a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		if (a<0 || b<0 || c<0||d<0||e<0||f<0)break;
		for (int g = 1; g < a; g++)
		{
			if (g % 400 == 0) L += 366;
			else if (g % 100 == 0) L += 365;
			else if (g % 4 == 0)L += 366;
			else L += 365;
		}
		
		for (int g = 1; g < d; g++)
		{
			if (g % 400 == 0) R += 366;
			else if (g % 100 == 0) R += 365;
			else if (g % 4 == 0)R += 366;
			else R += 365;
		}
		
		for (int h = 1; h < b; h++) {
			switch (h) {
			case 1:case 3:case 5:case 7:case 8:case 10:case 12:L += 31; break;
			case 4:case 6:case 9:case 11:L += 30; break;
			case 2:if (a % 400 == 0) L += 29;
				   else if (a % 100 == 0) L += 28;
				   else if (a % 4 == 0)L += 29;
				   else L += 28;
			}
			}
			
			for (int h = 1; h < e; h++) {
				switch (h) {
				case 1:case 3:case 5:case 7:case 8:case 10:case 12:R += 31; break;
				case 4:case 6:case 9:case 11:R += 30; break;
				case 2:if (a % 400 == 0)R += 29;
					   else if (a % 100 == 0) R += 28;
					   else if (a % 4 == 0)R += 29;
					   else R += 28;
				}
			}
			
		cout << (R + f) - (L + c) << endl;
	}
}

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

int cnt=0;

#define A 0
#define O 1
#define X 2

class state{
public:
  int num[(1<<4)];
  
};
const int lim = ( 1 << 4);
int table[8][(1<<4)];
int data[8];

state parse(string &in,int &p){
  state ret;
  rep(i,lim)ret.num[i]=0;
  if ( in[p]== '('){
    p++;
    state left = parse(in,p);
    p++;//space
    state right =parse(in,p);
    p++;


    rep(i,lim){
      rep(j,lim){
	int val1=i&j,val2=i|j,val3=i^j;

	int add=left.num[i]*right.num[j];
	ret.num[val1]+=add;
	ret.num[val2]+=add;
	ret.num[val3]+=add;
      }
    }
  }else if ( in[p] <='9' && in[p] >='0'){
    int now = in[p]-'0';
    now--;
    ret.num[data[now]]=1;
    p++;
  }
  return ret;
}


main(){
  string t;
  while(getline(cin,t) && t != "END"){
    int n;
    cin>>n;
    
    int num=0;
    int p=0;
    rep(i,n){
      data[i]=0;
      int kari;
      rep(j,4)cin>>kari,data[i]|=(kari<<j);
    }
    
    state ans = parse(t,p);
    cout << ans.num[(1<<4)-1]<<endl;
    getline(cin,t);
  }
  return false;
}