message stringlengths 2 433k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 113 108k | cluster float64 12 12 | __index_level_0__ int64 226 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.
Consider a subsequence s of a. He def... | instruction | 0 | 46,432 | 12 | 92,864 |
Tags: binary search, dp, dsu, greedy, implementation
Correct Solution:
```
def fun(mid):
global ar,k
cur1=0
cur2=0
for i in ar:
if(i<=mid or cur1%2==0):
cur1+=1
if(i<=mid or cur2%2!=0):
cur2+=1
f1=bool(cur1>=k)
f2=bool(cur2>=k)
return (f1 or f2)
n,k=ma... | output | 1 | 46,432 | 12 | 92,865 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.
Consider a subsequence s of a. He def... | instruction | 0 | 46,433 | 12 | 92,866 |
Tags: binary search, dp, dsu, greedy, implementation
Correct Solution:
```
# https://codeforces.com/contest/1370/problem/D
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
# do magic here
n, k = map(int, input().split())
arr = [int(x) for x in input().split()]
low = min(arr)
high = max(arr)
... | output | 1 | 46,433 | 12 | 92,867 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.
Consider a subsequence s of a. He def... | instruction | 0 | 46,434 | 12 | 92,868 |
Tags: binary search, dp, dsu, greedy, implementation
Correct Solution:
```
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for ... | output | 1 | 46,434 | 12 | 92,869 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.
Consider a subsequence s of a. He def... | instruction | 0 | 46,435 | 12 | 92,870 |
Tags: binary search, dp, dsu, greedy, implementation
Correct Solution:
```
def check(x, fl):
global n, a, k
cur = []
for i in range(n):
if (len(cur) + 1) % 2 == fl and a[i] <= x:
cur += [a[i]]
elif (len(cur) + 1) % 2 != fl:
cur += [a[i]]
return (len(cur) >= k)
d... | output | 1 | 46,435 | 12 | 92,871 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.
Consider a subsequence s of a. He def... | instruction | 0 | 46,436 | 12 | 92,872 |
Tags: binary search, dp, dsu, greedy, implementation
Correct Solution:
```
import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
except:
pass
input ... | output | 1 | 46,436 | 12 | 92,873 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.
Consider a subsequence s of a. He def... | instruction | 0 | 46,437 | 12 | 92,874 |
Tags: binary search, dp, dsu, greedy, implementation
Correct Solution:
```
import sys
n,k = 0,0
ans = 1000000000
a = []
def ok(mid):
for i in [0,1] :
l = 0
for val in a :
if l % 2 != i or val <= mid :
l += 1
if l >= k :
return True
return False
... | output | 1 | 46,437 | 12 | 92,875 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.
Consider a subsequence s of a. He def... | instruction | 0 | 46,438 | 12 | 92,876 |
Tags: binary search, dp, dsu, greedy, implementation
Correct Solution:
```
n,k=map(int,input().split())
a=list(map(int,input().split()))
def f(x):
global n,k,a
#x以下にできるか(こっちは奇数番目)
check=0
now=1
for i in range(n):
if now:
if a[i]<=x:
now=1-now
check... | output | 1 | 46,438 | 12 | 92,877 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.
Consider a subsequence s of a. He def... | instruction | 0 | 46,439 | 12 | 92,878 |
Tags: binary search, dp, dsu, greedy, implementation
Correct Solution:
```
l = lambda:map(int,input().split())
n,k = l()
a = list(l())
def check(x,cur):
ans = 0
for i in range(n):
if cur == 0:
ans+=1
cur = 1
elif a[i] <= x:
ans+=1
cur = 0
retur... | output | 1 | 46,439 | 12 | 92,879 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining e... | instruction | 0 | 46,440 | 12 | 92,880 |
Yes | output | 1 | 46,440 | 12 | 92,881 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining e... | instruction | 0 | 46,441 | 12 | 92,882 |
Yes | output | 1 | 46,441 | 12 | 92,883 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining e... | instruction | 0 | 46,442 | 12 | 92,884 |
Yes | output | 1 | 46,442 | 12 | 92,885 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining e... | instruction | 0 | 46,443 | 12 | 92,886 |
Yes | output | 1 | 46,443 | 12 | 92,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining e... | instruction | 0 | 46,444 | 12 | 92,888 |
No | output | 1 | 46,444 | 12 | 92,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining e... | instruction | 0 | 46,445 | 12 | 92,890 |
No | output | 1 | 46,445 | 12 | 92,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining e... | instruction | 0 | 46,446 | 12 | 92,892 |
No | output | 1 | 46,446 | 12 | 92,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ashish has an array a of size n.
A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining e... | instruction | 0 | 46,447 | 12 | 92,894 |
No | output | 1 | 46,447 | 12 | 92,895 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitw... | instruction | 0 | 46,451 | 12 | 92,902 |
Tags: bitmasks, data structures, divide and conquer, dp, greedy, math, sortings, strings, trees
Correct Solution:
```
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fra... | output | 1 | 46,451 | 12 | 92,903 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitw... | instruction | 0 | 46,452 | 12 | 92,904 |
Tags: bitmasks, data structures, divide and conquer, dp, greedy, math, sortings, strings, trees
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
cur = [a]
s = sum(a)
ans = 0
cnt = 0
i = 1 << 31
while i:
i >>= 1
fcnt = 0
bcnt = 0
nex = []
for arr in cur:
aa, bb = []... | output | 1 | 46,452 | 12 | 92,905 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitw... | instruction | 0 | 46,453 | 12 | 92,906 |
Tags: bitmasks, data structures, divide and conquer, dp, greedy, math, sortings, strings, trees
Correct Solution:
```
import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
... | output | 1 | 46,453 | 12 | 92,907 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitw... | instruction | 0 | 46,454 | 12 | 92,908 |
Tags: bitmasks, data structures, divide and conquer, dp, greedy, math, sortings, strings, trees
Correct Solution:
```
import io
import os
from collections import Counter, defaultdict, deque
def solve(N, A):
total = 0
ans = 0
groups = [A] # group by high bits equal so far
for pos in reversed(range(32... | output | 1 | 46,454 | 12 | 92,909 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitw... | instruction | 0 | 46,455 | 12 | 92,910 |
Tags: bitmasks, data structures, divide and conquer, dp, greedy, math, sortings, strings, trees
Correct Solution:
```
import sys
input = sys.stdin.buffer.readline
n, ls = int(input()), list(map(int, input().split()))
cur, res, cc = [ls], 0, 0
for i in range(30, -1, -1):
t_rc0, t_rc1, nx = 0, 0, []
for ar in cu... | output | 1 | 46,455 | 12 | 92,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitw... | instruction | 0 | 46,456 | 12 | 92,912 |
Tags: bitmasks, data structures, divide and conquer, dp, greedy, math, sortings, strings, trees
Correct Solution:
```
import sys,collections as cc
input = sys.stdin.buffer.readline
I = lambda : list(map(int,input().split()))
n,=I()
l=I()
an=ban=0
ar=cc.defaultdict(list)
ar[0]=l
xo=1<<30
for i in range(30,-1,-1):
a=b=... | output | 1 | 46,456 | 12 | 92,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitw... | instruction | 0 | 46,457 | 12 | 92,914 |
Tags: bitmasks, data structures, divide and conquer, dp, greedy, math, sortings, strings, trees
Correct Solution:
```
n = int(input())
a = [int(x) for x in input().split()]
def solve(w, bit_level):
l = []
h = []
openers = 0
inversions = 0
alt_openers = 0
alt_inversions = 0
for x in w... | output | 1 | 46,457 | 12 | 92,915 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes the operation [bitw... | instruction | 0 | 46,458 | 12 | 92,916 |
Tags: bitmasks, data structures, divide and conquer, dp, greedy, math, sortings, strings, trees
Correct Solution:
```
MB = 29
def ibit(n, k):
return (n>>k)&1
def count(m, k):
res0 = 0
on = 0
res1 = 0
zer = 0
prr = None
for ell in m:
el = ibit(ell, k)
ot = ell >> (k+1)
... | output | 1 | 46,458 | 12 | 92,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ... | instruction | 0 | 46,459 | 12 | 92,918 |
Yes | output | 1 | 46,459 | 12 | 92,919 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ... | instruction | 0 | 46,460 | 12 | 92,920 |
Yes | output | 1 | 46,460 | 12 | 92,921 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ... | instruction | 0 | 46,461 | 12 | 92,922 |
Yes | output | 1 | 46,461 | 12 | 92,923 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ... | instruction | 0 | 46,462 | 12 | 92,924 |
Yes | output | 1 | 46,462 | 12 | 92,925 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ... | instruction | 0 | 46,463 | 12 | 92,926 |
No | output | 1 | 46,463 | 12 | 92,927 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ... | instruction | 0 | 46,464 | 12 | 92,928 |
No | output | 1 | 46,464 | 12 | 92,929 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ... | instruction | 0 | 46,465 | 12 | 92,930 |
No | output | 1 | 46,465 | 12 | 92,931 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ... | instruction | 0 | 46,466 | 12 | 92,932 |
No | output | 1 | 46,466 | 12 | 92,933 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've got a positive integer sequence a1, a2, ..., an. All numbers in the sequence are distinct. Let's fix the set of variables b1, b2, ..., bm. Initially each variable bi (1 ≤ i ≤ m) contains the value of zero. Consider the following seque... | instruction | 0 | 46,564 | 12 | 93,128 |
Tags: bitmasks, dp
Correct Solution:
```
def Solve(x,B):
if((X,x,B) in Mem):
return Mem[(X,x,B)]
if(len(B)>X):
return False
if(x==len(L)):
return True
if(Form(L[x],B)):
A=list(B)
for e in range(len(B)):
r=A[e]
A[e]=L[x]
if(Solve... | output | 1 | 46,564 | 12 | 93,129 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dr. Evil is interested in math and functions, so he gave Mahmoud and Ehab array a of length n and array b of length m. He introduced a function f(j) which is defined for integers j, which satisfy 0 ≤ j ≤ m - n. Suppose, ci = ai - bi + j. The... | instruction | 0 | 46,770 | 12 | 93,540 |
Tags: binary search, data structures, sortings
Correct Solution:
```
def read(): return list(map(int, input().split(' ')))
n, m, q = read()
aa = read()
bb = read()
reqs = [read() for _ in range(q)]
asum = 0
bsum = 0
for i, (a, b) in enumerate(zip(aa, bb)):
asum += a if i % 2 == 0 else -a
bsum += b if i % 2 == ... | output | 1 | 46,770 | 12 | 93,541 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dr. Evil is interested in math and functions, so he gave Mahmoud and Ehab array a of length n and array b of length m. He introduced a function f(j) which is defined for integers j, which satisfy 0 ≤ j ≤ m - n. Suppose, ci = ai - bi + j. The... | instruction | 0 | 46,771 | 12 | 93,542 |
Tags: binary search, data structures, sortings
Correct Solution:
```
from bisect import *
f = lambda: list(map(int, input().split()))
n, m, q = f()
k = m - n + 1
a = f()
s = sum(a[0:n:2]) - sum(a[1:n:2])
b = [0] + f()
for i in range(2, m + 1, 2): b[i] = -b[i]
for i in range(m): b[i + 1] += b[i]
u = [b[j] - b[j + n]... | output | 1 | 46,771 | 12 | 93,543 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
Input
The first line contains positive... | instruction | 0 | 46,792 | 12 | 93,584 |
Tags: implementation
Correct Solution:
```
#python3
#utf-8
n = int(input())
idx___val = [int(x) for x in input().split()]
minim = min(idx___val)
min_idxes = [idx for idx in range(n) if idx___val[idx] == minim]
min_dist = min([(min_idxes[i] - min_idxes[i - 1]) for i in range(1, len(min_idxes))])
print(min_dist)
``` | output | 1 | 46,792 | 12 | 93,585 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
Input
The first line contains positive... | instruction | 0 | 46,793 | 12 | 93,586 |
Tags: implementation
Correct Solution:
```
n = int(input())
s = input()
a = []
s = s.split()
mn = 1000000001
count = 0
minres = 100000
for c in s:
if int(c)<mn:
mn = int(c)
minres = 100000
count = 0
if count!=0 and int(c)==mn:
if count<minres:
minres = count
c... | output | 1 | 46,793 | 12 | 93,587 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
Input
The first line contains positive... | instruction | 0 | 46,794 | 12 | 93,588 |
Tags: implementation
Correct Solution:
```
n = int(input())
a = list(map(int,input().split()))
cur = 0
ans = 100001
for i in range(1,n):
if a[cur] == a[i]:
ans = min(ans, i-cur)
cur = i
elif a[i] < a[cur]:
cur = i
ans = 100001
print(ans)
``` | output | 1 | 46,794 | 12 | 93,589 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
Input
The first line contains positive... | instruction | 0 | 46,795 | 12 | 93,590 |
Tags: implementation
Correct Solution:
```
input()
A = list(map(int, input().split()))
a_min = min(A)
X = [i for i, a in enumerate(A) if a == a_min]
print(min(i - j for i, j in zip(X[1:], X)))
``` | output | 1 | 46,795 | 12 | 93,591 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
Input
The first line contains positive... | instruction | 0 | 46,796 | 12 | 93,592 |
Tags: implementation
Correct Solution:
```
import math
n = int(input())
X = input()
x = X.split()
arr = []
m = math.inf
for i in x:
i = int(i)
if i<m:
m = i
for i in range(len(x)):
if int(x[i]) == int(m):
arr.append(i)
temp = arr[1]-arr[0]
for i in range(len(arr)-1):
if (arr[i+1]-arr[i])<temp:
temp = a... | output | 1 | 46,796 | 12 | 93,593 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
Input
The first line contains positive... | instruction | 0 | 46,797 | 12 | 93,594 |
Tags: implementation
Correct Solution:
```
n=int(input())
a=list(map(int,input().split()))
x=min(a)
ans=10000000
b=[]
for i in range(0,n):
if a[i]==x:
b.append(i)
pos=b[0]
for i in range(1,len(b)):
ans=min(ans,b[i]-pos)
pos=b[i]
print(ans)
``` | output | 1 | 46,797 | 12 | 93,595 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
Input
The first line contains positive... | instruction | 0 | 46,798 | 12 | 93,596 |
Tags: implementation
Correct Solution:
```
n=int(input())
a=[int(i) for i in input().split()]
z=min(a)
p=[]
for i in range(n):
if a[i]==z:
p.append(i)
h=[]
for i in range(len(p)-1):
h.append(p[i+1]-p[i])
print(min(h)+1-1)
``` | output | 1 | 46,798 | 12 | 93,597 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
Input
The first line contains positive... | instruction | 0 | 46,799 | 12 | 93,598 |
Tags: implementation
Correct Solution:
```
if __name__ == '__main__':
n = int(input())
a = [int(i) for i in input().split()]
mx = min(a)
a = [i for i in range(n) if a[i] == mx]
d = [a[i] - a[i - 1] for i in range(1, len(a))]
print(min(d))
``` | output | 1 | 46,799 | 12 | 93,599 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Fair Nut has found an array a of n integers. We call subarray l … r a sequence of consecutive elements of an array with indexes from l to r, i.e. a_l, a_{l+1}, a_{l+2}, …, a_{r-1}, a_{r}.
... | instruction | 0 | 47,043 | 12 | 94,086 |
No | output | 1 | 47,043 | 12 | 94,087 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Fair Nut has found an array a of n integers. We call subarray l … r a sequence of consecutive elements of an array with indexes from l to r, i.e. a_l, a_{l+1}, a_{l+2}, …, a_{r-1}, a_{r}.
... | instruction | 0 | 47,044 | 12 | 94,088 |
No | output | 1 | 47,044 | 12 | 94,089 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a matrix a, consisting of n rows and m columns. Each cell contains an integer in it.
You can change the order of rows arbitrarily (including leaving the initial order), but you can't change the order of cells in a row. After y... | instruction | 0 | 47,045 | 12 | 94,090 |
Tags: binary search, bitmasks, brute force, dp, graphs
Correct Solution:
```
import sys
from array import array # noqa: F401
from typing import List, Tuple, TypeVar, Generic, Sequence, Union # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
def solve(i, n, delta, delta2):
inf = ... | output | 1 | 47,045 | 12 | 94,091 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a matrix a, consisting of n rows and m columns. Each cell contains an integer in it.
You can change the order of rows arbitrarily (including leaving the initial order), but you can't change the order of cells in a row. After y... | instruction | 0 | 47,046 | 12 | 94,092 |
Tags: binary search, bitmasks, brute force, dp, graphs
Correct Solution:
```
import sys
import copy
input = sys.stdin.readline
n,m=map(int,input().split())
MAT=[list(map(int,input().split())) for i in range(n)]
#n=15
#m=10000
#MAT=[list(range(j*j,j*j*(m+1),j*j)) for j in range(1,n+1)]
if n==1:
ANS=10**10
f... | output | 1 | 47,046 | 12 | 94,093 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a matrix a, consisting of n rows and m columns. Each cell contains an integer in it.
You can change the order of rows arbitrarily (including leaving the initial order), but you can't change the order of cells in a row. After y... | instruction | 0 | 47,047 | 12 | 94,094 |
Tags: binary search, bitmasks, brute force, dp, graphs
Correct Solution:
```
import sys
def read():
return int(input())
def reads():
return [int(x) for x in input().split()]
N,M=reads()
table=[reads() for i in range(N)]
A=[[0]*N for i in range(N)]
B=[[0]*N for i in range(N)]
for i in range(N):
for j in rang... | output | 1 | 47,047 | 12 | 94,095 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a matrix a, consisting of n rows and m columns. Each cell contains an integer in it.
You can change the order of rows arbitrarily (including leaving the initial order), but you can't change the order of cells in a row. After y... | instruction | 0 | 47,048 | 12 | 94,096 |
Tags: binary search, bitmasks, brute force, dp, graphs
Correct Solution:
```
import sys
def read():
return int(input())
def reads():
return [int(x) for x in input().split()]
N,M=reads()
table=[reads() for i in range(N)]
A=[[0]*N for i in range(N)]
B=[[0]*N for i in range(N)]
for i in range(N):
for j in rang... | output | 1 | 47,048 | 12 | 94,097 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a matrix a, consisting of n rows and m columns. Each cell contains an integer in it.
You can change the order of rows arbitrarily (including leaving the initial order), but you ca... | instruction | 0 | 47,049 | 12 | 94,098 |
No | output | 1 | 47,049 | 12 | 94,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.