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.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r rows and c columns. Some of these cells contain r... | instruction | 0 | 75,114 | 15 | 150,228 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt
import unittest
def read_int():
return int(input().strip())
def read_int_array():
return [int(i) for i in input()... | output | 1 | 75,114 | 15 | 150,229 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r rows and c columns. Some of these cells contain r... | instruction | 0 | 75,115 | 15 | 150,230 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
t=int(input())
alp='0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'
for _ in range(t):
count=0
R,C,k=list(map(int,input().split()))
arr=[]
for i in range(R):
arr.append(input())
final=[['0' for _ in r... | output | 1 | 75,115 | 15 | 150,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r rows and c columns. Some of these cells contain r... | instruction | 0 | 75,116 | 15 | 150,232 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
from functools import reduce
import string
class IoTool: # a tool for input redirection
DEBUG = 0
def _read_dbg():
with open('./input.txt', 'r') as f:
lines = f.readlines()
for l in lines: yield l.strip() ... | output | 1 | 75,116 | 15 | 150,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r rows and c columns. Some of these cells contain r... | instruction | 0 | 75,117 | 15 | 150,234 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
R, C, K = map(int, input().split())
state = [list(input().rstrip()) for _ in range(R)]
Query.append((R, C, K, state))
Alp = [chr(i) for i in rang... | output | 1 | 75,117 | 15 | 150,235 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r ro... | instruction | 0 | 75,118 | 15 | 150,236 |
Yes | output | 1 | 75,118 | 15 | 150,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r ro... | instruction | 0 | 75,119 | 15 | 150,238 |
Yes | output | 1 | 75,119 | 15 | 150,239 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r ro... | instruction | 0 | 75,120 | 15 | 150,240 |
Yes | output | 1 | 75,120 | 15 | 150,241 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r ro... | instruction | 0 | 75,121 | 15 | 150,242 |
Yes | output | 1 | 75,121 | 15 | 150,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r ro... | instruction | 0 | 75,122 | 15 | 150,244 |
No | output | 1 | 75,122 | 15 | 150,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r ro... | instruction | 0 | 75,123 | 15 | 150,246 |
No | output | 1 | 75,123 | 15 | 150,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r ro... | instruction | 0 | 75,124 | 15 | 150,248 |
No | output | 1 | 75,124 | 15 | 150,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.
His farm is presented by a rectangle grid with r ro... | instruction | 0 | 75,125 | 15 | 150,250 |
No | output | 1 | 75,125 | 15 | 150,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a rectangular table 3 Γ n. Each cell contains an integer. You can move from one cell to another if they share a side.
Find such path from the upper left cell to the bottom right cell of the table that doesn't visit any of the ... | instruction | 0 | 75,548 | 15 | 151,096 |
Tags: dp, greedy, implementation
Correct Solution:
```
import sys
from array import array # noqa: F401
import typing as Tp # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
def output(*args):
sys.stdout.buffer.write(
('\n'.join(map(str, args)) + '\n').encode('utf-8')
... | output | 1 | 75,548 | 15 | 151,097 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a rectangular table 3 Γ n. Each cell contains an integer. You can move from one cell to another if they share a side.
Find such path from the upper left cell to the bottom right c... | instruction | 0 | 75,549 | 15 | 151,098 |
No | output | 1 | 75,549 | 15 | 151,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a rectangular table 3 Γ n. Each cell contains an integer. You can move from one cell to another if they share a side.
Find such path from the upper left cell to the bottom right c... | instruction | 0 | 75,552 | 15 | 151,104 |
No | output | 1 | 75,552 | 15 | 151,105 |
Provide a correct Python 3 solution for this coding contest problem.
A robot in a two-dimensional maze again. The maze has an entrance and an exit this time, though.
Just as in the previous problem, the maze is made up of H Γ W grid cells, its upper side faces north, and each cell is either empty or wall. Unlike the ... | instruction | 0 | 75,856 | 15 | 151,712 |
"Correct Solution:
```
from heapq import heappush, heappop
import sys
readline = sys.stdin.readline
write = sys.stdout.write
dd = ((-1, 0), (0, -1), (1, 0), (0, 1))
def solve():
H, W, N = map(int, readline().split())
if H == 0:
return False
S = readline().strip()
C = [[0]*W for i in range(H)]
... | output | 1 | 75,856 | 15 | 151,713 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya loves training spiders. Petya has a board n Γ m in size. Each cell of the board initially has a spider sitting on it. After one second Petya chooses a certain action for each spider... | instruction | 0 | 75,917 | 15 | 151,834 |
No | output | 1 | 75,917 | 15 | 151,835 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya loves training spiders. Petya has a board n Γ m in size. Each cell of the board initially has a spider sitting on it. After one second Petya chooses a certain action for each spider... | instruction | 0 | 75,918 | 15 | 151,836 |
No | output | 1 | 75,918 | 15 | 151,837 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya loves training spiders. Petya has a board n Γ m in size. Each cell of the board initially has a spider sitting on it. After one second Petya chooses a certain action for each spider... | instruction | 0 | 75,919 | 15 | 151,838 |
No | output | 1 | 75,919 | 15 | 151,839 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya loves training spiders. Petya has a board n Γ m in size. Each cell of the board initially has a spider sitting on it. After one second Petya chooses a certain action for each spider... | instruction | 0 | 75,920 | 15 | 151,840 |
No | output | 1 | 75,920 | 15 | 151,841 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem
You are given a grid nΓ n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of row x and column y, is d... | instruction | 0 | 75,953 | 15 | 151,906 |
Tags: implementation, interactive
Correct Solution:
```
#!/usr/bin/python3
import math
import sys
DEBUG = False
def inp():
return sys.stdin.readline().rstrip()
def dprint(*value, sep=' ', end='\n'):
if DEBUG:
print(*value, sep=sep, end=end)
def readi():
n = int(inp())
dprint('read', n)
... | output | 1 | 75,953 | 15 | 151,907 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem
You are given a grid nΓ n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of row x and column y, is d... | instruction | 0 | 75,954 | 15 | 151,908 |
Tags: implementation, interactive
Correct Solution:
```
import sys
def query(x1, y1, x2, y2):
print("?", x1, y1, x2, y2)
sys.stdout.flush()
odp = int(input())
return odp
n = int(input())
mat = [[2 for c in range(n + 1)] for r in range(n + 1)]
mat[1][1] = 1
mat[n][n] = 0
for d in range(1, n - 1):
odp... | output | 1 | 75,954 | 15 | 151,909 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem
You are given a grid nΓ n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of row x and column y, is d... | instruction | 0 | 75,955 | 15 | 151,910 |
Tags: implementation, interactive
Correct Solution:
```
import sys
def req(a, b, c, d):
print("?", a+1, b+1, c+1, d+1)
sys.stdout.flush()
return int(input())
n = int(input())
r = [[0]*n for _ in range(n)]
def tt(xx, yy, x, y):
if xx > x or yy > y:
q = req(x, y, xx, yy)
else:
q = req(xx, yy, x, y)
... | output | 1 | 75,955 | 15 | 151,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem
You are given a grid nΓ n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of row x and column y, is d... | instruction | 0 | 75,956 | 15 | 151,912 |
Tags: implementation, interactive
Correct Solution:
```
import sys
input = sys.stdin.readline
n=int(input())
ANS=[[-1]*(n+1) for i in range(n+1)]
ANS[1][1]=1
ANS[n][n]=0
for i in range(1,n+1):
for j in range(1,n+1):
if (i+j)%2==1:
continue
if i==j==1 or i==j==n:
continue
... | output | 1 | 75,956 | 15 | 151,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem
You are given a grid nΓ n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of row x and column y, is d... | instruction | 0 | 75,957 | 15 | 151,914 |
Tags: implementation, interactive
Correct Solution:
```
n = int(input())
a=[]
for i in range(0,n+1):
temp= [0]*(n+1)
a.append(temp)
a[1][1]=1
def ask(x1,y1,x2,y2):
print("?",x1,y1,x2,y2)
a= int(input())
if a:
return True
else:
False
for i in range(3,n+1,1):
a[1][i] = a[1][i-... | output | 1 | 75,957 | 15 | 151,915 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem
You are given a grid nΓ n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of row x and column y, is d... | instruction | 0 | 75,958 | 15 | 151,916 |
Tags: implementation, interactive
Correct Solution:
```
import math
import sys
# helpful:
# r,g,b=map(int,input().split())
#list1 = input().split()
#for i in range(len(list1)):
# list1[i] = int(list1[i])
# print(list1)
# arr = [[0 for x in range(columns)] for y in range(rows)]
n = int(input())
arr = [[-1 for x in ra... | output | 1 | 75,958 | 15 | 151,917 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem
You are given a grid nΓ n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of row x and column y, is d... | instruction | 0 | 75,959 | 15 | 151,918 |
Tags: implementation, interactive
Correct Solution:
```
import sys
def ask(x1, y1, x2, y2):
print(f'? {x1} {y1} {x2} {y2}')
inp = int(input())
sys.stdout.flush()
return inp
def main():
# sys.stdin = open("in.txt", "r")
# sys.stdout = open("out.txt", "w")
# it = iter(map(int, sys.stdin.r... | output | 1 | 75,959 | 15 | 151,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem
You are given a grid nΓ n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of row x and column y, is d... | instruction | 0 | 75,960 | 15 | 151,920 |
Tags: implementation, interactive
Correct Solution:
```
def main():
import sys
input = sys.stdin.readline
def interact(x1, y1, x2, y2):
print('?',x1, y1, x2, y2, flush=True)
return int(input())
def do_odds():
for i in range(1, n - 1, 2):
for j i... | output | 1 | 75,960 | 15 | 151,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters ... | instruction | 0 | 76,173 | 15 | 152,346 |
Tags: math
Correct Solution:
```
n,m,s=map(int,input().split())
n,m=min(n,m),max(n,m)
if(s>=max(n,m)):
print(n*m)
elif(s>=n and s<m):
x=1
count=1
a1=1
while(1):
if(x+s<=m):
x+=s
a1+=1
else:
break;
if(m%s==0):
print(n*m)
else:
... | output | 1 | 76,173 | 15 | 152,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters ... | instruction | 0 | 76,174 | 15 | 152,348 |
Tags: math
Correct Solution:
```
b, k, j = map(int, input().split())
print (((k-1)//j + 1) * ((k-1)%j + 1) * ((b-1)//j + 1) * ((b-1)%j + 1))
``` | output | 1 | 76,174 | 15 | 152,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters ... | instruction | 0 | 76,175 | 15 | 152,350 |
Tags: math
Correct Solution:
```
n, m, s = map(int, input().split())
def ceilDiv(a, b):
return a // b + (0 if a % b == 0 else 1)
sgsx, sgsy = n % s, m % s
if sgsx == 0:
sgsx = s
if sgsy == 0:
sgsy = s
print(sgsx * sgsy * ceilDiv(n, s) * ceilDiv(m, s))
``` | output | 1 | 76,175 | 15 | 152,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters ... | instruction | 0 | 76,176 | 15 | 152,352 |
Tags: math
Correct Solution:
```
from math import ceil
n, m, s = map(int, input().split())
o1 = n % s
o2 = m % s
if o1 == 0:
o1 = s
if o2 == 0:
o2 = s
print(o1 * o2 * ceil(n/s) * ceil(m / s))
``` | output | 1 | 76,176 | 15 | 152,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters ... | instruction | 0 | 76,177 | 15 | 152,354 |
Tags: math
Correct Solution:
```
import math
x,y,j = map(int,input().split())
print(((math.ceil(x/j)) * (j if x%j == 0 else x%j)) * (math.ceil(y/j)) * (j if y%j == 0 else y%j))
``` | output | 1 | 76,177 | 15 | 152,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters ... | instruction | 0 | 76,178 | 15 | 152,356 |
Tags: math
Correct Solution:
```
n,m,s=map(int,input().split())
print(((n-1)//s+1)*((n-1)%s+1)*((m-1)//s+1)*((m-1)%s+1))
``` | output | 1 | 76,178 | 15 | 152,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters ... | instruction | 0 | 76,179 | 15 | 152,358 |
Tags: math
Correct Solution:
```
n,m,s=list(map(int,input().split()))
def f(x):
k=(x-1)//(s)
return (k+1)*(x-k*s)
print(f(n)*f(m))
``` | output | 1 | 76,179 | 15 | 152,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n Γ m centimeters ... | instruction | 0 | 76,180 | 15 | 152,360 |
Tags: math
Correct Solution:
```
def flea(x, y):
return x // y + (0 if x % y == 0 else 1)
def div(r,p,pa):
jul, lol = r % pa, p % pa
if (lol == 0):
lol = pa
if (jul == 0):
jul = pa
print(jul * lol * flea(r, pa) * flea(p, pa))
r, p, pa = map(int, input().split())
div(r,p,pa)
``` | output | 1 | 76,180 | 15 | 152,361 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of t... | instruction | 0 | 76,181 | 15 | 152,362 |
Yes | output | 1 | 76,181 | 15 | 152,363 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of t... | instruction | 0 | 76,182 | 15 | 152,364 |
Yes | output | 1 | 76,182 | 15 | 152,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of t... | instruction | 0 | 76,183 | 15 | 152,366 |
Yes | output | 1 | 76,183 | 15 | 152,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of t... | instruction | 0 | 76,184 | 15 | 152,368 |
Yes | output | 1 | 76,184 | 15 | 152,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of t... | instruction | 0 | 76,185 | 15 | 152,370 |
No | output | 1 | 76,185 | 15 | 152,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of t... | instruction | 0 | 76,186 | 15 | 152,372 |
No | output | 1 | 76,186 | 15 | 152,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of t... | instruction | 0 | 76,187 | 15 | 152,374 |
No | output | 1 | 76,187 | 15 | 152,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of t... | instruction | 0 | 76,188 | 15 | 152,376 |
No | output | 1 | 76,188 | 15 | 152,377 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2, ..., pm with integer coordinates, do the following: denote its initial location by p0. First, the robot w... | instruction | 0 | 77,205 | 15 | 154,410 |
Tags: constructive algorithms, math
Correct Solution:
```
a=int(input())
s=input()
t=1
ch=''
for x in range(a):
if (s[x]=='L' and 'R' in ch) or (s[x]=='R' and 'L' in ch) or (s[x]=='U' and 'D' in ch) or (s[x]=='D' and 'U' in ch):
t+=1
ch=s[x]
else:
ch+='' if s[x] in ch else s[x]
print(t)
... | output | 1 | 77,205 | 15 | 154,411 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2, ..., pm with integer coordinates, do the following: denote its initial location by p0. First, the robot w... | instruction | 0 | 77,206 | 15 | 154,412 |
Tags: constructive algorithms, math
Correct Solution:
```
n=int(input())
s=input()
s=list(s)
r,l,u,d=0,0,0,0
points=0
for i in s:
if(i=='R'):
r=1
if(l==1):
points+=1
l, u, d = 0, 0, 0
if (i == 'L'):
l = 1
if (r == 1):
points += 1
r,... | output | 1 | 77,206 | 15 | 154,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2, ..., pm with integer coordinates, do the following: denote its initial location by p0. First, the robot w... | instruction | 0 | 77,207 | 15 | 154,414 |
Tags: constructive algorithms, math
Correct Solution:
```
n = int(input())
s = input()
ans = 0
tmp = []
for i in range(len(s)):
if len(tmp) < 2 or s[i] in tmp:
if len(tmp) == 1 and (s[i] == 'U' and tmp[0] == 'D' or s[i] == 'D' and tmp[0] == 'U' or s[i] == 'L' and tmp[0] == 'R' or s[i] == 'R' and tmp[0] == '... | output | 1 | 77,207 | 15 | 154,415 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2, ..., pm with integer coordinates, do the following: denote its initial location by p0. First, the robot w... | instruction | 0 | 77,208 | 15 | 154,416 |
Tags: constructive algorithms, math
Correct Solution:
```
n = int(input())
s = list(input())
a = [[0,0]]
for i in s:
x=a[-1]
if i=='L':a.append([x[0]-1, x[1]])
elif i=='R':a.append([x[0]+1, x[1]])
elif i=='U':a.append([x[0], x[1]-1])
else:a.append([x[0], x[1]+1])
j=1
c=a[0]
d=0
ans=1
while j<len(a)... | output | 1 | 77,208 | 15 | 154,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2, ..., pm with integer coordinates, do the following: denote its initial location by p0. First, the robot w... | instruction | 0 | 77,209 | 15 | 154,418 |
Tags: constructive algorithms, math
Correct Solution:
```
n = int(input())
moves = input()
rev = { 'R':'L', 'U':'D', 'L':'R', 'D':'U' }
seen = set()
min_pts = 1
for move in moves:
if rev[move] in seen:
min_pts += 1
seen = set()
seen.add(move)
print (min_pts)
``` | output | 1 | 77,209 | 15 | 154,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2, ..., pm with integer coordinates, do the following: denote its initial location by p0. First, the robot w... | instruction | 0 | 77,210 | 15 | 154,420 |
Tags: constructive algorithms, math
Correct Solution:
```
def m():
res = 0
input()
path = input().upper()
dirs = [None, None] # LR (horizontal); UD (vertical)
for p in path:
for ind, chk in enumerate(('LR', 'UD')):
if p in chk:
if dirs[ind] is None:
... | output | 1 | 77,210 | 15 | 154,421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.