Problem:


What day is today?

Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29.

Input

The input is a sequence of datasets. The end of the input is indicated by a line containing one zero. Each dataset consists of two integers m and d separated by a single space in a line. These integers respectively represent the month and the day. 

The number of datasets is less than or equal to 50.

Output

For each dataset, print the day (please see the following words) in a line.

Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday

Sample Input

1 1
2 29
0 0

Output for the Sample Input

Thursday
Sunday



Sample input:
1 1
2 29
0 0


Sample output:
Thursday
Sunday

Submission status: Accepted

Solution code:
y = [31,29,31,30,31,30,31,31,30,31,30,31]
dow = {0:"Monday", 1:"Tuesday", 2:"Wednesday", 3:"Thursday", 4:"Friday", 5:"Saturday", 6:"Sunday"}

while True:
    m, d = map(int, raw_input().split())
    if m == 0 and d == 0:
        break
    n = 0
    for i in range(m):
        n += y[i]
    n -= (y[m-1]-d+1)
    print dow[(n+3)%7]

Submission status: Accepted

Solution code:
wd=["Mon","Tues","Wednes","Thurs","Fri","Satur","Sun"]
md=[0,31,29,31,30,31,30,31,31,30,31,30,31]

while 1:
    m,d = map(int, raw_input().split())
    if m==0: break
    s = sum([md[i] for i in range(m)]) + d + 2
    s = wd[s % 7]+"day"
    print s

Submission status: Accepted

Solution code:
import datetime
WEEKDAY = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
while 1:
    a, b = map(int, raw_input().split())
    if a == b == 0:
        break
    print WEEKDAY[datetime.date(2004, a, b).weekday()]

Submission status: Accepted

Solution code:
import datetime
while True:
    m, d = map(int, raw_input().split())
    if m == 0 and d == 0:
        break
    print ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][datetime.date(2004, m, d).weekday()]

Submission status: Accepted

Solution code:
days=(31,29,31,30,31,30,31,31,30,31,30,31)
day=('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')
while True:
	total=0
	m,d=map(int,raw_input().split(" "))
	if m!=0:
		for i in range(m-1):
			total+=days[i]
		total+=d
		print day[(total+3)%7]
	else:
		break

Submission status: Accepted

Solution code:
dw = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')
dm = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)

while True:
    m, d = map(int, input().split())
    if m == d == 0: break

    total = sum(dm[i] for i in range(m - 1)) + d - 1
    print(dw[(total + 4) % 7])

Submission status: Accepted

Solution code:
day = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30]
for i in range(2,12):
    day[i] += day[i-1]
week = ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday']
while True:
    M, D = map(int, input().split())
    if M==0:
        break
    days = day[M-1] + D
    print(week[days%7])

Submission status: Accepted

Solution code:
lst = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    
    if m == 1 or m == 4 or m == 7:
        print(lst[(d + 2) % 7])

    elif m == 2 or m == 8:
        print(lst[(d + 5) % 7])

    elif m == 3 or m == 11:
        print(lst[(d + 6) % 7])

    elif m == 5:
        print(lst[(d + 4) % 7])

    elif m == 6:
        print(lst[d % 7])

    elif m == 9 or m == 12:
        print(lst[(d + 1) % 7])

    else:
        print(lst[(d + 3) % 7])

Submission status: Accepted

Solution code:
while 1:
    m,d = map(int,input().split())
    if m == 0:
        break
    w = ["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"]
    day = [0,31,60,91,121,152,182,213,244,274,305,335]
    print(w[(day[m-1]+d)%7])

Submission status: Accepted

Solution code:
#datetimeモジュールをインポートする
import datetime

#aとbが0になるまで処理を繰り返す
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0:break

    #detetimeモジュールを使い、youbiに代入し、"strftime"を使い、曜日を取得する
    youbi = datetime.datetime(2004,a,b)
    print(youbi.strftime("%A"))

Submission status: Accepted

Solution code:
from datetime import date
import calendar


while True:
    m,d = map(int,(input().split()))
    if m == 0 and d == 0:
        break
    x = date(2004,m,d).weekday()
    print(["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"][x])

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
write = sys.stdout.write

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

youbi = [
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
]

def solve():
    m, d = map(int, readline().split())
    if m == 0:
        return False
    write("%s\n" % youbi[(convert(2004, m, d) - convert(2004, 1, 1) + 3) % 7])
    return True
while solve():
    ...

Submission status: Accepted

