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.
Nobuo-kun and Shizuo-kun are playing a game of competing for territories on a rectangular island. As shown in Fig. 1 below, the entire island is made up of square compartments divided in a grid ... | instruction | 0 | 48,726 | 15 | 97,452 |
No | output | 1 | 48,726 | 15 | 97,453 |
Provide tags and a correct Python 3 solution for this coding contest problem.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions fo... | instruction | 0 | 49,252 | 15 | 98,504 |
Tags: math
Correct Solution:
```
pos = int(input())
cnt = 0
while pos > 0:
if pos >= 5:
pos -= 5
else:
pos -= pos
cnt += 1
print(cnt)
``` | output | 1 | 49,252 | 15 | 98,505 |
Provide tags and a correct Python 3 solution for this coding contest problem.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions fo... | instruction | 0 | 49,253 | 15 | 98,506 |
Tags: math
Correct Solution:
```
x = int(input())
if x % 5 == 0:
ans = x / 5
else:
ans = x / 5 + 1
print(int(ans))
``` | output | 1 | 49,253 | 15 | 98,507 |
Provide tags and a correct Python 3 solution for this coding contest problem.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions fo... | instruction | 0 | 49,254 | 15 | 98,508 |
Tags: math
Correct Solution:
```
pl = int(input())
step = 0
kol = 0
while step != pl:
if step + 5 < pl:
step += 5
kol += 1
else:
if pl - step == 0:
print(kol)
else:
print(kol + 1)
break
``` | output | 1 | 49,254 | 15 | 98,509 |
Provide tags and a correct Python 3 solution for this coding contest problem.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions fo... | instruction | 0 | 49,255 | 15 | 98,510 |
Tags: math
Correct Solution:
```
k=int(input())
kil=k//5
ost=k%5
kil=kil+ost//4
ost=ost%4
kil=kil+ost//3
ost=ost%3
kil=kil+ost//2
ost=ost%2
kil=kil+ost//1
ost=ost%1
print(kil)
``` | output | 1 | 49,255 | 15 | 98,511 |
Provide tags and a correct Python 3 solution for this coding contest problem.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions fo... | instruction | 0 | 49,256 | 15 | 98,512 |
Tags: math
Correct Solution:
```
d=0
n=int(input())
while(n>0):
if(n>=5):
d=d+(n//5)
n=n%5
elif(n>=4):
d=d+(n//4)
n=n%4
elif(n>=3):
d=d+(n//3)
n=n%3
elif(n>=2):
d=d+(n//2)
n=n%2
else:
... | output | 1 | 49,256 | 15 | 98,513 |
Provide tags and a correct Python 3 solution for this coding contest problem.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions fo... | instruction | 0 | 49,257 | 15 | 98,514 |
Tags: math
Correct Solution:
```
n=int(input())
t=n
c=0
while(t>0):
if(t%5>=0):
c=c+1
t=t-5
elif(t%4>=0):
c=c+1
t=t-4
elif(t%3>=0):
c=c+1
t=t-3
elif(t%2>=0):
c=c+1
t=t-2
elif(t%1>=0):
c=c+1
t=t-1
print(c)
... | output | 1 | 49,257 | 15 | 98,515 |
Provide tags and a correct Python 3 solution for this coding contest problem.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions fo... | instruction | 0 | 49,258 | 15 | 98,516 |
Tags: math
Correct Solution:
```
x = int(input())
print(x//5 + min(x%5, 1))
``` | output | 1 | 49,258 | 15 | 98,517 |
Provide tags and a correct Python 3 solution for this coding contest problem.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions fo... | instruction | 0 | 49,259 | 15 | 98,518 |
Tags: math
Correct Solution:
```
x = int(input())
if x%5!=0:
x = (x//5)+1
else:
x = x//5
print(x)
``` | output | 1 | 49,259 | 15 | 98,519 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the... | instruction | 0 | 49,260 | 15 | 98,520 |
Yes | output | 1 | 49,260 | 15 | 98,521 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the... | instruction | 0 | 49,261 | 15 | 98,522 |
Yes | output | 1 | 49,261 | 15 | 98,523 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the... | instruction | 0 | 49,262 | 15 | 98,524 |
Yes | output | 1 | 49,262 | 15 | 98,525 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the... | instruction | 0 | 49,263 | 15 | 98,526 |
Yes | output | 1 | 49,263 | 15 | 98,527 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the... | instruction | 0 | 49,264 | 15 | 98,528 |
No | output | 1 | 49,264 | 15 | 98,529 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the... | instruction | 0 | 49,265 | 15 | 98,530 |
No | output | 1 | 49,265 | 15 | 98,531 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the... | instruction | 0 | 49,266 | 15 | 98,532 |
No | output | 1 | 49,266 | 15 | 98,533 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the... | instruction | 0 | 49,267 | 15 | 98,534 |
No | output | 1 | 49,267 | 15 | 98,535 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Adieu l'ami.
Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence.
The space is represe... | instruction | 0 | 49,353 | 15 | 98,706 |
No | output | 1 | 49,353 | 15 | 98,707 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Adieu l'ami.
Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence.
The space is represe... | instruction | 0 | 49,354 | 15 | 98,708 |
No | output | 1 | 49,354 | 15 | 98,709 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Adieu l'ami.
Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence.
The space is represe... | instruction | 0 | 49,355 | 15 | 98,710 |
No | output | 1 | 49,355 | 15 | 98,711 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Adieu l'ami.
Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence.
The space is represe... | instruction | 0 | 49,356 | 15 | 98,712 |
No | output | 1 | 49,356 | 15 | 98,713 |
Provide a correct Python 3 solution for this coding contest problem.
Tetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little.
The size of the board of this game is 5 frames wide, and it is high enough to accommodate all the blocks that appea... | instruction | 0 | 49,529 | 15 | 99,058 |
"Correct Solution:
```
def v_block():
block.insert(0, [' ']*5)
for l, line in enumerate(block):
if line[q-1:q+p-1] != [' ']*p:
break
else:
l += 1
block[l-1][q-1:q+p-1] = ['*']*p
return delete()
def h_block():
for _p in range(p):
block.insert(0, [' ']*5)
... | output | 1 | 49,529 | 15 | 99,059 |
Provide a correct Python 3 solution for this coding contest problem.
Tetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little.
The size of the board of this game is 5 frames wide, and it is high enough to accommodate all the blocks that appea... | instruction | 0 | 49,530 | 15 | 99,060 |
"Correct Solution:
```
while 1:
N = int(input())
if N == 0:
break
L = 5000
MP = [[0]*L for i in range(5)]
cs = [L]*5
us = []
U = [0]*L
for i in range(N):
d, p, q = map(int, input().split()); q -= 1
if d == 1:
y = L
for j in range(p):
... | output | 1 | 49,530 | 15 | 99,061 |
Provide a correct Python 3 solution for this coding contest problem.
Tetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little.
The size of the board of this game is 5 frames wide, and it is high enough to accommodate all the blocks that appea... | instruction | 0 | 49,531 | 15 | 99,062 |
"Correct Solution:
```
def v_block():
block.insert(0, [' ']*5)
for l, line in enumerate(block):
if line[q-1:q+p-1] != [' ']*p:
break
else:
l += 1
block[l-1][q-1:q+p-1] = ['*']*p
return delete()
def h_block():
for _p in range(p):
block.insert(0, [' ']*5)
... | output | 1 | 49,531 | 15 | 99,063 |
Provide a correct Python 3 solution for this coding contest problem.
Tetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little.
The size of the board of this game is 5 frames wide, and it is high enough to accommodate all the blocks that appea... | instruction | 0 | 49,532 | 15 | 99,064 |
"Correct Solution:
```
end = [1,1,1,1,1]
while True:
n = int(input())
if n == 0:
break
mp = [[0] * 5 for _ in range(6000)]
height = [0] * 5
cnt = 0
for i in range(n):
d, p, q = map(int, input().split())
q -= 1
cnt += p
if d == 1:
pos = max(height[q:q + p])
mp[pos][q:q + p] = ... | output | 1 | 49,532 | 15 | 99,065 |
Provide a correct Python 3 solution for this coding contest problem.
Tetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little.
The size of the board of this game is 5 frames wide, and it is high enough to accommodate all the blocks that appea... | instruction | 0 | 49,533 | 15 | 99,066 |
"Correct Solution:
```
while True:
N = int(input())
if N == 0:
break
table = [[0 for i in range(5)] for j in range(6000)]
blocks = [0 for i in range(5)]
for l in range(N):
d,p,q = [int(i) for i in input().split()]
q -= 1
if d == 1:
maxtop = 0
... | output | 1 | 49,533 | 15 | 99,067 |
Provide a correct Python 3 solution for this coding contest problem.
Tetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little.
The size of the board of this game is 5 frames wide, and it is high enough to accommodate all the blocks that appea... | instruction | 0 | 49,534 | 15 | 99,068 |
"Correct Solution:
```
def solve():
from bisect import bisect_left
from sys import stdin
f_i = stdin
while True:
n = int(f_i.readline())
if n == 0:
break
b = [[0] for i in range(5)]
for i in range(n):
d, p, q = map(int, f_i.readline()... | output | 1 | 49,534 | 15 | 99,069 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,719 | 15 | 99,438 |
Tags: constructive algorithms, implementation
Correct Solution:
```
def col(x, y):
return (x + y) % 2 == 0
t = int(input())
for z in range(t):
w, b = map(int, input().split())
if b < w:
sx = 3
sy = 2
else:
sx = 2
sy = 2
x = sx
y = sy
if max(b, w) > min(b, w)... | output | 1 | 49,719 | 15 | 99,439 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,720 | 15 | 99,440 |
Tags: constructive algorithms, implementation
Correct Solution:
```
for _ in range(int(input())):
b, w = map(int, input().split())
if b <= w:
if w > 3 * b + 1:
print('NO')
else:
print('YES')
x = 2
y = 3
for i in range(b):
... | output | 1 | 49,720 | 15 | 99,441 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,721 | 15 | 99,442 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import sys
def main():
# a, b = [int(s) for s in sys.stdin.readline().strip().split()]
N = int(sys.stdin.readline().strip())
for _ in range(N):
(b, w) = [int(x) for x in sys.stdin.readline().strip().split()]
x = 2
... | output | 1 | 49,721 | 15 | 99,443 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,722 | 15 | 99,444 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().strip()
t = int(input())
for i in range(t):
b, w = map(int, input().split())
if w==b:
print("YES")
for i in range(1, 2*b+1):
print(2, i)
elif 3*b+1>=w>b:
p... | output | 1 | 49,722 | 15 | 99,445 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,723 | 15 | 99,446 |
Tags: constructive algorithms, implementation
Correct Solution:
```
from sys import stdin, stdout, exit
from collections import defaultdict
q = int(input())
for it in range(q):
b,w = map(int, stdin.readline().split())
ans = []
if b < w:
for i in range(b):
ans.append((2+2*i, 3))
... | output | 1 | 49,723 | 15 | 99,447 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,724 | 15 | 99,448 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import sys
input = sys.stdin.readline
for _ in range(int(input())):
b, w = map(int, input().split())
if min(b, w) * 3 + 1 < max(b, w):
print('NO')
continue
ans = []
x, y = 2, 2
if b < w:
x = 3
while b a... | output | 1 | 49,724 | 15 | 99,449 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,725 | 15 | 99,450 |
Tags: constructive algorithms, implementation
Correct Solution:
```
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
from sys import stdin, stdout
import collections
Q = int(input())
ans = [0]*Q
#s = input()
#N = len(s)
#arr = [int(x) for x in stdi... | output | 1 | 49,725 | 15 | 99,451 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,726 | 15 | 99,452 |
Tags: constructive algorithms, implementation
Correct Solution:
```
''' CODED WITH LOVE BY SATYAM KUMAR '''
from sys import stdin, stdout
import cProfile, math
from collections import Counter,defaultdict,deque
from bisect import bisect_left,bisect,bisect_right
import itertools
from copy import deepcopy
from fractions ... | output | 1 | 49,726 | 15 | 99,453 |
Provide tags and a correct Python 2 solution for this coding contest problem.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black ce... | instruction | 0 | 49,727 | 15 | 99,454 |
Tags: constructive algorithms, implementation
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
raw_input = stdin.readline
pr = stdout.write
def in_arr():
return map(int,raw_input().split())
def pr_num(n):
stdout... | output | 1 | 49,727 | 15 | 99,455 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on t... | instruction | 0 | 49,728 | 15 | 99,456 |
Yes | output | 1 | 49,728 | 15 | 99,457 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on t... | instruction | 0 | 49,729 | 15 | 99,458 |
Yes | output | 1 | 49,729 | 15 | 99,459 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on t... | instruction | 0 | 49,730 | 15 | 99,460 |
Yes | output | 1 | 49,730 | 15 | 99,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on t... | instruction | 0 | 49,731 | 15 | 99,462 |
Yes | output | 1 | 49,731 | 15 | 99,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on t... | instruction | 0 | 49,732 | 15 | 99,464 |
No | output | 1 | 49,732 | 15 | 99,465 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on t... | instruction | 0 | 49,733 | 15 | 99,466 |
No | output | 1 | 49,733 | 15 | 99,467 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on t... | instruction | 0 | 49,734 | 15 | 99,468 |
No | output | 1 | 49,734 | 15 | 99,469 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on t... | instruction | 0 | 49,735 | 15 | 99,470 |
No | output | 1 | 49,735 | 15 | 99,471 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are playing the following game. There are n points on a plane. They are the vertices of a regular n-polygon. Points are labeled with integer numbers from 1 to n. Each pair of distinct points is connected by a diagonal, which is colored i... | instruction | 0 | 49,995 | 15 | 99,990 |
Tags: dp, graphs, implementation, shortest paths
Correct Solution:
```
from collections import deque
__author__ = 'asmn'
n = int(input())
end = tuple(sorted(map(lambda x: int(x) - 1, input().split())))
st = (0, 1, 2)
mat = [input() for i in range(n)]
v = set([st])
path = {}
dist = {st: 0}
queue = deque([st])
while e... | output | 1 | 49,995 | 15 | 99,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The stones are numbe... | instruction | 0 | 50,776 | 15 | 101,552 |
Tags: constructive algorithms, data structures, implementation, two pointers
Correct Solution:
```
s=input()
n=len(s)
a=1
ans=[0]*n
for i in range(n):
if s[i]=='l':
ans[n-1]=i+1
n-=1
else:
ans[a-1]=i+1
a+=1
for i in ans:
print(i)
``` | output | 1 | 50,776 | 15 | 101,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The stones are numbe... | instruction | 0 | 50,777 | 15 | 101,554 |
Tags: constructive algorithms, data structures, implementation, two pointers
Correct Solution:
```
s = str(input())
n = len(s)
l1, l2 = list(), list()
for i in range(n):
if s[i] == 'l':
l1.append(i+1)
else:
l2.append(i+1)
for x in l2:
print(x)
for i in range(len(l1)-1, -1, -1):
print(l... | output | 1 | 50,777 | 15 | 101,555 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The stones are numbe... | instruction | 0 | 50,778 | 15 | 101,556 |
Tags: constructive algorithms, data structures, implementation, two pointers
Correct Solution:
```
s=input()
l,r=[],[]
n=len(s)
for i in range(n):
if s[i]=='l':
l.append(i+1)
else:
r.append(i+1)
l=sorted(l,reverse=True)
r.extend(l)
for i in r:
print(i)
``` | output | 1 | 50,778 | 15 | 101,557 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The stones are numbe... | instruction | 0 | 50,779 | 15 | 101,558 |
Tags: constructive algorithms, data structures, implementation, two pointers
Correct Solution:
```
s=input()
l,r=[],[]
for x in range(len(s)):
if s[x]=='r':
r.append(x+1)
else:
l.append(x+1)
for el in r:
print(el)
for el in l[::-1]:
print(el)
``` | output | 1 | 50,779 | 15 | 101,559 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The stones are numbe... | instruction | 0 | 50,780 | 15 | 101,560 |
Tags: constructive algorithms, data structures, implementation, two pointers
Correct Solution:
```
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
s = input()
n = len(s)
ans = [0]*(n + 1)
l = n
r = 1
stone = 1
for i in s:
if i == 'l':
ans[l] = stone
l -= 1
if i == 'r':
ans[r] = stone
r += 1
stone ... | output | 1 | 50,780 | 15 | 101,561 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.