Problem:


日数

2 つの日付を入力とし、その 2 つの日付けの間の日数を出力するプログラムを作成してください。

日付 1 (y1, m1, d1) は日付 2 (y2, m2, d2) と同じか、あるいはそれ以前の日付とします。日付 1 は日数に含め、日付 2 は含めません。また、うるう年を考慮にいれて計算してください。うるう年の条件は次のとおりとします。

   
西暦年が 4 で割り切れる年であること。

   
ただし、100 で割り切れる年はうるう年としない。

   
しかし、400 で割り切れる年はうるう年である。

Input

複数のデータセットが与えられます。各データセットの形式は以下のとおりです：

y1 m1 d1 y2 m2 d2

y1, m1, d1, y2, m2, d2 のいずれかが負の数のとき入力の終わりとします。

データセットの数は 50 を超えません。

Output

データセットごとに、日数を１行に出力してください。

Sample Input

2006 9 2 2006 9 3
2006 9 2 2006 11 11
2004 1 1 2005 1 1
2000 1 1 2006 1 1
2000 1 1 2101 1 1
-1 -1 -1 -1 -1 -1

Output for the Sample Input

1
70
366
2192
36890



Sample input:
2006 9 2 2006 9 3
2006 9 2 2006 11 11
2004 1 1 2005 1 1
2000 1 1 2006 1 1
2000 1 1 2101 1 1
-1 -1 -1 -1 -1 -1


Sample output:
1
70
366
2192
36890

Submission status: Wrong Answer

Solution code:
def y_to_d(y):
    y = y-1
    ret = 365 * y
    ret += y // 4
    ret -= y // 100
    ret += y // 400
    return ret

month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]


def m_to_d(y, m):
    ret = 0
    for i in range(m-1-1):
        ret += month[i]
    if m > 2 and (y % 4 == 0 and y % 100 != 0 or y % 400 == 0):
        ret -= 1
    return ret



while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if y1 == m1 == d1 == y2 == m2 == d2 == -1:
        quit()
    ymd1 = y_to_d(y1) + m_to_d(y1, m1) + d1
    ymd2 = y_to_d(y2) + m_to_d(y2, m2) + d2
    print(ymd2 - ymd1)

Submission status: Wrong Answer

Solution code:
def y_to_d(y):
    y -= 1
    ret = 365 * y
    ret += y // 4
    ret -= y // 100
    ret += y // 400
    return ret

month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]


def m_to_d(y, m):
    m -= 1
    ret = 0
    for i in range(m-1):
        ret += month[i]
    if m > 2 and (y % 4 == 0 and y % 100 != 0 or y % 400 == 0):
        ret -= 1
    return ret



while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if y1 == m1 == d1 == y2 == m2 == d2 == -1:
        quit()
    ymd1 = y_to_d(y1) + m_to_d(y1, m1) + d1
    ymd2 = y_to_d(y2) + m_to_d(y2, m2) + d2
    print(ymd2 - ymd1)

Submission status: Wrong Answer

Solution code:
def y_to_d(y):
    y -= 1
    ret = 365 * y
    ret += y // 4
    ret -= y // 100
    ret += y // 400
    return ret

month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]


def m_to_d(y, m):
    m -= 1
    ret = 0
    for i in range(m-1):
        ret += month[i]
    if m > 2 and (y % 4 == 0 and y % 100 != 0 or y % 400 == 0):
        ret += 1
    return ret


while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if y1 == m1 == d1 == y2 == m2 == d2 == -1:
        quit()
    ymd1 = y_to_d(y1) + m_to_d(y1, m1) + d1
    ymd2 = y_to_d(y2) + m_to_d(y2, m2) + d2
    print(ymd2 - ymd1)

Submission status: Wrong Answer

Solution code:
def uru(y):
    return y % 4 == 0 and y % 100 != 0 or y % 400 == 0