Solution code:
while True :
    M, D = map(int, input().split())
    if M == 0 and D == 0 :
        break

    else :
        if M == 1 :
            days = D
        elif M == 2 :
            days = 31 + D
        elif M == 3 :
            days = 31+29+D
        elif M == 4 :
            days = 31+29+31+D
        elif M == 5 :
            days = 31+29+31+30+D
        elif M == 6 :
            days = 31+29+31+30+31+D
        elif M == 7 :
            days = 31+29+31+30+31+30+D
        elif M == 8 :
            days = 31+29+31+30+31+30+31+D
        elif M == 9 :
            days = 31+29+31+30+31+30+31+31+D
        elif M == 10 :
            days = 31+29+31+30+31+30+31+31+30+D
        elif M == 11 :
            days = 31+29+31+30+31+30+31+31+30+31+D
        elif M == 12 :
            days = 31+29+31+30+31+30+31+31+30+31+30+D
            
        youbi = days % 7
        if youbi == 0 :
            print("Wednesday")
        elif youbi == 1 :
            print("Thursday")
        elif youbi == 2 :
            print("Friday")
        elif youbi == 3 :
            print("Saturday")
        elif youbi == 4 :
            print("Sunday")
        elif youbi == 5 :
            print("Monday")
        elif youbi == 6 :
            print("Tuesday")

Submission status: Accepted

Solution code:
from datetime import date
days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]

while True:
  month,day = map(int, input().split())
  
  if month == 0:
    break

  print(days[date(2004, month, day).weekday()])

Submission status: Accepted

Solution code:
import datetime
yobi = {0:"Monday",1:"Tuesday",2:"Wednesday",3:"Thursday",4:"Friday",5:"Saturday",6:"Sunday"}
try:
    while True:
        m, d= map(int, input().split())
        if m == 0 and d == 0 :
            exit()
        day = datetime.datetime.strptime("2004/" + str(m) + "/" + str(d),"%Y/%m/%d")
        if day.weekday() in yobi:
            output = yobi[int(day.weekday())]
            print(output)
except EOFError:
    pass

Submission status: Accepted

Solution code:
month = [0,31,60,91,121,152,182,213,244,274,305,335]
day = ["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"]
while True:
    a,b = map(int,input().split())
    if a == 0:
        break
    num = month[a-1]+b
    print(day[num%7])

Submission status: Accepted

Solution code:
# coding=utf-8

###
### for python program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    def pnum_check(self, n):
        if (n==1):
            return False
        elif (n==2):
            return True
        else:
            for x in range(2,n):
                if(n % x==0):
                    return False
            return True

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans
    
    ### intチェック
    def is_integer(self, n):
        try:
            float(n)
        except ValueError:
            return False
        else:
            return float(n).is_integer()

    ### 幾何学問題用
    def dist(self, A, B):
        d = 0
        for i in range(len(A)):
            d += (A[i]-B[i])**2            
        d = d**(1/2)
        return d

    ### 絶対値
    def abs(self, n):
        if n >= 0:
            return n
        else:
            return -n

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
# print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
# print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
# print(" {}".format(i), end="")

def printA(A):
    N = len(A)
    for i, n in enumerate(A):
        print(n, end='')
        if i != N-1:
            print(' ', end='')
    print()

# リスト内包表記 ifあり
# [x-k if x != 0 else x for x in C]

# ソート（代入する必要なし）
# N.sort()

# 10000個の素数リスト
# P = mymath.pnum_eratosthenes(105000)

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            #N.append(int(input()))
            #N.append(float(input()))
            #N.append([int(x) for x in input().split()])
        except EOFError:
            break
    return N


M = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
A = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"]
 
while True:
    m, d = [int(x) for x in input().split()]
    if m==0 and d==0:
        break
    B = (sum(M[:m])+d-1)%7
    print(A[B])

Submission status: Accepted

Solution code:
import datetime

while 1:
    m, d = map(int, input().split())
    if m == 0:
        break
    dt = datetime.datetime(2004, m, d)

    print(dt.strftime('%A'))

Submission status: Accepted

Solution code:

import datetime
L = [ "Monday", "Tuesday", "Wednesday", "Thursday","Friday",
      "Saturday", "Sunday" ]

while True:
    m, d = [int(x) for x in input().split()]
    if m == 0 and d == 0:
        break
    dt = datetime.datetime(2004, m, d)
    w = dt.weekday()
    print(L[w])

