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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bishwock is a chess figure that consists of three squares resembling an "L-bar". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states:
X... | instruction | 0 | 54,544 | 15 | 109,088 |
No | output | 1 | 54,544 | 15 | 109,089 |
Provide a correct Python 3 solution for this coding contest problem.
You have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are m columns of tiles from west to east, and n rows of tiles from south to north (1 <= m, n <= 100). Each tile is given a pa... | instruction | 0 | 54,726 | 15 | 109,452 |
"Correct Solution:
```
moves = [
{'F': lambda i, j, x: (i, min(n, j + x)), 'B': lambda i, j, x: (i, max(1, j - x))},
{'F': lambda i, j, x: (min(m, i + x), j), 'B': lambda i, j, x: (max(1, i - x), j)},
{'F': lambda i, j, x: (i, max(1, j - x)), 'B': lambda i, j, x: (i, min(n, j + x))},
{'F': lambda i, j, ... | output | 1 | 54,726 | 15 | 109,453 |
Provide a correct Python 3 solution for this coding contest problem.
You have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are m columns of tiles from west to east, and n rows of tiles from south to north (1 <= m, n <= 100). Each tile is given a pa... | instruction | 0 | 54,727 | 15 | 109,454 |
"Correct Solution:
```
def numchange(boo):
if boo:return 1
else: return -1
while True:
m,n = map(int,input().split())
if m==0: break
yaxis = 1
xaxis = 1
rotation = 0
while True:
lnr = input()
if lnr == "STOP": break
elif lnr == "RIGHT": rotation = (rotation+1)%4... | output | 1 | 54,727 | 15 | 109,455 |
Provide a correct Python 3 solution for this coding contest problem.
You have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are m columns of tiles from west to east, and n rows of tiles from south to north (1 <= m, n <= 100). Each tile is given a pa... | instruction | 0 | 54,728 | 15 | 109,456 |
"Correct Solution:
```
while True:
col, row = map(int, input().split())
if col == 0:
break
else:
robot = [1, 1]
direction = "up"
while True:
str = input()
if str == "STOP":
print(robot[0], robot[1])
break
eli... | output | 1 | 54,728 | 15 | 109,457 |
Provide a correct Python 3 solution for this coding contest problem.
You have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are m columns of tiles from west to east, and n rows of tiles from south to north (1 <= m, n <= 100). Each tile is given a pa... | instruction | 0 | 54,729 | 15 | 109,458 |
"Correct Solution:
```
# AOJ 1104: Where's Your Robot?
# Python3 2018.7.14 bal4u
# N,E,S,W -> 0,1,2,3
f = [[0,1],[1,0],[0,-1],[-1,0]]
b = [[0,-1],[-1,0],[0,1],[1,0]]
while True:
w, h = map(int, input().split())
if w == 0: break
r, c, d = 1, 1, 0
while True:
buf = input().split()
if buf[0] == "STOP": break
... | output | 1 | 54,729 | 15 | 109,459 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are m columns of tiles from west to east, and n rows of tiles from so... | instruction | 0 | 54,730 | 15 | 109,460 |
No | output | 1 | 54,730 | 15 | 109,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in... | instruction | 0 | 54,812 | 15 | 109,624 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
#sys.setrecursionlimit(10**6)
I=sys.stdin.readline
#s="abcdefghijklmnopqrstuvwxyz"
"""
x_move=[-1,0,1,0,-1,1,1,-1]
y_move=[0,1,0,-1,1,1,-... | output | 1 | 54,812 | 15 | 109,625 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in... | instruction | 0 | 54,813 | 15 | 109,626 |
Tags: constructive algorithms, implementation
Correct Solution:
```
#double underscore makes a class variable or a class method private
mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().spli... | output | 1 | 54,813 | 15 | 109,627 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in... | instruction | 0 | 54,814 | 15 | 109,628 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s=input()
i=0
j=0
k=0
while i<len(s):
if s[i]=='0':
if j==0:
print("1 1")
j=1
else:
print("3 1")
j=0
else:
if k==0:
print("4 3")
k=1
else:
... | output | 1 | 54,814 | 15 | 109,629 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in... | instruction | 0 | 54,815 | 15 | 109,630 |
Tags: constructive algorithms, implementation
Correct Solution:
```
__author__ = 'Esfandiar'
s = input()
Len = len(s)
f=ff=0
for i in range(Len):
if s[i] == '0':
if f==0:
print(1,1)
f=1
else:
print(3,1)
f=0
else:
if ff==0:
print... | output | 1 | 54,815 | 15 | 109,631 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in... | instruction | 0 | 54,816 | 15 | 109,632 |
Tags: constructive algorithms, implementation
Correct Solution:
```
from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisec... | output | 1 | 54,816 | 15 | 109,633 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in... | instruction | 0 | 54,817 | 15 | 109,634 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s = input()
zero, one = 0, 0
for si in s:
if si=='0':
print(1, zero%4+1)
zero += 1
else:
print(4, one%2*2+1)
one += 1
``` | output | 1 | 54,817 | 15 | 109,635 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in... | instruction | 0 | 54,818 | 15 | 109,636 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s=input()
twos=0
fours=0
for i in s:
if i=='0':
if twos==1:
print(3,1)
twos=0
else:
print(1,1)
twos=1
else:
print(fours+1,2)
fours+=1
fours%=4
``` | output | 1 | 54,818 | 15 | 109,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. When tile is placed, each cell which is located in... | instruction | 0 | 54,819 | 15 | 109,638 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque
def r():
return int(input())
def rm():
return map(int,input().split())
def rl():
return list(map(... | output | 1 | 54,819 | 15 | 109,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. Whe... | instruction | 0 | 54,820 | 15 | 109,640 |
Yes | output | 1 | 54,820 | 15 | 109,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. Whe... | instruction | 0 | 54,821 | 15 | 109,642 |
Yes | output | 1 | 54,821 | 15 | 109,643 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. Whe... | instruction | 0 | 54,822 | 15 | 109,644 |
Yes | output | 1 | 54,822 | 15 | 109,645 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. Whe... | instruction | 0 | 54,823 | 15 | 109,646 |
Yes | output | 1 | 54,823 | 15 | 109,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. Whe... | instruction | 0 | 54,824 | 15 | 109,648 |
No | output | 1 | 54,824 | 15 | 109,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. Whe... | instruction | 0 | 54,825 | 15 | 109,650 |
No | output | 1 | 54,825 | 15 | 109,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. Whe... | instruction | 0 | 54,826 | 15 | 109,652 |
No | output | 1 | 54,826 | 15 | 109,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a 4x4 grid. You play a game β there is a sequence of tiles, each of them is either 2x1 or 1x2. Your task is to consequently place all tiles from the given sequence in the grid. Whe... | instruction | 0 | 54,827 | 15 | 109,654 |
No | output | 1 | 54,827 | 15 | 109,655 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote a cell on the intersection of the r-th row and... | instruction | 0 | 54,860 | 15 | 109,720 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import math
from collections import Counter
#n=int(input())
#l=list(map(int,input().split()))
n=int(input())
#a,b,c=map(int,input().split())
#l=list(map(int,input().split()))
#a,b,c,d=map(int,input().split())
#l=[]
#for i in range(n):
# l+=[list(map(int,input(... | output | 1 | 54,860 | 15 | 109,721 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote a cell on the intersection of the r-th row and... | instruction | 0 | 54,861 | 15 | 109,722 |
Tags: constructive algorithms, greedy
Correct Solution:
```
n = int( input() )
i, j = 1, 1
print( n // 2 + 1 )
for qwq in range( n ):
print( str( i ) + ' ' + str( j ) )
if qwq & 1 == 0: i += 1
else: j += 1
``` | output | 1 | 54,861 | 15 | 109,723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote a cell on the intersection of the r-th row and... | instruction | 0 | 54,862 | 15 | 109,724 |
Tags: constructive algorithms, greedy
Correct Solution:
```
n = int(input())
m = (n+2)//2
ans = []
for i in range(1, n+1):
if i <= m:
r = 1
c = i
else:
r = m
c = m-(n-i)
ans.append((r, c))
print(m)
for i in range(n):
print(*ans[i])
``` | output | 1 | 54,862 | 15 | 109,725 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote a cell on the intersection of the r-th row and... | instruction | 0 | 54,863 | 15 | 109,726 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import math
n=int(input())
a=math.ceil((n+1)/2)
print(a)
for i in range(1,a+1):
print('1 '+str(i))
for i in range(2, n-a+2):
print(str(i)+' '+str(a))
``` | output | 1 | 54,863 | 15 | 109,727 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote a cell on the intersection of the r-th row and... | instruction | 0 | 54,864 | 15 | 109,728 |
Tags: constructive algorithms, greedy
Correct Solution:
```
N = int(input())
tmp = N
ans = 0
for b in range(1, 1000):
if b + b - 1 >= N:
ans = b
break
print(ans)
for i in range(1, ans + 1):
print(1, i)
tmp -= 1
if tmp == 0:
exit()
for j in range(2, ans + 1):
print(j, ans)
... | output | 1 | 54,864 | 15 | 109,729 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote a cell on the intersection of the r-th row and... | instruction | 0 | 54,865 | 15 | 109,730 |
Tags: constructive algorithms, greedy
Correct Solution:
```
n = int(input())
print((n + 2) // 2)
row = col = 1
di, dj = 0, 1
for k in range(n):
print(row, col, sep=" ")
row += di
col += dj
di, dj = dj, di
``` | output | 1 | 54,865 | 15 | 109,731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote a cell on the intersection of the r-th row and... | instruction | 0 | 54,866 | 15 | 109,732 |
Tags: constructive algorithms, greedy
Correct Solution:
```
n = int(input())
m = (n+2)//2
print(m)
for i in range(m):
print(1, i+1)
for i in range(n-m):
print(i+2, m)
``` | output | 1 | 54,866 | 15 | 109,733 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote a cell on the intersection of the r-th row and... | instruction | 0 | 54,867 | 15 | 109,734 |
Tags: constructive algorithms, greedy
Correct Solution:
```
#!/usr/bin/env python3
import atexit
import io
import sys
from math import ceil
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B
@atexit.register
def write():
sys.__stdout__.write(_O_B.getvalue())
d... | output | 1 | 54,867 | 15 | 109,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote... | instruction | 0 | 54,868 | 15 | 109,736 |
Yes | output | 1 | 54,868 | 15 | 109,737 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote... | instruction | 0 | 54,869 | 15 | 109,738 |
Yes | output | 1 | 54,869 | 15 | 109,739 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote... | instruction | 0 | 54,870 | 15 | 109,740 |
Yes | output | 1 | 54,870 | 15 | 109,741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote... | instruction | 0 | 54,871 | 15 | 109,742 |
Yes | output | 1 | 54,871 | 15 | 109,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote... | instruction | 0 | 54,872 | 15 | 109,744 |
No | output | 1 | 54,872 | 15 | 109,745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote... | instruction | 0 | 54,873 | 15 | 109,746 |
No | output | 1 | 54,873 | 15 | 109,747 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote... | instruction | 0 | 54,874 | 15 | 109,748 |
No | output | 1 | 54,874 | 15 | 109,749 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Nauuo is a girl who loves playing chess.
One day she invented a game by herself which needs n chess pieces to play on a mΓ m chessboard. The rows and columns are numbered from 1 to m. We denote... | instruction | 0 | 54,875 | 15 | 109,750 |
No | output | 1 | 54,875 | 15 | 109,751 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string s consisting of characters 'L',... | instruction | 0 | 55,700 | 15 | 111,400 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
from collections import deque
def solve(arr):
dict = {'R':0,'L':0,'U':0,'D':0}
for char in arr:
dict[char] += 1
dict['R'] = min(dict['R'], dict['L'])
dict['L'] = min(dict['R'], dict['L'])
dict['U'] = min(dict['U'], ... | output | 1 | 55,700 | 15 | 111,401 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string s consisting of characters 'L',... | instruction | 0 | 55,701 | 15 | 111,402 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
for _ in range(int(input())):
s = input()
i = 0
ans = ''
ls = {'U': 0, 'D': 0, 'L': 0, 'R': 0}
for i in s:
ls[i] += 1
if ls['U'] > ls['D']:
ls['U'] = ls['D']
else:
ls['D'] = ls['U']
if ls[... | output | 1 | 55,701 | 15 | 111,403 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string s consisting of characters 'L',... | instruction | 0 | 55,702 | 15 | 111,404 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
ans1 = []
ans2 = []
for _ in range(int(input())):
str1 = input()
u=str1.count("U")
d=str1.count("D")
l=str1.count("L")
r=str1.count("R")
ud = 0
lr = 0
if u>d: ud = d
else: ud = u
if l>r: lr = r
else: ... | output | 1 | 55,702 | 15 | 111,405 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string s consisting of characters 'L',... | instruction | 0 | 55,703 | 15 | 111,406 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
q = int(input())
for w in range(q):
s = str(input())
n = len(s)
x, y = 0, 0
ans = ""
was = []
if n == 1:
print(0)
continue
sCheck = list(set(s))
if len(sCheck) == 1:
print(0)
c... | output | 1 | 55,703 | 15 | 111,407 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string s consisting of characters 'L',... | instruction | 0 | 55,704 | 15 | 111,408 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
q = int(input())
for _ in range(q):
s = input()
d = {}
for c in ['L', 'R', 'U', 'D']: d[c] = 0
for c in s:
d[c] += 1
if(0 not in d.values()):
rem = 2*(min(d['L'], d['R']) + min(d['U'], d['D']))
print... | output | 1 | 55,704 | 15 | 111,409 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string s consisting of characters 'L',... | instruction | 0 | 55,705 | 15 | 111,410 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
instructions = list(input())
r = instructions.count('R')
l = instructions.count('L')
u = instructions.count('U')
d = instructions.count('D')
diff1 = r - l
if diff1 > 0:
r =... | output | 1 | 55,705 | 15 | 111,411 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string s consisting of characters 'L',... | instruction | 0 | 55,706 | 15 | 111,412 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
s = input()[:-1]
cntU = s.count("U")
cntD = s.count("D")
cntL = s.count("L")
cntR = s.count("R")
minLR = min(cntR, cntL)
minUD = m... | output | 1 | 55,706 | 15 | 111,413 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string s consisting of characters 'L',... | instruction | 0 | 55,707 | 15 | 111,414 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
import sys
import math
t = int(input())
for _ in range(t):
s = input()
l, r, d, u = 0, 0, 0, 0
for i in range(len(s)):
if s[i] == 'L':
l += 1
if s[i] == 'R':
r += 1
if s[i] == 'D':
... | output | 1 | 55,707 | 15 | 111,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is writte... | instruction | 0 | 55,708 | 15 | 111,416 |
Yes | output | 1 | 55,708 | 15 | 111,417 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is writte... | instruction | 0 | 55,709 | 15 | 111,418 |
Yes | output | 1 | 55,709 | 15 | 111,419 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is writte... | instruction | 0 | 55,710 | 15 | 111,420 |
Yes | output | 1 | 55,710 | 15 | 111,421 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.
You also have the sequence of instructions of this robot. It is writte... | instruction | 0 | 55,711 | 15 | 111,422 |
Yes | output | 1 | 55,711 | 15 | 111,423 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.