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.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.... | instruction | 0 | 68,618 | 8 | 137,236 |
Tags: bitmasks, brute force, dp
Correct Solution:
```
from itertools import dropwhile
n, m = map(int, input().split())
m += 2
p = list(dropwhile(lambda line: '1' not in line, (input() for i in range(n))))
p.reverse()
addition = len(p) - 1
p = list(filter(lambda line: '1' in line, p))
n = len(p)
if n == 0:
print... | output | 1 | 68,618 | 8 | 137,237 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.... | instruction | 0 | 68,619 | 8 | 137,238 |
Tags: bitmasks, brute force, dp
Correct Solution:
```
R = lambda: map(int, input().split())
n, m = R()
m += 2
fls = [input() for i in range(n)]
while fls and not fls[0].count('1'):
fls.pop(0)
if not fls:
print(0)
exit(0)
ls, rs = [], []
resv = 0
for i in range(len(fls) - 1, -1, -1):
s = fls[i]
if '1... | output | 1 | 68,619 | 8 | 137,239 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.... | instruction | 0 | 68,620 | 8 | 137,240 |
Tags: bitmasks, brute force, dp
Correct Solution:
```
n,m=map(int,input().split())
p=1
l=[[1,0]]
l1=[]
r=0
M=[input() for i in range(n)]
for i in range(n) :
if M[i].count('1')==0 :
r=r+1
else :
break
for i in range(n-1,r,-1) :
for j in range(len(l)) :
k=l[j][1]
if l[j][0]==1 ... | output | 1 | 68,620 | 8 | 137,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.... | instruction | 0 | 68,621 | 8 | 137,242 |
Tags: bitmasks, brute force, dp
Correct Solution:
```
n,m=map(int,input().strip().split())
a=[]
L=[]
R=[]
t={}
for i in range(n):
b=input()
a.append(b)
L.append(9000000)
R.append(0)
t[i]=0
a.reverse()
for i in range(n):
for j in range(m+2):
if a[i][j]=='1':
L[i]=min(L[i],j)... | output | 1 | 68,621 | 8 | 137,243 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.... | instruction | 0 | 68,622 | 8 | 137,244 |
Tags: bitmasks, brute force, dp
Correct Solution:
```
def simulate(n, m, first, last, mask):
pos = 'left'
time = 0
for floor in range(n - 1):
action = mask & 1
mask >>= 1
if pos == 'left':
if action == 0:
time += 2 * last[floor]
else:
... | output | 1 | 68,622 | 8 | 137,245 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.... | instruction | 0 | 68,623 | 8 | 137,246 |
Tags: bitmasks, brute force, dp
Correct Solution:
```
def variant(cur):
global minv
if len(cur) < len(rooms):
variant(cur + [0])
variant(cur + [1])
else:
curpos = 0
time = 0
for i in range(len(rooms) - 1):
if curpos != cur[i]:
time += m + 1... | output | 1 | 68,623 | 8 | 137,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university bu... | instruction | 0 | 68,624 | 8 | 137,248 |
Yes | output | 1 | 68,624 | 8 | 137,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university bu... | instruction | 0 | 68,625 | 8 | 137,250 |
Yes | output | 1 | 68,625 | 8 | 137,251 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university bu... | instruction | 0 | 68,626 | 8 | 137,252 |
Yes | output | 1 | 68,626 | 8 | 137,253 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university bu... | instruction | 0 | 68,627 | 8 | 137,254 |
Yes | output | 1 | 68,627 | 8 | 137,255 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university bu... | instruction | 0 | 68,628 | 8 | 137,256 |
No | output | 1 | 68,628 | 8 | 137,257 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university bu... | instruction | 0 | 68,629 | 8 | 137,258 |
No | output | 1 | 68,629 | 8 | 137,259 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university bu... | instruction | 0 | 68,630 | 8 | 137,260 |
No | output | 1 | 68,630 | 8 | 137,261 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university bu... | instruction | 0 | 68,631 | 8 | 137,262 |
No | output | 1 | 68,631 | 8 | 137,263 |
Provide a correct Python 3 solution for this coding contest problem.
In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.
The pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_... | instruction | 0 | 68,749 | 8 | 137,498 |
"Correct Solution:
```
n=int(input())
xyh=[list(map(int,input().split())) for _ in range(n)]
for x,y,h in xyh:
if h>0:
sx=x
sy=y
sh=h
for i in range(101):
for j in range(101):
th=abs(i-sx)+abs(j-sy)+sh
for x,y,h in xyh:
if h!=max(th-abs(i-x)-abs(j-y),0):
... | output | 1 | 68,749 | 8 | 137,499 |
Provide a correct Python 3 solution for this coding contest problem.
In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.
The pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_... | instruction | 0 | 68,750 | 8 | 137,500 |
"Correct Solution:
```
N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]
for i in range(N):
if xyh[i][2] != 0:
xs, ys, hs = xyh[i]
for xt in range(101):
for yt in range(101):
ht = hs + abs(xt - xs) + abs(yt - ys)
if all([xyh[i][2] == max(0, ht - abs(xt-xyh[i][0]... | output | 1 | 68,750 | 8 | 137,501 |
Provide a correct Python 3 solution for this coding contest problem.
In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.
The pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_... | instruction | 0 | 68,751 | 8 | 137,502 |
"Correct Solution:
```
n=int(input())
L=sorted([list(map(int,input().split())) for i in range(n)],key=lambda x:x[2])
for cx in range(101):
for cy in range(101):
H=L[-1][2]+abs(L[-1][0]-cx)+abs(L[-1][1]-cy)
if all([L[i][2]==max(H-abs(L[i][0]-cx)-abs(L[i][1]-cy),0) for i in range(n-1)]):
print(cx,cy,H)
``` | output | 1 | 68,751 | 8 | 137,503 |
Provide a correct Python 3 solution for this coding contest problem.
In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.
The pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_... | instruction | 0 | 68,752 | 8 | 137,504 |
"Correct Solution:
```
n=int(input())
L=[list(map(int,input().split())) for i in range(n)]
LSort=sorted(L,key=lambda x:x[2])
x,y,h=LSort[-1]
for cx in range(0,101):
for cy in range(0,101):
H=h+abs(x-cx)+abs(y-cy)
if all([h==max(H-abs(x-cx)-abs(y-cy),0) for x,y,h in LSort]):
print(cx,cy,H)
exit()
``` | output | 1 | 68,752 | 8 | 137,505 |
Provide a correct Python 3 solution for this coding contest problem.
In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.
The pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_... | instruction | 0 | 68,754 | 8 | 137,508 |
"Correct Solution:
```
N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
arr.sort(key=lambda l:-l[2])
for cx in range(101):
for cy in range(101):
ch = None
for x, y, h in arr:
t = h + abs(cx-x) + abs(cy-y)
if h > 0:
if ch is not None and t != ch:
break
... | output | 1 | 68,754 | 8 | 137,509 |
Provide a correct Python 3 solution for this coding contest problem.
In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.
The pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_... | instruction | 0 | 68,755 | 8 | 137,510 |
"Correct Solution:
```
N = int(input())
List = [[int(i) for i in input().split()] for _ in range(N)]
for xt, yt, ht in List:
if ht > 0:
break
for px in range(0, 101):
for py in range(0, 101):
H = ht + abs(px - xt) + abs(py - yt)
if len(list(filter(lambda x: x[2] != max(H - abs(px - x[0])... | output | 1 | 68,755 | 8 | 137,511 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
<image>
William owns a flat in central London. He decided to rent his flat out for the next n days to earn some money.
Since his flat is in the center of the city, he instantly got m offers in... | instruction | 0 | 69,187 | 8 | 138,374 |
No | output | 1 | 69,187 | 8 | 138,375 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size... | instruction | 0 | 69,297 | 8 | 138,594 |
Tags: greedy, sortings
Correct Solution:
```
from collections import Counter as cs
n=int(input())
ls=[int(a) for a in input().split()]
ls.sort()
ls1=dict(cs(ls))
ctr1,ctr2=1,0
for i in range(n):
if ls1[ls[i]]:
ls1[ls[i]]-=1
for j in range(i,n):
if i!=j and ls[j]>=ctr1 and ls1[ls[j]]:
... | output | 1 | 69,297 | 8 | 138,595 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size... | instruction | 0 | 69,298 | 8 | 138,596 |
Tags: greedy, sortings
Correct Solution:
```
n = int(input())
val = [[]]
for x in sorted(int(x) for x in input().split()):
for l in val:
if x >= len(l):
l.append(x)
break
if len(val[-1]) > 0:
val.append([])
print(len(val) - 1)
``` | output | 1 | 69,298 | 8 | 138,597 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size... | instruction | 0 | 69,299 | 8 | 138,598 |
Tags: greedy, sortings
Correct Solution:
```
from collections import Counter
def check(arr):
l=len(arr)
for i in range(len(arr)):
if l-i-1>arr[i]:
return False
return True
def boredom(arr):
arr=sorted(arr,reverse=True)
for ans in range(1,len(arr)+1):
d={}
ind=0
... | output | 1 | 69,299 | 8 | 138,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size... | instruction | 0 | 69,300 | 8 | 138,600 |
Tags: greedy, sortings
Correct Solution:
```
n = int(input())
nums = sorted(list(map(int, input().split(' '))))
v = []
b = [0] * 105
cnt = 0
k = 0
while cnt < n:
k += 1
for i in range(n):
if nums[i] >= len(v) and b[i] == 0:
v.append(nums[i])
b[i] = 1
cnt += 1
v... | output | 1 | 69,300 | 8 | 138,601 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size... | instruction | 0 | 69,301 | 8 | 138,602 |
Tags: greedy, sortings
Correct Solution:
```
n=int(input())
ar=list(map(int,input().strip().split(' ')))
ar.sort()
i=0
li=list()
cnt=[0]*(101)
for i in ar:
cnt[i]+=1
for i in range(101):
if cnt[i]==0:
continue
if len(li)==00:
x=(i+1)
li.extend([x]*(cnt[i]//x))
i... | output | 1 | 69,301 | 8 | 138,603 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size... | instruction | 0 | 69,302 | 8 | 138,604 |
Tags: greedy, sortings
Correct Solution:
```
n=int(input())
l=list(map(int,input().split()))
l.sort()
i=0
v=[0]*n
out=0
while i<n:
if v[i]==0:
c=0
j=i
while j<n:
if l[j]>=c and v[j]==0:
v[j]=1
c+=1
j+=1
out+=1
i+=1
print(out)
``` | output | 1 | 69,302 | 8 | 138,605 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size... | instruction | 0 | 69,303 | 8 | 138,606 |
Tags: greedy, sortings
Correct Solution:
```
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
pile,tc=0,n
visited = [0]*n
while tc != 0:
tt=0
for i in range(0,n):
if a[i]>=tt and visited[i] != 1:
visited[i]=1
tt+=1
tc-=1
if(tt>0):
pile+=1
pr... | output | 1 | 69,303 | 8 | 138,607 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).
Since all the boxes have the same size... | instruction | 0 | 69,304 | 8 | 138,608 |
Tags: greedy, sortings
Correct Solution:
```
# from itertools import combinations
# from bisect import bisect_left
from collections import Counter
I = lambda: list(map(int, input().split()))
n, a = I(), I()
a.sort()
h = [1]
for el in a[1:]:
mn = min(h)
if el >= mn:
h[h.index(mn)] += 1
else:
h.append(1)
p... | output | 1 | 69,304 | 8 | 138,609 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the... | instruction | 0 | 69,305 | 8 | 138,610 |
Yes | output | 1 | 69,305 | 8 | 138,611 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the... | instruction | 0 | 69,306 | 8 | 138,612 |
Yes | output | 1 | 69,306 | 8 | 138,613 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the... | instruction | 0 | 69,307 | 8 | 138,614 |
Yes | output | 1 | 69,307 | 8 | 138,615 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the... | instruction | 0 | 69,308 | 8 | 138,616 |
Yes | output | 1 | 69,308 | 8 | 138,617 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the... | instruction | 0 | 69,309 | 8 | 138,618 |
No | output | 1 | 69,309 | 8 | 138,619 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the... | instruction | 0 | 69,310 | 8 | 138,620 |
No | output | 1 | 69,310 | 8 | 138,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the... | instruction | 0 | 69,311 | 8 | 138,622 |
No | output | 1 | 69,311 | 8 | 138,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the... | instruction | 0 | 69,312 | 8 | 138,624 |
No | output | 1 | 69,312 | 8 | 138,625 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to right, starting with one. A house is considere... | instruction | 0 | 69,403 | 8 | 138,806 |
Tags: implementation, math
Correct Solution:
```
n = int(input())
h = map(int, input().split()[::-1])
m_h = 0
res = []
for h in h:
if m_h < h:
res.append('0')
m_h = h
else:
res.append(str(m_h - h + 1))
print(" ".join(res[::-1]))
``` | output | 1 | 69,403 | 8 | 138,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to right, starting with one. A house is considere... | instruction | 0 | 69,404 | 8 | 138,808 |
Tags: implementation, math
Correct Solution:
```
import sys
try:
while True:
n = int(input())
val = list(map(int, input().split()))
maxval = 0
for i in range(n-1, -1, -1):
if maxval >= val[i]:
val[i] = maxval - val[i] + 1
else:
... | output | 1 | 69,404 | 8 | 138,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to right, starting with one. A house is considere... | instruction | 0 | 69,405 | 8 | 138,810 |
Tags: implementation, math
Correct Solution:
```
n = int(input())
ans = []
ma = 0
for h in list(reversed(list(map(int, input().split())))):
ans += [max(0, ma - h + 1)]
ma = max(ma, h)
print(' '.join(map(str, reversed(ans))))
``` | output | 1 | 69,405 | 8 | 138,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to right, starting with one. A house is considere... | instruction | 0 | 69,406 | 8 | 138,812 |
Tags: implementation, math
Correct Solution:
```
n = input()
buildings = list(map(int, input().split(' ')))
m = 0
result = []
for i in range(len(buildings) - 1, -1, -1):
b = buildings[i]
x = m - b
if x < 0:
result.append(0)
m = b
else:
result.append(x + 1)
print(' '.join(map(str, result[::-1]))... | output | 1 | 69,406 | 8 | 138,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to right, starting with one. A house is considere... | instruction | 0 | 69,407 | 8 | 138,814 |
Tags: implementation, math
Correct Solution:
```
n=int(input())
a=list(map(int,input().split()))
x=1
r=[]
for i in range(n-1,-1,-1):r+=[max(x-a[i],0)];x=max(x,a[i]+1)
print(' '.join(map(str,r[::-1])))
``` | output | 1 | 69,407 | 8 | 138,815 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to right, starting with one. A house is considere... | instruction | 0 | 69,408 | 8 | 138,816 |
Tags: implementation, math
Correct Solution:
```
n = int(input())
h = [int(i) for i in input().split()]
l = []
l_2 = []
for i in range(n):
l_2 += [0]
l_2[n-1] = h[n-1]
for i in range (n-2, 0, -1):
l_2[i] = max( l_2[i+1], h[i])
l_2 = l_2 + [0]
for i in range (n):
m = l_2[i+1]
g = max ( m - h[i]... | output | 1 | 69,408 | 8 | 138,817 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to right, starting with one. A house is considere... | instruction | 0 | 69,409 | 8 | 138,818 |
Tags: implementation, math
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
_max = max(a)
b = [0] * n
b[n - 1] = 0
c = a[n - 1]
for i in range(n - 2, -1, -1):
if(a[i] > c):
b[i] = 0
c = a[i]
else:
c = max(c, a[i])
b[i] = c - a[i] + 1
for i in range(... | output | 1 | 69,409 | 8 | 138,819 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to right, starting with one. A house is considere... | instruction | 0 | 69,410 | 8 | 138,820 |
Tags: implementation, math
Correct Solution:
```
n = int(input())
l = list(map(int , input().split()))
a = list(range(n+1)); y = 0
for i in range(n-1 , -1 , -1):
y = max(y , l[i])
a[i] = y
a[n] = 0
for i in range(n):
if (l[i] == a[i]) & (l[i] != a[i+1]):
print('0 ' , end = '')
else:
prin... | output | 1 | 69,410 | 8 | 138,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to... | instruction | 0 | 69,411 | 8 | 138,822 |
Yes | output | 1 | 69,411 | 8 | 138,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to... | instruction | 0 | 69,412 | 8 | 138,824 |
Yes | output | 1 | 69,412 | 8 | 138,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to... | instruction | 0 | 69,413 | 8 | 138,826 |
Yes | output | 1 | 69,413 | 8 | 138,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to... | instruction | 0 | 69,414 | 8 | 138,828 |
Yes | output | 1 | 69,414 | 8 | 138,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.
Let's enumerate all the houses from left to... | instruction | 0 | 69,415 | 8 | 138,830 |
No | output | 1 | 69,415 | 8 | 138,831 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.