TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = input()
tmp = 0
while N > 0:
  tmp += (N % 10)
  N /= 10
if tmp % 9 == 0:
  print("Yes")
else:
  print("No")


N = input()
tmp = 0
while N > 0:
    tmp += (N % 10)
    N /= 10
if tmp % 9 == 0:
    print("Yes")
else:
    print("No")


N = input()
tmp = 0
while N > 0:
  tmp += (N % 10)
  N /= 10
if tmp % 9 == 0:
  print("Yes")
else:
  print("No")


# # Make IO faster
# import sys
# input = sys.stdin.readline


# X = input()


# N = int(input())

# X, Y = map(int, input().split())
 for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
tmp = 0
while N > 0:
    tmp += (N % 10)
    N = N // 10
print(tmp)
if tmp % 9 == 0:
    print("Yes")
else:
    print("No")


print("No"if int(input())%9else"Yes")


Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = input()
ans = 0
while N:
    ans += int(N[:-1])
    ans = ans % 9
    N = N[:-1]
if ans == 0:
    print('Yes')
else:
    print('No')


N = input()
ans = 0
while N:
    ans += int(N[-1])
    ans = ans % 9
    N = N[:-1]
if ans == 0:
    print('Yes')
else:
    print('No')


Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):

def main():
  N = input()
  N_sum = 0
  
  if N == str(0):
    print("No")
    exit()
  
  for i in N:
    N_sum += int(i)
    
  if N_sum // 9 == 0:
    print("Yes")
  else:
    print("No")
  
if __name__ == "__main__":
  main()
  

def main():
  N = input()
  N_sum = 0
  
  for i in N:
    N_sum += int(i)
    
  if N_sum % 9 == 0:
    print("Yes")
  else:
    print("No")
  
if __name__ == "__main__":
  main()
  

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n=input()
s=0
for i in range(n):
  s+=int(n[i])
if(s%9==0):
  print("Yes")
else:
  print("No")

n=input()
s=0
for i in range(len(n)):
  s+=int(n[i])
if(s%9==0):
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = input(int())

N = str(N)

sum = 0
for i in len(N):
  sum += N[i]

if sum % 9 ==0:
  print('Yes')
else:
  print('No')

N = input()

N = str(N)

sum = 0
for i in range(0, len(N)):
  sum += N[i]

if sum % 9 ==0:
  print('Yes')
else:
  print('No')

N = int(input())

if N % 9 ==0:
  print('Yes')
else:
  print('No')

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n=int(input())
sum=0
while (n != 0):
  sum = sum + n % 10; 
  n = n/10; 
if(sum%9==0):
  print("Yes")
else:
  print("No")    
     

n=int(input())
sum=0
while (n != 0):
  sum = sum + n % 10; 
  n = n/10; 
if(sum%9==0):
  print("Yes")