def y_to_d(y):
    ret = 0
    for i in range(y):
        if uru(i):
            ret += 366
        else:
            ret += 365
    return ret

month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]


def m_to_d(y, m):
    m -= 1
    ret = 0
    for i in range(m-1):
        ret += month[i]
    if m > 2 and uru:
        ret += 1
    return ret


while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if min(y1, m1, d1, y2, m2, d2) < 0:
        quit()
    ymd1 = y_to_d(y1) + m_to_d(y1, m1) + d1
    ymd2 = y_to_d(y2) + m_to_d(y2, m2) + d2
    print(ymd2 - ymd1)

Submission status: Wrong Answer

Solution code:
def uru(y):
    return y % 4 == 0 and y % 100 != 0 or y % 400 == 0

def y_to_d(y):
    ret = 0
    for i in range(y):
        if uru(i):
            ret += 366
        else:
            ret += 365
    return ret

month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]


def m_to_d(y, m):
    m -= 1
    ret = 0
    for i in range(m-1):
        ret += month[i]
    if m >= 2 and uru:
        ret += 1
    return ret


while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if min(y1, m1, d1, y2, m2, d2) < 0:
        quit()
    ymd1 = y_to_d(y1) + m_to_d(y1, m1) + d1
    ymd2 = y_to_d(y2) + m_to_d(y2, m2) + d2
    print(ymd2 - ymd1)

Submission status: Wrong Answer

Solution code:
def fairfield(y, m, d):
	y -= 1
	return 365 * y + int(y / 4) - int(y / 100) + int(y / 400) + int(306 * (m + 1) / 10) + d - 428
while True:
	dset =  map(int, raw_input().split())
	if -1 in dset:
		break
	y1, m1, d1 = dset[0:3]
	y2, m2, d2 = dset[3:6]
	print fairfield(y2, m2, d2) - fairfield(y1, m1, d1)

Submission status: Wrong Answer

Solution code:
# cheat

from datetime import date

while True:
    dates = map(int, raw_input().split())
    if any(map(lambda x: x < 0, dates)): 
        break
    y1, m1, d1, y2, m2, d2 = dates
    print str(date(y2, m2, d2) - date(y1, m1, d1)).split()[0]

Submission status: Accepted

Solution code:
import datetime
while 1:
  y1,m1,d1,y2,m2,d2=map(int,raw_input().split(" "))
  if y1==m1==d1==y2==m2==d2==-1: break
  a=datetime.date(y1,m1,d1)
  b=datetime.date(y2,m2,d2)
  print (b-a).days

Submission status: Accepted

Solution code:
import datetime
while 1:
  a,b,c,d,e,f=map(int,raw_input().split(" "))
  if a==b==c==d==e==f==-1: break
  print (datetime.date(d,e,f)-datetime.date(a,b,c)).days

Submission status: Accepted

Solution code:
import datetime
while 1:
  x=map(int,raw_input().split(" "))
  if x==[-1]*6: break
  a,b,c,d,e,f=x
  print (datetime.date(d,e,f)-datetime.date(a,b,c)).days

Submission status: Accepted

Solution code:
M=[0,31,28,31,30,31,30,31,31,30,31,30]
def L(y,m):
  if m<=2: y-=1
  return y/4-y/100+y/400+sum(M[:m])
while 1:
  x=map(int,raw_input().split(" "))
  if x==[-1]*6: break
  a,b,c,d,e,f=x
  print (d-a)*365+f-c+L(d,e)-L(a,b)

Submission status: Accepted

Solution code:
M=[0,1,-1,0,0,1,1,2,3,3,4,4]
def L(y,m):
  if m<=2: y-=1
  return y/4-y/100+y/400+M[m-1]

while 1:
  a,b,c,d,e,f=x=map(int,raw_input().split(" "))
  if any([i<0 for i in x]): break
  ans=(d-a)*365+(e-b)*30+f-c+L(d,e)-L(a,b)
  print ans

