problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02577
u909224749
2,000
1,048,576
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.
["N = str(input())\n\na = []\nfor n in range(N):\n a.append(int(N[n]))\n \nif sum(a) % 9 == 0:\n print('Yes')\nelse:\n print('No')", "N = str(input())\n \na = []\nfor n in range(len(N)):\n a.append(int(N[n]))\n \nif sum(a) % 9 == 0:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s399629968', 's283624786']
[9152.0, 10684.0]
[25.0, 78.0]
[123, 129]
p02577
u913565745
2,000
1,048,576
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.
["from sys import stdin\n\n\ntest = list(stdin.readline().lstrip().rstrip())\n\ntotal=0\n\nfor i in test:\n total += total + int(i)\n\n\nif total%9 == 0:\n print('Yes')\nelse:\n print('No')\n", "from sys import stdin\n\n\n\ntest = list(stdin.readline().rstrip())\n \nresult=0\n \nfor i in test:\n result = result + int(i)\n \nif (result % 9) == 0:\n print('Yes')\nelse:\n print('No')\n"]
['Wrong Answer', 'Accepted']
['s234046194', 's046594989']
[10308.0, 10508.0]
[945.0, 69.0]
[183, 178]
p02577
u914883924
2,000
1,048,576
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.
["N=int(input())\nif N//9==0:\n print('Yes')\nelse:\n print('No')", "N=int(input())\nif N%9==0:\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s117371580', 's078080692']
[9168.0, 9292.0]
[215.0, 218.0]
[61, 60]
p02577
u917678406
2,000
1,048,576
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.
['def digitSum(n):\n s = str(n)\n array = list(map(int, s))\n return sum(array)\n\nN = int(input())\nif digitSum(N) // 9 == 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nif N // 9 == 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nif N % 9 == 0:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s970874505', 's973135387', 's427864318']
[11188.0, 9232.0, 9300.0]
[705.0, 206.0, 205.0]
[166, 71, 70]
p02577
u917972976
2,000
1,048,576
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.
['a = int(input())\nprint "Yes" if a % 9 == 0 else "No"', 'a=int(input())\nprint("Yes"if a%9==0else"No")']
['Runtime Error', 'Accepted']
['s076491763', 's606808029']
[8904.0, 9188.0]
[27.0, 209.0]
[52, 44]
p02577
u920391637
2,000
1,048,576
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.
["N = input()\n\nans = sum(map(int, N))\n\nif ans % 9 == 0:\n print('YES')\nelse:\n print('NO')\n", 'N = input()\n \nans = sum(map(int, N))\n \nif ans % 9 == 0:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s788955125', 's402192209']
[9184.0, 9240.0]
[45.0, 48.0]
[89, 94]
p02577
u924241064
2,000
1,048,576
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.
["N = str(input())\nlists = [int(x) for x in N]\n\nif a % 9 == 0:\n print('Yes')\nelse:\n print('No')", "N = str(input())\nlists = [int(x) for x in N]\na = sum(lists)\n\nif a % 9 == 0:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s839604983', 's248249521']
[10916.0, 10832.0]
[58.0, 61.0]
[107, 123]
p02577
u927506431
2,000
1,048,576
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.
['N = line(input().rstrip())\nsum = 0\n\nfor i in range(len(N)):\n sum += int(N[i])\n \nif sum % 9 == 0:\n print("Yes")\nelse:\n print("No")', 'N = list(input().rstrip())\nsum = 0\n \nfor i in range(len(N)):\n sum += int(N[i])\n \nif sum % 9 == 0:\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s045632717', 's198106706']
[9008.0, 10524.0]
[31.0, 84.0]
[132, 133]
p02577
u940652437
2,000
1,048,576
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.
['N=int(input())\nc = 0\nif(N % 2 == 1):\n if( N % 9 == 0 ):\n num_list = list(str(N))\n s = len(num_list)\n for i in range(s):\n a = num_list[i]\n c += int(a) \n if(c % 9 == 0):\n print("Yes")\n else:\n print("No")\n \n else:\n print("No")\nif (N == 0):\n print("Yes")\nelse:\n print("No")', 'N=int(input())\nc = 0\nif (N == 0):\n print("Yes")\nelse:\n num_list = list(str(N))\n s = len(num_list)\n for i in range(s):\n a = num_list[i]\n c += int(a) \n if(c % 9 == 0):\n print("Yes")\n else:\n print("No")\n\n']
['Wrong Answer', 'Accepted']
['s695166464', 's018688816']
[10732.0, 10872.0]
[782.0, 741.0]
[370, 247]
p02577
u942280986
2,000
1,048,576
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.
["N=list(input())\nN_2=list(map(int,N))\nprint(N_2)\n\nprint('YNeos'[sum(N_2)%9!=0::2])", "N=list(input())\nN_2=list(map(int,N))\nprint('YNeos'[sum(N_2)%9!=0::2])"]
['Wrong Answer', 'Accepted']
['s361452702', 's733047361']
[13268.0, 11980.0]
[62.0, 57.0]
[81, 69]
p02577
u945199633
2,000
1,048,576
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.
["N = list(input())\n\nsum_N = 0\nfor i in range(len(N)):\n sum_N += int(N[i])\n\nif sum_N%9 == 0:\n print('yes')\nelse:\n print('no')", "N = list(input())\n\nsum_N = 0\nfor i in range(len(N)):\n sum_N += int(N[i])\n\nif sum_N%9 == 0:\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s047180045', 's018339153']
[10492.0, 10560.0]
[83.0, 79.0]
[132, 132]
p02577
u945342410
2,000
1,048,576
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.
['strList = list(input())\nintList = [int(s) for s in strList]\nif sum(intList)%9 == 0:\n print(Yes)\nelse:\n print(No)', 'strList = input()\nintList = [int(s) for s in strList]\nif sum(intList)%9 == 0:\n print(Yes)\nelse:\n print(No)\n', 'strList = input()\nintList = [int(s) for s in strList]\nsum = sum(intList)\nif sum%9 == 0:\n print(Yes)\nelse:\n print(No)', 'strList = list(input())\nintList = [int(s) for s in strList]\nif sum(intList)%9 == 0:\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s097779338', 's188252454', 's816059929', 's493335289']
[12284.0, 10836.0, 10884.0, 12036.0]
[61.0, 55.0, 52.0, 59.0]
[114, 109, 118, 118]
p02577
u952968889
2,000
1,048,576
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.
["n = list(map(int, input()))\nif stm(n)%9==0:\n print('Yes')\nelse:\n print('No')", 'n = list(map(int, input()))\nif stm(n)%9==0:\n print("Yes")\nelse:\n print("No")\n', "n = list(map(int, input()))\nif sum(n)%9==0:\n print('Yes')\nelse:\n print('No')\n"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s606939434', 's710672991', 's560700053']
[10716.0, 10528.0, 10476.0]
[49.0, 45.0, 53.0]
[78, 79, 79]
p02577
u955653863
2,000
1,048,576
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.
['N = int(input())\n\ndef if_test(N):\n if N&9 == 0:\n \tprint("Yes")\n else:\n print("No")', 'N = int(input())\n\ndef if_test(N):\n if N&9 == 0:\n \tprint(Yes)\n else:\n print(No)', 's = int(input())\n\nif s % 9 == 0:\n \tprint("Yes")\nelse:\n \tprint("No")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s041401978', 's812565865', 's290122601']
[9072.0, 9100.0, 9296.0]
[218.0, 217.0, 220.0]
[88, 84, 67]
p02577
u956318161
2,000
1,048,576
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.
['N=int(input())\nLs = list(map(int,input().split()))\nscore=0\nfor i in range(0,N-2):\n a = Ls[i]\n for j in range(i+1, N-1):\n b = Ls[j]\n for k in range(j+1, N):\n c = Ls[k]\n if ((a+b>c)&(a+c>b)&(b+c>a)&(a!=b)&(a!=c)&(b!=c)):\n score+=1\n L_list=[i,j,k]\n print(L_list)\nprint(score)', 'n = input()\npoint=0\nfor i in range(len(n)):\n point+=int(n[i])\n \nif point%9==0:\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s154856593', 's923710875']
[9296.0, 9216.0]
[201.0, 72.0]
[325, 115]
p02577
u957149382
2,000
1,048,576
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.
['n=input()\n\n\nn=str(n)\nSum=0\nfor i in range(len(n)):\n Sum=Sum+int(n[i])\n\nif Sum%9==0:\n print("yes")\nelse:\n print("no")\n \n\n ', 'n=input()\n\n\nn=str(n)\nSum=0\nfor i in range(len(n)):\n Sum=Sum+n[i]-"0"\n\nif Sum%9==0:\n print("yes")\nelse:\n print("no")\n \n\n ', 'n=input()\n\n\nn=str(n)\nSum=0\nfor i in range(len(n)):\n Sum=Sum+int(n[i])\n\nif Sum%9==0:\n print("Yes")\nelse:\n print("No")\n \n\n ']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s415694870', 's734585332', 's105408561']
[9280.0, 9244.0, 9140.0]
[74.0, 29.0, 79.0]
[140, 139, 140]
p02577
u959682820
2,000
1,048,576
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.
['if int(input()) % 9 == 0 : print("Yes")\nelse print("No")', 'if int(input()) % 9 == 0 : print("Yes")\nelse : print("No")\n']
['Runtime Error', 'Accepted']
['s192939824', 's398847743']
[8864.0, 9128.0]
[23.0, 205.0]
[56, 59]
p02577
u964182912
2,000
1,048,576
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.
['N=int(input())\n\nif(N%9==) print("Yes")\nelse print("No")', 'N=int(input())\n\nif N%9==0:\n print("Yes")\n\nelse:\n print("No")\n ']
['Runtime Error', 'Accepted']
['s768100339', 's692724098']
[8856.0, 9204.0]
[28.0, 213.0]
[55, 65]
p02577
u965397031
2,000
1,048,576
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.
['l = list(map(int, input()))\nsum = 0\nfor i in range(len(l)):\n sum += l[i]\n\nprint(sum)', "l = list(map(int, input()))\nsum = 0\nfor i in range(len(l)):\n sum += l[i]\n\nprint('Yes' if sum % 9 == 0 else 'No')"]
['Wrong Answer', 'Accepted']
['s778301589', 's934968826']
[10536.0, 10568.0]
[70.0, 70.0]
[87, 115]
p02577
u969081133
2,000
1,048,576
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.
["n=int()\narray=list(map(int,n))\na=sum(array)\nif a%9==0:\n print('Yes')\nelse:\n print('No')", "n=input()\narray=list(map(int,n))\na=sum(array)\nif a%9==0:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s566153882', 's218732682']
[8944.0, 10756.0]
[26.0, 53.0]
[89, 91]
p02577
u970267139
2,000
1,048,576
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.
["n = int(input())\nn = pow(10, 200000)-1\n\ntotal = 0\nn = str(n)\nfor i in range(len(n)):\n total += int(n[i])\n\nif total % 9 == 0:\n print('Yes')\nelse:\n print('No')\n", "n = int(input())\n\ntotal = 0\nn = str(n)\nfor i in range(len(n)):\n total += int(n[i])\n\nif total % 9 == 0:\n print('Yes')\nelse:\n print('No')\n"]
['Wrong Answer', 'Accepted']
['s787801959', 's685607235']
[9236.0, 9212.0]
[785.0, 775.0]
[167, 145]
p02577
u970490119
2,000
1,048,576
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.
['from math import ceil\nn, x, t = map(int, input().split())\nprint(t*ceil(n/x))', "n = str(input())\nlst = [int(i) for i in n]\nif sum(lst) % 9 ==0:\n print('Yes')\nelse:\n print('No')\n "]
['Runtime Error', 'Accepted']
['s527389830', 's383585373']
[9156.0, 10756.0]
[211.0, 61.0]
[76, 107]
p02577
u971811058
2,000
1,048,576
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.
['#include<bits/stdc++.h>\n// Begin Header {{{\nusing namespace std;\nusing ll = long long;\nusing P = pair<ll, ll>;\nusing Graph = vector<vector<ll>>;\n#define rep(i,n) for(ll i=0; i<n; i++)\n#define loop(i, j, n) for(ll i=j; i<n; i++)\n#define all(x) (x).begin(), (x).end()\nconstexpr int INF = 0x3f3f3f3f;\nconst long long mod=1e9+7;\nconst long double PI = acos(-1);\n// }}} End Header\nint main() {\n\tll sum=0;\n\tstring n;\n\tcin >> n;\n\trep(i, n.length()){\n\t\tsum+=n[i]-\'0\';\n\t}\n\tif(sum%9 == 0) puts("Yes");\n\telse puts("No");\n\treturn 0;\n}\n', 'n = int(input())\nif n%9 == 0: print("Yes")\nelse: print("No")']
['Runtime Error', 'Accepted']
['s530476761', 's959726132']
[9000.0, 9324.0]
[27.0, 203.0]
[524, 60]
p02577
u972991614
2,000
1,048,576
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.
["n = input()\nlist_n = list(n)\nlist_n = [int(s) for s in list_n]\nsum_list = 0\nfor i in list_n:\n sum_list += list_n[i]\nif sum_list%9 ==0:\n print('Yes')\nelse:\n print('No')", "n = input()\nlist_n = list(n)\nlist_n = [int(s) for s in list_n]\nsum_list = 0\nfor i in range(len(list_n)):\n sum_list += list_n[i]\nif sum_list%9 ==0:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s207466752', 's300649045']
[12344.0, 12508.0]
[80.0, 80.0]
[176, 188]
p02577
u974190618
2,000
1,048,576
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.
['N = str(input())\nans = 0\nfor i in N:\n ans += int(i)\nif ans%9 == 0:\n print("yes")\nelse:\n print("no")', 'N = str(input())\nans = 0\nfor i in N:\n ans += int(i)\nif ans%9 == 0:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s915960828', 's564783482']
[9132.0, 9204.0]
[66.0, 68.0]
[102, 102]
p02577
u975771310
2,000
1,048,576
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.
['N = int(input())\n\ntemp = 0\nfor x in str(N):\n temp += int(x)\n\nif temp%9==0:\n ans = "yes"\nelse:\n ans = "No"\n\nprint(ans)', 'N = int(input())\n\ntemp = 0\nfor x in str(N):\n temp += int(x)\n\nif temp%9==0:\n ans = "Yes"\nelse:\n ans = "No"\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s607056717', 's019591738']
[9288.0, 9228.0]
[723.0, 771.0]
[126, 126]
p02577
u991604406
2,000
1,048,576
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.
["n = int(input())\nsum1 = 0\nfor i in range(len(str(n))):\n sum1 += int(str(n)[i])\n print(int(str(n)[i]))\nif sum1 % 9 == 0:\n print('Yes')\nelse:\n print('No')", "n = int(input())\ns = str(n)\narray = list(map(int, s))\nif sum(array) % 9 == 0:\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s274400920', 's944639289']
[9336.0, 11180.0]
[2205.0, 748.0]
[164, 116]
p02577
u999799597
2,000
1,048,576
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.
['n = input()\ntotal = 0\nfor i in range(len(n)):\n total += int(n[i])\nprint(total % 9 == 0)', 'n = input()\ntotal = 0\nfor i in range(len(n)):\n total += int(n[i])\nans = "Yes" if total % 9 == 0 else "No"\nprint(ans)']
['Wrong Answer', 'Accepted']
['s319345947', 's260196996']
[9232.0, 9216.0]
[74.0, 75.0]
[90, 119]
p02579
u243312682
2,000
1,048,576
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)?
["from collections import deque\n\ndef main():\n h, w = map(int, input().split())\n ch, cw = map(int, input().split())\n ch -= 1\n cw -= 1\n dh, dw = map(int, input().split())\n dh -= 1\n dw -= 1\n maze = [input() for i in range(h)]\n visited = [[-1]*w for j in range(h)]\n \n def maze_solver(maze, visited, sy, sx, gy, gx):\n mv = [[1, 0], [-1, 0], [0, 1], [0, -1]]\n q = deque([[sy, sx]])\n visited[sy][sx] = 0 \n _yx = list()\n _yx.append([sy, sx])\n while q:\n y, x = q.popleft()\n if y == gy and x == gx:\n ans = visited[y][x]\n return ans, visited, _yx\n for i, j in mv:\n if (0 <= y + i < h) and (0 <= x + j < w): \n ny = y+i\n nx = x+j\n if visited[ny][nx] != -1:\n continue\n if maze[ny][nx] == '.':\n visited[ny][nx] = visited[y][x] + 1 \n q.append([ny, nx])\n _yx.append([ny, nx])\n else:\n continue\n _yx = list(map(list, set(map(tuple, _yx))))\n return -1, visited, _yx\n\n def telepo(visited, _yx, h, w):\n n_yx = list()\n for y, x in _yx:\n for ny in range(-2, 3):\n for nx in range(-2, 3):\n if 0 < y+ny < h and \\\n 0 < x+nx < w and \\\n visited[y+ny][x+nx] == -1 and \\\n maze[y+ny][x+nx] != '#': \n n_yx.append([y+ny, x+nx])\n n_yx_s = list(map(list, set(map(tuple, n_yx))))\n return n_yx_s\n \n telepo_cnt = 0\n ans, visited, _yx = maze_solver(maze, visited, ch, cw, dh, dw)\n if ans != -1:\n print(telepo_cnt)\n exit()\n else:\n n_yx_s = telepo(visited, _yx, h, w)\n while len(n_yx_s) > 0:\n telepo_cnt += 1\n for ny, nx in n_yx_s:\n ans, visted = maze_solver(maze, visited, ny, nx, dh, dw)\n if ans != -1:\n print(telepo_cnt)\n exit()\n print(-1)\n \nif __name__ == '__main__':\n main()", "def main():\n from collections import deque\n import sys\n input = sys.stdin.readline\n h, w = map(int, input().split())\n ch, cw = map(int, input().split())\n dh, dw = map(int, input().split())\n \n \n \n maze = ['#' * (w+4)]\n maze.append('#' * (w+4))\n for _ in range(h):\n maze.append('##' + input()[:-1] + '##')\n maze.append('#' * (w+4))\n maze.append('#' * (w+4))\n visited = [[-1] * (w+4) for _ in range(h+4)]\n for i in range(h+4):\n for j in range(w+4):\n if maze[i][j] == '#':\n visited[i][j] = -2\n \n ch += 1\n cw += 1\n dh += 1\n dw += 1\n visited[ch][cw] = 0\n walk = [[1, 0], [-1, 0], [0, 1], [0, -1]]\n telepo = [[i,j] for i in range(-2, 3) for j in range(-2, 3)]\n\n q_walk = deque([[ch, cw]])\n q_telepo = deque([])\n while q_walk:\n yw, xw = q_walk.popleft()\n \n q_telepo.append([yw, xw])\n for i, j in walk:\n ny, nx = yw + i, xw + j\n # if ny < 0 or h <= ny or nx < 0 or w <= nx:\n # continue\n if visited[ny][nx] == -1:\n \n visited[ny][nx] = visited[yw][xw]\n q_walk.append([ny, nx])\n \n if len(q_walk) == 0:\n while q_telepo:\n yt, xt = q_telepo.popleft()\n for i, j in telepo:\n my, mx = yt + i, xt + j\n # if my < 0 or h <= my or mx < 0 or w <= mx:\n # continue\n \n \n if visited[my][mx] == -1:\n visited[my][mx] = visited[yt][xt] + 1\n q_walk.append([my, mx])\n print(visited[dh][dw])\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Accepted']
['s036334586', 's875913032']
[18144.0, 23548.0]
[41.0, 1903.0]
[2234, 2192]
p02579
u312814337
2,000
1,048,576
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)?
['from collections import deque\n\nh, w = map(int, input().split())\nch, cw = map(int, input().split())\ndh, dw = map(int, input().split())\nbase = ["#" *(w+4)]\nbase.append("#" * (w+4))\nfor n in range(h):\n base.append("##" + input() + "##")\nbase.append("#" * (w+4))\nbase.append("#" * (w+4))\nans = [[-1] * (w+4) for _ in range(h+4)]\nfor j in range(w+4):\n for i in range(h+4):\n if base[i][j] == "#":\n ans[i][j] = -2\nch+=1; cw+=1\ndh+=1; dw+=1\nans[ch][cw] = 0\nmove = [[1, 0], [-1, 0], [0, 1], [0, -1]]\nmove2 = [\n [-2, -2], [-2, -1], [-2, 0], [-2, 1], [-2, 2], \\\n [-1, -2], [-1, -1], [-1, 0], [-1, 1], [-1, 2], \\\n [0, -2], [0, -1], [0, 0], [0, 1], [0, 2], \\\n [1, -2], [1, -1], [1, 0], [1, 1], [1, 2], \\\n [2, -2], [2, -1], [2, 0], [2, 1], [2, 2]]\nq = deque([ch, cw])\none_time = deque()\nwhile q:\n x, y = q.popleft()\n one_time.append([x, y])\n for i, j in move:\n v1, v2 = x+i, y+j\n if ans[v1][v2] == -1:\n ans[v1][v2] = ans[x][y]\n q.append([v1, v2])\n if len(q) == 0:\n while one_time:\n x2, y2 = one_time.popleft()\n for i, j in move2:\n v1, v2 = x2+i, y2+j\n if ans[v1][v2] == -1:\n ans[v1][v2] = ans[x2][y2] + 1\n q.append([v1, v2])\nprint(ans[dh][dw])', 'from collections import deque\n\n\ndef main():\n h, w = map(int, input().split())\n ch, cw = map(int, input().split())\n dh, dw = map(int, input().split())\n base = ["#" *(w+4)]\n base.append("#" * (w+4))\n for n in range(h):\n base.append("##" + input() + "##")\n base.append("#" * (w+4))\n base.append("#" * (w+4))\n ans = [[-1] * (w+4) for _ in range(h+4)]\n for j in range(w+4):\n for i in range(h+4):\n if base[i][j] == "#":\n ans[i][j] = -2\n ch+=1; cw+=1\n dh+=1; dw+=1\n ans[ch][cw] = 0\n move = [[1, 0], [-1, 0], [0, 1], [0, -1]]\n move2 = [\n [-2, -2], [-2, -1], [-2, 0], [-2, 1], [-2, 2], \\\n [-1, -2], [-1, -1], [-1, 0], [-1, 1], [-1, 2], \\\n [0, -2], [0, -1], [0, 0], [0, 1], [0, 2], \\\n [1, -2], [1, -1], [1, 0], [1, 1], [1, 2], \\\n [2, -2], [2, -1], [2, 0], [2, 1], [2, 2]\n ]\n q = deque([[ch, cw]])\n one_time = deque([])\n while len(q) > 0:\n x, y = q.popleft()\n one_time.append([x, y])\n for i, j in move:\n v1, v2 = x+i, y+j\n if ans[v1][v2] == -1:\n ans[v1][v2] = ans[x][y]\n q.append([v1, v2])\n if len(q) == 0:\n while len(one_time) > 0:\n x2, y2 = one_time.popleft()\n for i, j in move2:\n v1, v2 = x2+i, y2+j\n if ans[v1][v2] == -1:\n ans[v1][v2] = ans[x2][y2] + 1\n q.append([v1, v2])\n print(ans[dh][dw])\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s878240931', 's634245920']
[18356.0, 23636.0]
[232.0, 1974.0]
[1313, 1568]
p02579
u414980766
2,000
1,048,576
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)?
["import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\nh,w=map(int,readline().split())\nch, cw=map(int,readline().split())\ndh, dw=map(int,readline().split())\nm=list(map(lambda x: list(x.decode()), readlines()))\n\n\nch-=1; cw-=1; dh-=1; dw-=1\n\nad = [(-1,0), (0,-1), (1,0), (0,1)]\nwarp = [(-2, -2),(-2, -1),(-2, 0),(-2, 1),(-2, 2),\n (-1, -2),(-1, -1),(-1, 1),(-1, 2),\n (0, -2),(0, 2),\n (1, -2),(1, -1),(1, 1),(1, 2),\n (2, -2),(2, -1),(2, 0),(2, 1),(2, 2)]\n\ndef bfs4():\n \n for i in range(h):\n m[i] = ['#']*2 + m[i] + ['#']*2\n \n m = [['#']*(w+4)]*2 + m + [['#']*(w+4)]*2\n ch+=2; cw+=2; dh+=2; dw+=2\n \n que1=[]\n que2=[] \n m[ch][cw]=str(0)\n que1.append((ch,cw))\n\n while que1!=[]:\n l1=len(que1)\n r1=0 \n\n \n while r1<l1:\n i, j=que1[r1]\n r1+=1\n \n for si, sj in ad:\n if m[i+si][j+sj]=='.': \n m[i+si][j+sj]=m[i][j]\n que1.append((i+si, j+sj))\n l1+=1\n\n \n for i,j in que1:\n for si, sj in warp:\n if m[i+si][j+sj]=='.':\n m[i+si][j+sj]=str(int(m[i][j])+1)\n que2.append((i+si, j+sj))\n\n que1=que2\n que2=[]\n###---------------------------------------\n\nbfs4()\n\n\nif m[dh][dw] == '.':\n print(-1)\nelse:\n print(m[dh][dw])", "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\nh,w=map(int,readline().split())\nch, cw=map(int,readline().split())\ndh, dw=map(int,readline().split())\nm=list(map(lambda x: list(x.decode()), readlines()))\n\n\nad = [(-1,0), (0,-1), (1,0), (0,1)]\nwarp = [(-2, -2),(-2, -1),(-2, 0),(-2, 1),(-2, 2),\n (-1, -2),(-1, -1),(-1, 1),(-1, 2),\n (0, -2),(0, 2),\n (1, -2),(1, -1),(1, 1),(1, 2),\n (2, -2),(2, -1),(2, 0),(2, 1),(2, 2)]\n\ndef bfs6():\n \n que1=[]\n que2=[] \n m[ch][cw]=str(0)\n que1.append((ch,cw))\n\n while que1!=[]:\n l1=len(que1)\n r1=0 \n\n \n while r1<l1:\n i, j=que1[r1]\n r1+=1\n for si, sj in ad:\n if m[i+si][j+sj]=='.': \n m[i+si][j+sj]=m[i][j]\n que1.append((i+si, j+sj))\n l1+=1\n\n \n for i,j in que1:\n if (m[i][j]==m[i-1][j] and m[i][j]==m[i+1][j]) or (m[i][j]==m[i][j-1] and m[i][j]==m[i][j+1]):\n continue\n for si, sj in warp:\n if m[i+si][j+sj]=='.':\n m[i+si][j+sj]=str(int(m[i][j])+1)\n que2.append((i+si, j+sj))\n\n que1=que2\n que2=[]\n###---------------------------------------\n\nfor i in range(h):\n m[i] = ['#']*2 + m[i] + ['#']*2\n \nm = [['#']*(w+4)]*2 + m + [['#']*(w+4)]*2\nch+=1; cw+=1; dh+=1; dw+=1\n\nbfs6()\n\nif m[dh][dw] == '.':\n print(-1)\nelse:\n print(m[dh][dw])"]
['Runtime Error', 'Accepted']
['s306276297', 's727803676']
[18196.0, 29044.0]
[55.0, 1351.0]
[1779, 2068]
p02579
u684814987
2,000
1,048,576
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)?
['\nfrom collections import deque\n\nh, w = map(int, input().split())\nch, cw = map(int, input().split())\ndh, dw = map(int, input().split())\n\n\n\nbase = ["#" * (w + 4)]\nbase.append("#" * (w + 4))\nfor n in range(h):\n base.append("##" + input() + "##")\nbase.append("#" * (w + 4))\nbase.append("#" * (w + 4))\nans = [[-1] * (w + 4) for _ in range(h + 4)]\nfor i in range(h + 4):\n for j in range(w + 4):\n if base[i][j] == "#":\n ans[i][j] = -2\nch += 1\ncw += 1\ndh += 1\ndw += 1\n\nans[ch][cw] = 0\nmove1 = [[1, 0], [-1, 0], [0, 1], [0, -1]]\nmove2 = [\n [-2, -2], [-2, -1], [-2, 0], [-2, 1], [-2, 2], [-1, -2], [-1, -1],\n [-1, 1], [-1, 2], [0, -2], [0, 2], [1, -2], [1, -1], [1, 1],\n [1, 2], [2, -2], [2, -1], [2, 0], [2, 1], [2, 2]\n ]\nq1 = deque([[ch, cw]])\nq2 = deque([])\n\nwhile q1:\n x1, y1 = q1.popleft()\n q2.append([x1, y1])\n for i, j in move1:\n nx, ny = x1 + i, y1 + j\n if nx < 0 or h <= nx or ny < 0 or w <= ny:\n continue\n if ans[nx][ny] == -1:\n ans[nx][ny] = ans[x1][y1]\n q1.append([nx, ny])\n if len(q1) == 0:\n while q2:\n x2, y2 = q2.popleft()\n for i, j in move2:\n mx, my = x2 + i, y2 + j\n if mx < 0 or h <= mx or my < 0 or w <= my:\n continue\n if ans[mx][my] == -1:\n ans[mx][my] = ans[x2][y2] + 1\n q1.append([mx, my])\nprint(ans[dh][dw])\n\n\n\n', '\nfrom collections import deque\n\n\ndef main():\n h, w = map(int, input().split())\n ch, cw = map(int, input().split())\n dh, dw = map(int, input().split())\n\n \n\n base = ["#" * (w + 4)]\n base.append("#" * (w + 4))\n for n in range(h):\n base.append("##" + input() + "##")\n base.append("#" * (w + 4))\n base.append("#" * (w + 4))\n ans = [[-1] * (w + 4) for _ in range(h + 4)]\n for i in range(h + 4):\n for j in range(w + 4):\n if base[i][j] == "#":\n ans[i][j] = -2\n ch += 1\n cw += 1\n dh += 1\n dw += 1\n \n ans[ch][cw] = 0\n move1 = [[1, 0], [-1, 0], [0, 1], [0, -1]]\n move2 = [\n [-2, -2], [-2, -1], [-2, 0], [-2, 1], [-2, 2], [-1, -2], [-1, -1],\n [-1, 1], [-1, 2], [0, -2], [0, 2], [1, -2], [1, -1], [1, 1],\n [1, 2], [2, -2], [2, -1], [2, 0], [2, 1], [2, 2]\n ]\n q1 = deque([[ch, cw]])\n q2 = deque([])\n\n while q1:\n x1, y1 = q1.popleft()\n q2.append([x1, y1])\n for i, j in move1:\n nx, ny = x1 + i, y1 + j\n """\n if nx < 0 or h <= nx or ny < 0 or w <= ny:\n continue\n """\n if ans[nx][ny] == -1:\n ans[nx][ny] = ans[x1][y1]\n q1.append([nx, ny])\n if len(q1) == 0:\n while q2:\n x2, y2 = q2.popleft()\n for i, j in move2:\n mx, my = x2 + i, y2 + j\n """\n if mx < 0 or h <= mx or my < 0 or w <= my:\n continue\n """\n if ans[mx][my] == -1:\n ans[mx][my] = ans[x2][y2] + 1\n q1.append([mx, my])\n print(ans[dh][dw])\n\n\nif __name__ == "__main__":\n main()\n\n\n']
['Wrong Answer', 'Accepted']
['s870140121', 's363944839']
[21220.0, 23492.0]
[2206.0, 1653.0]
[1687, 2043]
p02579
u694665829
2,000
1,048,576
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)?
["from collections import deque\nh, w = map(int,input().split())\nch, cw = map(int,input().split())\ndh, dw = map(int,input().split())\n\nM = ['##' + input() + '##' for _ in range(h)]\nfor i in range(2):\n M.insert(0,'#'*(w+4))\n M.append('#'*(w+4))\n\nINF = float('inf')\ncost = [[INF for _ in range(w+4)] for _ in range(h+4)]\ncost0 = deque()\nans = -1\n\ncost0.append((ch+1, cw+1, 0))\ncost[ch+1][cw+1] = 0\n\nmove = [(1,0),(0,1),(-1,0),(0,-1)]\nwarp = [(i,j) for i in range(-2,3) for j in range(-2,3) if (i,j) not in [(0,0)] + move]\n\ncost1 = deque()\n\nwhile cost0:\n h, w, c = cost0.popleft()\n cost1.append((h, w, c))\n \n for i,j in move:\n dh = h + i\n dw = w + j\n if M[dh][dw] == '.' and c < cost[dh][dw]: \n cost[dh][dw] = c\n cost0.appendleft((dh, dw, cost[dh][dw]))\n \n if len(cost0) == 0:\n while cost1:\n h, w, c = cost1.popleft()\n for i,j in warp:\n dh = h + i\n dw = w + j\n if S[dh][dw] == '.' and c+1 < cost[dh][dw]: \n cost[dh][dw] = c+1\n cost0.append((dh, dw, cost[dh][dw]))\n if cost[dh+1][dw+1] != INF:\n ans = cost[dh+1][dw+1]\n\nprint(ans)", 'from collections import deque\ndef solve(): \n h, w = map(int,input().split())\n ch, cw = map(int,input().split())\n Dh, Dw = map(int,input().split())\n \n M = [\'##\' + input() + \'##\' for _ in range(h)]\n for i in range(2):\n M.insert(0,\'#\'*(w+4))\n M.append(\'#\'*(w+4))\n \n INF = float(\'inf\')\n cost = [[INF for _ in range(w+4)] for _ in range(h+4)]\n cost0 = deque()\n ans = -1\n \n cost0.append((ch+1, cw+1, 0))\n cost[ch+1][cw+1] = 0\n \n move = [(1,0),(0,1),(-1,0),(0,-1)]\n warp = [(i,j) for i in range(-2,3) for j in range(-2,3) if (i,j) not in [(0,0)] + move]\n \n cost1 = deque()\n \n while cost0:\n h, w, c = cost0.popleft()\n cost1.append((h, w, c))\n \n for i,j in move:\n dh = h + i\n dw = w + j\n if M[dh][dw] == \'.\' and c < cost[dh][dw]: \n cost[dh][dw] = c\n cost0.appendleft((dh, dw, cost[dh][dw]))\n \n if len(cost0) == 0:\n while cost1:\n h, w, c = cost1.popleft()\n for i,j in warp:\n dh = h + i\n dw = w + j\n if M[dh][dw] == \'.\' and c+1 < cost[dh][dw]: \n cost[dh][dw] = c+1\n cost0.append((dh, dw, cost[dh][dw]))\n if cost[Dh+1][Dw+1] != INF:\n ans = cost[Dh+1][Dw+1]\n \n print(ans)\n\nif __name__ == "__main__":\n solve()\n ']
['Runtime Error', 'Accepted']
['s162490239', 's989369263']
[19160.0, 24620.0]
[78.0, 1987.0]
[1333, 1593]
p02579
u857759499
2,000
1,048,576
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)?
['from collections import deque\ndef main():\n h,w = map(int,input().split())\n ch,cw = map(lambda x:int(x)+1,input().split())\n dh,dw = map(lambda x:int(x)+1,input().split())\n s = [["#"]*(w+4) for _ in range(2)]+[["#"]*2+list(input())+["#"]*2 for _ in range(h)]+[["#"]*(w+4) for _ in range(2)]\n m1 = ((-1,0),(0,-1),(0,1),(1,0))\n m2 = [(i,j) for i in range(-2,3) for j in range(-2,3) if abs(i)+abs(j)>1]\n a = deque([(ch,cw)])\n b = deque()\n i = 0\n while a:\n while a:\n ah,aw = a.popleft()\n if s[bh][bw]!=".":\n continue\n b.append((ah,aw))\n s[ah][aw] = i\n for bh,bw in m1:\n bh,bw = ah+bh,aw+bw\n if s[bh][bw]==".":\n a.append((bh,bw))\n while b:\n ah,aw = b.popleft()\n for bh,bw in m2:\n bh,bw = ah+bh,aw+bw\n if s[bh][bw]==".":\n a.append((bh,bw))\n i += 1\n ans = s[dh][dw]\n print(ans if ans != "." else -1)\n\nif __name__ == "__main__":\n main()', 'from collections import deque\ndef main():\n h,w = map(int,input().split())\n ch,cw = map(lambda x:int(x)+1,input().split())\n dh,dw = map(lambda x:int(x)+1,input().split())\n s = [["#"]*(w+4) for _ in range(2)]+[["#"]*2+list(input())+["#"]*2 for _ in range(h)]+[["#"]*(w+4) for _ in range(2)]\n m1 = ((-1,0),(0,-1),(0,1),(1,0))\n m2 = [(i,j) for i in range(-2,3) for j in range(-2,3) if abs(i)+abs(j)>1]\n a = deque([(ch,cw)])\n b = deque()\n i = 0\n while a:\n while a:\n ah,aw = a.popleft()\n if s[ah][aw]!=".":\n continue\n b.append((ah,aw))\n s[ah][aw] = i\n for bh,bw in m1:\n bh,bw = ah+bh,aw+bw\n if s[bh][bw]==".":\n a.append((bh,bw))\n while b:\n ah,aw = b.popleft()\n for bh,bw in m2:\n bh,bw = ah+bh,aw+bw\n if s[bh][bw]==".":\n a.append((bh,bw))\n i += 1\n ans = s[dh][dw]\n print(ans if ans != "." else -1)\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s267585596', 's576267510']
[17148.0, 22380.0]
[53.0, 1715.0]
[938, 938]
p02579
u887833602
2,000
1,048,576
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)?
["from collections import deque\n\n\nH, W = map(int, input().split())\nCh, Cw = map(lambda x: int(x) - 1, input().split())\nDh, Dw = map(lambda x: int(x) - 1, input().split())\nmaze = [input() for _ in range(H)]\n\nINF = 10 ** 12\npath = [[INF] * W for _ in range(H)] \n\n\nwalk = [(0, 1), (0, -1), (-1, 0), (1, 0)]\nwarp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]\n\nq = deque()\npath[Ch][Cw] = 0\nq.append((Ch, Cw, 0))\n\nwhile q:\n x, y, s = q.popleft()\n for dx, dy in walk: \n nx = x + dx\n ny = y + dy\n if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s:\n path[nx][ny] = s\n q.appendleft((nx, ny, s)) の場合はコスト0. キューの先頭に追加する.\n for dx, dy in warp: \n nx = x + dx\n ny = y + dy\n if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s + 1:\n path[nx][ny] = s + 1\n q.append((nx, ny, s + 1)) の場合はコスト1. キューの最後尾に追加する.\n \nans = path[Dh][Dw] if path[Dh][Dw] < INF else '-1'\nprint(ans)", 'h = 0\nw = 0\nreached = []\nmaze = []\ndh = 0\ndw = 0\n\n\ndef main():\n global h\n global w\n global dh\n global dw\n h, w = map(int, input().split()) \n ch, cw = map(int, input().split()) \n dh, dw = map(int, input().split()) \n for i in range(h):\n maze.append(list(input()))\n # for (i, row) in enumerate(maze, 1):\n # print(\'{}: {}\'.format(i, row))\n warp_count = 0\n while True:\n if walk_to(ch, cw):\n \n # print(\'Goal!\')\n print(warp_count)\n break\n else:\n \n mch, mcw = most_close()\n \n warped_hw = warp_from(mch, mcw)\n if warped_hw is not None:\n warp_count += 1\n ch, cw = warped_hw\n else:\n 不能\n \n print(-1)\n break\n\n\ndef warp_from(mch, mcw):\n start_h = max(mch - 2, 1)\n end_h = min(mch + 2, h)\n start_w = max(mcw - 2, 1)\n end_w = min(mcw + 2, w)\n\n min_distance = None\n min_hw = None\n for i in range(start_h, end_h + 1):\n for j in range(start_w, end_w + 1):\n # print(i, j)\n if get_block(i, j) == \'.\' and yet(i, j):\n \n distance = abs(dh - i) + abs(dw - j)\n if min_distance is None or distance < min_distance:\n min_distance = distance\n min_hw = [i, j]\n return min_hw\n\n\ndef most_close():\n min_hw = []\n min_distance = None\n for r in reached:\n distance = max(abs(dh - r[0]), abs(dw - r[1]))\n if min_distance is None or distance < min_distance:\n min_distance = distance\n min_hw = [r[0], r[1]]\n return min_hw\n\n\ndef walk_to(current_h, current_w):\n reached.append([current_h, current_w]) 済み\n if current_h == dh and current_w == dw:\n return True\n \n if current_h > 1 and get_block(current_h - 1, current_w) == \'.\' and yet(current_h - 1, current_w):\n \n return walk_to(current_h - 1, current_w)\n \n if current_w < w and get_block(current_h, current_w + 1) == \'.\' and yet(current_h, current_w + 1):\n \n return walk_to(current_h, current_w + 1)\n \n if current_h < h and get_block(current_h + 1, current_w) == \'.\' and yet(current_h + 1, current_w):\n \n return walk_to(current_h + 1, current_w)\n \n if current_w > 1 and get_block(current_h, current_w - 1) == \'.\' and yet(current_h, current_w - 1):\n \n return walk_to(current_h, current_w - 1)\n\n \n return False\n\n\ndef get_block(target_h, target_w):\n return maze[target_h - 1][target_w - 1]\n\n\ndef yet(check_h, check_w):\n for r in reached:\n if check_h == r[0] and check_w == r[1]:\n return False\n return True\n\n\nif __name__ == "__main__":\n main()\n', "from collections import deque\n\n\ndef solve(H, W, Ch, Cw, Dh, Dw, maze):\n \n walled_maze = ['##{}##'.format(row) for row in maze]\n walled_maze.insert(0, '##{}##'.format('#' * W))\n walled_maze.insert(0, '##{}##'.format('#' * W))\n walled_maze.append('##{}##'.format('#' * W))\n walled_maze.append('##{}##'.format('#' * W))\n\n INF = 10 ** 12\n path = [[INF] * (W + 4) for _ in range(H + 4)]\n walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]\n warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]\n\n yet = deque()\n yet.append((Ch + 2, Cw + 2, 0)) \n path[Ch + 2][Cw + 2] = 0\n done = deque()\n\n while yet:\n y, x, s = yet.popleft()\n done.append((y, x, s))\n for dy, dx in walk:\n ny = y + dy\n nx = x + dx\n if walled_maze[ny][nx] == '.' and path[ny][nx] > s:\n path[ny][nx] = s\n yet.append((ny, nx, s))\n if len(yet) == 0:\n while done:\n y, x, s = done.popleft()\n for dy, dx in warp:\n ny = y + dy\n nx = x + dx\n if walled_maze[ny][nx] == '.' and path[ny][nx] > s + 1:\n path[ny][nx] = s + 1\n yet.append((ny, nx, s + 1))\n ans = path[Dh + 2][Dw + 2] if path[Dh + 2][Dw + 2] < INF else -1\n print(ans)\n\n\nif __name__ == '__main__':\n H, W = map(int, input().split())\n Ch, Cw = map(lambda x: int(x) - 1, input().split())\n Dh, Dw = map(lambda x: int(x) - 1, input().split())\n maze = [input() for _ in range(H)]\n solve(H, W, Ch, Cw, Dh, Dw, maze)\n"]
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s404639433', 's677812199', 's332265513']
[23264.0, 17144.0, 24524.0]
[2206.0, 498.0, 1899.0]
[1219, 3465, 1790]
p02579
u972591645
2,000
1,048,576
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)?
["from collections import deque\n\n\nH, W = map(int, input().split())\nCh, Cw = map(lambda x: int(x) - 1, input().split())\nDh, Dw = map(lambda x: int(x) - 1, input().split())\nmaze = [input() for _ in range(H)]\n\nINF = 10 ** 12\npath = [[INF] * W for _ in range(H)] \n\n\nwalk = [(0, 1), (0, -1), (-1, 0), (1, 0)]\nwarp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]\n\nq = deque()\npath[Ch][Cw] = 0\nq.append((Ch, Cw, 0))\n\nwhile q:\n x, y, s = q.popleft()\n for dx, dy in walk: \n nx = x + dx\n ny = y + dy\n if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s:\n path[nx][ny] = s\n q.appendleft((nx, ny, s)) の場合はコスト0. キューの先頭に追加する.\n for dx, dy in warp: \n nx = x + dx\n ny = y + dy\n if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s + 1:\n path[nx][ny] = s + 1\n q.append((nx, ny, s + 1)) の場合はコスト1. キューの最後尾に追加する.\n \nans = path[Dh][Dw] if path[Dh][Dw] < INF else '-1'\nprint(ans)", "from collections import deque\n\ndef main():\n h, w = map(int, input().split())\n c = list(map(lambda x: int(x)+1, input().split()))\n d = list(map(lambda x: int(x)+1, input().split()))\n s = ['#'*(w+4)]*2 + ['#'*2 + input() + '#'*2 for _ in range(h)] + ['#'*(w+4)]*2\n\n ans = [[-1]*(w+4) for _ in range(h+4)]\n for i in range(h+4):\n for j in range(w+4):\n if s[i][j] == '#':\n ans[i][j] = -2\n ans[c[0]][c[1]] = 0\n\n move1 = [(0, 1), (0, -1), (1, 0), (-1, 0)]\n move2 = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if abs(i)+abs(j) > 1]\n\n yet = deque([(c[0], c[1])])\n done = deque()\n\n while yet:\n y, x = yet.popleft()\n done.append((y, x))\n for dy, dx in move1:\n ydy, xdx = y+dy, x+dx\n if ans[ydy][xdx] == -1:\n yet.append((ydy, xdx))\n ans[ydy][xdx] = ans[y][x]\n\n if len(yet) == 0:\n while done:\n y, x = done.popleft()\n for dy, dx in move2:\n ydy, xdx = y+dy, x+dx\n if ans[ydy][xdx] == -1:\n ans[ydy][xdx] = ans[y][x] + 1\n yet.append((ydy, xdx))\n\n print(ans[d[0]][d[1]])\n\nif __name__ == '__main__':\n main()\n"]
['Time Limit Exceeded', 'Accepted']
['s358252499', 's281623185']
[23404.0, 23476.0]
[2206.0, 1607.0]
[1219, 1277]
p02582
u000037600
2,000
1,048,576
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.
['a=list(input())\ncnt=0\nfor i in a:\n if i=="R":\n cnt+=1\n else:\n cnt=0\nprint(cnt)', 'a=list(input())\ncnt=0\nans=0\nfor i in a:\n if i=="R":\n cnt+=1\n else:\n ans=max(cnt,ans)\n cnt=0\nprint(cnt)', 'a=list(input())\ncnt=0\nans=0\nfor i in a:\n if i=="R":\n cnt+=1\n else:\n ans=max(cnt,ans)\n cnt=0\nans=max(cnt,ans)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s440939715', 's717923650', 's623501165']
[8976.0, 8956.0, 9036.0]
[28.0, 34.0, 34.0]
[86, 113, 130]
p02582
u001769145
2,000
1,048,576
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.
['S = input()\n\nans = 0\ntmp = 0\nfor i in range(3):\n if S[i] == "R":\n tmp += 1\n ans = max(ans, tmp)\n else:\n ans = max(ans, tmp)\n ans = 0\n\nprint(ans)\n', 'S = input()\n\nans = 0\nfor i in range(3):\n if S[i] == "R":\n ans += 1\n else:\n ans = 0\n\nprint(ans)\n', 'S = input()\n\nans = 0\n_tmp = 0\nfor i in range(3):\n if S[i] == "R":\n _tmp += 1\n ans = max(ans, _tmp)\n else:\n ans = max(ans, _tmp)\n _tmp = 0\n\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s362150810', 's872987440', 's943725259']
[8880.0, 9076.0, 9040.0]
[29.0, 30.0, 24.0]
[179, 115, 184]
p02582
u006738234
2,000
1,048,576
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.
['s = str(input())\ns = list(s)\n\ncnt = 0\n\nfor i in range(3):\n if(s[i] == "S"):\n cnt += 1\n\nif(s[0] == "S" and s[1] == "R" and s[2] == "S"):\n cnt = 1\n\n\nprint(cnt)', 's = str(input())\ns = list(s)\n\ncnt = 0\n\nfor i in range(3):\n if(s[i] == "R"):\n cnt += 1\n\nif(s[0] == "R" and s[1] == "S" and s[2] == "R"):\n cnt = 1\n\n\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s774577500', 's380489088']
[9108.0, 9044.0]
[32.0, 31.0]
[170, 170]
p02582
u006782785
2,000
1,048,576
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.
['ans = 0\n\nif (a==s,b==s,c==s):\n print(ans)\n\nelif (a==r,b==s,c==s):\n ans = 1 + ans\n print(ans)\n\nelif (a==r,b==r,c==s):\n ans = 2 + ans\n print(ans)\n\nelse:\n ans = 1 + ans\n print(ans)', 'S = input()\n\na=RSS\nb=RRS\nc=RRR\nd=SSS\n\nif a in S:\n print(1)\n\nelif b in S:\n print(2)\n \nelif c = S:\n print(3)\n \nelif d = S:\n print(0)\n\nelse:\n print(1)', 'S = input()\n\na = "RRR"\nb = "RR"\nc = "R"\n \nif a == S:\n print(3)\n \nelif b in S:\n print(2)\n\nelif c in S:\n print(1)\n \nelse:\n print(0)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s045880641', 's574716570', 's162033704']
[9100.0, 9024.0, 9028.0]
[29.0, 20.0, 28.0]
[198, 167, 150]
p02582
u007346335
2,000
1,048,576
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.
["s = input()\ncount = 0\nfor i in range(3):\n if s[i] == 'R':\n count++\nif count <= 1 || count == 3:\n print(count)\nelif s[1] != 'S':\n print(count-1)\nelse:\n print(count)\n ", "s = input()\ncount = 0\nfor i in range(3):\n if s[i] == 'R':\n count+=1\nif count <= 1 or count == 3:\n print(count)\nelif s[1] != 'R':\n print(count-1)\nelse:\n print(count)\n "]
['Runtime Error', 'Accepted']
['s850634633', 's665143240']
[8936.0, 8992.0]
[24.0, 27.0]
[173, 174]
p02582
u008586830
2,000
1,048,576
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.
["s=input()\ncount=0\nflag=True\nif s[0]=='R' and s[1]=='R' and s[2]=='R':\n print(3)\nelif (s[0]=='R' and s[1]=='R') or (s[0]=='R' and s[2]=='R') \nor(s[1]=='R' and s[2]=='R'):\n print(2)\nelif s[0]=='R' or s[1]=='R' or s[2]=='R':\n print(1)\nelse:\n print(0)", "s=input()\ncount=0\nflag=True\nfor char in s:\n if char=='R' and flag:\n count+=1\n flag=False\nprint(count)", "s=input()\ncount=0\nsa=0\nfor char in s:\n if char=='R':\n sa+=1\n else:\n sa=0\n count=max(sa,count)\nprint(count)"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s659784914', 's767875982', 's530365386']
[8832.0, 9056.0, 9000.0]
[23.0, 30.0, 27.0]
[259, 118, 129]
p02582
u021849254
2,000
1,048,576
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.
['a=input()\nif a=="SSS":\n print(0)\nelif a="RRR":\n print(3)\nelif a="RRS" or a="SRR":\n print(2)\nelse:\n print(1)\n', 'a=input()\nif a==SSS:\n print(0)\nelif a=RRR:\n print(3)\nelif a=RRS or a=SRR:\n print(2)\nelse:\n print(1)', 'a=input()\nif a=="SSS":\n print(0)\nelif a=="RRR":\n print(3)\nelif a=="RRS" or a=="SRR":\n print(2)\nelse:\n print(1)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s154991231', 's612892952', 's005353201']
[8940.0, 8580.0, 9032.0]
[27.0, 27.0, 30.0]
[112, 103, 114]
p02582
u021877437
2,000
1,048,576
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.
["S = list(input().rstrip())\nnum = 0\nfor c in S:\n\tif c == 'R':\n\t\tnum += 1\n\telse:\n\t\tnum = 0\n\nprint(num)\n\n", "S = input().rstrip()\nnum = 0\nmnum = 0\nfor c in S:\n if c == 'R':\n num += 1\n else:\n num = 0\n\n if mnum < num:\n mnum = num\n\nprint(mnum)\n"]
['Wrong Answer', 'Accepted']
['s056090155', 's536770087']
[9088.0, 9096.0]
[27.0, 28.0]
[102, 162]
p02582
u021916304
2,000
1,048,576
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.
["def ii():return int(input())\ndef iim():return map(int,input().split())\ndef iil():return list(map(int,input().split()))\n\ns = input()\ncnt = 0\nans = 0\nfor i in s:\n if i=='R':\n cnt += 1\n else:\n ans = max(ans,cnt)\n cnt = 0\nprint(cnt)", "def ii():return int(input())\ndef iim():return map(int,input().split())\ndef iil():return list(map(int,input().split()))\n\ns = input()\ncnt = 0\nans = 0\nfor i in s:\n if i=='R':\n cnt += 1\n else:\n ans = max(ans,cnt)\n cnt = 0\nprint(max(ans,cnt))"]
['Wrong Answer', 'Accepted']
['s777252477', 's795266757']
[8932.0, 9048.0]
[28.0, 25.0]
[255, 264]
p02582
u026155812
2,000
1,048,576
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.
["s = input()\nans = 0\nif s == 'SSS':\n print(3)\nelif s == 'SSR' or s == 'RSS':\n print(2)\nelif s == 'SRR' or s == 'RSR' or s == 'RRS' or s == 'SRS':\n print(1)\nelse:\n print(0)", "s = input()\nans = 0\nif s == 'SSS':\n print(3)\nelif s == 'SSR' or s == 'RSS':\n print(2)\nelif s == 'SRR' or s == 'RSR' s == 'RRS' or s == 'SRS':\n print(1)\nelse:\n print(0)", "s = input()\nans = 0\nif s == 'SSS':\n print(0)\nelif s == 'SSR' or s == 'RSS' or s == 'SRS' or s == 'RSR':\n print(1)\nelif s == 'SRR' or s == 'RRS':\n print(2)\nelse:\n print(3)"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s892290263', 's956985164', 's748892760']
[8772.0, 8856.0, 8952.0]
[30.0, 24.0, 28.0]
[182, 179, 182]
p02582
u026381867
2,000
1,048,576
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.
['a = input()\nlist1 = a.split("S")\nprint(list)\nif len(list1) == 1:\n print(3)\nelif len(list1) == 2:\n if a == "RSR":\n print(1)\n else:\n print(2)\nelif len(list1) == 3:\n print(1)\nelse:\n print(0)', 'a = input()\nlist1 = a.split("S")\n\nif len(list1) == 1:\n print(3)\nelif len(list1) == 2:\n if a == "RSR":\n print(1)\n else:\n print(2)\nelif len(list1) == 3:\n print(1)\nelse:\n print(0)']
['Wrong Answer', 'Accepted']
['s998095377', 's949019282']
[9044.0, 8944.0]
[28.0, 30.0]
[198, 187]
p02582
u035445296
2,000
1,048,576
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.
["s = input()\ns.replace('R', '').replace('RR', '').replace('RRR', '')\nprint(3-len(s))", "s = input()\nans = 0\nfor i in range(1, 4):\n if 'R'*i in s:\n ans = len('R'*i)\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s002042190', 's121824098']
[9032.0, 9092.0]
[27.0, 26.0]
[83, 90]
p02582
u039304781
2,000
1,048,576
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.
["S = input()\ns = list(S)\n\ncount = 0\n\nfor i in range(len(s)):\n if s[i] == 'R':\n count = 1\n try:\n if s[i+1] == 'R':\n count += 1\n \n except IndexError:\n break\n\nprint(count)\n", "S = input()\ns = list(S)\n\ncount = 0\nl = [0]\n\nfor i in range(len(s)):\n if s[i] == 'R':\n l.append(1)\n try:\n if s[i+1] == 'R':\n count += 1\n l.append(count+1)\n else:\n l.append(count)\n count = 0\n \n except IndexError:\n break\n\nprint(max(l))\n"]
['Wrong Answer', 'Accepted']
['s429715959', 's165976346']
[9032.0, 9044.0]
[36.0, 36.0]
[236, 357]
p02582
u042414886
2,000
1,048,576
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.
["S = input()\nresult = 0\nfor i in range(3):\n if S[i] == 'R':\n result = result + 1\n else:\n result = 0\n\nprint(result)\n", "S = input()\nScnt = S.count('S')\nresult = 0\nresult2 = 0\n\nfor i in range(3):\n if S[i] == 'R':\n result = result + 1\n else:\n if result2 < result:\n result2 = result\n result = 0\n \nif result > result2:\n print(result)\nelse:\n print(result2)\n"]
['Wrong Answer', 'Accepted']
['s522275372', 's210547566']
[9084.0, 9100.0]
[36.0, 32.0]
[134, 276]
p02582
u048169875
2,000
1,048,576
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.
["res, prev, count = 0, '', 0\nfor s in S:\n if s == 'R':\n count += 1\n else:\n res = max(res, count)\n count = 0\nres = max(res, count)\nreturn res", "S = input()\nres, prev, count = 0, '', 0\nfor s in S:\n if s == 'R':\n count += 1\n else:\n res = max(res, count)\n count = 0\nprint(max(res, count))"]
['Runtime Error', 'Accepted']
['s695684736', 's211572212']
[8936.0, 9112.0]
[23.0, 32.0]
[150, 152]
p02582
u054825571
2,000
1,048,576
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.
["S=input()\nans=0\ntmp=0\nfor s in S:\n if s=='S':\n tmp+=1\n else:\n ans=max(ans,tmp)\n tmp=0\nprint(max(ans,tmp))", "S=input()\nans=0\ntmp=0\nfor s in S:\n if s='S':\n tmp+=1\n else:\n ans=max(ans,tmp)\n tmp=0\nprint(max(ans,tmp))", "S=input()\nans=0\ntmp=0\nfor s in S:\n if s=='R':\n tmp+=1\n else:\n ans=max(ans,tmp)\n tmp=0\nprint(max(ans,tmp))"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s412007578', 's419114649', 's071809433']
[9084.0, 9008.0, 9108.0]
[29.0, 24.0, 28.0]
[116, 115, 116]
p02582
u055127677
2,000
1,048,576
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.
["X,K,D=list(map(int,input().split()))\n\ndef sgn(x):\n if x>0:\n return 1\n elif x<0:\n return -1\n return 0\n\ndef solve():\n if X>0:\n x_greedy=X-K*D\n else:\n x_greedy=X+K*D\n\n if sgn(X)==sgn(x_greedy):\n return print(x_greedy)\n\n else:\n x_r=X%D\n x_l=x_r-D\n\n r_parity=(abs(X-x_r)//D)%2\n if K%2==r_parity:\n return print(abs(x_r))\n else:\n return print(abs(x_l))\n\nif __name__=='__main__':\n solve()", "X,K,D=list(map(int,input().split()))\n\ndef sgn(x):\n if x>0:\n return 1\n elif x<0:\n return -1\n return 0\n\ndef solve():\n if X>0:\n x_greedy=X-K*D\n elif X<0:\n x_greedy=X+K*D\n\n if sgn(X)==sgn(x_greedy):\n return print(abs(x_greedy))\n\n else:\n x_r=X%D\n x_l=x_r-D\n\n r_parity=(abs(X-x_r)//D)%2\n if K%2==r_parity:\n return print(abs(x_r))\n else:\n return print(abs(x_l))\n\nif __name__=='__main__':\n solve()", "S=input()\nset_S=set(S)\nif len(set_S)==1:\n ret=S.count('R')\nelse:\n if S[0]==S[1]=='R' or S[1]==S[2]=='R':\n ret=2\n else:\n ret=1\nprint(ret)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s319664927', 's373840376', 's958147358']
[9188.0, 9032.0, 8992.0]
[21.0, 22.0, 27.0]
[496, 505, 159]
p02582
u057441537
2,000
1,048,576
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.
["S = input[0]\ncnt = 0\nfor i in range(3):\n if S[i] == 'R':\n \n # \n if i == 0 or S[i - 1] == 'R':\n\t cnt += 1\n else:\n cnt = 1\nprint(cnt)", "S = input()\ncnt = 0\nfor i in range(3):\n if S[i] == 'R':\n \n if i == 0 or S[i - 1] == 'R':\n cnt += 1\n else:\n cnt = 1\nprint(cnt)\n"]
['Runtime Error', 'Accepted']
['s915783043', 's167586028']
[9008.0, 9092.0]
[23.0, 28.0]
[225, 247]
p02582
u060012100
2,000
1,048,576
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.
["S = input()\ncount = 0\nif S == 'RSR':\n print(1)\nelse:\n for i in S:\n if i == 'R':\n cout+=1\n print(count)", "S = input()\ncount = 0\nif S == 'RSR':\n print(1)\nelse:\n for i in S:\n if i == 'R':\n count+=1\n print(count)"]
['Runtime Error', 'Accepted']
['s020775780', 's725383525']
[8964.0, 9020.0]
[25.0, 29.0]
[113, 114]
p02582
u061835391
2,000
1,048,576
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.
["s=input()\ni=0\nc=0\nif s[i]=='R':\n c=1\n if s[i+1]=='R':\n c=2\n if s[i+2]=='R':\n c=3\nif s[i]=='S':\n c=0\n if s[i+1]=='R':\n c=1\n \tif s[i+2]=='R':\n c=2\nprint(c)\n ", "s=input()\nif 'RRR' in s:\n c=3\nelif 'RR' in s:\n c=2\nelif 'R' in s:\n c=1\nelse:\n c=0\nprint(c)"]
['Runtime Error', 'Accepted']
['s194507212', 's210431931']
[8968.0, 8964.0]
[24.0, 32.0]
[185, 94]
p02582
u065578867
2,000
1,048,576
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.
['from collections import Counter\n\nn = int(input())\nl = list(map(int, input().split()))\n\nl_counter = Counter(l)\nl_set = sorted(list(l_counter.keys()))\n\nlength = len(l_set)\nans = 0\nif n < 3:\n print(0)\nelse:\n for i in range(length - 2):\n for j in range(i + 1, length - 1):\n for k in range(j + 1, length):\n if l_set[k] < l_set[i] + l_set[j]:\n ans += l_counter[l_set[i]] * l_counter[l_set[j]] * l_counter[l_set[k]]\n\n print(ans)\n', "s = input()\nif s.count('R') == 0:\n print(0)\nelif s.count('R') == 1:\n print(1)\nelif s.count('R') == 2:\n if s[1] == 'R':\n print(2)\n else:\n print(1)\nelse:\n print(3) \n"]
['Runtime Error', 'Accepted']
['s258059935', 's565636447']
[9460.0, 9036.0]
[31.0, 31.0]
[483, 199]
p02582
u066675967
2,000
1,048,576
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.
["s = input()\ndef solve(s):\n if not s:\n return 0\n d = 0\n res = 0\n for i in s:\n if i == 'R':\n d += 1\n else:\n res = max(res, d)\n d = 0\n return res\nsolve(s)", "s = input()\ndef solve(s):\n c = s.count('R')\n if c in [0, 1, 3]:\n return c\n elif s.count('RR') == 1:\n return 2\n else:\n return 1\nprint(solve(s))\n"]
['Wrong Answer', 'Accepted']
['s261532695', 's432449052']
[9032.0, 9028.0]
[27.0, 29.0]
[180, 176]
p02582
u068291196
2,000
1,048,576
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.
["S = input('>>>')\nnum = 0\nnum_rev = [0,0,0]\nfor i in range(3):\n if S[i] == 'R':\n num += 1\n elif S[i] == 'S':\n num_rev[i] = num\n num = 0\n \n\nprint(max(num,num_rev[0],num_rev[1],num_rev[2]))", "S = input('>>>')\nnum = 0\nnum_rev = 0\nfor i in range(3):\n if S[i] == 'R':\n num += 1\n elif S[i] == 'S':\n num_rev = num\n num = 0\n \n\nprint(max(num,num_rev))", "S = input('')\nnum = 0\nnum_rev = [0,0,0]\nfor i in range(3):\n if S[i] == 'R':\n num += 1\n elif S[i] == 'S':\n num_rev[i] = num\n num = 0\n \n\nprint(max(num,num_rev[0],num_rev[1],num_rev[2]))\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s323477517', 's349140037', 's726270334']
[9044.0, 9032.0, 9040.0]
[29.0, 34.0, 31.0]
[220, 186, 218]
p02582
u068322747
2,000
1,048,576
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.
["z=[]\na=input()\nfor i in a:\n z.append(i)\nprint(z)\nz.count('R')", "z=[]\na=input()\nfor i in a:\n z.append(i)\n\nif (z[0]=='R') and (z[1]=='R') and (z[2]=='S'):\n print(2)\nelif (z[1]=='R') and (z[2]=='R') and (z[0]=='S'):\n print(2)\nelif (z[0]=='S') and (z[1]=='S') and (z[2]=='S'):\n print(0)\nelif (z[0]=='R') and (z[1]=='R') and (z[2]=='R'):\n print(3)\nelse: \n print(1)"]
['Wrong Answer', 'Accepted']
['s648852800', 's705416136']
[9024.0, 9088.0]
[28.0, 29.0]
[64, 329]
p02582
u068944955
2,000
1,048,576
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.
['S = input()\nc = 0\nm = 0\nif s in S:\n if s == "R":\n c+=1\n m = max(c, m)\n else:\n m = max(c, m)\n c = 0\nprint(m)\n \n ', 'S = input()\nc = 0\nm = 0\nfor s in S:\n m = max(c, m)\n if s == "R":\n c += 1\n m = max(c, m)\n else:\n c = 0\nprint(m)']
['Runtime Error', 'Accepted']
['s601189299', 's231774179']
[9024.0, 9024.0]
[25.0, 33.0]
[131, 140]
p02582
u075317232
2,000
1,048,576
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.
["def RainySeason():\n \n str1 = str(input())\n\n print(str1[:2], str1[1:])\n\n if str1 == 'RRR':\n print(3)\n \n elif str1 == 'SSS':\n print(0)\n \n elif str1[:2] == 'RR' or str1[1:] == 'RR':\n print(2)\n \n else:\n print(1)\n\nif __name__ == '__main__':\n RainySeason()\n\n", "def RainySeason():\n \n str1 = str(input())\n\n if str1 == 'RRR':\n print(3)\n \n elif str1 == 'SSS':\n print(0)\n \n elif str1[:2] == 'RR' or str1[1:] == 'RR':\n print(2)\n \n else:\n print(1)\n\nif __name__ == '__main__':\n RainySeason()\n\n"]
['Wrong Answer', 'Accepted']
['s527577651', 's714053412']
[9100.0, 9040.0]
[33.0, 34.0]
[321, 290]
p02582
u080419397
2,000
1,048,576
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.
['weather = input()\nraincount=0\nfor i in range(3):\n if weather[i]=="R":\n raincount=raincount+1\n else:\n raincount=0\n\nprint(raincount)', 'weather = input()\nraincount=0\ncont=0\nfor i in range(3):\n if weather[i]=="R" and cont==0:\n raincount=raincount+1\n elif weather[i]=="R" and cont==1:\n raincount=1\n cont=0\n elif weather[i] == "S":\n cont=1\n\nprint(raincount)']
['Wrong Answer', 'Accepted']
['s991216962', 's293699449']
[9088.0, 9016.0]
[34.0, 30.0]
[157, 265]
p02582
u081060730
2,000
1,048,576
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.
['n,k=map(int,input().split(" "))\nP=list(map(int,input().split(" ")))\nC=list(map(int,input().split(" ")))\ncount=[]\ndef f (i):\n q=deepcopy(i)\n count1=[]\n count2=0\n for j in range(k):\n count2+=C[i]\n count1.append(count2)\n if i==q and count1<0:\n break\n i=P[i]-1\n return max(count1)\nfor i in range(n):\n count.append(f(i))\nprint(max(count))', 'S=input()\nif S=="RSR":\n print(1)\nelse:\n \n print(len(S.replace("S","")))']
['Runtime Error', 'Accepted']
['s306127167', 's011832933']
[9180.0, 9020.0]
[25.0, 32.0]
[390, 80]
p02582
u081714930
2,000
1,048,576
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.
['S = input()\n\nif "RRR" in S:\n print(3)\nelse "RR" in S:\n print(2)\nelse "R" in S:\n print(1)\nelse:\n print(0)', 'S = input()\n\nif "RRR" in S:\n print(3)\nelif "RR" in S:\n print(2)\nelif "R" in S:\n print(1)\nelse:\n print(0)\n']
['Runtime Error', 'Accepted']
['s383282773', 's879476981']
[8864.0, 9032.0]
[20.0, 28.0]
[108, 109]
p02582
u086450146
2,000
1,048,576
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.
['X,K,D = map(int,input().split())\nX = abs(X)\n\nif X > K*D:\n ans = X - K*D\n\nelse:\n while X >= 0 :\n X = X - D\n K -= 1\n if K % 2 == 0:\n ans = abs(X)\n if K % 2 != 0:\n ans = X+D\n\nprint(ans)', 'X,K,D = map(int,input().split())\nX = abs(X)\n\nif X > K*D:\n ans = X - K*D\n\nelse:\n while X >= 0 :\n X = X - D\n K -= 1\n if K % 2 == 0:\n ans = abs(X)\n else:\n ans = X+D\n\nprint(ans)', 'S = input()\ns = list(S)\nif S == "RSR":\n print(1)\nelse:\n print(s.count(\'R\'))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s713869730', 's960955522', 's491639378']
[9164.0, 9084.0, 9024.0]
[21.0, 30.0, 31.0]
[250, 241, 81]
p02582
u091207675
2,000
1,048,576
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.
['i = input()\n\n\nif i == "SSS":\n print(0)\nelif i == "RRR":\n print(3)\nelif i == "RSR" or "SSR" or "RSS" or "SRS":\n print(1)\nelif i = "RRS" or "SRR":\n print(2)\n', 'i = input()\n\n\nif i == "SSS":\n print(0)\nelif i == "RRR":\n print(3)\nelif i == "RSR" or i == "SSR" or i=="RSS" or i=="SRS":\n print(1)\nelif i == "RRS" or i=="SRR":\n print(2)\n']
['Runtime Error', 'Accepted']
['s331086828', 's379358760']
[8980.0, 8980.0]
[27.0, 27.0]
[167, 182]
p02582
u094102716
2,000
1,048,576
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.
['a = input()\nif "RRR" in a:\n print(3)\nelif "RR" in a:\n print(2)\nelif "R" in a:\n print(1)\nelse:a\n print(0)\n', 'a = input()\nif "RRR" in a:\n print(3)\nelif "RR" in a:\n print(2)\nelif "R" in a:\n print(1)\nelse:\n print(0)\n']
['Runtime Error', 'Accepted']
['s097486780', 's742750341']
[9012.0, 9016.0]
[25.0, 24.0]
[109, 108]
p02582
u096146539
2,000
1,048,576
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.
['n=int(input())\nl=list(map(int,input().split()))\ncount=0\nfor i in range (n-2):\n for j in range (i+1,n-1):\n if l[i]==l[j]:\n continue\n l[i]+l[j]\n for k in range (j+1,n):\n if l[k]==l[i] or l[k]==l[l]:\n continue\n if l[k]<l[i]+l[j] and l[i]<l[j]+l[k] and l[j]<l[k]+l[i] :\n count+=1\nprint(count)\n \n', "m=input()\ns=list(m)\na=[]\nn=len(s)\nj=0\nwhile (j<n):\n x=0\n if s[j] == 'R':\n y=j+1\n for k in range (j,n):\n y=k+1\n if s[k]=='S':\n y=k+1\n break\n else:\n x+=1\n a.append(x)\n j=y\n\n else:\n j+=1\n\na.sort(reverse=True)\nif len(a)==0:\n print (0)\nelse:\n print(a[0])\n"]
['Runtime Error', 'Accepted']
['s597961728', 's655899456']
[9204.0, 9068.0]
[25.0, 31.0]
[381, 378]
p02582
u097852911
2,000
1,048,576
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.
['str = str(input())\nprint(str)\nif str == "RRR":\n print(3)\nelif str == "RRS" or str=="SRR":\n print(2)\nelif str == "SSS":\n print(0)\nelse:\n print(1)\n\n\n', 'str = str(input())\nprint(str)\nif str == "RRR":\n print(3)\nelif str == "RRS" or str=="SRR":\n print(2)\nelif str == "SSS":\n print(0)\nelse:\n print(1)\n\n\n', 'str = str(input())\nif str == "RRR":\n print(3)\nelif str == "RRS" or str=="SRR":\n print(2)\nelif str == "SSS":\n print(0)\nelse:\n print(1)\n\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s184184170', 's819025534', 's579722412']
[9040.0, 8992.0, 8912.0]
[25.0, 26.0, 25.0]
[151, 151, 140]
p02582
u102655885
2,000
1,048,576
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.
['x, k, d = list(map(lambda x: int(x), input().split()))\n\nmin_pos = x % d\nmin_neg = min_pos - d\n\nnum_to_min_pos = x // d\nif k <= num_to_min_pos:\n print(x - d * k)\n \nelse:\n if (k - num_to_min_pos) % 2 == 0:\n print(min_pos)\n else:\n print(abs(min_neg))\n', "import re\ns = input()\narray = re.split(r'S+', s)\nprint(max([len(e) for e in array]))"]
['Runtime Error', 'Accepted']
['s587683142', 's077381356']
[9088.0, 9820.0]
[25.0, 45.0]
[274, 84]
p02582
u105608888
2,000
1,048,576
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.
["mozi = input()\nif mozi == 'SSS':\n print(3)\nif mozi == 'SSR':\n print(2)\nif mozi == 'RSS':\n print(2)\nif mozi == 'SRR':\n print(1)\nif mozi == 'RSR':\n print(1)\nif mozi == 'RRS':\n print(1)\nelse:\n print(0)", "mozi = input()\nif mozi == 'RRR':\n print(3)\nelif mozi == 'RRS':\n print(2)\nelif mozi == 'SRR':\n print(2)\nelif mozi == 'SRS':\n print(1)\nelif mozi == 'SSR':\n print(1)\nelif mozi == 'RSS':\n print(1)\nelif mozi == 'RSR':\n print(1)\nelse:\n print(0)"]
['Wrong Answer', 'Accepted']
['s421443346', 's287584204']
[9108.0, 9048.0]
[28.0, 35.0]
[219, 262]
p02582
u105659451
2,000
1,048,576
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.
['S = input()\nif S=="RRR":\n print(3)\nelif S=="RRS":\n print(3)\nelif S=="RSS":\n print(1)\nelif S=="SSS":\n print(0)\nelif S=="RSR":\n print(1)\nelif S=="SRR":\n print(2)\nelif S=="SSR":\n print(1)\nelif S=="SRS":\n print(1)', 'S = input()\nif S=="RRR":\n print(3)\nelif S=="RRS":\n print(2)\nelif S=="RSS":\n print(1)\nelif S=="SSS":\n print(0)\nelif S=="RSR":\n print(1)\nelif S=="SRR":\n print(2)\nelif S=="SSR":\n print(1)\nelif S=="SRS":\n print(1)']
['Wrong Answer', 'Accepted']
['s570480538', 's074009517']
[8912.0, 9116.0]
[30.0, 32.0]
[233, 233]
p02582
u106816675
2,000
1,048,576
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.
['S = input()\ncnt = 0\n\n\nfor i in S:\n if i == "R":\n cnt += 1\n else:\n cnt = 0\n\n\nprint(cnt)\n', 'S = input()\n\nif S == "SSS":\n print(0)\n exit()\nelif S == "RSS" or S == "SRS" or S == "SSR" or S == "RSR":\n print(1)\n exit()\nelif S == "RRS" or S == "SRR":\n print(2)\n exit()\nelse:\n print(3)\n exit()\n']
['Wrong Answer', 'Accepted']
['s219615411', 's421468056']
[9100.0, 9032.0]
[33.0, 30.0]
[107, 220]
p02582
u112247039
2,000
1,048,576
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.
['x,k,d = map(int, input().split())\nx= abs(x)\nm= min(k,x//d)\nx -= m*d\nk -= m\nif k%2:\n x = abs(x-d)\nprint(x)', 'x,k,d = map(int, input().split())\nx = abs(x)\nm = min(k,x//d)\nx -= m*d\nk -= m\nif k%2: x = abs(x-d)\nprint(x)', "s = input()\nfor i in ['RRR','RR','R']:\n if i in s:\n print(len(i));break\nelse:\n print(0)"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s009037418', 's825708921', 's305619075']
[9120.0, 9168.0, 8916.0]
[27.0, 23.0, 28.0]
[106, 106, 100]
p02582
u117078923
2,000
1,048,576
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.
['s = input()\n\nif s=="RRR":\n print(3)\nelif s=="RRS" or s=="SRR":\n print(2)\nelif s=="SSR" or s=="SRS" or s=="RSS" or s="RSR":\n print(1)\nelse:\n print(0)', 's = input()\n\nif s=="RRR":\n print(3)\nelif s=="RRS" or s=="SRR":\n print(2)\nelif s=="SSR" or s=="SRS" or s=="RSS" or s=="RSR":\n print(1)\nelse:\n print(0)']
['Runtime Error', 'Accepted']
['s978997483', 's026686272']
[9012.0, 9032.0]
[30.0, 31.0]
[152, 153]
p02582
u122428774
2,000
1,048,576
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.
['s = input()\nif s.count("R"):\n if s.count("RR"):\n if s.count("RRR"):\n print(3)\n else:\n print(2)\n else:\n print(1)\nprint(0)\n', 's = input()\nif s.count("R"):\n if s.count("RR"):\n if s.count("RRR"):\n print(3)\n else:\n print(2)\n else:\n print(1)\nelse:\n print(0)\n']
['Wrong Answer', 'Accepted']
['s480463093', 's217391824']
[9088.0, 9088.0]
[36.0, 32.0]
[170, 180]
p02582
u123745130
2,000
1,048,576
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.
['s=input()\nif s=="RRR":\n print(3)\nelif s="RR":\n print(2)\nelif s="R":\n print(1)\nelse: print(0)\n', 's=input()\nif s=="RRR":\n print(3)\nelif s=="RR":\n print(2)\nelif s=="R":\n print(1)\nelse: print(0)\n', 's=input()\nif "RRR" in s:\n print(3)\nelif "RR" in s:\n print(2)\nelif "R" in s:\n print(1)\nelse: print(0)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s039197287', 's332824214', 's769998084']
[8796.0, 9092.0, 9080.0]
[26.0, 30.0, 30.0]
[102, 104, 110]
p02582
u128697000
2,000
1,048,576
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.
['code = input()\n\nif code == SSS:\n print(0)\nelif code == SSR or SRS or RSS or RSR:\n print(1)\nelif code == SRR or RRS:\n print(2)\nelse:\n print(3)', 'word = input()\nif word == "SSS":\n print(0)\nelif word == "RSS" or "SRS" or "SSR" or "RSR":\n print(1)\nelif word == "RRR":\n print(3)\nelse:\n print(2)', 'word = input()\nif word == "SSS":\n print(0)\nelif word == "RSS" or "SRS" or "SSR" or "RSR":\n print(1)\nelif word == "SRR" or "RRS":\n print(2)\nelse:\n print(3)\n', 'word = input()\nif word == "SSS":\n print(0)\nelif word == "RSS" or "SRS" or "SSR" or "RSR":\n print(1)\nelif word == "SRR" or "RRS":\n print(2)\nelif word == "RRR":\n print(3)\n', 'code = input()\n\nif code == SSS:\n print(0)\nelif code == SSR or SRS or RSS or RSR:\n print(1)\nelif code == SRR or RRS:\n print(2)\nelse:\n print(3)', 'x, y ,z = input()\nif x == "S" and y == "S" and z == "S":\n print(0)\nelif x =="S" and y=="R" and z=="R":\n print(2)\nelif x=="R" and y=="R" and z=="S":\n print(2)\nelif x=="R" and y=="R" and z=="R":\n print(3)\nelse:\n print(1)\n ']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s279067568', 's522221545', 's572789021', 's650883857', 's962967826', 's301855505']
[9096.0, 8888.0, 9084.0, 9084.0, 9032.0, 9112.0]
[25.0, 29.0, 30.0, 27.0, 24.0, 29.0]
[153, 158, 168, 182, 153, 239]
p02582
u129749062
2,000
1,048,576
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.
['import sys\nX, K, D = map(int,input().split())\ncnt = 0\na = X\nb = 0\ntmp = 0\nif X >= K*D:\n print(X - K*D)\n sys.exit()\nif K % 2 == 0:\n tmp = int(X/D)\n if tmp% 2 == 0:\n a = X - D*tmp\n else:\n a = X - D*tmp + D\n b = a - D*2\nelse:\n tmp = int(X/D)\n if tmp% 2 == 1:\n a = X - D*tmp\n else:\n a = X - D*tmp + D\n b = a - D*2\nprint(min(abs(a),abs(b)))\n', 'S = input()\nif "RRR" in S:\n print(3)\nelif "RR" in S:\n print(2)\nelif "R" in S:\n print(1)\nelse:\n print(0)']
['Runtime Error', 'Accepted']
['s928165310', 's377425441']
[9132.0, 9024.0]
[27.0, 31.0]
[358, 107]
p02582
u135331079
2,000
1,048,576
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.
["S = input()\nans = 0\n\nfor s in S:\n if s == 'R':\n ans += 1\n else:\n ans = 0\n\nprint(ans)", "S = input()\nans = 0\n\nif S == 'RSR':\n ans = 1\nelse:\n ans = S.count('R')\n\nprint(ans)\n"]
['Wrong Answer', 'Accepted']
['s211304930', 's227198380']
[8952.0, 9088.0]
[28.0, 32.0]
[104, 89]
p02582
u135389999
2,000
1,048,576
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.
['s = input()\nrain = 0\nans = 0\nfor i in s:\n if i == "R":\n rain += 1\n ans = max(ans, rain)\n else:\n rain = 0\nprint(rain)', 's = input()\nrain = 0\nans = 0\nfor i in s:\n if i == "R":\n rain += 1\n ans = max(ans, rain)\n else:\n rain = 0\nprint(ans)']
['Wrong Answer', 'Accepted']
['s522946712', 's607817305']
[9068.0, 9036.0]
[31.0, 29.0]
[127, 126]
p02582
u149475724
2,000
1,048,576
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.
['n = input()\n if n == "RRR":\n print("3")\n elif n[:2] == "RR" or n[1:] == "RR":\n print("2")\n elif n=="SSS":\n print("0")\n else:\n print("1")', 'n = input()\nif n == "RRR":\n print("3")\nelif n[:2] == "RR" or n[1:] == "RR":\n print("2")\nelif n=="SSS":\n print("0")\nelse:\n print("1")']
['Runtime Error', 'Accepted']
['s751707533', 's991884031']
[8844.0, 9028.0]
[28.0, 28.0]
[176, 144]
p02582
u153955689
2,000
1,048,576
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.
['s = input()\n\nfor i in range(1, 4):\n c = "R" * i\n if c in s:\n ans = c\n \nprint(ans)\n \n', 's = list(input())\n\nfor i in range(1, 4):\n c = "R" * i\n if c in s:\n ans = c\n \nprint(ans)\n ', "S = list(input())\n\nif 'RRR' in s:\n i = 3\nelif 'RR' in s:\n i = 2\nelif 'R' in s:\n i = 1\nelse:\n i = 0\nprint(i)", 's = list(input())\nans = 0\n\nfor i in range(1, 4):\n c = "R" * i\n if c in s:\n ans = c\n \nprint(ans)\n \n', "s = input()\n \nif 'RRR' in s:\n i = 3\nelif 'RR' in s:\n i = 2\nelif 'R' in s:\n i = 1\nelse:\n i = 0\nprint(i)"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s192506743', 's366529855', 's438704519', 's620128322', 's294215433']
[8880.0, 9080.0, 9028.0, 9048.0, 8936.0]
[24.0, 27.0, 23.0, 27.0, 30.0]
[93, 98, 111, 107, 106]
p02582
u159144188
2,000
1,048,576
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.
['S = input()\nif S = "RRR":\n print(3)\nelif "RR" in S:\n print(2)\nelif "R" in S:\n print(1)\nelse:\n print(0)', 'S = input()\nif S == "RRR":\n print(3)\nelif "RR" in S:\n print(2)\nelif "R" in S:\n print(1)\nelse:\n print(0)']
['Runtime Error', 'Accepted']
['s807349449', 's985521405']
[8884.0, 9020.0]
[25.0, 36.0]
[106, 107]
p02582
u161857931
2,000
1,048,576
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.
['S = input()\n\nif S.count("RRR") == 1 :\n print("3")\nelif S.count("RRR") == 1 :\n print("2")\nelse :\n if S.count("R") >= 1 :\n print("1")\n else :\n print("0")', 'S = input()\n\nif S.count("RRR") == 1 :\n print("3")\nelif S.count("RR") == 1 :\n print("2")\nelse :\n if S.count("R") >= 1 :\n print("1")\n else :\n print("0")']
['Wrong Answer', 'Accepted']
['s535087558', 's709673080']
[9096.0, 9064.0]
[26.0, 31.0]
[177, 176]
p02582
u162612857
2,000
1,048,576
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.
['\n\n\nR, C, k = list(map(int, input().split()))\nitems = [list(map(int, input().split())) for _ in range(k)]\n\ndp = [[[0 for _ in range(4)] for _ in range(C+1+1)] for _ in range(R+1+1)] \n\nitem_values = [[0 for _ in range(C+1+1)] for _ in range(R+1+1)]\n\nfor item in items:\n item_values[item[0]][item[1]] = item[2]\n\nfor r in range(1, R+1):\n for c in range(1, C+1):\n value_here = item_values[r][c]\n\n if value_here == 0:\n dp[r][c][0] = max(\n dp[r][c-1][0],\n max(dp[r-1][c])\n )\n dp[r][c][1] = dp[r][c-1][1]\n dp[r][c][2] = dp[r][c-1][2]\n dp[r][c][3] = dp[r][c-1][3]\n \n else:\n dp[r][c][0] = max(\n dp[r][c-1][0],\n max(dp[r-1][c])\n )\n dp[r][c][1] = max([\n dp[r][c-1][1],\n dp[r][c-1][0] + value_here,\n max(dp[r-1][c]) + value_here\n ])\n\n dp[r][c][2] = max(dp[r][c-1][2], dp[r][c-1][1] + value_here)\n dp[r][c][3] = max(dp[r][c-1][3], dp[r][c-1][2] + value_here)\n \nprint(max(dp[R][C]))\n\n# print(dp)\n', "s = input()\nif 'RRR' in s:\n print(3)\nelif 'RR' in s:\n print(2)\nelif 'R' in s:\n print(1)\nelse:\n print(0)\n\n"]
['Runtime Error', 'Accepted']
['s484689492', 's308753981']
[9344.0, 9080.0]
[27.0, 32.0]
[1300, 117]
p02582
u163393400
2,000
1,048,576
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.
["s=input()\ncount=0\nfor i in s:\n if i =='S':\n count+=1\nprint(count)\n ", "s=input()\ncount=0\nm=0\nfor i in range(len(s)):\n if s[i]=='R':\n count+=1\n else:\n if count > m :\n m=count\n count=0\nif count>m:\n m=count\nprint(m)\n "]
['Wrong Answer', 'Accepted']
['s912222900', 's187685001']
[9080.0, 8920.0]
[30.0, 28.0]
[84, 189]
p02582
u163501259
2,000
1,048,576
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.
["import sys\ninput = sys.stdin.readline\ndef main():\n S = input().rstrip()\n CNT = 0\n ans = 0\n for c in S:\n if c == 'R':\n CNT += 1\n else:\n ans = max(ans,CNT)\n CNT = 0\n print(ans)\n\n\nif __name__ == '__main__':\n main)", "import sys\ninput = sys.stdin.readline\ndef main():\n S = input().rstrip()\n CNT = 0\n ans = 0\n for c in S:\n if c == 'R':\n CNT += 1\n else:\n ans = max(ans,CNT)\n CNT = 0\n\n ans = max(ans,CNT)\n print(ans)\n\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Accepted']
['s769099264', 's874100339']
[9036.0, 9048.0]
[24.0, 31.0]
[275, 300]
p02582
u163543660
2,000
1,048,576
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.
["s=input()\n\nlist = list(s)\ncnt=0\nif list(0) == 'R' and list(1) == 'R' and list(2)=='R':\n print(3)\nelif list(0)=='R' and list(1) == 'R'and list(2)!='R':\n print(2)\nelif list(0)=='R' and list(1) != 'R'and list(2)!='R':\n print(1)\nelif list(0)=='R' and list(1) != 'R'and list(2)=='R':\n print(1)\nelif list(0)!='R' and list(1) == 'R' and list(2)=='R':\n print(2)\nelif list(0)!='R' and list(1) != 'R' and list(2)=='R':\n print(1)\nelif list(0)!='R' and list(1) == 'R' and list(2)!='R':\n print(1)\nelse:\n print(0)", "s=input()\n\nlist = list(s)\ncnt=0\nif list[0] == 'R' and list[1] == 'R' and list[2]=='R':\n print(3)\nelif list[0]=='R' and list[1] == 'R'and list[2]!='R':\n print(2)\nelif list[0]=='R' and list[1] != 'R'and list[2]!='R':\n print(1)\nelif list[0]=='R' and list[1] != 'R'and list[2]=='R':\n print(1)\nelif list[0]!='R' and list[1] == 'R' and list[2]=='R':\n print(2)\nelif list[0]!='R' and list[1] != 'R' and list[2]=='R':\n print(1)\nelif list[0]!='R' and list[1] == 'R' and list[2]!='R':\n print(1)\nelse:\n print(0)"]
['Runtime Error', 'Accepted']
['s822488436', 's566194559']
[9108.0, 9176.0]
[27.0, 28.0]
[523, 523]
p02582
u166057331
2,000
1,048,576
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.
["a = input(str)\n\nif a[0]=='R' and a[1]=='R' and a[2]=='R':\n res = 3\nelif a[0]=='R' and a[1]=='R':\n res = 2\nelif a[1]=='R' and a[2]=='R':\n res = 2 \nelif a[0]=='R':\n res = 1\nelif a[1]=='R':\n res = 1\nelif a[2]=='R':\n res = 1 \nelse:\n res = 0\n \nprint(res)", "a = input()\n\nif a[0]=='R' and a[1]=='R' and a[2]=='R':\n res = 3\nelif a[0]=='R' and a[1]=='R':\n res = 2\nelif a[1]=='R' and a[2]=='R':\n res = 2 \nelif a[0]=='R':\n res = 1\nelif a[1]=='R':\n res = 1\nelif a[2]=='R':\n res = 1 \nelse:\n res = 0\n\nres = int(res)\nprint(res)"]
['Wrong Answer', 'Accepted']
['s660952818', 's137405247']
[9068.0, 9044.0]
[29.0, 31.0]
[262, 273]
p02582
u170410075
2,000
1,048,576
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.
["s=input()\nc=0\ntmp=0\nfor i in range(3):\n if s[i]=='s':\n tmp+=1\n if c<tmp:\n c=tmp\n else:\n tmp=0\nprint(c)", "s=input()\nc=0\ntmp=0\nfor i in range(3):\n if s[i]='s':\n tmp+=1\n if c<tmp:\n c=tmp\n else:\n tmp=0\nprint(c)", "s=input()\nc=0\ntmp=0\nfor i in range(3):\n if s[i]='S':\n tmp+=1\n if c<tmp:\n c=tmp\n else:\n tmp=0\nprint(c)", "s=input()\nc=0\ntmp=0\nfor i in range(3):\n if s[i]=='R':\n tmp+=1\n if c<tmp:\n c=tmp\n else:\n tmp=0\nprint(c)"]
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s102918654', 's286245183', 's934893760', 's649188398']
[8984.0, 8952.0, 9008.0, 9040.0]
[28.0, 21.0, 23.0, 27.0]
[140, 139, 139, 140]
p02582
u174404613
2,000
1,048,576
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.
['s=input()\nif ("RRR" in s):\n print(3)\nif ("RR" in s):\n print(2)\nif ("R" in s):\n print(3)\nprint(0)', 's=input()\nif ("RRR" in s):\n print(3)\nelif ("RR" in s):\n print(2)\nelif ("R" in s):\n print(1)\nelse:\n print(0)\n']
['Wrong Answer', 'Accepted']
['s294882096', 's793898876']
[9092.0, 8928.0]
[34.0, 32.0]
[99, 112]
p02582
u180776099
2,000
1,048,576
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.
['cnt = 0\nt = list(input())\nfor i in range(len(t)):\n print(len(t))\n if i == 1:\n if t[i] == "R":\n cnt += 1\n if i != 1:\n if t[i] == "R" and t[i-1] == "R":\n cnt += 1\n if t[i] == "R" and t[i-1] == "S":\n cnt = 1\n else:\n cnt = 0\nprint(cnt)', 'cnt = 0\nt = input()\nfor i in range(len(t)):\n if i == 1:\n if t[i] == "R":\n cnt += 1\n if i != 1:\n if t[i] == "R" and t[i-1] == "R":\n cnt += 1\n if t[i] == "R" and t[i-1] == "S":\n cnt = 1\n else:\n cnt = 0\nprint(cnt)', 'cnt = 0\nt = list(input())\nfor i in range(len(t)):\n if "R" * i in t:\n cnt = i\nprint(cnt)\n', 'cnt = 0\nt = list(input())\nfor i in range(len(t)):\n if "R" * (i + 1) in t:\n cnt = i + 1\nprint(cnt)', 'cnt = 0\nt = input().split()\nfor i in range(len(t)):\n print(len(t))\n if i == 1:\n if t[i] == "R":\n cnt += 1\n if i != 1:\n if t[i] == "R" and t[i-1] == "R":\n cnt += 1\n if t[i] == "R" and t[i-1] == "S":\n cnt = 1\n else:\n cnt = 0\nprint(cnt)', 'cnt = 0\nt = input()\nfor i in range(len(t)):\n if "R" * (i + 1) in t:\n print(cnt)\n cnt = i + 1\nprint(cnt)\n', 'cnt = 0\nt = input()\nfor i in range(len(t)):\n if "R" * (i + 1) in t:\n\n cnt = i + 1\nprint(cnt)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s088677936', 's169267322', 's362798030', 's464023155', 's503600065', 's994150332', 's639814596']
[8876.0, 8976.0, 8928.0, 8952.0, 8996.0, 8996.0, 8960.0]
[26.0, 25.0, 28.0, 25.0, 28.0, 27.0, 35.0]
[312, 288, 98, 107, 314, 121, 102]
p02582
u185042816
2,000
1,048,576
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.
["N, K = map(int, input().split())\nP = list(map(int, input().split()))\nC = list(map(int, input().split()))\n \nans = -float('inf')\nfor s in range(N):\n S = [] \n i = P[s] - 1\n S.append(C[i])\n while i != s:\n i = P[i] - 1\n S.append(S[-1] + C[i])\n \n if K <= len(S):\n score = max(S[:K])\n elif S[-1] <= 0:\n score = max(S)\n else:\n score1 = S[-1] * (K // len(S) - 1)\n score1 += max(S)\n score2 = S[-1] * (K // len(S))\n r = K % len(S)\n if r != 0:\n score2 += max(0, max(S[:r]))\n score = max(score1, score2)\n \n ans = max(ans, score)\n \nprint(ans)\n", 'data = input()\n\nif data[0]=="R" and data[1]=="R" and data[2]=="R":\n print(3)\nelif (data[0]=="R" and data[1]=="R") or (data[1]=="R" and data[2]=="R"):\n print(2)\nelif data[0]=="R" or data[1]=="R" or data[2]=="R":\n print(1)\nelse:\n print(0)']
['Runtime Error', 'Accepted']
['s203167620', 's810343870']
[9100.0, 9060.0]
[30.0, 25.0]
[634, 248]
p02582
u185354171
2,000
1,048,576
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.
['s=input()\nif s=="SSS":\n print(0)\nelse if s=="RRS" or s== "SRR":\n print(2)\nelse if s== "RRR":\n print(3)\nelse:\n print(1)', 's=input()\nif s=="SSS":\n print(0)\nelse if s=="RRS" or s= "SRR":\n print(2)\nelse if s= "RRR":\n print(3)\nelse:\n print(1)', 's=input()\nif s=="SSS":\n print(0)\nelif s=="RRS" or s== "SRR":\n print(2)\nelif s== "RRR":\n print(3)\nelse:\n print(1)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s178936389', 's361200438', 's382253827']
[8948.0, 8924.0, 8992.0]
[32.0, 25.0, 27.0]
[122, 120, 116]
p02582
u190167135
2,000
1,048,576
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.
["S=input()\nS='RRR'\nif S=='SSS':\n print(0)\nif S=='RSS' or S=='SRS' or S=='SSR' or S=='RSR':\n print(1)\nif S=='RRS' or S=='SRR':\n print(2)\nif S=='RRR':\n print(3)", "if S=='SSS':\n print(0)\nif S=='RSS' or S=='SRS' or S=='SSR' or S=='RSR':\n print(1)\nif S=='RRS' or S=='SRR':\n print(2)\nif S=='RRR':\n print(3)", "S=input()\nif S=='SSS':\n print(0)\nif S=='RSS' or S=='SRS' or S=='SSR' or S=='RSR':\n print(1)\nif S=='RRS' or S=='SRR':\n print(2)\nif S=='RRR':\n print(3)"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s458992262', 's650591395', 's568860549']
[9096.0, 9088.0, 8852.0]
[29.0, 27.0, 33.0]
[161, 143, 153]
p02582
u190385778
2,000
1,048,576
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.
['for r in S:\n if rrr in S:\n return(3)\n elif rr in S:\n return(2)\n elif: r in S:\n return(1)\n else:\n return(0)\n \n ', "s= input()\n\nif 'RRR' in s:\n print(3)\n \n\nelif 'RR' in s:\n print(2)\n \nelif 'R' in s:\n print(1)\nelse:\n print(0)"]
['Runtime Error', 'Accepted']
['s515013738', 's991132182']
[8856.0, 8996.0]
[23.0, 25.0]
[136, 126]
p02582
u191386074
2,000
1,048,576
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.
['x, k, d = map(int, input().split(" "))\n\ndef y(l): return abs(x + l * d - (k - l) * d)\n\nlf = max(0, (k - x / d) / 2)\nl = int(lf)\nif lf - l > 0 and l + 1 <= k:\n print(min(y(l), y(l + 1)))\nelse:\n print(y(l))\n', 'print({\n "SSS": 0,\n "SSR": 1,\n "SRS": 1,\n "SRR": 2,\n "RSS": 1,\n "RSR": 1,\n "RRS": 2,\n "RRR": 3,\n}[input()])\n']
['Runtime Error', 'Accepted']
['s849435743', 's956644723']
[9180.0, 9076.0]
[21.0, 28.0]
[211, 132]
p02582
u192627933
2,000
1,048,576
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.
['n = 0\nS = Input()\nfor i in range(0,len(S)):\n if i==0:\n if S[i]=="R":\n n += 1\n if i==1:\n if S[i]=="R":\n n += 1\n else:\n n = 0\n if i==2:\n if S[i]=="R":\n n += 1\n else:\n continue\nprint(n)', 'def judge(S):\n n = 0\n \n for i in range(0,len(S)):\n if i==0:\n if S[i]=="R":\n n += 1\n if i==1:\n if S[i]=="R":\n n += 1\n else:\n n = 0\n if i==2:\n if S[i]=="R":\n n += 1\n else:\n continue\n \n return n', 'n = 0\nS = input()\nfor i in range(0,len(S)):\n if i==0:\n if S[i]=="R":\n n += 1\n if i==1:\n if S[i]=="R":\n n += 1\n else:\n n = 0\n if i==2:\n if S[i]=="R":\n n += 1\n else:\n continue\n if S == "RSS":\n n = 1\nprint(n)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s603996083', 's922754410', 's370660324']
[9104.0, 9108.0, 9060.0]
[29.0, 28.0, 26.0]
[281, 369, 314]