else:
  print("No)    
     
    

n=int(input())
while (n != 0):
  sum = sum + n % 10; 
  n = n/10; 
if(sum%9==0):
  print("Yes")
else:
  print("No)    
     
    

n=str(input())
sum=0
for i in range(len(n)):
    sum+=int(n[i]); 
if(sum%9==0):
  print("Yes")
else:
  print("No")    
     

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = str(input())

a = []
for n in range(N):
  a.append(int(N[n]))
  
if sum(a) % 9 == 0:
  print('Yes')
else:
  print('No')

N = str(input())
 
a = []
for n in range(len(N)):
  a.append(int(N[n]))
  
if sum(a) % 9 == 0:
  print('Yes')
else:
  print('No')

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
from sys import stdin


test = list(stdin.readline().lstrip().rstrip())

total=0

for i in test:
    total += total + int(i)


if total%9 == 0:
    print('Yes')
else:
    print('No')


from sys import stdin



test = list(stdin.readline().rstrip())
 
result=0
 
for i in test:
  result = result + int(i)
 
if (result % 9) == 0:
  print('Yes')
else:
  print('No')


Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N=int(input())
if N//9==0:
  print('Yes')
else:
  print('No')

N=int(input())
if N%9==0:
  print('Yes')
else:
  print('No')

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)

N = int(input())
if digitSum(N) // 9 == 0:
    print("Yes")
else:
    print("No")

N = int(input())
if N // 9 == 0:
    print("Yes")
else:
    print("No")

N = int(input())
if N % 9 == 0:
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
a = int(input())
print "Yes" if a % 9 == 0 else "No"

a=int(input())
print("Yes"if a%9==0else"No")

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = input()

ans = sum(map(int, N))

if ans % 9 == 0:
  print('YES')
else:
  print('NO')


N = input()
 
ans = sum(map(int, N))
 
if ans % 9 == 0:
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = str(input())
lists = [int(x) for x in N]

if a % 9 == 0:
        print('Yes')
else:
        print('No')

N = str(input())
lists = [int(x) for x in N]
a = sum(lists)

if  a % 9 == 0:
        print('Yes')
else:
        print('No')

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = line(input().rstrip())
sum = 0

for i in range(len(N)):
  sum += int(N[i])
 
if sum % 9 == 0:
  print("Yes")
else:
  print("No")

N = list(input().rstrip())
sum = 0
 
for i in range(len(N)):
  sum += int(N[i])
 
if sum % 9 == 0:
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N=int(input())
c = 0
if(N % 2 == 1):
    if( N % 9 == 0 ):
        num_list = list(str(N))
        s = len(num_list)
        for i in range(s):
            a = num_list[i]
            c += int(a) 
        if(c % 9 == 0):
            print("Yes")
        else:
            print("No")
    
    else:
        print("No")
if (N == 0):
    print("Yes")
else:
    print("No")

N=int(input())
c = 0
if (N == 0):
    print("Yes")
else:
    num_list = list(str(N))
    s = len(num_list)
    for i in range(s):
        a = num_list[i]
        c += int(a) 
    if(c % 9 == 0):
        print("Yes")
    else:
        print("No")



Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N=list(input())
N_2=list(map(int,N))
print(N_2)

print('YNeos'[sum(N_2)%9!=0::2])

N=list(input())
N_2=list(map(int,N))
print('YNeos'[sum(N_2)%9!=0::2])

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = list(input())

sum_N = 0
for i in range(len(N)):
    sum_N += int(N[i])

if sum_N%9 == 0:
    print('yes')
else:
    print('no')

N = list(input())

sum_N = 0
for i in range(len(N)):
    sum_N += int(N[i])

if sum_N%9 == 0:
    print('Yes')
else:
    print('No')

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
strList = list(input())
intList = [int(s) for s in strList]
if sum(intList)%9 == 0:
  print(Yes)
else:
  print(No)

strList = input()
intList = [int(s) for s in strList]
if sum(intList)%9 == 0:
  print(Yes)
else:
  print(No)


strList = input()
intList = [int(s) for s in strList]
sum = sum(intList)
if sum%9 == 0:
  print(Yes)
else:
  print(No)

strList = list(input())
intList = [int(s) for s in strList]
if sum(intList)%9 == 0:
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n = list(map(int, input()))
if stm(n)%9==0:
  print('Yes')
else:
  print('No')

n = list(map(int, input()))
if stm(n)%9==0:
  print("Yes")
else:
  print("No")


n = list(map(int, input()))
if sum(n)%9==0:
  print('Yes')
else:
  print('No')


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = int(input())

def if_test(N):
  if N&9 == 0:
  	print("Yes")
  else:
    print("No")

N = int(input())

def if_test(N):
  if N&9 == 0:
  	print(Yes)
  else:
    print(No)

s = int(input())

if s % 9 == 0:
 	print("Yes")
else:
 	print("No")

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N=int(input())
Ls = list(map(int,input().split()))
score=0
for i in range(0,N-2):
  a = Ls[i]
  for j in range(i+1, N-1):
      b = Ls[j]
      for k in range(j+1, N):
        c = Ls[k]
        if ((a+b>c)&(a+c>b)&(b+c>a)&(a!=b)&(a!=c)&(b!=c)):
          score+=1
          L_list=[i,j,k]
          print(L_list)
print(score)

n = input()
point=0
for i in range(len(n)):
  point+=int(n[i])
  
if point%9==0:
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n=input()


n=str(n)
Sum=0
for i in range(len(n)):
    Sum=Sum+int(n[i])

if Sum%9==0:
    print("yes")
else:
    print("no")
    

        

n=input()


n=str(n)
Sum=0
for i in range(len(n)):
    Sum=Sum+n[i]-"0"

if Sum%9==0:
    print("yes")
else:
    print("no")
    

        

n=input()


n=str(n)
Sum=0
for i in range(len(n)):
    Sum=Sum+int(n[i])

if Sum%9==0:
    print("Yes")
else:
    print("No")
    

        

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
if int(input()) % 9 == 0 : print("Yes")
else print("No")

if int(input()) % 9 == 0 : print("Yes")
else : print("No")


Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N=int(input())

if(N%9==) print("Yes")
else print("No")

N=int(input())

if N%9==0:
  print("Yes")

else:
  print("No")
  

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
l = list(map(int, input()))
sum = 0
for i in range(len(l)):
    sum += l[i]

print(sum)

l = list(map(int, input()))
sum = 0
for i in range(len(l)):
    sum += l[i]

print('Yes' if sum % 9 == 0 else 'No')

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n=int()
array=list(map(int,n))
a=sum(array)
if a%9==0:
  print('Yes')
else:
  print('No')

n=input()
array=list(map(int,n))
a=sum(array)
if a%9==0:
  print('Yes')
else:
  print('No')

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n = int(input())
n = pow(10, 200000)-1

total = 0
n = str(n)
for i in range(len(n)):
    total += int(n[i])

if total % 9 == 0:
    print('Yes')
else:
    print('No')


n = int(input())

total = 0
n = str(n)
for i in range(len(n)):
    total += int(n[i])

if total % 9 == 0:
    print('Yes')
else:
    print('No')


Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
from math import ceil
n, x, t = map(int, input().split())
print(t*ceil(n/x))

n = str(input())
lst = [int(i) for i in n]
if sum(lst) % 9 ==0:
    print('Yes')
else:
    print('No')
    

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	ll sum=0;
	string n;
	cin >> n;
	rep(i, n.length()){
		sum+=n[i]-'0';
	}
	if(sum%9 == 0) puts("Yes");
	else puts("No");
	return 0;
}