Submission status: Accepted

Solution code:
import datetime as D

while 1:
  a,b,c,d,e,f=x=map(int,raw_input().split(" "))
  if any([i<0 for i in x]): break
  print (D.date(d,e,f)-D.date(a,b,c)).days

Submission status: Accepted

Solution code:
import datetime as D
while 1:
  a,b,c,d,e,f=x=map(int,raw_input().split(" "))
  if min(x)<0: break
  print (D.date(d,e,f)-D.date(a,b,c)).days

Submission status: Accepted

Solution code:
import datetime as D
while 1:
  a,b,c,d,e,f=x=map(int,raw_input().split(" "))
  if any(map(lambda i:i<0,x)): break
  print (D.date(d,e,f)-D.date(a,b,c)).days

Submission status: Accepted

Solution code:
import datetime as D
while 1:
  a,b,c,d,e,f=x=map(int,raw_input().split(" "))
  try: print (D.date(d,e,f)-D.date(a,b,c)).days
  except: break

Submission status: Accepted

Solution code:
import datetime as D
while 1:
  a,b,c,d,e,f=map(int,raw_input().split(" "))
  try: print (D.date(d,e,f)-D.date(a,b,c)).days
  except: break

Submission status: Accepted

Solution code:
import datetime as D
while 1:
  a,b,c,d,e,f=map(int,raw_input().split())
  try: print (D.date(d,e,f)-D.date(a,b,c)).days
  except: break

Submission status: Accepted

Solution code:
import datetime
while True:
    ymd  = map(str, raw_input().split())
    if (ymd[0] == '-1'):
        break
    d1 = ":".join(ymd[:3])
    d2 = ":".join(ymd[3:])
    t1 = datetime.datetime.strptime(d1, "%Y:%m:%d")
    t2 = datetime.datetime.strptime(d2, "%Y:%m:%d")
    print (t2 - t1).days

Submission status: Accepted

Solution code:
import datetime

str = raw_input()
while True:
    str = str.split()
    num = []
    for s in str:
        num.append(int(s))
    if num[0] < 0:
        break
    
    d1 = datetime.date(num[0], num[1], num[2])
    d2 = datetime.date(num[3], num[4], num[5])
    print (d2 - d1).days
    str = raw_input()

Submission status: Accepted

Solution code:
def f1():
    if y1 == y2 and m1 == m2:
        return d2- d1
    
    a = 0
    if y1 % 400 == 0 or (y1 % 4 == 0 and y1 % 100 != 0):
        a = 29
    else:
        a = 28
    
    t = 0
    if m1 in [4,6,9,11]:
        t += (30 - d1 + 1)
    elif m1 in [1,3,5,7,8,10,12]:
        t += (31 - d1 + 1)
    else:
        t += (a - d1 + 1)
        
        
    if y1 == y2:
        return f3(t, m1+1)
    else:
        for m in range(m1+1, 13):
            if m in [4,6,9,11]:
                t += 30
            elif m in [1,3,5,7,8,10,12]:
                t += 31
            else:
                t += a
            
        return f2(t)
    
def f2(t):
    for y in range(y1+1, y2):
        if y % 400 == 0 or (y % 4 == 0 and y % 100 != 0):
            t += 366
        else:
            t += 365
    
    return f3(t, 1)
    
def f3(t, s):
    a = 0
    if y2 % 400 == 0 or (y2 % 4 == 0 and y2 % 100 != 0):
        a = 29
    else:
        a = 28
        
    for m in range(s, m2):
        if m in [4,6,9,11]:
            t += 30
        elif m in [1,3,5,7,8,10,12]:
            t += 31
        else:
            t += a
            
    t += (d2 - 1)
            
    return t
            
while True:
    y1, m1, d1, y2, m2, d2 = map(int, raw_input().split())
    if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0:
        break
    print f1()

Submission status: Accepted

