table1 = [16, 6, 7, 10, 9, 16, 10, 8, 8, 9, 6, 6]
table2 = [5, 10, 8, 15, 16, 15, 8, 16, 8, 16, 9, 17, 8, 17, 10, 8, 9, 18, 5, 15, 10, 9, 8, 9, 15, 18, 7, 8, 16, 6]
table3 = [6, 7, 18, 9, 5, 16, 9, 15, 18, 8, 9, 5]
table4 = [7, 7, 9, 12, 8, 7, 13, 5, 14, 5, 9, 17, 5, 7, 12, 8, 8, 6, 19, 6, 8, 16, 10, 6, 12, 9, 6, 7, 12, 5, 9, 8, 7, 8, 15, 9, 16, 8, 8, 19, 12, 6, 8, 7, 5, 15, 6, 16, 15, 7, 9, 12, 10, 7, 15, 6, 5, 14, 14, 9]
m = ["23to01", "01to03", "03to05", "05to07", "07to09", "09to11", "11to13", "13to15", "15to17", "17to19", "19to21", "21to23"]
deal_0_3=0
deal_4_5=0
deal_6_7=0
def get_table4(deal_0_3):
if ((deal_0_3-1900)%60) >=len(table4):
return 0
t=table4[(deal_0_3-1900)%60]
#print "table4="+str(t)
return t
def get_table3(deal_4_5):
if deal_4_5-1 >=len(table3):
return 0
t=table3[deal_4_5-1]
#print "table3="+str(t)
return t
def get_table2(deal_6_7):
if deal_6_7-1 >=len(table2):
return 0
t=table2[deal_6_7-1]
#print "table3="+str(t)
return t
def GetText2(deal_4_5,s_):
t=deal_4_5
flag=0
for i in range(len(m)):
if s_==m[i]:
if t==2 and s_==m[6]:
return 63
k=table1[i]
flag=1
if flag==0:
print "not me!"
return k
def check_mod(s_0_3,s_4_5,s_6_7):
global deal_0_3
global deal_4_5
global deal_6_7
#print "s_0_3: "+str(s_0_3)
#print "s_4_5: "+str(s_4_5)
#print "s_6_7: "+str(s_6_7)
if s_0_3==1989 or s_0_3==2004:
s_6_7=31
if s_4_5 ==1 or s_4_5==4 or s_4_5 == 5 or s_4_5 == 7 or s_4_5 == 10 or s_4_5 == 11 or s_4_5 == 12:
s_0_3=1999
if s_0_3 <= 1994 and (s_4_5 == 2 or s_4_5 == 6 or s_4_5 == 8) :
s_4_5=3
if s_0_3 >= 1996 and (s_4_5 == 2 or s_4_5 == 6 or s_4_5 == 8) :
s_4_5=9
if s_0_3 == 1995 and ( (s_6_7 > (s_4_5 + 2)) or s_4_5 == s_6_7 ) :
s_4_5=6
deal_0_3=s_0_3
deal_4_5=s_4_5
deal_6_7=s_6_7
#print "deal_0_3: "+str(deal_0_3)
#print "deal_4_5: "+str(deal_4_5)
#print "deal_6_7: "+str(deal_6_7)
def main():
for i in range(1983,2007):
for j in range(1,12):
for k in range(1,31):
for h in range(len(m)):
check_mod(i,j,k)
a1=get_table4(deal_0_3)
a2=get_table3(deal_4_5)
a3=get_table2(deal_6_7)
if a1!=0 and a2!=0 and a3!=0:
total=a1+a2+a3+GetText2(deal_4_5,m[h])
if total==34:
year=str(i)
month=str(j)
day=str(k)
if len(month)==1:
month='0'+month
if len(day)==1:
day='0'+day
print "Found:"+year+month+day+m[h]
if __name__=="__main__":
main()