n = int(input())
if n%9 == 0: print("Yes")
else: print("No")

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n = input()
list_n = list(n)
list_n = [int(s) for s in list_n]
sum_list = 0
for i in list_n:
    sum_list += list_n[i]
if sum_list%9 ==0:
    print('Yes')
else:
    print('No')

n = input()
list_n = list(n)
list_n = [int(s) for s in list_n]
sum_list = 0
for i in range(len(list_n)):
    sum_list += list_n[i]
if sum_list%9 ==0:
    print('Yes')
else:
    print('No')

Verdicts: Runtime Error

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = str(input())
ans = 0
for i in N:
  ans += int(i)
if ans%9 == 0:
  print("yes")
else:
  print("no")

N = str(input())
ans = 0
for i in N:
  ans += int(i)
if ans%9 == 0:
  print("Yes")
else:
  print("No")

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
N = int(input())

temp = 0
for x in str(N):
    temp += int(x)

if temp%9==0:
    ans = "yes"
else:
    ans = "No"

print(ans)

N = int(input())

temp = 0
for x in str(N):
    temp += int(x)

if temp%9==0:
    ans = "Yes"
else:
    ans = "No"

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n = int(input())
sum1 = 0
for i in range(len(str(n))):
    sum1 += int(str(n)[i])
    print(int(str(n)[i]))
if sum1 % 9 == 0:
    print('Yes')
else:
    print('No')

n = int(input())
s = str(n)
array = list(map(int, s))
if sum(array) % 9 == 0:
    print('Yes')
else:
    print('No')

Verdicts: Wrong Answer

Accepted
Problem: An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.  Determine whether N is a multiple of 9.

Submission attempts (in order):
n = input()
total = 0
for i in range(len(n)):
    total += int(n[i])
print(total % 9 == 0)

n = input()
total = 0
for i in range(len(n)):
    total += int(n[i])
ans = "Yes" if total % 9 == 0 else "No"
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: A maze is composed of a grid of H \times W squares - H vertical, W horizontal.  The square at the i-th row from the top and the j-th column from the left - (i,j) \- is a wall if S_{ij} is `#` and a road if S_{ij} is `.`.  There is a magician in (C_h,C_w). He can do the following two kinds of moves:    * Move A: Walk to a road square that is vertically or horizontally adjacent to the square he is currently in.   * Move B: Use magic to warp himself to a road square in the 5\times 5 area centered at the square he is currently in.  In either case, he cannot go out of the maze.  At least how many times does he need to use the magic to reach (D_h, D_w)?

