Problem:


Score : 100 points

Problem Statement

Given is a string S representing the day of the week today.

S is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.

After how many days is the next Sunday (tomorrow or later)?

Constraints

S is SUN, MON, TUE, WED, THU, FRI, or SAT.

Input

Input is given from Standard Input in the following format:

S

Output

Print the number of days before the next Sunday.

Sample Input 1

SAT

Sample Output 1

1

It is Saturday today, and tomorrow will be Sunday.

Sample Input 2

SUN

Sample Output 2

7

It is Sunday today, and seven days later, it will be Sunday again.



Sample input:
SAT


Sample output:
1

Submission status: Runtime Error

Solution code:
input()
if s == 'SUN':
  print('7')
elif s == 'MON':
  print('6') 
elif s == 'TUE':
  print('5') 
elif s == 'WED':
  print('4')
elif s == 'THU':
  print('3')
elif s == 'FRI':
  print('2')
else:
  print('1')

Submission status: Runtime Error

Solution code:
print(7 - ['SUN', 'MUN', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(input()))

Submission status: Runtime Error

Solution code:
l = ['SUN', 'MUN', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];print(len(l) - l.index(input()))

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()
lenlen = len(s)
 
a = ''
for i in range(lenlen):
    c = ord(s[i]) + n
    if 91 <= c:
        c = c - 26
    a = a + chr(c)
print(a)

Submission status: Runtime Error

Solution code:
Cal={'SUN':7 , 'MON':6 , 'TUE':5 , 'WED':4 , 'THU':3 , 'FRI':2 , 'SUT':1}
print(Cal[input()])

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()

ans = ''

for x in S
	num=(ord(x) + N)
  	if(num >90):
    	num=64+num%90
    ans += chr(num)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()

ans = ""

for x in range(S)
	num=(ord(x) + N)
  	if(num >90):
    	num=64+num%90
    ans += chr(num)
print(ans)

Submission status: Runtime Error

Solution code:
cal = {"SUN":0,"MON":1,"TUE":2,"WEN":3,"THU":4,"FRI":5,"SAT":6}
S = input()
print(7-cal[S])

Submission status: Runtime Error

Solution code:
D = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SUT": 1}
print(D[input()])

Submission status: Runtime Error

Solution code:
# SUN MON TUE WED THU FRI SAT

A = input()

if A == "SUN":
  print(7)
elif A == "MON":
  print(6)
elif A == "TUE":
  prnt(5)
elif A == "WED":
  print(4)
elif A == "THU":
  print(3)
elif A == "FRI":
  print(2)
elif A == "SAT":
  print(1)

Submission status: Runtime Error

Solution code:
A,B,X=input().split()
A=int(A)
B=int(B)
X=int(X)
dN=1
N=10**(dN-1)

if(X<A*N+B*dN):
    print(0)
elif (X==A*N+B*dN):
    print(dN)
else:
    while(X>A*N+B*dN):
        
        dN+=1
        N=10**(dN-1)
    
    dN-=1
    N=int((X-B*dN)/A)
    ans=min(N,10**9)
    print(ans)

Submission status: Runtime Error

Solution code:
S = input()
SUN,MON,TUE,WED,THU,FRI,SAT

if S[0]=='M':
  print(6)
elif S[2]=='E':
  print(5)
elif S[0] == 'W':
  print(4)
elif S[1] == 'H':
  print(3)
elif S[0] == 'F':
  print(2)
elif S[1] == 'A':
  print(1)
else:
  print(7)

Submission status: Runtime Error

Solution code:
S = str(input())
day_list = ["MON", "TUE", "WED", "THU", "FRI", "SAT"]
if S == "SUN":
  print(7)
else:
  ind = day_list.index(S)
  printt(6-ind)

Submission status: Runtime Error

Solution code:
S = input()
day_list = ["MON", "TUE", "WED", "THU", "FRI", "SAT"]
if S == "SUN":
  print(7)
else:
  ind = day_list.index(S)
  printt(6-ind)

Submission status: Runtime Error

Solution code:
dic[]

dic["SUN"] = 7
dic["MON"] = 6
dic["TUE"] = 5
dic["WED"] = 4
dic["THU"] = 3
dic["FRI"] = 2
dic["SAT"] = 1

S = str()input()

print(dic[S])

Submission status: Runtime Error

Solution code:
days = ['SUN','MON','TUE','WED','THU','FRI','SAT'] 
i = str(input())
count = 7
for day in days:
  if i == day:
    print(count)
    break
   else:
    count-=1

Submission status: Runtime Error

Solution code:
day = {"SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRY":2, "SAT":1}
s = input()
print(day[s])

Submission status: Runtime Error

Solution code:
S = str(input())

if s == "SUN":
  print("7")
elif s == "MON":
  print("6")
elif s == "TUE":
  print("5")
elif s == "WED":
  print("4")
elif s == "THU":
  print("3")
elif s == "FRY":
  print("2")
elif s == "SAT":
  print("1")

Submission status: Runtime Error

Solution code:
a, b, x = map(int, input().split())
ans =0
left = 0
right = 10**9+1

def dN(n):
  return len(str(n))

def cal_price(a, b, n):
  return a*n + b*dN(n)

while right - left > 1:
  mid = (left + right)//2
  if a*mid + b*dN(mid) > x: right = mid
  else: left = mid
    
print(left)

Submission status: Runtime Error

Solution code:
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRY', 'SAT']
S = input()
print(7-l.index(S))

Submission status: Runtime Error

Solution code:
a, b, x = map(int, input().split())

if x < a + b:
    print(0)
elif x >= a * 10 ** 9 + 10* b:
    print(int(10 ** 9))
else:
    high = 10 ** 9
    mid = (10 ** 9) // 2
    low = 1
    
    for i in range(50):
        if x > a * mid + b * len(str(mid)):
            low = mid
            mid = (high + mid) // 2
        else:
            high = mid
            mid = (mid + low) // 2
    
    print(mid)

Submission status: Runtime Error

Solution code:
a, b, x = map(int, input().split())

if x < a + b:
    print(0)
elif x => a * 10 ** 9 + 10* b:
    print(int(10 ** 9))
else:
    high = 10 ** 9
    mid = (10 ** 9) // 2
    low = 1
    
    for i in range(50):
        if x > a * mid + b * len(str(mid)):
            low = mid
            mid = (high + mid) // 2
        else:
            high = mid
            mid = (mid + low) // 2
    
    print(mid)

Submission status: Runtime Error

Solution code:
d = ['SUN','MON','TUE','WED','THUv,'FRI','SAT'].index(input())
print(7 - d)

Submission status: Runtime Error

Solution code:
s=input()
l=["SUN","MON","TUE","WED","THU","FRI","SAT"]
print(7-l.index(s)

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(input())
for i in range(len(s)):
  s[i]=chr((ord(s[i])-ord('A')+n)%26+ord('A'))
print(''.join(s))

Submission status: Runtime Error

Solution code:
s=input()
if(s=="SUN")x=7
if(s=="MON")x=6
if(s=="TUE")x=5
if(s=="WED")x=4
if(s=="THU")x=3
if(s=="FRI")x=2
if(s=="SAT")x=1
print(x)

Submission status: Runtime Error

Solution code:
S=input()

A=['SAT','FRI','THU','WED','THU','MON','SUN']

print(A.index(S)+1)

Submission status: Runtime Error

Solution code:
S=["MON","TUE","WED","THU","FRY","SAT","SUN"]

a=input()
n=S.index(a)

if a=="SUN":
    print(7)
else:
    print(6-n)

Submission status: Runtime Error

Solution code:
S = ["SUN", "MON","TUE","WED","THU","FRI","SAT"]
d = input()
for i in range(d):
  if d == S[i]:
    print(7 - i)
    break

Submission status: Runtime Error

Solution code:
day = input()

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT',6}

print(7 - days[day])

Submission status: Runtime Error

Solution code:
day = input().rstrip()

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT',6}

print (7 - days[day])

Submission status: Runtime Error

Solution code:
day = input()

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT',6}

print (7 - days[day])

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()
string = list(S)

alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
            'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
            'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

#Generate empty output
output = ''

for i in range(len(S)):
    #Get the index of an alphabet in the list
    ind1 = alphabet.index(string[i])
    #Divide N by 26 and get the remainder
    ind2 = (int(ind1) + N) % 26
    #Update the letter and keep adding it to the list
    output += alphabet[ind2]

print(output)

Submission status: Runtime Error

Solution code:
s = input()
if s = "SUN":
  print (7) 
elif s= "MON":
  print (6)
elif s= "TUE":
  print (5)
elif s= "WED":
  print (4)
elif s= "THU":
  print (3)
elif s= "FRI":
  print (2)
else:
  print(1)

Submission status: Runtime Error

Solution code:
s = input()
if s = "SUN":
  print ("7") 
elif s= "MON":
  print ("6")
elif s= "TUE":
  print ("5")
elif s= "WED":
  print ("4")
elif s= "THU":
  print ("3")
elif s= "FRI":
  print ("2")
else:
  print("1")

Submission status: Runtime Error

Solution code:
S = input()

X = [SUN,MON,TUE,WED,THU,FRI,SAT]
print(7 - X.index(S))

Submission status: Runtime Error

Solution code:
a = input()
b = ['SUN','MON','TUE','WED','THU','FRI','SAT']
ptint(7 - b.index(a))

Submission status: Runtime Error

Solution code:
ans = {"SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1, }
s = input()
print(ans[s])D

Submission status: Runtime Error

Solution code:
days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
day = input()
i = 7 - days.indexOf(day)
print(i)

Submission status: Runtime Error

Solution code:
li = ['SAT','FRI','THU','WED','TUE','MON','SAT']
x = input()
print(li.index(x)+1)

Submission status: Runtime Error

Solution code:
li = ['SUN','SAT','FRY','THU','WED','TUE','MON']
x = input()
print(li.index(x))

Submission status: Runtime Error

Solution code:
str_d = input().replace("SUN","7").replace("MON","6").replace("TUE","5").replace("WED","4").replace("THU","3").replace("FRI","2").replace("SUT","1")
ans = int(str_d)
print(ans)

Submission status: Runtime Error

Solution code:
a = input()
if a == SUN:
  print(7)
elif a == MUN:
  print(6)
elif a==TUE:
  print(5)
elif a==WEN:
  print(4)
elif a==THU:
  print(3)
elif a==FRI:
  print(2)
elif a==SAT:
  print(1)

Submission status: Runtime Error

Solution code:
import math
A,B,X = list(map(int, input().split()))

def nedan(n):
    return A*n + B*int(math.log10(n)+1)

if nedan(1000000000) <= X:
    print(1000000000)
else:
    min = 0
    max = 1000000000
    while(True):
        if nedan((max+min)//2) <= X:
            min = (max+min)//2
        else:
            max = (max+min)//2
        
        if abs(max-min)<=1:
            break

if nedan(max) <= X:
    print(max)
else:
    print(min)

Submission status: Runtime Error

Solution code:
S = input()

if S = 'SUN':
    print(7)
elif S = 'MON':
    print(6)
elif S = 'THE':
    print(5)
elif S = 'WED':
    print(4)
elif S = 'THU':
    print(3)
elif S = 'FRI':
    print(2)
elif S = 'SAT':
    print(1)

Submission status: Runtime Error

Solution code:
s = input()
n = int(input())
ans=[]
a = "ABCDEFGHIJKLMNOPQRSTUWVXYZABCDEFGHIJKLMNOPQRSTUWVXYZ"
a_list=[]
for j in a:
	a_list.append(j)
for i in range (len(s)):
	ans.append(a_list[(a_list.index(s[i]))+n])
print("".join(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()
L=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
A = []
 
for c in S:
  i = L.find(c)
  A.append(L[(i + n)%26])
  
print(''.join(A))

Submission status: Runtime Error

Solution code:
a=input()
if a=="SUN":
 b=7
if a=="MON":
 b=6
if a=="TUE":
 b=5
if a=="WED":
 b=4
if a=="THU":
 b=3
if a=="FRI":
 b=2
if a=="SET":
 b=1
print(b)

Submission status: Runtime Error

Solution code:
import sys

week = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
today = input()

for i, day in enumerate(week):
  if day == today:
    print(7 - i)
	sys.exit()

Submission status: Runtime Error

Solution code:
# input
n = int(input())

edges = [[] for i in range(n)]
for i in range(n-1):
    a ,b = map(int, list(input().split()))
    edges[a-1].append((b-1, i))

# process
ans = [0]*(n-1)

def f(a, c):
    color = 1
    for b, i in edges[a]:
        if color == c: color += 1
        ans[i] = color 
        f(b, color)
        color += 1

f(0, 0)

# output
print(max(ans))
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
alp = 'abcdefghijklmnopqrstuvwxyz' * 2
ss = ''

for i in range(len(s)):

    ss += str(alp[alp.index(s[i])+n])

print(ss)

Submission status: Runtime Error

Solution code:
k=["MON","TUE","WED","THU","FRI","SAT"]
s=input()
j="SUN"
if(s==j):
  print(7)
else:
  for a,i in enumerate k:
    if(s==i):
      print(6-a)

Submission status: Runtime Error

Solution code:
days=["MON","TUE","WED","THU","FRI","SAT","SUN"]
s=input()
for k,i in enumerate days:
  if(s=="SUN"):
    print(7)
  elif(s==i)
    print(6-k)

Submission status: Runtime Error

Solution code:
def when_sunday(day):
    week_d = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
    if day == "SUN":
        return 7
    return 6 - week_d.index(day)
  

print(when_sunday(input())

Submission status: Runtime Error

Solution code:
a,b,x = map(int,input().split())

max=0
start=0
i=1
while True:
  sums=a*i+b*len(str(i))
  if x>=sums:
    i=i*10
    continue
  else:
    break

if i==1:
  print(0)
  exit(0)
if i>=1000000000:
  print(1000000000)
  exit(0)

#print("i="+str(i))
for j in range(int(i/10),i+1):
  #print(j)
  sums=a*j+b*len(str(j))
  if x>=sums:
    max=j
  else:
    break
print(max)

"""
for i in range(1,1000000001):
  sums=a*i+b*len(str(i))
  if x>=sums:
   max=i
  else:
   break
print(max)
"""

Submission status: Runtime Error

Solution code:
a,b,x = map(int,input().split())

max=0
start=0
i=1
while True:
  sums=a*i+b*len(str(i))
  if x>=sums:
    i=i*10
    continue
  else:
    break

if i==1:
  print(0)
  exit(0)
if i>=1000000000:
  print(1000000000)
  exit(0)

#print("i="+str(i))
for j in range(int(i/10)-1,i+1):
  #print(j)
  sums=a*j+b*len(str(j))
  if x>=sums:
    max=j
  else:
    break
print(max)

"""
for i in range(1,1000000001):
  sums=a*i+b*len(str(i))
  if x>=sums:
   max=i
  else:
   break
print(max)
"""

Submission status: Runtime Error

Solution code:
N = int(input())
graph = [[] for _ in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append((b-1,i))
    graph[b-1].append((a-1,i))
ans = 0
print(graph)
pos = 0
for i in range(N-1):
    if ans < len(graph[i]):
        ans = len(graph[i])
        pos = i
print(ans)

color = [-1 for i in range(N-1)]
def dps(now,pare,par_col=-1):
    col = 1
    for u,idx in graph[now]:
        if u != pare :
            if col == par_col :
                col += 1
            color[idx] = col
            dps(u,now,col)
            col += 1

dps(0,-1,-1)
print("\n".join(map(str,color)))

Submission status: Runtime Error

Solution code:
from sys import stdin
INF = float("inf")#無限大の設定1
IINF = 10 ** 18#無限大の設定2
MOD = 10 ** 9 + 7#まれに用いるmodを予め設定しておく
n = (stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]
S =['SUN','MON','TUE','WEN','THU','FRI','SAT']
a = S.index(n)
print(len(S) - a)

Submission status: Runtime Error

Solution code:
S=input()
if S="SUN":
  print("0")
elif S="MON":
  print("1")
elif S="TUE":
  print("2")
elif S="Wed":
  print("3")
elif S="THU":
  print("4")
elif S="FRI":
  print("5")
elif S="SAT":
  print("6")

Submission status: Runtime Error

Solution code:
S=input()
if S="SUN":
  print("7")
elif S="MON":
  print("6")
elif S="TUE":
  print("5")
elif S="WED":
  print("4")
elif S="THU":
  print("3")
elif S="FRI":
  print("2")
elif S="SAT":
  print("1")

Submission status: Runtime Error

Solution code:
S=input()
if S="SUN":
  print("0")
  elif S="MON":
  print("1")
  elif S="TUE":
  print("2")
  elif S="Wed":
  print("3")
  elif S="THU":
  print("4")
  elif S="FRI":
  print("5")
  elif S="SAT":
  print("6")

Submission status: Runtime Error

Solution code:
input(S)
if S="SUN":
  print("7")
elif S="MON":
  print("6")
elif S="TUE":
  print("5")
elif S="WED":
  print("4")
elif S="THU":
  print("3")
elif S="FRI":
  print("2")
elif S="SAT":
  print("1")

Submission status: Runtime Error

Solution code:
if S="SUN":
  print("0")
  elif S="MON":
  print("1")
  elif S="TUE":
  print("2")
  elif S="Wed":
  print("3")
  elif S="THU":
  print("4")
  elif S="FRI":
  print("5")
  elif S="SAT":
  print("6")

Submission status: Runtime Error

Solution code:
input(S)
if S="SUN":
  print(7)
elif S="MON":
  print(6)
elif S="TUE":
  print(5)
elif S="WED":
  print(4)
elif S="THU":
  print(3)
elif S="FRI":
  print(2)
elif S="SAT":
  print(1)

Submission status: Runtime Error

Solution code:
if S="SUN":
  print("0")
  elif S="MON"
  print("1")
  elif S="TUE"
  print("2")
  elif S="Wed"
  print("3")
  elif S="THU"
  print("4")
  elif S="FRI"
  print("5")
  elif S="SAT"
  print("6")

Submission status: Runtime Error

Solution code:
if S="SUN":
  print("7")
elif S="SAT":
  print("1")
elif S="FRI":
  print("2")
elif S="THU":
  print("3")
elif S="WED":
  print("4")
elif S="TUE":
  print("5")
elif S="MON":
  print("6")

Submission status: Runtime Error

Solution code:
s = input()
w = ['SUM','MON','TUE','WED','THU','FRI','SAT']
for i in range(len(S)):
    if s == w[i]:
        print 7 - i

Submission status: Runtime Error

Solution code:
char=input()

week=("SUN","MON","TUE","WED","THU","FRI","SAT")

print(7-week.index())

Submission status: Runtime Error

Solution code:
s = input()
week = ("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT")

print(7 - index.week(s))

Submission status: Runtime Error

Solution code:
import sys

day = sys.stdin().read().strip()

days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

day_index = days.index(day)

print(7-day_index)

Submission status: Runtime Error

Solution code:
import sys

day = sys.stdin.read()

days = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
day_index = days.index(day)

print(6 - day_index)

Submission status: Runtime Error

Solution code:
N = int(input())
W = []
G = [[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    W.append((a,b))
    G[a].append(b)
    G[b].append(a)
K = 0
for i in range(1,N+1):
    n = len(G[i])
    K = max(K,n)
print(K)
C = [[i for i in range(1,K+1)] for j in range(N+1)]
import copy 
w = copy.deepcopy(W)
d = [[0 for i in range(N+1)] for j in range(N+1)]
w.sort()
for i in range(N-1):
    a,b = W[i]
    print(d[a][b])

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    S=input()
    days=['SAN','MON','TUE','WED','THU','FRI','SAT']
    print(7-days.index(S))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
D=["SUN","MON","TUE","WED","THU","FRY","SAT"]
S=input()

print(7-D.index(S))

Submission status: Runtime Error

Solution code:
D=["SUN","MON","TUE","WED","THU","FRY","SAT"]
S=input(int())

print(7-D.index(S))

Submission status: Runtime Error

Solution code:
D=["SUN","MON","TUE","WED","THU","FRY","SAT"]
S=input(int())

print(7-D.index(D))

Submission status: Runtime Error

Solution code:
 s=input()
 l=['SUN','MON','TUE','WED','THU','FRI','SAT']
 l.reverse()
 print(l.index(s)+1)

Submission status: Runtime Error

Solution code:
S = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
s = print()
result = abs(S.index(s)-S.index("SUN"))
print(result)

Submission status: Runtime Error

Solution code:
S = input()
a = 0

if S = 'SUN':
  a = 7
elif S = 'MON':
  a = 6
elif S = 'TUE':
  a = 5
elif S = 'WED':
  a = 4
elif S = 'THU':
  a = 3
elif S = 'FRI':
  a = 2
elif S = 'SAT':
  a = 1

print(a)

Submission status: Runtime Error

Solution code:
class Node:
    nodes = {}
    @classmethod
    def get_root_node(cls):
        #n = Node.nodes[next(iter(Node.nodes))]
        n = Node.nodes[1]
        for _ in range(len(Node.nodes)):
            if n.parent is None:
                return n
            else:
                n = n.parent

    @classmethod
    def largest_num_color(cls):
        r = 0
        for key, node in Node.nodes.items():
            if node.num_color > r:
                r = node.num_color
        return r

    @classmethod
    def dump_all_nodes(cls):
        for key, node in Node.nodes.items():
            print(str(node))

    @classmethod
    def get_instance(cls, id, parent):
        if id in Node.nodes:
            if Node.nodes[id].parent is None:
                Node.nodes[id].parent = parent
            return Node.nodes[id]
        else:
            return Node(id, parent)

    @classmethod
    def color_childs(clf, start_node):
        c = 1
        list_to_visit = []
        list_to_visit += start_node.childs
        list_to_visit.append(-1)
        while(len(list_to_visit)>0):
            if list_to_visit[0]==-1:
                c = 1
                list_to_visit.remove(list_to_visit[0])
                continue
            node = list_to_visit[0]
            list_to_visit.remove(list_to_visit[0])
            if c == node.parent.parent_edge_color:
                c += 1
            node.parent_edge_color = c
            list_to_visit += node.childs
            list_to_visit.append(-1)
            c += 1

    def __init__(self, id, parent):
        self.id = id
        self.parent = parent # None if root Node
        self.parent_edge_color = None
        self.childs = []
        Node.nodes[id] = self
        self.used_color = []

    def __str__(self):
        x = self.parent.id if self.parent else "None"
        #return f"id: {self.id}, parent: {x}, parent_edge_color: {self.parent_edge_color} ,num_child {len(self.childs)}, num_color {self.num_color}"
        return str(self.id)

    def append_child(self, node):
        self.childs.append(node)

    @property
    def num_color(self):
        if self.parent_edge_color is None:
            return len(self.childs)
        else:
            return len(self.childs) + 1

N = int(input())

Edges = []
Edges_color = []
for i in range(N-1):
    edge = list(map(int, input().split()))
    Edges.append(edge)


for edge in Edges:
    pnode = Node.get_instance(edge[0], None)
    cnode = Node.get_instance(edge[1], pnode)
    pnode.append_child(cnode)

root = Node.get_root_node()

Node.color_childs(root)
#Node.dump_all_nodes()
K = Node.largest_num_color()
print(K)

for edge in Edges:
    print(Node.get_instance(edge[1], edge[0]).parent_edge_color)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000)
class Node:
    nodes = {}
    @classmethod
    def get_root_node(cls):
        #n = Node.nodes[next(iter(Node.nodes))]
        n = Node.nodes[1]
        for _ in range(len(Node.nodes)):
            if n.parent is None:
                return n
            else:
                n = n.parent

    @classmethod
    def largest_num_color(cls):
        r = 0
        for key, node in Node.nodes.items():
            if node.num_color > r:
                r = node.num_color
        return r

    @classmethod
    def dump_all_nodes(cls):
        for key, node in Node.nodes.items():
            print(str(node))

    @classmethod
    def get_instance(cls, id, parent):
        if id in Node.nodes:
            if Node.nodes[id].parent is None:
                Node.nodes[id].parent = parent
            return Node.nodes[id]
        else:
            return Node(id, parent)

    @classmethod
    def color_childs(clf, start_node):
        c = 1
        list_to_visit = []
        list_to_visit += start_node.childs
        list_to_visit.append(-1)
        while(len(list_to_visit)>0):
            if list_to_visit[0]==-1:
                c = 1
                list_to_visit.remove(list_to_visit[0])
                continue
            node = list_to_visit[0]
            list_to_visit.remove(list_to_visit[0])
            if c == node.parent.parent_edge_color:
                c += 1
            node.parent_edge_color = c
            list_to_visit += node.childs
            list_to_visit.append(-1)
            c += 1

    def __init__(self, id, parent):
        self.id = id
        self.parent = parent # None if root Node
        self.parent_edge_color = None
        self.childs = []
        Node.nodes[id] = self
        self.used_color = []

    def __str__(self):
        x = self.parent.id if self.parent else "None"
        return f"id: {self.id}, parent: {x}, parent_edge_color: {self.parent_edge_color} ,num_child {len(self.childs)}, num_color {self.num_color}"

    def append_child(self, node):
        self.childs.append(node)

    @property
    def num_color(self):
        if self.parent_edge_color is None:
            return len(self.childs)
        else:
            return len(self.childs) + 1

N = int(input())

Edges = []
Edges_color = []
for i in range(N-1):
    edge = list(map(int, input().split()))
    Edges.append(edge)


for edge in Edges:
    pnode = Node.get_instance(edge[0], None)
    cnode = Node.get_instance(edge[1], pnode)
    pnode.append_child(cnode)

root = Node.get_root_node()

Node.color_childs(root)
#Node.dump_all_nodes()
K = Node.largest_num_color()
print(K)

for edge in Edges:
    print(Node.get_instance(edge[1], edge[0]).parent_edge_color)

Submission status: Runtime Error

Solution code:

class Node(object):
    nodes = {}
    @classmethod
    def get_root_node(cls):
        n = Node.nodes[next(iter(Node.nodes))]
        while True:
            if n.parent is None:
                return n
            else:
                n = n.parent

    @classmethod
    def largest_num_color(cls):
        r = 0
        for key, node in Node.nodes.items():
            if node.num_color > r:
                r = node.num_color
        return r

    @classmethod
    def dump_all_nodes(cls):
        for key, node in Node.nodes.items():
            print(str(node))

    @classmethod
    def get_instance(cls, id, parent):
        if id in Node.nodes:
            if Node.nodes[id].parent is None:
                Node.nodes[id].parent = parent
            return Node.nodes[id]
        else:
            return Node(id, parent)

    @classmethod
    def color_childs(clf, start_node):
        c = 1
        list_to_visit = []
        list_to_visit += start_node.childs
        list_to_visit.append(-1)
        while(len(list_to_visit)>0):
            if list_to_visit[0]==-1:
                c = 1
                list_to_visit.remove(list_to_visit[0])
                continue
            node = list_to_visit[0]
            list_to_visit.remove(list_to_visit[0])
            if c == node.parent.parent_edge_color:
                c += 1
            node.parent_edge_color = c
            list_to_visit += node.childs
            list_to_visit.append(-1)
            c += 1

    def __init__(self, id, parent):
        self.id = id
        self.parent = parent # None if root Node
        self.parent_edge_color = None
        self.childs = []
        Node.nodes[id] = self
        self.used_color = []

    def __str__(self):
        x = self.parent.id if self.parent else "None"
        return f"id: {self.id}, parent: {x}, parent_edge_color: {self.parent_edge_color} ,num_child {len(self.childs)}, num_color {self.num_color}"

    def append_child(self, node):
        self.childs.append(node)

    @property
    def num_color(self):
        if self.parent_edge_color is None:
            return len(self.childs)
        else:
            return len(self.childs) + 1

N = int(input())

Edges = []
Edges_color = []
for i in range(N-1):
    edge = list(map(int, input().split()))
    Edges.append(edge)


for edge in Edges:
    pnode = Node.get_instance(edge[0], None)
    cnode = Node.get_instance(edge[1], pnode)
    pnode.append_child(cnode)

root = Node.get_root_node()
Node.color_childs(root)
#Node.dump_all_nodes()
K = Node.largest_num_color()
print(K)

for edge in Edges:
    print(Node.get_instance(edge[1], edge[0]).parent_edge_color)

Submission status: Runtime Error

Solution code:
W = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
for j in range(7):
    if W[j] == input():
        print(7-j)

Submission status: Runtime Error

Solution code:
day = input()
week = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
ans = 6;

for i in int(len(week)):
    if day != week[i]:
        ans -= 1
print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**7)

n = int(input())

graph = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    graph[a].append([b,i])

ans = [0]*(N-1)
def col(now,color):
    c = 1
    for (b,j) in graph[now]:
        if c == color:
            c += 1
    ans[j] = c
    col(b,c)
    c += 1

col(0,0)
print(max(ans))
[print(a) for a in ans]

Submission status: Runtime Error

Solution code:
dist = {"MON":0,"TUE":1,"WED":2,"THU":3,"FRI":4,"SAT":5,"FRI":6,"SUN":7}
i = str(input())
if i == "SUN":
  print(7)
else:
  print(dist["SUN"]-dist(i))

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
if A-2*B > 0:
    print(A-2*B)
else:
    print('0')

Submission status: Runtime Error

Solution code:
A, B, X = map(int, input().split())
import math
def buy(A,B,X):
    if X < (A+B):
        return 0
    d = 0
    for i in range(1, 10):
        if pow(10,i-1) <= (X - B*i)/A:
            d = i
# 算出最大值
    result = math.floor((X - B*d)/A)
    return min(result, 1000000000)
  
print(buy(A,B,X))

Submission status: Runtime Error

Solution code:
s = input()

N = int(s)

s = input()

S = s

for c in S:
    t = ord(c)
    t = t - 65 # A
    t = t + N
    t = t % 24
    print(chr(t+65))

Submission status: Runtime Error

Solution code:
from sys import stdin, stdout

if __name__ == '__main__':
  S = stdin.readlines().replace("\n","")
  d = {'SUN':7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1}
  stdout.writelines("%d" % d[S])

Submission status: Runtime Error

Solution code:
s=input()
if s=="SUN"
  print(7)
if s=="MON"
  print(6)
if s=="TUE"
  print(5)
if s=="WED"
  print(4)
if s=="THU"
  print(3)
if s=="FRI"
  print(2)
if s=="SAT"
  print(1)

Submission status: Runtime Error

Solution code:
s=input()
if s=='SUN'
  print(7)
if s=='MON'
  print(6)
if s=='TUE'
  print(5)
if s=='WED'
  print(4)
if s=='THU'
  print(3)
if s=='FRI'
  print(2)
if s=='AST'
  print(1)

Submission status: Runtime Error

Solution code:
s=input()
if s='SUN'
  print(7)
if s='MON'
  print(6)
if s='TUE'
  print(5)
if s='WED'
  print(4)
if s='THU'
  print(3)
if s='FRI'
  print(2)
if s='AST'
  print(1)

Submission status: Runtime Error

Solution code:
def solve(string):
    l = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
    return str(7 - l.index(string))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read()))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
S = []
d = {}
A = list(map(int,input().split()))
ans = 0
sum =0
for i in range(1,N+1):
    sum += A[i-1] % K
    s = (sum - i) % K
    if i > K:
        x = S.pop(0)
        d[x] -= 1
    elif i < K:
        if s == 0:
            ans += 1
    if s not in d:
        d[s] = 0
    ans += d[s]
    d[s] += 1
    S.append(s)
print(ans)

Submission status: Runtime Error

Solution code:
if str(input())="SUN":
	print(7)
elif str(input())="MON":
  print(6)
elif str(input())="TUE":
  print(5)
elif str(input())="WED":
  print(4)
elif str(input())="THU":
  print(3)
elif str(input())="FRI":
  print(2)
elif str(input())="SAT":
  print(1)

Submission status: Runtime Error

Solution code:
if str(input())='SUN':
	print(7)
elif str(input())='MON':
  print(6)
elif str(input())='TUE':
  print(5)
elif str(input())='WED':
  print(4)
elif str(input())='THU':
  print(3)
elif str(input())='FRI':
  print(2)
elif str(input())='SAT':
  print(1)

Submission status: Runtime Error

Solution code:
if str(input())='SUN':
	print(7)
elif str(input())='MON':
  print(6)
elif str(input())='TUE':
  print(5)
elif str(input())='WED':
  print(4)
elif str(input())='THU':
  print(3)
elif str(input())='FRI':
  print(2)
elif str(input())='SAT':
  print(1)
end