Submission status: Accepted

Solution code:
while True:
    month,day=list(map(int, input().split()))
    if month==day==0:
        break
    month_day=[30,29,31,30,31,30,31,31,30,31,30,31]             #1から12
    tmp_day=0
    for i in range(month-1):
        tmp_day+=month_day[i]
    tmp_day+=day
    amari=tmp_day%7
    if month==day==1:
        print("Thursday")
    elif amari==0:
        print("Thursday")
    elif amari==1:
        print("Friday")
    elif amari==2:
        print("Saturday")
    elif amari==3:
        print("Sunday")
    elif amari==4:
        print("Monday")
    elif amari==5:
        print("Tuesday")
    elif amari==6:
        print("Wednesday")

Submission status: Accepted

Solution code:
import sys

def zeller(y,m,d):
  if m==1 or m==2:
    y-=1
    m+=12
  day=(y+int(y/4)-int(y/100)+int(y/400)+int((13*m+8)/5)+d)%7
  D={0:'Sunday',1:'Monday',2:'Tuesday',3:'Wednesday',4:'Thursday',5:'Friday',6:'Saturday'}
  return D[day]
  

for l in sys.stdin:
  m,d=list(map(int,l.split()))
  if m==0:
    break
  print(zeller(2004,m,d))

Submission status: Accepted

Solution code:
w = ["Wednesday", "Thursday", "Friday",
     "Saturday", "Sunday", "Monday", "Tuesday"]
a = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
while 1:
    m, d = map(int, input().split())
    if m == 0:
        break
    s = 0
    for i in range(m - 1):
        s += a[i]

    print(w[(s+d) % 7])

Submission status: Accepted

Solution code:
import datetime
 
week=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
while True:
    a,b=map(int, input().split())
    if a == b == 0:
        break
    print(week[datetime.date(2004, a, b).weekday()])

Submission status: Accepted

Solution code:
W = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')
M = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
 
while True:
    m, d = map(int, input().split())
    if m == d == 0: break
 
    total = sum(M[i] for i in range(m - 1)) + d - 1
    print(W[(total + 4) % 7])

Submission status: Accepted

Solution code:
import sys
 
day = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
num = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
 
for s in sys.stdin:
    M, D = map(int, s.strip().split())
    if M == 0:
        break
    totalDay = D
    M -= 1
 
    while M > 0:
        totalDay += num[M-1]
        M -= 1
 
    print(day[(totalDay+2)%7])

Submission status: Accepted

Solution code:
import datetime

num2wd={0:"Monday",1:"Tuesday",2:"Wednesday",3:"Thursday",4:"Friday",5:"Saturday",6:"Sunday"}

while True:
    m,d=[int(i) for i in input().split(" ")]
    if m==0 and d==0:
        break

    date=datetime.datetime(2004,m,d)
    print(num2wd[date.weekday()])

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	W = ["Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"]
	Y = [31,29,31,30,31,30,31,31,30,31,30,31]

	while True:
		m,d = map(int,input().split())
		if m == 0 and d == 0:
			break

		day = 0
		for i in range(m-1):
			day += Y[i]
		day += d

		ans = day % 7
		print(W[ans-1])

Submission status: Accepted

Solution code:
m = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
d = ["Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"]
while True:
  a, b = map(int, input().split())
  if a + b == 0:
    break
  mon = 0
  for i in range(a):
    mon += m[i]
  day = mon + b
  print(d[day % 7])

Submission status: Accepted

Solution code:
month = [3, 1, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3]

while True:
  m, d = map(int, input().split())
  if m == 0:
    break
  piv = 3
  for i in range(m-1):
    piv += month[i]
  piv += d
  piv %= 7
  if piv == 0:
    print("Sunday")
  elif piv == 1:
    print("Monday")
  elif piv == 2:
    print("Tuesday")
  elif piv == 3:
    print("Wednesday")
  elif piv == 4:
    print("Thursday")
  elif piv == 5:
    print("Friday")
  elif piv == 6:
    print("Saturday")

Submission status: Accepted

Solution code:
days = ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday']
month = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30]
while True:
	m, d = map(int, raw_input().split())
	if m == 0: break
	for i in range(0, m):
		d += month[i]
	print days[d%7]

Submission status: Accepted

Solution code:
import datetime
while 1:
    m,d=map(int,input().split())
    if m==d==0:break
    ans=datetime.datetime(2004, m, d)
    print(ans.strftime('%A'))