Submission attempts (in order):
from collections import deque
def main():
  h,w = map(int,input().split())
  ch,cw = map(lambda x:int(x)+1,input().split())
  dh,dw = map(lambda x:int(x)+1,input().split())
  s = [["#"]*(w+4) for _ in range(2)]+[["#"]*2+list(input())+["#"]*2 for _ in range(h)]+[["#"]*(w+4) for _ in range(2)]
  m1 = ((-1,0),(0,-1),(0,1),(1,0))
  m2 = [(i,j) for i in range(-2,3) for j in range(-2,3) if abs(i)+abs(j)>1]
  a = deque([(ch,cw)])
  b = deque()
  i = 0
  while a:
    while a:
      ah,aw = a.popleft()
      if s[bh][bw]!=".":
        continue
      b.append((ah,aw))
      s[ah][aw] = i
      for bh,bw in m1:
        bh,bw = ah+bh,aw+bw
        if s[bh][bw]==".":
          a.append((bh,bw))
    while b:
      ah,aw = b.popleft()
      for bh,bw in m2:
        bh,bw = ah+bh,aw+bw
        if s[bh][bw]==".":
          a.append((bh,bw))
    i += 1
  ans = s[dh][dw]
  print(ans if ans != "." else -1)

if __name__ == "__main__":
    main()

from collections import deque
def main():
  h,w = map(int,input().split())
  ch,cw = map(lambda x:int(x)+1,input().split())
  dh,dw = map(lambda x:int(x)+1,input().split())
  s = [["#"]*(w+4) for _ in range(2)]+[["#"]*2+list(input())+["#"]*2 for _ in range(h)]+[["#"]*(w+4) for _ in range(2)]
  m1 = ((-1,0),(0,-1),(0,1),(1,0))
  m2 = [(i,j) for i in range(-2,3) for j in range(-2,3) if abs(i)+abs(j)>1]
  a = deque([(ch,cw)])
  b = deque()
  i = 0
  while a:
    while a:
      ah,aw = a.popleft()
      if s[ah][aw]!=".":
        continue
      b.append((ah,aw))
      s[ah][aw] = i
      for bh,bw in m1:
        bh,bw = ah+bh,aw+bw
        if s[bh][bw]==".":
          a.append((bh,bw))
    while b:
      ah,aw = b.popleft()
      for bh,bw in m2:
        bh,bw = ah+bh,aw+bw
        if s[bh][bw]==".":
          a.append((bh,bw))
    i += 1
  ans = s[dh][dw]
  print(ans if ans != "." else -1)

if __name__ == "__main__":
    main()

Verdicts: Runtime Error

Accepted
Problem: A maze is composed of a grid of H \times W squares - H vertical, W horizontal.  The square at the i-th row from the top and the j-th column from the left - (i,j) \- is a wall if S_{ij} is `#` and a road if S_{ij} is `.`.  There is a magician in (C_h,C_w). He can do the following two kinds of moves:    * Move A: Walk to a road square that is vertically or horizontally adjacent to the square he is currently in.   * Move B: Use magic to warp himself to a road square in the 5\times 5 area centered at the square he is currently in.  In either case, he cannot go out of the maze.  At least how many times does he need to use the magic to reach (D_h, D_w)?

Submission attempts (in order):
from collections import deque


H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x) - 1, input().split())
Dh, Dw = map(lambda x: int(x) - 1, input().split())
maze = [input() for _ in range(H)]

INF = 10 ** 12
path = [[INF] * W for _ in range(H)]  


walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

q = deque()
path[Ch][Cw] = 0
q.append((Ch, Cw, 0))

while q:
    x, y, s = q.popleft()
    for dx, dy in walk:  
        nx = x + dx
        ny = y + dy
        if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s:
            path[nx][ny] = s
            q.appendleft((nx, ny, s))  の場合はコスト0. キューの先頭に追加する.
    for dx, dy in warp:  
        nx = x + dx
        ny = y + dy
        if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s + 1:
            path[nx][ny] = s + 1
            q.append((nx, ny, s + 1))  の場合はコスト1. キューの最後尾に追加する.
    
