message stringlengths 2 48.6k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 318 108k | cluster float64 8 8 | __index_level_0__ int64 636 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every number aloud. For example, if she climbs two s... | instruction | 0 | 78,282 | 8 | 156,564 |
Tags: implementation
Correct Solution:
```
n=int(input())
s=list(map(int,input().split()))
last=0
x=[]
for i in range(1,n):
if s[i]==1:
x.append(i-last)
last=i
x.append(n-last)
print(len(x))
print(*x)
``` | output | 1 | 78,282 | 8 | 156,565 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every... | instruction | 0 | 78,283 | 8 | 156,566 |
Yes | output | 1 | 78,283 | 8 | 156,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every... | instruction | 0 | 78,284 | 8 | 156,568 |
Yes | output | 1 | 78,284 | 8 | 156,569 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every... | instruction | 0 | 78,285 | 8 | 156,570 |
Yes | output | 1 | 78,285 | 8 | 156,571 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every... | instruction | 0 | 78,286 | 8 | 156,572 |
Yes | output | 1 | 78,286 | 8 | 156,573 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every... | instruction | 0 | 78,287 | 8 | 156,574 |
No | output | 1 | 78,287 | 8 | 156,575 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every... | instruction | 0 | 78,288 | 8 | 156,576 |
No | output | 1 | 78,288 | 8 | 156,577 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every... | instruction | 0 | 78,289 | 8 | 156,578 |
No | output | 1 | 78,289 | 8 | 156,579 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number of steps in this stairway. She speaks every... | instruction | 0 | 78,290 | 8 | 156,580 |
No | output | 1 | 78,290 | 8 | 156,581 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is in the palace that can be represented as a grid n Γ m. Each room contains a single chest, an the room located in the i-th row and j-th columns contains the chest of type aij. Each chest... | instruction | 0 | 78,729 | 8 | 157,458 |
No | output | 1 | 78,729 | 8 | 157,459 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is in the palace that can be represented as a grid n Γ m. Each room contains a single chest, an the room located in the i-th row and j-th columns contains the chest of type aij. Each chest... | instruction | 0 | 78,730 | 8 | 157,460 |
No | output | 1 | 78,730 | 8 | 157,461 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is in the palace that can be represented as a grid n Γ m. Each room contains a single chest, an the room located in the i-th row and j-th columns contains the chest of type aij. Each chest... | instruction | 0 | 78,731 | 8 | 157,462 |
No | output | 1 | 78,731 | 8 | 157,463 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is in the palace that can be represented as a grid n Γ m. Each room contains a single chest, an the room located in the i-th row and j-th columns contains the chest of type aij. Each chest... | instruction | 0 | 78,732 | 8 | 157,464 |
No | output | 1 | 78,732 | 8 | 157,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snackt... | instruction | 0 | 78,774 | 8 | 157,548 |
Tags: data structures, implementation
Correct Solution:
```
n, s = int(input()), set()
for a in map(int, input().split()):
s.add(a)
while True:
try:
s.remove(n)
except KeyError:
print()
break
else:
print(n, end=' ')
n -= 1
``` | output | 1 | 78,774 | 8 | 157,549 |
Provide tags and a correct Python 3 solution for this coding contest problem.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snackt... | instruction | 0 | 78,775 | 8 | 157,550 |
Tags: data structures, implementation
Correct Solution:
```
n, s = int(input()), set()
for a in map(int,input().split()):
s.add(a)
while n in s:
print(n, end=' ')
n -= 1
print()
``` | output | 1 | 78,775 | 8 | 157,551 |
Provide tags and a correct Python 3 solution for this coding contest problem.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snackt... | instruction | 0 | 78,776 | 8 | 157,552 |
Tags: data structures, implementation
Correct Solution:
```
n=int(input())
a=list(map(int,input().split()))
t=n
for i in range(n):
a[abs(a[i])-1]=-1*(a[abs(a[i])-1])
if(abs(a[i])==t):
print(t,end=" ")
t=t-1
for j in range(t-1,-1,-1):
if(a[j]<0):
print(t,end=" ... | output | 1 | 78,776 | 8 | 157,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snackt... | instruction | 0 | 78,777 | 8 | 157,554 |
Tags: data structures, implementation
Correct Solution:
```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
A = list(map(int, input().split()))
V = [False] * (n + 1)
p = n
for i in range(n):
V[A[i]] = True
p0 = p
while V[p]:
print(p, end=' ')
p -= 1
print()
``` | output | 1 | 78,777 | 8 | 157,555 |
Provide tags and a correct Python 3 solution for this coding contest problem.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snackt... | instruction | 0 | 78,778 | 8 | 157,556 |
Tags: data structures, implementation
Correct Solution:
```
import sys
n = int(input())
a = list(map(int, input().split()))
b = list(reversed(sorted(a)))
has = set()
l = 0
for i in range(n):
if a[i] == b[l]:
has.add(a[i])
while l < n and b[l] in has :
print(b[l], end = ' ')
l... | output | 1 | 78,778 | 8 | 157,557 |
Provide tags and a correct Python 3 solution for this coding contest problem.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snackt... | instruction | 0 | 78,779 | 8 | 157,558 |
Tags: data structures, implementation
Correct Solution:
```
n = int(input())
A = list(map(int,input().split()))
B = [0] * (n + 1)
k = n
for i in range(n):
B[A[i]] = 1
if A[i] == k:
while B[k] == 1:
print(k,end = ' ')
k -= 1
print()
else:
print( )
``` | output | 1 | 78,779 | 8 | 157,559 |
Provide tags and a correct Python 3 solution for this coding contest problem.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snackt... | instruction | 0 | 78,780 | 8 | 157,560 |
Tags: data structures, implementation
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
t = [False]*n
t_idx = n-1
for idx, value in enumerate(a):
t[value-1] = True
cur_res = []
while t[t_idx]:
cur_res.append(t_idx+1)
t_idx -= 1
if t_idx == -1:
bre... | output | 1 | 78,780 | 8 | 157,561 |
Provide tags and a correct Python 3 solution for this coding contest problem.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snackt... | instruction | 0 | 78,781 | 8 | 157,562 |
Tags: data structures, implementation
Correct Solution:
```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
snacks = map(int, input().split())
status = [False] * (n + 1)
biggest = n
for day, snack in enumerate(snacks):
status[snack] = True
ret = ''
if biggest == snack:
biggest -= 1
... | output | 1 | 78,781 | 8 | 157,563 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on th... | instruction | 0 | 78,782 | 8 | 157,564 |
Yes | output | 1 | 78,782 | 8 | 157,565 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on th... | instruction | 0 | 78,783 | 8 | 157,566 |
Yes | output | 1 | 78,783 | 8 | 157,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on th... | instruction | 0 | 78,784 | 8 | 157,568 |
Yes | output | 1 | 78,784 | 8 | 157,569 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on th... | instruction | 0 | 78,785 | 8 | 157,570 |
Yes | output | 1 | 78,785 | 8 | 157,571 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on th... | instruction | 0 | 78,786 | 8 | 157,572 |
No | output | 1 | 78,786 | 8 | 157,573 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on th... | instruction | 0 | 78,787 | 8 | 157,574 |
No | output | 1 | 78,787 | 8 | 157,575 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on th... | instruction | 0 | 78,788 | 8 | 157,576 |
No | output | 1 | 78,788 | 8 | 157,577 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on th... | instruction | 0 | 78,789 | 8 | 157,578 |
No | output | 1 | 78,789 | 8 | 157,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the... | instruction | 0 | 78,830 | 8 | 157,660 |
Tags: brute force, implementation
Correct Solution:
```
import sys
v1,v2,v3,vm=map(int,input().split(' '))
arr=[]
s1=max(v1,vm)
if(2*v1>2*vm and 2*v1>=s1):
arr.append(2*v1)
else:
print("-1")
sys.exit()
s2=max(v2,vm)
if(2*v2>2*vm and 2*v1>=s2):
arr.append(2*v2)
else:
print("-1")
sys.exit()
s3=max... | output | 1 | 78,830 | 8 | 157,661 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the... | instruction | 0 | 78,831 | 8 | 157,662 |
Tags: brute force, implementation
Correct Solution:
```
L, M, S, Ma = map(int, input().split())
l = max(S, Ma)
s = min(S, Ma)
if s * 2 < l:
print(-1)
else:
if l >= L or l >= M:
print(-1)
else:
print(L*2)
print(M*2)
print(s*2)
``` | output | 1 | 78,831 | 8 | 157,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the... | instruction | 0 | 78,832 | 8 | 157,664 |
Tags: brute force, implementation
Correct Solution:
```
def run():
b1, b2, b3, m = [int(x) for x in input().split()]
if b1 <= m:
print('-1')
return
if b2 <= m:
print('-1')
return
if 2*m < b3:
print('-1')
return
if 2*b3 < m:
print('-1')
... | output | 1 | 78,832 | 8 | 157,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the... | instruction | 0 | 78,833 | 8 | 157,666 |
Tags: brute force, implementation
Correct Solution:
```
a,b,c,d = map(int,input().split())
flag = 0
for i in range(a,2*a+1):
for j in range(b,2*b+1):
for k in range(c,2*c+1):
if i>=a and 2*a>=i and j>=b and 2*b>=j and k>=c and 2*c>=k and i>j>k and d<=k and 2*d>=k and 2*d<i and 2*d<j:
flag = 1
print(i)
... | output | 1 | 78,833 | 8 | 157,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the... | instruction | 0 | 78,834 | 8 | 157,668 |
Tags: brute force, implementation
Correct Solution:
```
v1, v2, v3, vm = map(int, input().split())
car = max(vm, v3)
if car >= v1 or car >= v2:
print(-1)
exit(0)
if vm * 2 >= car and v3 * 2 >= car:
print(v1 * 2)
print(v2 * 2)
print(car)
else:
print(-1)
``` | output | 1 | 78,834 | 8 | 157,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the... | instruction | 0 | 78,835 | 8 | 157,670 |
Tags: brute force, implementation
Correct Solution:
```
v1, v2, v3, vm = list( map( int, input().split() ) )
ans = []
def can_climb( a, b ):
return ( a <= b )
def likes( a, b ):
return ( 2*a >= b )
for b1 in range( 1, 221 ):
if can_climb( v1, b1 ) and can_climb( vm, b1 ):
if likes( v1, b1 ) and... | output | 1 | 78,835 | 8 | 157,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the... | instruction | 0 | 78,836 | 8 | 157,672 |
Tags: brute force, implementation
Correct Solution:
```
v1, v2, v3, vm = map(int, input().split())
if vm > v3*2 or v3 > vm*2 or vm>=v2:
print(-1)
else:
print(2*v1, 2*v2, min(2*v3, vm*2))
``` | output | 1 | 78,836 | 8 | 157,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the... | instruction | 0 | 78,837 | 8 | 157,674 |
Tags: brute force, implementation
Correct Solution:
```
v1, v2, v3, vm = map(int,input().split())
if v2>vm and vm<=2*v3 and vm >= v3/2:
print(2*v1)
print(2*v2)
print(max(vm,v3))
else:
print(-1)
``` | output | 1 | 78,837 | 8 | 157,675 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she ... | instruction | 0 | 78,838 | 8 | 157,676 |
Yes | output | 1 | 78,838 | 8 | 157,677 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she ... | instruction | 0 | 78,839 | 8 | 157,678 |
Yes | output | 1 | 78,839 | 8 | 157,679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she ... | instruction | 0 | 78,840 | 8 | 157,680 |
Yes | output | 1 | 78,840 | 8 | 157,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she ... | instruction | 0 | 78,841 | 8 | 157,682 |
Yes | output | 1 | 78,841 | 8 | 157,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she ... | instruction | 0 | 78,842 | 8 | 157,684 |
No | output | 1 | 78,842 | 8 | 157,685 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she ... | instruction | 0 | 78,843 | 8 | 157,686 |
No | output | 1 | 78,843 | 8 | 157,687 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she ... | instruction | 0 | 78,844 | 8 | 157,688 |
No | output | 1 | 78,844 | 8 | 157,689 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she ... | instruction | 0 | 78,845 | 8 | 157,690 |
No | output | 1 | 78,845 | 8 | 157,691 |
Provide a correct Python 3 solution for this coding contest problem.
There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.
For each square, you will perform either of the following operations once:
* Decrease the height of the square by 1.
* Do nothing.
Dete... | instruction | 0 | 78,908 | 8 | 157,816 |
"Correct Solution:
```
n=int(input())
h=list(map(int,input().split()))
ans="Yes"
for i in range(1,n):
if h[i]<h[i-1]:
if h[i]-h[i-1]<-1: ans="No"
h[i]+=1
print(ans)
``` | output | 1 | 78,908 | 8 | 157,817 |
Provide a correct Python 3 solution for this coding contest problem.
There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.
For each square, you will perform either of the following operations once:
* Decrease the height of the square by 1.
* Do nothing.
Dete... | instruction | 0 | 78,909 | 8 | 157,818 |
"Correct Solution:
```
N = int(input())
H = list(map(int, input().split()))
F = "Yes"
l = H[0]
for i in range(1, N):
if l < H[i]:
l = H[i]
if l - 1 > H[i]:
F = "No"
break
print(F)
``` | output | 1 | 78,909 | 8 | 157,819 |
Provide a correct Python 3 solution for this coding contest problem.
There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.
For each square, you will perform either of the following operations once:
* Decrease the height of the square by 1.
* Do nothing.
Dete... | instruction | 0 | 78,910 | 8 | 157,820 |
"Correct Solution:
```
N=int(input())
H=list(map(int,input().split()))
base=0
for h in H:
if base>h:
print("No")
break
base=max(base,h-1)
else:
print("Yes")
``` | output | 1 | 78,910 | 8 | 157,821 |
Provide a correct Python 3 solution for this coding contest problem.
There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.
For each square, you will perform either of the following operations once:
* Decrease the height of the square by 1.
* Do nothing.
Dete... | instruction | 0 | 78,911 | 8 | 157,822 |
"Correct Solution:
```
N=int(input())
H=list(map(int,input().split()))
pre=0
for h in H:
if h<pre:
print("No");exit()
elif h>pre:
pre=h-1
print("Yes")
``` | output | 1 | 78,911 | 8 | 157,823 |
Provide a correct Python 3 solution for this coding contest problem.
There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.
For each square, you will perform either of the following operations once:
* Decrease the height of the square by 1.
* Do nothing.
Dete... | instruction | 0 | 78,912 | 8 | 157,824 |
"Correct Solution:
```
n=int(input())
h=list(map(int,input().split()))
H=h[::-1]
t=H[0]
for i in range(1,n):
if H[i]>t+1:
print("No")
break
else:
t=min(H[i],t)
else:
print("Yes")
``` | output | 1 | 78,912 | 8 | 157,825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.