message stringlengths 2 19.9k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 322 108k | cluster float64 15 15 | __index_level_0__ int64 644 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 68,199 | 15 | 136,398 |
Tags: graphs
Correct Solution:
```
n, k = map(int, input().split())
ls = list(map(int, input().split()))
last = {}
for i in range(k-1, -1, -1):
try: last[ls[i]]+=0
except: last[ls[i]] = i
_list = []
for i in range(k):
_list.append(ls[i])
try:
if last[ls[i]+1]>i: _list.append((ls[i], ls[i]+1))
... | output | 1 | 68,199 | 15 | 136,399 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some cell on the line, and Bob tries to guess where ... | instruction | 0 | 68,200 | 15 | 136,400 |
Tags: graphs
Correct Solution:
```
n, k = [int(x) for x in input().split(' ')]
questions = [int(x) for x in input().split(' ')]
total = 3 * n - 2
visited_combo = {}
visited = [0] * (n+1)
for i in range(k):
q = questions[i]
if not visited[q]:
visited[q] = 1
total -= 1
visited_combo[(q,... | output | 1 | 68,200 | 15 | 136,401 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 68,201 | 15 | 136,402 |
Yes | output | 1 | 68,201 | 15 | 136,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 68,202 | 15 | 136,404 |
Yes | output | 1 | 68,202 | 15 | 136,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 68,203 | 15 | 136,406 |
Yes | output | 1 | 68,203 | 15 | 136,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 68,204 | 15 | 136,408 |
Yes | output | 1 | 68,204 | 15 | 136,409 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 68,205 | 15 | 136,410 |
No | output | 1 | 68,205 | 15 | 136,411 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 68,206 | 15 | 136,412 |
No | output | 1 | 68,206 | 15 | 136,413 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 68,207 | 15 | 136,414 |
No | output | 1 | 68,207 | 15 | 136,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.
Alice initially has a token on some ... | instruction | 0 | 68,208 | 15 | 136,416 |
No | output | 1 | 68,208 | 15 | 136,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner ... | instruction | 0 | 68,225 | 15 | 136,450 |
Tags: math, number theory
Correct Solution:
```
def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
n,m,q=[int(x) for x in input().split()]
g=gcd(n,m)
l=n*m//g
for _ in range(q):
a,b,c,d=[int(x) for x in input().split()]
if a==1:
b*=m
else:
b*=n
if c==1:
d*=m
... | output | 1 | 68,225 | 15 | 136,451 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner ... | instruction | 0 | 68,226 | 15 | 136,452 |
Tags: math, number theory
Correct Solution:
```
def mp():
return map(int, input().split())
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
n, m, q = mp()
st = gcd(n, m)
stn = n // st
stm = m // st
for qq in range(q):
s, x, e, y = mp()
if s == 1:
x = (x + stn - 1) // ... | output | 1 | 68,226 | 15 | 136,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner ... | instruction | 0 | 68,227 | 15 | 136,454 |
Tags: math, number theory
Correct Solution:
```
import sys
import math
n, m, q = map(int, input().split())
g = math.gcd(n, m)
ds = [None, n // g, m // g]
buf = []
for line in sys.stdin:
sx, sy, ex, ey = map(int, line.split())
s_area = (sy - 1) // ds[sx]
e_area = (ey - 1) // ds[ex]
buf.append('yes' if s... | output | 1 | 68,227 | 15 | 136,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner ... | instruction | 0 | 68,228 | 15 | 136,456 |
Tags: math, number theory
Correct Solution:
```
from math import gcd
n, m, q = map(int, input().split())
d = gcd(n, m)
c = [n//d, m//d]
for _ in range(q):
sx, sy, ex, ey = map(int, input().split())
print("YES" if (sy - 1) // c[sx - 1] == (ey - 1) // c[ex - 1] else "NO")
``` | output | 1 | 68,228 | 15 | 136,457 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner ... | instruction | 0 | 68,229 | 15 | 136,458 |
Tags: math, number theory
Correct Solution:
```
def gcd(a,b):
if(b==0):
return a
else:
return gcd(b,a%b)
n,m,q = [int(x) for x in input().split()]
N = (n * m)//gcd(n,m)
one,two = N//m,N//n
for _ in range(q):
sx,sy,ex,ey = [int(x) for x in input().split()]
if sx==1:
sy=(sy-1)//one;
els... | output | 1 | 68,229 | 15 | 136,459 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner ... | instruction | 0 | 68,230 | 15 | 136,460 |
Tags: math, number theory
Correct Solution:
```
import sys
input = sys.stdin.readline
n, m, q = list(map(int, input().split()))
def computeGCD(x, y):
while(y):
x, y = y, x % y
return x
gcd = computeGCD(n, m)
factorN = n // gcd
factorM = m // gcd
for _ in range(q):
sx, sy, ex, ey = list(map(in... | output | 1 | 68,230 | 15 | 136,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner ... | instruction | 0 | 68,231 | 15 | 136,462 |
Tags: math, number theory
Correct Solution:
```
from sys import stdin
def gcd(a,b):
while b!=0:
t=int(a)
a=int(b)
b=t%a
return int(a)
def lcm(a, b):
return int((a*b)/gcd(a, b))
n,m,q=map(int,stdin.readline().strip().split())
b=lcm(n,m)//n
a=lcm(n,m)//m
for i in range(q):
x,y,x1,y... | output | 1 | 68,231 | 15 | 136,463 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner ... | instruction | 0 | 68,232 | 15 | 136,464 |
Tags: math, number theory
Correct Solution:
```
import math
n,m,q=map(int,input().split())
c1=n//math.gcd(n,m)
c2=m//math.gcd(n,m)
for _ in range(q):
ang1=0
ang2=0
x,y,x2,y2=map(int,input().split())
y-=1
y2-=1
if(x==1):
ang1=y//c1
else:
ang1=y//c2
if(x2==2):
ang2=... | output | 1 | 68,232 | 15 | 136,465 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists be... | instruction | 0 | 68,234 | 15 | 136,468 |
Yes | output | 1 | 68,234 | 15 | 136,469 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists be... | instruction | 0 | 68,235 | 15 | 136,470 |
Yes | output | 1 | 68,235 | 15 | 136,471 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists be... | instruction | 0 | 68,237 | 15 | 136,474 |
No | output | 1 | 68,237 | 15 | 136,475 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists be... | instruction | 0 | 68,238 | 15 | 136,476 |
No | output | 1 | 68,238 | 15 | 136,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists be... | instruction | 0 | 68,240 | 15 | 136,480 |
No | output | 1 | 68,240 | 15 | 136,481 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:
* 'U': go up,... | instruction | 0 | 68,445 | 15 | 136,890 |
Tags: binary search, implementation, math
Correct Solution:
```
target = tuple(map(int, input().split()))
s = input()
#print(target)
#print(s)
ok = False
pos = (0, 0)
for c in s:
if c == 'L': pos = (pos[0]-1, pos[1])
if c == 'R': pos = (pos[0]+1, pos[1])
if c == 'U': pos = (pos[0], pos[1]+1)
if c == '... | output | 1 | 68,445 | 15 | 136,891 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:
* 'U': go up,... | instruction | 0 | 68,446 | 15 | 136,892 |
Tags: binary search, implementation, math
Correct Solution:
```
# https://codeforces.com/problemset/problem/321/A
def reachable(target, position, vector):
x, y = vector
dx = target[0] - position[0]
dy = target[1] - position[1]
if x == y == dx == dy == 0:
return True
if x == 0:
if ... | output | 1 | 68,446 | 15 | 136,893 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:
* 'U': go up,... | instruction | 0 | 68,447 | 15 | 136,894 |
Tags: binary search, implementation, math
Correct Solution:
```
a,b = map(int,input().split())
s = list(input())
dist = a*a + b*b
lis=[[0,0]]
ver=hor=0
for i in s:
if i=='U':
ver+=1
elif i=='D':
ver-=1
elif i=='R':
hor+=1
else:
hor-=1
lis.append([hor,ver])
flag=1
if ... | output | 1 | 68,447 | 15 | 136,895 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:
* 'U': go up,... | instruction | 0 | 68,448 | 15 | 136,896 |
Tags: binary search, implementation, math
Correct Solution:
```
#http://codeforces.com/problemset/problem/321/A
import logging as log
class Point(object):
def __init__(self, x,y):
self.x, self.y = x, y
def __str__(self):
return "({}, {})".format(self.x, self.y)
def __add__(self, other):
#add 2 points t... | output | 1 | 68,448 | 15 | 136,897 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:
* 'U': go up,... | instruction | 0 | 68,449 | 15 | 136,898 |
Tags: binary search, implementation, math
Correct Solution:
```
a, b = map(int, input().split())
s = input()
p = [[0, 0]]
d = {'R': (1, 0), 'L': (-1, 0), 'U': (0, 1), 'D': (0, -1)}
for c in s:
p.append([p[-1][0] + d[c][0], p[-1][1] + d[c][1]])
px, py = p[-1][0], p[-1][1]
for x, y in p:
k = 0
if px:
... | output | 1 | 68,449 | 15 | 136,899 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:
* 'U': go up,... | instruction | 0 | 68,450 | 15 | 136,900 |
Tags: binary search, implementation, math
Correct Solution:
```
import sys
ox,oy = map(int,sys.stdin.readline().split()) # original position
s= sys.stdin.readline()
h = 0
v = 0
# here we calculate the distance to target position after one simulation
for i in range (len(s)):
if s[i] == 'R':
h+=1
if s[i]... | output | 1 | 68,450 | 15 | 136,901 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:
* 'U': go up,... | instruction | 0 | 68,451 | 15 | 136,902 |
Tags: binary search, implementation, math
Correct Solution:
```
go = {'U' : (0, 1), 'D' : (0, -1), 'R' : (1, 0), 'L' : (-1, 0)}
a, b = map(int, input().split())
s = input()
dx = dy = x = y = cx = cy = 0
for c in s:
dx += go[c][0]
dy += go[c][1]
ans = a == b == 0
for c in s:
x += go[c][0]
y += go[c][1]
... | output | 1 | 68,451 | 15 | 136,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:
* 'U': go up,... | instruction | 0 | 68,452 | 15 | 136,904 |
Tags: binary search, implementation, math
Correct Solution:
```
R = lambda: map(int, input().split())
a, b = R()
cs = [[0, 0]]
d = {'R': (1, 0), 'L': (-1, 0), 'U': (0, 1), 'D': (0, -1)}
for c in input():
cs.append([cs[-1][0] + d[c][0], cs[-1][1] + d[c][1]])
px, py = cs[-1][0], cs[-1][1]
for x, y in cs:
k = 0
... | output | 1 | 68,452 | 15 | 136,905 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There ar... | instruction | 0 | 68,453 | 15 | 136,906 |
Yes | output | 1 | 68,453 | 15 | 136,907 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There ar... | instruction | 0 | 68,454 | 15 | 136,908 |
Yes | output | 1 | 68,454 | 15 | 136,909 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There ar... | instruction | 0 | 68,455 | 15 | 136,910 |
Yes | output | 1 | 68,455 | 15 | 136,911 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There ar... | instruction | 0 | 68,456 | 15 | 136,912 |
Yes | output | 1 | 68,456 | 15 | 136,913 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There ar... | instruction | 0 | 68,457 | 15 | 136,914 |
No | output | 1 | 68,457 | 15 | 136,915 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There ar... | instruction | 0 | 68,458 | 15 | 136,916 |
No | output | 1 | 68,458 | 15 | 136,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There ar... | instruction | 0 | 68,459 | 15 | 136,918 |
No | output | 1 | 68,459 | 15 | 136,919 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There ar... | instruction | 0 | 68,460 | 15 | 136,920 |
No | output | 1 | 68,460 | 15 | 136,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at th... | instruction | 0 | 69,071 | 15 | 138,142 |
Tags: binary search, data structures, dfs and similar, greedy, implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
s = input()
n = len(s)
ind = [0]
for i in range(n):
if s[i] == "R":
ind.append(1+i)
ind.append(n+1)
d = 0
for i ... | output | 1 | 69,071 | 15 | 138,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at th... | instruction | 0 | 69,072 | 15 | 138,144 |
Tags: binary search, data structures, dfs and similar, greedy, implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
s = input()
gl,ll = 1,1
for i in s:
if i=="L":
ll += 1
else:
gl = max(ll,gl)
ll = 1
gl = max(ll,gl)
print(gl... | output | 1 | 69,072 | 15 | 138,145 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at th... | instruction | 0 | 69,073 | 15 | 138,146 |
Tags: binary search, data structures, dfs and similar, greedy, implementation
Correct Solution:
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2020/3/12 22:30
@Author : Yuki
@File : C.py
@Software: PyCharm
@E-main : fujii20180311@foxmail.com
"""
n = int(input())
for i in range(n):
path = inpu... | output | 1 | 69,073 | 15 | 138,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at th... | instruction | 0 | 69,074 | 15 | 138,148 |
Tags: binary search, data structures, dfs and similar, greedy, implementation
Correct Solution:
```
def main():
def is_ok(mid, S):
flag = True
from collections import Counter
cur = Counter(S[:mid])
for i in range(len(S)-mid+1):
if mid <= cur["L"]:
flag = F... | output | 1 | 69,074 | 15 | 138,149 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at th... | instruction | 0 | 69,075 | 15 | 138,150 |
Tags: binary search, data structures, dfs and similar, greedy, implementation
Correct Solution:
```
def find(val):
li = list(val)
li.append("R")
li = ["R"] +li
index = 0
ans = float('-inf')
for i in range(len(li)):
if li[i] =="R":
ans = max(ans,i-index)
index = i
return ans
x = int(input())
for i in ... | output | 1 | 69,075 | 15 | 138,151 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at th... | instruction | 0 | 69,076 | 15 | 138,152 |
Tags: binary search, data structures, dfs and similar, greedy, implementation
Correct Solution:
```
import sys
import math
#sys.stdin=open("input.in","r")
#sys.stdout=open("output.out","w")
for _ in range(int(input())):
s=list(input())
s.insert(0,"R")
s.append("R")
m=-1
prev=0
for i in range(1,l... | output | 1 | 69,076 | 15 | 138,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at th... | instruction | 0 | 69,077 | 15 | 138,154 |
Tags: binary search, data structures, dfs and similar, greedy, implementation
Correct Solution:
```
for _ in range(int(input())):
s=input()
a=t=0
res='R'+s+'R'
for i in range(len(res)):
if res[i]=='R':
if a<i-t:
a=i-t
t=i
print(a)
``` | output | 1 | 69,077 | 15 | 138,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the frog is staying at th... | instruction | 0 | 69,078 | 15 | 138,156 |
Tags: binary search, data structures, dfs and similar, greedy, implementation
Correct Solution:
```
t=int(input())
for you in range(t):
l=input()
li=[0]
for i in range(len(l)):
if(l[i]=='R'):
li.append(i+1)
li.append(len(l)+1)
lo=[]
for i in range(len(li)-1):
lo.app... | output | 1 | 69,078 | 15 | 138,157 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or ... | instruction | 0 | 69,079 | 15 | 138,158 |
Yes | output | 1 | 69,079 | 15 | 138,159 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or ... | instruction | 0 | 69,080 | 15 | 138,160 |
Yes | output | 1 | 69,080 | 15 | 138,161 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a frog staying to the left of the string s = s_1 s_2 β¦ s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or ... | instruction | 0 | 69,081 | 15 | 138,162 |
Yes | output | 1 | 69,081 | 15 | 138,163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.