ans = path[Dh][Dw] if path[Dh][Dw] < INF else '-1'
print(ans)

from collections import deque

def main():
    h, w = map(int, input().split())
    c = list(map(lambda x: int(x)+1, input().split()))
    d = list(map(lambda x: int(x)+1, input().split()))
    s = ['#'*(w+4)]*2 + ['#'*2 + input() + '#'*2 for _ in range(h)] + ['#'*(w+4)]*2

    ans = [[-1]*(w+4) for _ in range(h+4)]
    for i in range(h+4):
        for j in range(w+4):
            if s[i][j] == '#':
                ans[i][j] = -2
    ans[c[0]][c[1]] = 0

    move1 = [(0, 1), (0, -1), (1, 0), (-1, 0)]
    move2 = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if abs(i)+abs(j) > 1]

    yet = deque([(c[0], c[1])])
    done = deque()

    while yet:
        y, x = yet.popleft()
        done.append((y, x))
        for dy, dx in move1:
            ydy, xdx = y+dy, x+dx
            if ans[ydy][xdx] == -1:
                yet.append((ydy, xdx))
                ans[ydy][xdx] = ans[y][x]

        if len(yet) == 0:
            while done:
                y, x = done.popleft()
                for dy, dx in move2:
                    ydy, xdx = y+dy, x+dx
                    if ans[ydy][xdx] == -1:
                        ans[ydy][xdx] = ans[y][x] + 1
                        yet.append((ydy, xdx))

    print(ans[d[0]][d[1]])

if __name__ == '__main__':
    main()


Verdicts: Time Limit Exceeded

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
a=list(input())
cnt=0
for i in a:
  if i=="R":
    cnt+=1
  else:
    cnt=0
print(cnt)

a=list(input())
cnt=0
ans=0
for i in a:
  if i=="R":
    cnt+=1
  else:
    ans=max(cnt,ans)
    cnt=0
print(cnt)

a=list(input())
cnt=0
ans=0
for i in a:
  if i=="R":
    cnt+=1
  else:
    ans=max(cnt,ans)
    cnt=0
ans=max(cnt,ans)
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S = input()

ans = 0
tmp = 0
for i in range(3):
    if S[i] == "R":
        tmp += 1
        ans = max(ans, tmp)
    else:
        ans = max(ans, tmp)
        ans = 0

print(ans)


S = input()

ans = 0
for i in range(3):
    if S[i] == "R":
        ans += 1
    else:
        ans = 0

print(ans)


S = input()

ans = 0
_tmp = 0
for i in range(3):
    if S[i] == "R":
        _tmp += 1
        ans = max(ans, _tmp)
    else:
        ans = max(ans, _tmp)
        _tmp = 0

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
s = str(input())
s = list(s)

cnt = 0

for i in range(3):
    if(s[i] == "S"):
        cnt += 1

if(s[0] == "S" and s[1] == "R" and s[2] == "S"):
    cnt = 1


print(cnt)

s = str(input())
s = list(s)

cnt = 0

for i in range(3):
    if(s[i] == "R"):
        cnt += 1

if(s[0] == "R" and s[1] == "S" and s[2] == "R"):
    cnt = 1


print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
ans = 0

if (a==s,b==s,c==s):
    print(ans)

elif (a==r,b==s,c==s):
    ans = 1 + ans
    print(ans)

elif (a==r,b==r,c==s):
    ans = 2 + ans
    print(ans)

else:
    ans = 1 + ans
    print(ans)

S = input()

a=RSS
b=RRS
c=RRR
d=SSS

if a in S:
   print(1)

elif b in S:
    print(2)
    
elif c = S:
    print(3)
    
elif d = S:
    print(0)

else:
    print(1)

S = input()

a = "RRR"
b = "RR"
c = "R"
    
if a == S:
    print(3)
    
elif b in S:
    print(2)

elif c in S:
    print(1)
    
else:
    print(0)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
s = input()
count = 0
for i in range(3):
  if s[i] == 'R':
    count++
if count <= 1 || count == 3:
  print(count)
elif s[1] != 'S':
  print(count-1)
else:
  print(count)
  

s = input()
count = 0
for i in range(3):
  if s[i] == 'R':
    count+=1