Solution code:
import time
from datetime import date

#solve function
def solve(str_dates):
    dates = []
    for i in range(len(str_dates)):
        dates.append(int(str_dates[i]))

    date_start = date(dates[0], dates[1], dates[2])
    date_end = date(dates[3], dates[4], dates[5])

    return (date_end - date_start)


#main function
if __name__ == '__main__':
    while True:
        dates = input().split()

        if dates[0] == "-1":
            break

        date_diff = solve(dates)

        print(date_diff.days)

Submission status: Accepted

Solution code:
import datetime
while 1:
    t=list(map(int,input().split()))
    if t[0]<0:break
    s=datetime.date(t[0],t[1],t[2])
    e=datetime.date(t[3],t[4],t[5])
    print((e-s).days)

Submission status: Accepted

Solution code:
import datetime
while True:
    a,b,c,x,y,z = map(int, input().split())
    if a == -1: break
    old, new = datetime.datetime(a,b,c), datetime.datetime(x,y,z)
    ans = new - old
    print(ans.days)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math
from datetime import date

for s in sys.stdin:
    y1, m1, d1, y2, m2, d2 = map(int, s.split())

    if y1 == m1 == d1 == y2 == m2 == d2 == -1:
        break

    day1 = date(y1, m1, d1)
    day2 = date(y2, m2, d2)

    delta = day2 - day1
    print(delta.days)

Submission status: Accepted

Solution code:
import datetime