Submission status: Accepted

Solution code:
ndays = [31,29,31,30,31,30,31,31,30,31,30,31]
days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
offset = 3
while(1):
	m,d = [int(i) for i in input().split()]
	if m == 0 and d == 0:
		break
	tot_d = sum(ndays[:m-1]) + d 
	print(days[(tot_d + offset - 1)%7])

Submission status: Accepted

Solution code:
from datetime import *
wd_map = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
while True:
    month, day = map(int, input().split())
    if month == 0:
        break
    print(wd_map[date(2004, month, day).weekday()])

Submission status: Accepted

Solution code:
daylist = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
week = ["Wednesday", "Thursday", "Friday", "Saturday",
        "Sunday", "Monday", "Tuesday"]

while(1):
    m, d = map(int, input().split())
    if m == 0:
        break

    day = 0
    for i in range(m-1):
        day += daylist[i]
    day += d

    w = week[day % 7]
    print(w)

Submission status: Accepted

Solution code:
lastDayofLastMonth = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]
dateList = ["Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"]
inputData = []

while True:
    inputData = list(map(int, input().split()))
    if inputData[0]==0:
        break
    dd_date = lastDayofLastMonth[inputData[0]-1] + inputData[1]
    print(dateList[dd_date%7])

Submission status: Accepted

Solution code:
import datetime
import calendar

def trans(month, day, year=2004):
    past = datetime.date(year, month, day)
    result = calendar.day_name[past.weekday()]
    return result
    
while True:
    month, day = map(int, input().split())
    if month == day == 0: break
    print(trans(month, day))

Submission status: Accepted