if count <= 1 or count == 3:
  print(count)
elif s[1] != 'R':
  print(count-1)
else:
  print(count)
  

Verdicts: Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
s=input()
count=0
flag=True
if s[0]=='R' and s[1]=='R' and s[2]=='R':
    print(3)
elif (s[0]=='R' and s[1]=='R') or (s[0]=='R' and s[2]=='R') 
or(s[1]=='R' and s[2]=='R'):
    print(2)
elif s[0]=='R' or s[1]=='R' or s[2]=='R':
    print(1)
else:
    print(0)

s=input()
count=0
flag=True
for char in s:
    if char=='R' and flag:
        count+=1
        flag=False
print(count)

s=input()
count=0
sa=0
for char in s:
    if char=='R':
        sa+=1
    else:
        sa=0
    count=max(sa,count)
print(count)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
a=input()
if a=="SSS":
  print(0)
elif a="RRR":
  print(3)
elif a="RRS" or a="SRR":
  print(2)
else:
  print(1)


a=input()
if a==SSS:
  print(0)
elif a=RRR:
  print(3)
elif a=RRS or a=SRR:
  print(2)
else:
  print(1)

a=input()
if a=="SSS":
  print(0)
elif a=="RRR":
  print(3)
elif a=="RRS" or a=="SRR":
  print(2)