while(True):
	y1, m1, d1, y2, m2, d2 = map(int, raw_input().split())
	if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0:
		break
	dt1 = datetime.datetime(y1, m1, d1, 0, 0, 0)
	dt2 = datetime.datetime(y2, m2, d2, 0, 0, 0)
	dt3 = dt2 - dt1
	print dt3.days

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0125
"""
import sys
from datetime import timedelta, date


def solve(data):
    y1, m1, d1, y2, m2, d2 = data
    date1 = date(y1, m1, d1)
    date2 = date(y2, m2, d2)
    delta = date2 - date1
    return delta.days


def main(args):
    while True:
        data = [int(x) for x in input().split()]
        try:
            result = solve(data)
            print(result)
        except ValueError:
            break


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
# Aizu Problem 00125: Day Count
#
import sys, math, os, datetime

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


for line in sys.stdin:
    y1, m1, d1, y2, m2, d2 = [int(_) for _ in line.split()]
    if y1 == m1 == d1 == y2 == m2 == d2 == -1:
        break
    date1 = datetime.date(y1, m1, d1)
    date2 = datetime.date(y2, m2, d2)
    print((date2 - date1).days)

Submission status: Accepted

Solution code:
import datetime

while True:

    year1, month1, day1, year2, month2, day2 = [int(item) for item in input().split(" ")]

    if any([item < 0 for item in [year1, month1, day1, year2, month2, day2]]):
        break

    date1 = datetime.date(year1, month1, day1)
    date2 = datetime.date(year2, month2, day2)

    subtract = date2 - date1

    print(subtract.days)

Submission status: Accepted

Solution code:
def uru(y):
    return y % 4 == 0 and y % 100 != 0 or y % 400 == 0

def y_to_d(y):
    ret = 0
    for i in range(y):
        if uru(i):
            ret += 366
        else:
            ret += 365
    return ret

month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]


def m_to_d(y, m):
    m -= 1
    ret = 0
    for i in range(m):
        ret += month[i]
    if m >= 2 and uru(y):
        ret += 1
    return ret


while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if min(y1, m1, d1, y2, m2, d2) < 0:
        quit()
    ymd1 = y_to_d(y1) + m_to_d(y1, m1) + d1
    ymd2 = y_to_d(y2) + m_to_d(y2, m2) + d2
    print(ymd2 - ymd1)

Submission status: Accepted

Solution code:
def isU(y):
    if y % 4 == 0:
        if y % 100 == 0:
            if y % 400 == 0:
                return True
            else:
                return False
        else:
            return True
    else:
        return False

def dd(y,m,d):
    a = 0
    mm = [0,31,28,31,30,31,30,31,31,30,31,30,31]
    if isU(y):
        mm[2] = 29

    for i in range(m):
        a += mm[i]
    a += d
    return a

def dy(y1, y2):
    y = 0
    for i in range(y1, y2):
        if isU(i):
            y += 366
        else:
            y += 365
    return y

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

while True:
    y1,m1,d1,y2,m2,d2 = [int(i) for i in input().split()]
    if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0:
        break
    ans = 0
    ans += dy(y1,y2)
    ans -= dd(y1,m1,d1)
    ans += dd(y2,m2,d2)
    print(ans)

Submission status: Accepted

Solution code:
import datetime

while True:
  y1, m1, d1, y2, m2, d2 = map(int, input().split())
  if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0:
    break

  D1 = datetime.datetime(y1, m1, d1)
  D2 = datetime.datetime(y2, m2, d2)
  dD = D2 - D1
  print(dD.days)

Submission status: Accepted

Solution code:
# AOJ 0125 Day Count
# Python3 2018.6.18 bal4u

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

while True:
	y1, m1, d1, y2, m2, d2 = list(map(int, input().split()))
	if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0: break
	print(ut2jd(y2, m2, d2)-ut2jd(y1, m1, d1))

Submission status: Accepted

Solution code:
def fairfield(y, m, d):
	if m < 3:
		y -= 1
		m += 12;
	return 365 * y + int(y / 4) - int(y / 100) + int(y / 400) + int(306 * (m + 1) / 10) + d - 428
while True:
	dset =  map(int, raw_input().split())
	if -1 in dset:
		break
	y1, m1, d1 = dset[0:3]
	y2, m2, d2 = dset[3:6]
	print fairfield(y2, m2, d2) - fairfield(y1, m1, d1)

Submission status: Accepted

Solution code:
from datetime import datetime
while True:
	line = raw_input()
	if "-" in line: break
	v = map(int, line.split())
	print (datetime(*v[3:]) - datetime(*v[0:3])).days

Submission status: Accepted

Solution code:
import datetime
while True:
    y1,m1,d1,y2,m2,d2=map(int,raw_input().split())
    if y1==m1==d1==y2==m2==d2==-1:break
    a=datetime.datetime(y1,m1,d1)
    b=datetime.datetime(y2,m2,d2)
    print (b-a).days

Submission status: Accepted

Solution code:
cal = {}
month = [[31,28,31,30,31,30,31,31,30,31,30,31],
         [31,29,31,30,31,30,31,31,30,31,30,31]]
count = 1
for y in xrange(3000):#
    f = 1 if y%4 == 0 and y%100 != 0 or y%400 == 0 else 0
    for m in xrange(12):
        for d in xrange(month[f][m]):
            cal[(y,m+1,d+1)] = count
            count += 1
while True:
    y1,m1,d1,y2,m2,d2 = map(int,raw_input().split())
    if any(i<0 for i in (y1,m1,d1,y2,m2,d2)):
        break
    print cal[(y2,m2,d2)] - cal[(y1,m1,d1)]

Submission status: Accepted

Solution code:
from datetime import datetime
while True:
    y1,m1,d1,y2,m2,d2 = map(int,raw_input().split())
    if any(i<0 for i in (y1,m1,d1,y2,m2,d2)):
        break
    print (datetime(y2,m2,d2) - datetime(y1,m1,d1)).days

Submission status: Accepted

Solution code:
import copy

common = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 365]
leep = copy.deepcopy(common)
leep[1] += 1
leep[12] += 1

def get_days(year):
    if year % 400 == 0:
        return leep
    elif year % 100 == 0:
        return common 
    elif year % 4 == 0:
        return leep 
    else:
        return common 

if __name__ == '__main__':

    while True:
        y1, m1, d1, y2, m2, d2 = map(int, raw_input().split())
        if y1 < 0 or y2 < 0 or m1 < 0 or m2 < 0 or d1 < 0 or d2 < 0:
            break
        ans = 0
        if y2 - y1 == 0:
            if m2 - m1 == 0:
                ans = d2 - d1
            else:
                days = get_days(y2)

                ans += days[m1 - 1] - d1
                ans += d2
                nm = m1
                while nm + 1 < m2:
                    ans += days[nm]
                    nm += 1
        else:

            days = get_days(y1)
            ans += days[m1 - 1] - d1 + 1
            nm = m1 + 1
            while nm <=  12:
                ans += days[nm - 1]
                nm += 1
            days = get_days(y2)
            nm = 0
            while nm + 1 < m2:
                ans += days[nm] 
                nm += 1
            ans += d2 - 1
            ny = y1 + 1
            for i in xrange(y2 - y1 - 1):
                days = get_days(ny + i)
                ans += days[12]
        print(ans)

Submission status: Accepted

Solution code:
import datetime
while 1:
	y1,m1,d1,y2,m2,d2=map(int,raw_input().split())
	if y1==-1:break
	print (datetime.date(y2,m2,d2)-datetime.date(y1,m1,d1)).days

Submission status: Accepted

Solution code:
import datetime
while 1:
	y1,m1,d1,y2,m2,d2=map(int,raw_input().split())
	if y1==-1:break
	print (datetime.date(y2,m2,d2)-datetime.date(y1,m1,d1)).days

Submission status: Accepted

Solution code:

import datetime

while 1:
    d = list(map(int,input().split()))
    if -1 in d:
        break
        
    d1 = datetime.date(d[0],d[1],d[2])
    d2 = datetime.date(d[3],d[4],d[5])

    ans = d2 - d1

    print(ans.days)

Submission status: Accepted

Solution code:
#datetimeモジュールのインポート
import datetime

#標準入力をし、いずれかが負の数なら、処理を終了する。
while True:
    y1,m1,d1,y2,m2,d2 = map(int,input().split())
    if y1 < 0 or y2 < 0 or m1 < 0 or m2 < 0 or d1 < 0 or d2 < 0:break

    #入力値をdatetime型にする
    dt1 = datetime.date(y1,m1,d1)
    dt2 = datetime.date(y2,m2,d2)
    
    #差を求めて出力する
    days = max(dt1,dt2) - min(dt1,dt2)
    print(days.days)

Submission status: Accepted

Solution code:
import datetime
while 1:
    lis = list(map(int, input().split()))
    if min(lis) < 0: break
    y1,m1,d1,y2,m2,d2 = lis
    a = datetime.date(y1,m1,d1)
    b = datetime.date(y2,m2,d2)
    c = b - a
    print(c.days)

Submission status: Accepted

Solution code:
def convert(y, m, d):
    if m <= 2:
        m += 12
        y -= 1
    mjd = int(365.25*y) + (y//400) - (y//100) + int(30.59*(m-2)) + d - 678912
    return mjd
while 1:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if y1 == -1:
        break
    print(convert(y2, m2, d2) - convert(y1, m1, d1))

Submission status: Accepted

Solution code:
import datetime
while 1:
    y1,m1,d1,y2,m2,d2 = (int(x) for x  in input().split())
    if y1 < 0:break
    start = datetime.date(y1,m1,d1)
    end = datetime.date(y2,m2,d2)
    print((end - start).days)

Submission status: Accepted

Solution code:
import datetime

while True:
    y1,m1,d1,y2,m2,d2=[int(i) for i in input().split(" ")]
    if y1==-1:
        break
    d1=datetime.datetime(y1,m1,d1)
    d2=datetime.datetime(y2,m2,d2)
    print((d2-d1).days)

Submission status: Accepted

Solution code:
import datetime
while True:
    y1, m1, d1, y2, m2, d2 = [int(x) for x in input().split()]
    if y1 < 0:
        break
    dt1 = datetime.date(y1,m1,d1)
    dt2 = datetime.date(y2,m2,d2)
    print((dt2-dt1).days)

Submission status: Accepted

Solution code:
import datetime
while 1:
    y1,m1,d1,y2,m2,d2=map(int,input().split())
    if y1==-1:break
    print((datetime.datetime(y2,m2,d2)-datetime.datetime(y1,m1,d1)).days)

Submission status: Accepted

Solution code:
import datetime
while 1:
    y1,m1,d1,y2,m2,d2=map(int,input().split())
    if y1==-1:break
    d1 = datetime.date(y1, m1, d1)
    d2 = datetime.date(y2, m2, d2)
    print((d2-d1).days)

Submission status: Accepted

Solution code:
import datetime

while 1:
    data = list(map(int, input().split()))
    if data[0] < 0:
        break

    first = datetime.date(data[0], data[1], data[2])
    second = datetime.date(data[3], data[4], data[5])
    diff = (second - first).days
    print(diff)

Submission status: Accepted

Solution code:
from datetime import datetime

while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0: break
    date1 = datetime(y1, m1, d1)
    date2 = datetime(y2, m2, d2)
    result = date2 - date1
    print(result.days)

Submission status: Accepted

Solution code:
from datetime import date
while 1:
    t=list(map(int,input().split()))
    if t[0]<0:break
    print((date(*t[3:])-date(*t[:3])).days)

Submission status: Accepted

Solution code:
ans_list = []
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if y1+y2+m1+m2+d1+d2 == -6:
        break
    else:
        ans = 0
        dis_m = m2 - m1
        dis_y = y2 - y1
        leap = 0
        if dis_y == 0:
            leap = 0
            if y1 % 4 == 0:
                if y1 % 100 == 0:
                    if y1 % 400 != 0:
                        leap = 1
                else:
                    leap = 1
            if dis_m == 0:
                ans = d2 - d1
            else:
                ans += sum(days[m1:m2-1]) + days[m1-1] - d1 + d2
            if leap == 1 and m1 < 3 and 2 < m2:
                ans += 1
            ans_list.append(ans)
        else:
            for y in range(y1, y2+1):
                leap = 0
                if y % 4 == 0:
                    if y % 100 == 0 and y % 400 != 0:
                        leap = 0
                    else:
                        leap = 1
                if y == y1:
                    ans += sum(days[m1:]) + days[m1-1] - d1
                    if leap == 1 and m1 < 3:
                        ans += 1
                elif y == y2:
                    ans += sum(days[:m2-1]) + d2
                    if leap == 1 and m2 > 2:
                        ans += 1
                else:
                    if leap == 0:
                        ans += 365
                    else:
                        ans += 366
            ans_list.append(ans)
for a in ans_list:
    print(a)

Submission status: Runtime Error

Solution code:
M=[0,1,-1,0,0,1,1,2,3,3,4,4]
def L(y,m):
  if m<=2: y-=1
  return y/4-y/100+y/400+M[m]

while 1:
  x=map(int,raw_input().split(" "))
  if any([e<0 for e in x]): break
  a,b,c,d,e,f=x
  ans=(d-a)*365+(e-b)*30+f-c+L(d,e)-L(a,b)  
  print ans

Submission status: Runtime Error

Solution code:
M=[0,1,-1,0,0,1,1,2,3,3,4,4]
def L(y,m):
  if m<=2: y-=1
  return y/4-y/100+y/400+M[m]

while 1:
  a,b,c,d,e,f=x=map(int,raw_input().split(" "))
  if any([i<0 for i in x]): break
  ans=(d-a)*365+(e-b)*30+f-c+L(d,e)-L(a,b)
  print ans