Solution code:
import datetime
import sys
i_weekday = { i:weekday for i, weekday in enumerate('Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split() ) }
while True:
  M, D = map(int, input().split())
  if M == 0:
    sys.exit()
  dt = datetime.datetime.strptime(f'2004-{M}-{D}', '%Y-%m-%d')
  #print(dt)
  print(i_weekday[ dt.weekday() ] )

Submission status: Accepted

Solution code:
while(True):
    m,d = map(int,input().split())
    if m==0 and d==0:
        break
    dn = sum([[31,29,31,30,31,30,31,31,30,31,30,31][a] for a in range(m-1)]) + d-1
    print(["Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"][dn%7])

Submission status: Accepted

Solution code:
import datetime
while 1:
    try:
        m,d=map(int, input().split())
        print(datetime.date(2004, m,d).strftime('%A'))
    except:break

Submission status: Accepted

Solution code:
def solve():
    day = [
        'Wednesday',
        'Thursday',
        'Friday',
        'Saturday',
        'Sunday',
        'Monday',
        'Tuesday',
    ]
    
    days_month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    days_total = []
    for i in range(len(days_month)):
        days_total.append(sum(days_month[0:i]))
    
    while True:
        mm, dd = map(int, input().split())
        if mm == 0 and dd == 0:
            break
        
        numd = days_total[mm - 1]
        total = numd + dd
        idx = total % len(day)
        
        print(day[idx])
    

if __name__ == "__main__":
    solve()

Submission status: Runtime Error

Solution code:
import datetime

weekdays = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
]

while True:
  m, d = map(int, raw_input().strip().split(" "))
  print weekdays[datetime.date(2004, m, d).weekday()]

Submission status: Runtime Error

Solution code:
days_sum={1:31,2:29,3:31,4:30,5:31,6:30,7:31,8:31,9:30,
          10:31,11:30,12:31}
days2month={1:'Thursday',2:'Friday',3:'Saturday',4:'Sunday',
            5:'Monday',6:'Tuesday',7:'Wednesday'}

while True:
    month,day=map(int,raw_input().split(" "))
    if month==0 and day==0:
        break
    keika=0
    for i in range(1,month):
        keika += days_sum[i]
    keika+=day
    print days2month[keika%7]

Submission status: Runtime Error

Solution code:
from datetime import date
while 1:
    m,d=map(int,raw_input().split())
    if m==0:break
    print date(404,m,d).strftime("%A")

Submission status: Runtime Error

Solution code:
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
nums = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
while True:
    try:
        m, d = map(int, input().split())
        if not m:
            break
    except:
        break
    print(days[(sum(nums[:m - 1]) + d) % 7 + 2])

Submission status: Runtime Error

Solution code:
week = {"1": "Thursday", "2": "Friday", "3": "Saturday", "4": "Sunday", "5": "Monday", "6": "Tuesday", "7": "Wednesday"}
month = {"1": 0, "2": 31, "3": 60, "4": 91, "5": 121, "6": 152, "7": 182, "8": 213, "9": 244, "10": 274, "11": 305, "12": 335}
m, d = input().split()
while m != "0":
    days = month[m] + int(d)
    print(week[str(days % 7)])
    m, d = input().split()

Submission status: Runtime Error

Solution code:
week = {1: "Thursday", 2: "Friday", 3: "Saturday", 4: "Sunday", 5: "Monday", 6: "Tuesday", 7: "Wednesday"}
month = {1: 0, 2: 31, 3: 60, 4: 91, 5: 121, 6: 152, 7: 182, 8: 213, 9: 244, 10: 274, 11: 305, 12: 335}
m, d = map(int, input().split())
while m:
    days = month[m] + d
    print(week[days % 7])
    m, d = map(int, input().split())

Submission status: Runtime Error

Solution code:
week = {1: "Thursday", 2: "Friday", 3: "Saturday", 4: "Sunday", 5: "Monday", 6: "Tuesday", 7: "Wednesday"}
month = {1: 0, 2: 31, 3: 60, 4: 91, 5: 121, 6: 152, 7: 182, 8: 213, 9: 244, 10: 274, 11: 305, 12: 335}
while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    days = month[m] + d
    print(week[days % 7])

Submission status: Runtime Error

Solution code:
import sys

l = []
day = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']
size = [31,29,31,30,31,30,31,31,30,31,30,31]
for input in sys.stdin:
    l.append(input.split())
for i in range(0,len(l)):
    for j in range(0,len(l[i])):
        l[i][j] = int(l[i][j])
for i in range(0,len(l)):
    temp = 0
    if((l[i][0]-1) < 0 or (l[i][0]-1) > 11):
        continue
    if((l[i][0]-1) > 0):
        for j in range(0,l[i][0]-1):
            temp += size[j]
    temp += l[i][1]
    temp = temp - 1
    temp = temp % 7
    if(temp > 3):
        temp -= 3
    print day[temp+3]

Submission status: Runtime Error

Solution code:
s = (0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30)
w = ("Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday")
while True:
    m, d = map(int, input().split())
    if m == 0:break
    print(w[(d + sum(s[:m])) % 7])

Submission status: Runtime Error

Solution code:
day=['0','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']
mou=[0,31,29,31,30,31,30,31,31,30,31,30,31]
while True:
	try:
		n,m=map(int,input().split())
	except:
		break
	if n==0 and m==0:
		break
	count=0
	for a in range(1,n+1):
		if a==n :
			count+=m
		else:
			count+=mou[a]
	print(day[count%7+3])

Submission status: Runtime Error

Solution code:

dates = []
youbi = []

for i in range(1,13):
    if i == 1 or i == 3 or i == 5 or i == 7 or i == 8 or i == 10 or i == 12:
        for j in range(1,32):
            dates.append([i,j])
    elif i == 4 or i == 6 or i == 9 or i == 11:
        for j in range(1,31):
            dates.append([i,j])
    elif i == 2:
        for j in range(1,30):
            dates.append([i,j])

while True:
    x = map(int, raw_input().split(' '))
    if x == [0,0]:
        for yo in youbi:
            print yo
    elif dates.index(x) % 7 == 0:
        youbi.append('Thursday')
    elif dates.index(x) % 7 == 1:
        youbi.append('Friday')
    elif dates.index(x) % 7 == 2:
        youbi.append('Saturday')
    elif dates.index(x) % 7 == 3:
        youbi.append('Sunday')
    elif dates.index(x) % 7 == 4:
        youbi.append('Monday')
    elif dates.index(x) % 7 == 5:
        youbi.append('Tuesday')
    elif dates.index(x) % 7 == 6:
        youbi.append('Wednesday')

Submission status: Runtime Error

Solution code:
#include <stdio.h>
const char WEEKDAYS[7][10] = {
	"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday",
	"Sunday"
};
const int MONTHS_1ST_WEEKDAY[] = {
	3, 6, 0, 3, 5, 1, 3, 6, 2, 4, 0, 2
};

int main() {
	int month, day;
	while (1) {
		scanf(" %d %d", &month, &day);
		if (month == 0 && day == 0)
			break;
		puts(WEEKDAYS[(MONTHS_1ST_WEEKDAY[month-1] + day - 1) % 7]);
	}
	return 0;
}

Submission status: Runtime Error

Solution code:
ans ={}
for i in range(1,13):
    if i%2 !=0:
        ans[str(i)] = 31
    else:
        ans[str(i)] = 30
ans['2']=29 
while True:
    a,b=map(int,raw_input().split())
    day =b
    if a+b == 0: break;
    if a == 1:   day = b;
    elif a == 2: day+=31
    else:
        for i in range(a):
            if i ==0: pass;
            day += ans[str(i)]
    print ['Wednesday','Thurday','Friday',
            'Saturday','Sunday','Monday',
            'Tuesday'][day%7]

Submission status: Runtime Error

Solution code:
                                                                                                                                      
nm = [0,31,29,31,30,31,30,31,31,30,31,30]

while True:

    m,d = map(int,raw_input().split(" "))

    if m == 0:
        break
    nd = 0 
    for i in range(m):
       nd += nm[i]

    nd += d
    n = nd%7
    if n == 1:
        print "Thursday"
    elif n == 2:
        print "Tryday"
    elif n == 3:
        print "Saturday"
    elif n == 4:
        print "Sunday"
    elif n == 5:
        print "Monday"
    elif n == 6:
        print "Tuesday"
    elif n == 7:
        print "Wednesday"
~

Submission status: Runtime Error

Solution code:
nm = [0,31,29,31,30,31,30,31,31,30,31,30]

while True:

    m,d = map(int,raw_input().split(" "))

    if m == 0:
        break
    nd = 0 
    for i in range(m):
       nd += nm[i]

    nd += d 
    n = nd%7
    if n == 1:
        print "Thursday"
    elif n == 2:
        print "Tryday"
    elif n == 3:
        print "Saturday"
    elif n == 4:
        print "Sunday"
    elif n == 5:
        print "Monday"
    elif n == 6:
        print "Tuesday"
    else:                                                                                                                             
        print "Wednesday"
~                                                                                                                                     
~                                                                                                                                     
~                                                                                                                                     
~

Submission status: Runtime Error

Solution code:
nm = [0,31,29,31,30,31,30,31,31,30,31,30]

while True:

    m,d = map(int,raw_input().split(" "))

    if m == 0:
        break
    nd = 0 
    for i in range(m):
       nd += nm[i]

    nd += d
    n = nd%7
    if n == 1:
        print "Thursday"
    elif n == 2:
        print "Friday"                                                                                                                
    elif n == 3:
        print "Saturday"
    elif n == 4:
        print "Sunday"
    elif n == 5:
        print "Monday"
    elif n == 6:
        print "Tuesday"
    else:
        print "Wednesday"
~                                                                                                                                     
~                                                                                                                                     
~

Submission status: Runtime Error

Solution code:
nm = [0,31,29,31,30,31,30,31,31,30,31,30]
while True:
                                                                                                                                      
    m,d = map(int,raw_input().split(" "))

    if m == 0:
        break
    else:
        nd = 0 
        for i in range(m):
           nd += nm[i]

        nd += d
        n = nd%7
        if n == 1:
            print "Thursday"
        elif n == 2:
            print "Friday"
        elif n == 3:
            print "Saturday"
        elif n == 4:
            print "Sunday"
        elif n == 5:
            print "Monday"
        elif n == 6:
            print "Tuesday"
        else:
            print "Wednesday"
~                                                                                                                                     
~

Submission status: Runtime Error

Solution code:
while True:
    m, d = map(int, raw_inpud().split())
    if m == 0 and d == 0:
        break

Submission status: Runtime Error

Solution code:
y = [31,29,31,30,31,30,31,31,30,31,30,31]
dow = [0:"Monday", 1:"Thuesday", 2:"Wednesday", 3:"Thursday", 4:"Friday", 5:"Saturday", 6:"Sunday"]

while True:
    m, d = map(int, raw_inpud().split())
    if m == 0 and d == 0:
        break
    n =	0
    for i in range(m):
        n += y[i]
    n -= (n[m]-d+1)
    print dow[(n+3)%7]

Submission status: Runtime Error

Solution code:
wd=["Mon","Tues","Wednes","Thurs","Fri","Satur","Sun"]
md=[0,31,29,31,30,31,30,31,31,30,31,30,31]

while 1:
    m,d = map(int, raw_input().split())
    if m==0: break
    s = sum([md[i] for i in range(month)]) + day + 2
    s = wd[s % 7]+"day"
    print s