else:
  print(1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S = list(input().rstrip())
num = 0
for c in S:
	if c == 'R':
		num += 1
	else:
		num = 0

print(num)



S = input().rstrip()
num = 0
mnum = 0
for c in S:
    if c == 'R':
        num += 1
    else:
        num = 0

    if mnum < num:
        mnum = num

print(mnum)


Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

s = input()
cnt = 0
ans = 0
for i in s:
    if i=='R':
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 0
print(cnt)

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

s = input()
cnt = 0
ans = 0
for i in s:
    if i=='R':
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 0
print(max(ans,cnt))

Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
s = input()
ans = 0
if s == 'SSS':
    print(3)
elif s == 'SSR' or s == 'RSS':
    print(2)
elif s == 'SRR' or s == 'RSR' or s == 'RRS' or s == 'SRS':
    print(1)
else:
    print(0)

s = input()
ans = 0
if s == 'SSS':
    print(3)
elif s == 'SSR' or s == 'RSS':
    print(2)
elif s == 'SRR' or s == 'RSR' s == 'RRS' or s == 'SRS':
    print(1)
else:
    print(0)

s = input()
ans = 0
if s == 'SSS':
    print(0)
elif s == 'SSR' or s == 'RSS' or s == 'SRS' or s == 'RSR':
    print(1)
elif s == 'SRR' or s == 'RRS':
    print(2)
else:
    print(3)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
a = input()
list1 = a.split("S")
print(list)
if len(list1) == 1:
  print(3)
elif len(list1) == 2:
  if a == "RSR":
    print(1)
  else:
    print(2)
elif len(list1) == 3:
  print(1)
else:
  print(0)

a = input()
list1 = a.split("S")

if len(list1) == 1:
  print(3)
elif len(list1) == 2:
  if a == "RSR":
    print(1)
  else:
    print(2)
elif len(list1) == 3:
  print(1)
else:
  print(0)

Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
s = input()
s.replace('R', '').replace('RR', '').replace('RRR', '')
print(3-len(s))

s = input()
ans = 0
for i in range(1, 4):
  if 'R'*i in s:
    ans = len('R'*i)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S = input()
s = list(S)

count = 0

for i in range(len(s)):
    if s[i] == 'R':
        count = 1
        try:
            if s[i+1] == 'R':
                count += 1
        
        except IndexError:
            break

print(count)


S = input()
s = list(S)

count = 0
l = [0]

for i in range(len(s)):
    if s[i] == 'R':
        l.append(1)
        try:
            if s[i+1] == 'R':
                count += 1
                l.append(count+1)
            else:
                l.append(count)
                count = 0
        
        except IndexError:
            break

print(max(l))


Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S = input()
result = 0
for i in range(3):
    if S[i] == 'R':
        result = result + 1
    else:
        result = 0

print(result)


S = input()
Scnt = S.count('S')
result = 0
result2 = 0

for i in range(3):
    if S[i] == 'R':
        result = result + 1
    else:
        if result2 < result:
            result2 = result
        result = 0
 
if result > result2:
    print(result)
else:
    print(result2)


Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
res, prev, count = 0, '', 0
for s in S:
  if s == 'R':
    count += 1
  else:
    res = max(res, count)
    count = 0
res = max(res, count)
return res

S = input()
res, prev, count = 0, '', 0
for s in S:
  if s == 'R':
    count += 1
  else:
    res = max(res, count)
    count = 0
print(max(res, count))

Verdicts: Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S=input()
ans=0
tmp=0
for s in S:
  if s=='S':
    tmp+=1
  else:
    ans=max(ans,tmp)
    tmp=0
print(max(ans,tmp))

S=input()
ans=0
tmp=0
for s in S:
  if s='S':
    tmp+=1
  else:
    ans=max(ans,tmp)
    tmp=0
print(max(ans,tmp))

S=input()
ans=0
tmp=0
for s in S:
  if s=='R':
    tmp+=1
  else:
    ans=max(ans,tmp)
    tmp=0
print(max(ans,tmp))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
X,K,D=list(map(int,input().split()))

def sgn(x):
    if x>0:
        return 1
    elif x<0:
        return -1
    return 0

def solve():
    if X>0:
        x_greedy=X-K*D
    else:
        x_greedy=X+K*D

    if sgn(X)==sgn(x_greedy):
        return print(x_greedy)

    else:
        x_r=X%D
        x_l=x_r-D

        r_parity=(abs(X-x_r)//D)%2
        if K%2==r_parity:
            return print(abs(x_r))
        else:
            return print(abs(x_l))

if __name__=='__main__':
    solve()

X,K,D=list(map(int,input().split()))

def sgn(x):
    if x>0:
        return 1
    elif x<0:
        return -1
    return 0

def solve():
    if X>0:
        x_greedy=X-K*D
    elif X<0:
        x_greedy=X+K*D

    if sgn(X)==sgn(x_greedy):
        return print(abs(x_greedy))

    else:
        x_r=X%D
        x_l=x_r-D

        r_parity=(abs(X-x_r)//D)%2
        if K%2==r_parity:
            return print(abs(x_r))
        else:
            return print(abs(x_l))

if __name__=='__main__':
    solve()

S=input()
set_S=set(S)
if len(set_S)==1:
    ret=S.count('R')
else:
    if S[0]==S[1]=='R' or S[1]==S[2]=='R':
        ret=2
    else:
        ret=1
print(ret)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S = input[0]
cnt = 0
for i in range(3):
  if S[i] == 'R':
    
    # 
    if i == 0 or S[i - 1] == 'R':
	  cnt += 1
    else:
      cnt = 1
print(cnt)

S = input()
cnt = 0
for i in range(3):
    if S[i] == 'R':
        
        if i == 0 or S[i - 1] == 'R':
            cnt += 1
        else:
            cnt = 1
print(cnt)


Verdicts: Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S = input()
count = 0
if S == 'RSR':
  print(1)
else:
  for i in S:
    if i == 'R':
      cout+=1
  print(count)

S = input()
count = 0
if S == 'RSR':
  print(1)
else:
  for i in S:
    if i == 'R':
      count+=1
  print(count)

Verdicts: Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
s=input()
i=0
c=0
if s[i]=='R':
  c=1
  if s[i+1]=='R':
    c=2
    if s[i+2]=='R':
      c=3
if s[i]=='S':
  c=0
  if s[i+1]=='R':
    c=1
   	if s[i+2]=='R':
      c=2
print(c)
      

s=input()
if 'RRR' in s:
  c=3
elif 'RR' in s:
  c=2
elif 'R' in s:
  c=1
else:
  c=0
print(c)

Verdicts: Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
from collections import Counter

n = int(input())
l = list(map(int, input().split()))

l_counter = Counter(l)
l_set = sorted(list(l_counter.keys()))

length = len(l_set)
ans = 0
if n < 3:
    print(0)
else:
    for i in range(length - 2):
        for j in range(i + 1, length - 1):
            for k in range(j + 1, length):
                if l_set[k] < l_set[i] + l_set[j]:
                    ans += l_counter[l_set[i]] * l_counter[l_set[j]] * l_counter[l_set[k]]

    print(ans)


s = input()
if s.count('R') == 0:
    print(0)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 2:
    if s[1] == 'R':
        print(2)
    else:
        print(1)
else:
    print(3)        


Verdicts: Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
s = input()
def solve(s):
  if not s:
    return 0
  d = 0
  res = 0
  for i in s:
    if i == 'R':
      d += 1
    else:
      res = max(res, d)
      d = 0
  return res
solve(s)

s = input()
def solve(s):
    c = s.count('R')
    if c in [0, 1, 3]:
        return c
    elif s.count('RR') == 1:
        return 2
    else:
        return 1
print(solve(s))


Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S = input('>>>')
num = 0
num_rev = [0,0,0]
for i in range(3):
    if S[i] == 'R':
        num += 1
    elif S[i] == 'S':
        num_rev[i] = num
        num = 0
        

print(max(num,num_rev[0],num_rev[1],num_rev[2]))

S = input('>>>')
num = 0
num_rev = 0
for i in range(3):
    if S[i] == 'R':
        num += 1
    elif S[i] == 'S':
        num_rev = num
        num = 0
        

print(max(num,num_rev))

S = input('')
num = 0
num_rev = [0,0,0]
for i in range(3):
    if S[i] == 'R':
        num += 1
    elif S[i] == 'S':
        num_rev[i] = num
        num = 0
        

print(max(num,num_rev[0],num_rev[1],num_rev[2]))


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
z=[]
a=input()
for i in a:
    z.append(i)
print(z)
z.count('R')

z=[]
a=input()
for i in a:
    z.append(i)

if (z[0]=='R') and (z[1]=='R') and (z[2]=='S'):
        print(2)
elif (z[1]=='R') and (z[2]=='R') and (z[0]=='S'):
        print(2)
elif (z[0]=='S') and (z[1]=='S') and (z[2]=='S'):
        print(0)
elif (z[0]=='R') and (z[1]=='R') and (z[2]=='R'):
        print(3)
else: 
    print(1)

Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
S = input()
c = 0
m = 0
if s in S:
  if s == "R":
    c+=1
    m = max(c, m)
  else:
    m = max(c, m)
    c = 0
print(m)
    
    

S = input()
c = 0
m = 0
for s in S:
    m = max(c, m)
    if s == "R":
        c += 1
        m = max(c, m)
    else:
        c = 0
print(m)

Verdicts: Runtime Error

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
def RainySeason():
    
    str1 = str(input())

    print(str1[:2], str1[1:])

    if str1 == 'RRR':
        print(3)
        
    elif str1 == 'SSS':
        print(0)
        
    elif str1[:2] == 'RR' or str1[1:] == 'RR':
        print(2)
    
    else:
        print(1)

if __name__ == '__main__':
    RainySeason()



def RainySeason():
    
    str1 = str(input())

    if str1 == 'RRR':
        print(3)
        
    elif str1 == 'SSS':
        print(0)
        
    elif str1[:2] == 'RR' or str1[1:] == 'RR':
        print(2)
    
    else:
        print(1)

if __name__ == '__main__':
    RainySeason()



Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
weather = input()
raincount=0
for  i in range(3):
    if weather[i]=="R":
           raincount=raincount+1
    else:
           raincount=0

print(raincount)

weather = input()
raincount=0
cont=0
for  i in range(3):
    if weather[i]=="R" and cont==0:
           raincount=raincount+1
    elif weather[i]=="R" and cont==1:
           raincount=1
           cont=0
    elif weather[i] == "S":
        cont=1

print(raincount)

Verdicts: Wrong Answer

Accepted
Problem: We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day.  Find the maximum number of consecutive rainy days in this period.

Submission attempts (in order):
n,k=map(int,input().split(" "))
P=list(map(int,input().split(" ")))
C=list(map(int,input().split(" ")))
count=[]
def f (i):
    q=deepcopy(i)
    count1=[]
    count2=0
    for j in range(k):
        count2+=C[i]
        count1.append(count2)
        if i==q and count1<0:
            break
        i=P[i]-1
    return max(count1)
for i in range(n):
    count.append(f(i))
print(max(count))

S=input()
if S=="RSR":
    print(1)
else:
    
    print(len(S.replace("S","")))

Verdicts: Runtime Error

Accepted