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.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent on searching for a new toy, Ba... | instruction | 0 | 2,474 | 12 | 4,948 |
Tags: implementation
Correct Solution:
```
import sys
import math
def period(x):
n = len(x)
res = []
for i in range(1, len(x)):
if all(i==j for i,j in zip(x, x[i:])):
res.append(i)
return res + [n]
def main():
[n] = map(int, next(sys.stdin).split())
a = list(map(int, next(s... | output | 1 | 2,474 | 12 | 4,949 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. A... | instruction | 0 | 2,475 | 12 | 4,950 |
Yes | output | 1 | 2,475 | 12 | 4,951 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. A... | instruction | 0 | 2,476 | 12 | 4,952 |
Yes | output | 1 | 2,476 | 12 | 4,953 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. A... | instruction | 0 | 2,477 | 12 | 4,954 |
Yes | output | 1 | 2,477 | 12 | 4,955 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. A... | instruction | 0 | 2,478 | 12 | 4,956 |
Yes | output | 1 | 2,478 | 12 | 4,957 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. A... | instruction | 0 | 2,479 | 12 | 4,958 |
No | output | 1 | 2,479 | 12 | 4,959 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. A... | instruction | 0 | 2,480 | 12 | 4,960 |
No | output | 1 | 2,480 | 12 | 4,961 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. A... | instruction | 0 | 2,481 | 12 | 4,962 |
No | output | 1 | 2,481 | 12 | 4,963 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bajtek, known for his unusual gifts, recently got an integer array x_0, x_1, β¦, x_{k-1}.
Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. A... | instruction | 0 | 2,482 | 12 | 4,964 |
No | output | 1 | 2,482 | 12 | 4,965 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this task, Nastya asked us to write a formal statement.
An array a of length n and an array k of length n-1 are given. Two types of queries should be processed:
* increase a_i by x. Then... | instruction | 0 | 2,503 | 12 | 5,006 |
No | output | 1 | 2,503 | 12 | 5,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this task, Nastya asked us to write a formal statement.
An array a of length n and an array k of length n-1 are given. Two types of queries should be processed:
* increase a_i by x. Then... | instruction | 0 | 2,504 | 12 | 5,008 |
No | output | 1 | 2,504 | 12 | 5,009 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this task, Nastya asked us to write a formal statement.
An array a of length n and an array k of length n-1 are given. Two types of queries should be processed:
* increase a_i by x. Then... | instruction | 0 | 2,505 | 12 | 5,010 |
No | output | 1 | 2,505 | 12 | 5,011 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In this task, Nastya asked us to write a formal statement.
An array a of length n and an array k of length n-1 are given. Two types of queries should be processed:
* increase a_i by x. Then... | instruction | 0 | 2,506 | 12 | 5,012 |
No | output | 1 | 2,506 | 12 | 5,013 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number of continuous segments, such that in each segm... | instruction | 0 | 2,655 | 12 | 5,310 |
Tags: data structures, dp, greedy, math, number theory, two pointers
Correct Solution:
```
#!/usr/bin/env python3
import sys, getpass
import math, random
import functools, itertools, collections, heapq, bisect
from collections import Counter, defaultdict, deque
input = sys.stdin.readline # to read input quickly
# ava... | output | 1 | 2,655 | 12 | 5,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number of continuous segments, such that in each segm... | instruction | 0 | 2,656 | 12 | 5,312 |
Tags: data structures, dp, greedy, math, number theory, two pointers
Correct Solution:
```
import logging
import sys
from collections import Counter, defaultdict
from inspect import currentframe
# sys.setrecursionlimit(10 ** 6) #Pypyγ γ¨256MBδΈιγθΆ
γγ
input = sys.stdin.readline
logging.basicConfig(level=logging.DEBUG)
de... | output | 1 | 2,656 | 12 | 5,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number of continuous segments, such that in each segm... | instruction | 0 | 2,657 | 12 | 5,314 |
Tags: data structures, dp, greedy, math, number theory, two pointers
Correct Solution:
```
from math import ceil,floor,log
import sys,threading
from heapq import heappush,heappop
from collections import Counter,defaultdict,deque
import bisect
input=lambda : sys.stdin.readline().strip()
c=lambda x: 10**9 if(x=="?") else... | output | 1 | 2,657 | 12 | 5,315 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number of continuous segments, such that in each segm... | instruction | 0 | 2,658 | 12 | 5,316 |
Tags: data structures, dp, greedy, math, number theory, two pointers
Correct Solution:
```
import sys
input = sys.stdin.readline
max_ = 10 ** 4
tf = [True] * (max_ + 1)
tf[0] = False
tf[1] = False
for i in range(2, int((max_ + 1) ** 0.5 + 1)):
if not tf[i]: continue
for j in range(i * i, max_ + 1, i):
... | output | 1 | 2,658 | 12 | 5,317 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number of continuous segments, such that in each segm... | instruction | 0 | 2,660 | 12 | 5,320 |
Tags: data structures, dp, greedy, math, number theory, two pointers
Correct Solution:
```
import functools
import sys
input = iter(sys.stdin.read().splitlines()).__next__
MAX_A = 10**7
MAX_SQRT = 3163 # ceil sqrt MAX_A
# factors = [[] for _ in range(MAX_A+1)] # list of unique prime factors for each i
# for i in ra... | output | 1 | 2,660 | 12 | 5,321 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number of continuous segments, such that in each segm... | instruction | 0 | 2,661 | 12 | 5,322 |
Tags: data structures, dp, greedy, math, number theory, two pointers
Correct Solution:
```
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
... | output | 1 | 2,661 | 12 | 5,323 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number... | instruction | 0 | 2,663 | 12 | 5,326 |
Yes | output | 1 | 2,663 | 12 | 5,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number... | instruction | 0 | 2,666 | 12 | 5,332 |
No | output | 1 | 2,666 | 12 | 5,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number... | instruction | 0 | 2,667 | 12 | 5,334 |
No | output | 1 | 2,667 | 12 | 5,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number... | instruction | 0 | 2,668 | 12 | 5,336 |
No | output | 1 | 2,668 | 12 | 5,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that in this version k = 0.
There is an array a_1, a_2, β¦, a_n of n positive integers. You should divide it into a minimal number... | instruction | 0 | 2,669 | 12 | 5,338 |
No | output | 1 | 2,669 | 12 | 5,339 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \:\&\: a_... | instruction | 0 | 2,686 | 12 | 5,372 |
Tags: bitmasks, constructive algorithms, greedy
Correct Solution:
```
from collections import defaultdict as df
import sys
input = lambda : sys.stdin.readline().rstrip()
def compare(a,b):
n1 = len(a) - 1
n2 = len(b) - 1
more = False
ans = []
while True:
if n2 <= 1 and n1 <= 1:
b... | output | 1 | 2,686 | 12 | 5,373 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \:\&\: a_... | instruction | 0 | 2,687 | 12 | 5,374 |
Tags: bitmasks, constructive algorithms, greedy
Correct Solution:
```
t = int(input())
for j in range(t):
n = int(input())
x = list(map(int, input().split()))
ans = [0]
for i in range(1, n):
k = 0
otv = 0
while 2 ** k <= max(x[i], x[i-1]):
if 2 ** k & x[i-1] == 2**k a... | output | 1 | 2,687 | 12 | 5,375 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \:\&\: a_... | instruction | 0 | 2,688 | 12 | 5,376 |
Tags: bitmasks, constructive algorithms, greedy
Correct Solution:
```
#####################################
import atexit, io, sys, collections, math, heapq, fractions,copy, os, functools
import sys
import random
import collections
from io import BytesIO, IOBase
##################################### python 3 ST... | output | 1 | 2,688 | 12 | 5,377 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \:\&\: a_... | instruction | 0 | 2,689 | 12 | 5,378 |
Tags: bitmasks, constructive algorithms, greedy
Correct Solution:
```
def foo(a,b):
c,d=0,0
while b:
if b&1:
c=c|((a&1)^1)<<d
else:
c+=0
d+=1
a=a>>1
b=b>>1
return c
for _ in range(int(input())):
n=int(input())
x=list(map(int,input().spl... | output | 1 | 2,689 | 12 | 5,379 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \:\&\: a_... | instruction | 0 | 2,690 | 12 | 5,380 |
Tags: bitmasks, constructive algorithms, greedy
Correct Solution:
```
def solution(s):
res = [0]
a = s[0]
i = 1
while i < len(s):
a = a | s[i]
curr = a ^ s[i]
res.append(curr)
a = curr ^ s[i]
i += 1
return res
if __name__ == '__main__':
n = int(input())
... | output | 1 | 2,690 | 12 | 5,381 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \:\&\: a_... | instruction | 0 | 2,691 | 12 | 5,382 |
Tags: bitmasks, constructive algorithms, greedy
Correct Solution:
```
T=int(input());
for t in range(T):
n=int(input());
x=list(map(int,input().split()));
y=[];
y.append(0);
for i in range(n-1):
b=x[i]|x[i+1];
y.append(abs(x[i+1]-b));
x[i+1]=b;
print(*y);
``... | output | 1 | 2,691 | 12 | 5,383 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \:\&\: a_... | instruction | 0 | 2,692 | 12 | 5,384 |
Tags: bitmasks, constructive algorithms, greedy
Correct Solution:
```
# Problem: D. Co-growing Sequence
# Contest: Codeforces - Codeforces Round #731 (Div. 3)
# URL: https://codeforces.com/contest/1547/problem/D
# Memory Limit: 512 MB
# Time Limit: 2000 ms
#
# Powered by CP Editor (https://cpeditor.org)
# ____ ... | output | 1 | 2,692 | 12 | 5,385 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \:\&\: a_... | instruction | 0 | 2,693 | 12 | 5,386 |
Tags: bitmasks, constructive algorithms, greedy
Correct Solution:
```
n = int(input())
for k in range(n):
nn = input()
a = list(map(int, input().split()))
ans = [0]
for i in range(1, len(a)):
st = 1
an = 0
while st <= a[i - 1]:
if ((a[i - 1] // st) % 2 - (a[i] // st) ... | output | 1 | 2,693 | 12 | 5,387 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representati... | instruction | 0 | 2,694 | 12 | 5,388 |
Yes | output | 1 | 2,694 | 12 | 5,389 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representati... | instruction | 0 | 2,695 | 12 | 5,390 |
Yes | output | 1 | 2,695 | 12 | 5,391 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representati... | instruction | 0 | 2,696 | 12 | 5,392 |
Yes | output | 1 | 2,696 | 12 | 5,393 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representati... | instruction | 0 | 2,697 | 12 | 5,394 |
Yes | output | 1 | 2,697 | 12 | 5,395 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representati... | instruction | 0 | 2,698 | 12 | 5,396 |
No | output | 1 | 2,698 | 12 | 5,397 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representati... | instruction | 0 | 2,699 | 12 | 5,398 |
No | output | 1 | 2,699 | 12 | 5,399 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representati... | instruction | 0 | 2,700 | 12 | 5,400 |
No | output | 1 | 2,700 | 12 | 5,401 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representati... | instruction | 0 | 2,701 | 12 | 5,402 |
No | output | 1 | 2,701 | 12 | 5,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Levko has an array that consists of integers: a1, a2, ... , an. But he doesnβt like this array at all.
Levko thinks that the beauty of the array a directly depends on value c(a), which can be c... | instruction | 0 | 2,791 | 12 | 5,582 |
No | output | 1 | 2,791 | 12 | 5,583 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Levko has an array that consists of integers: a1, a2, ... , an. But he doesnβt like this array at all.
Levko thinks that the beauty of the array a directly depends on value c(a), which can be c... | instruction | 0 | 2,792 | 12 | 5,584 |
No | output | 1 | 2,792 | 12 | 5,585 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Levko has an array that consists of integers: a1, a2, ... , an. But he doesnβt like this array at all.
Levko thinks that the beauty of the array a directly depends on value c(a), which can be c... | instruction | 0 | 2,793 | 12 | 5,586 |
No | output | 1 | 2,793 | 12 | 5,587 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Levko has an array that consists of integers: a1, a2, ... , an. But he doesnβt like this array at all.
Levko thinks that the beauty of the array a directly depends on value c(a), which can be c... | instruction | 0 | 2,794 | 12 | 5,588 |
No | output | 1 | 2,794 | 12 | 5,589 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of integers of length n and integer number k. You should print any integer number x in the range of [1; 10^9] (i.e. 1 β€ x β€ 10^9) such that exactly k elements of given sequence are less than or equal to x.
Note that... | instruction | 0 | 3,060 | 12 | 6,120 |
Tags: sortings
Correct Solution:
```
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
a = sorted(a)
count = 0
if n < k:
print(-1)
exit()
if k == 0:
ans = a[0]-1
else:
ans = a[k-1]
for i in range(n):
if a[i]<= ans:
count+=1
if count != k or ans<1:
print(-1)
else:
print(ans)
``` | output | 1 | 3,060 | 12 | 6,121 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of integers of length n and integer number k. You should print any integer number x in the range of [1; 10^9] (i.e. 1 β€ x β€ 10^9) such that exactly k elements of given sequence are less than or equal to x.
Note that... | instruction | 0 | 3,061 | 12 | 6,122 |
Tags: sortings
Correct Solution:
```
n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
if k == 0:
if min(a) == 1:
print(-1)
else:
print(1)
exit()
c = a[k - 1] + 1
counter = 0
for el in a:
if el <= c:
counter += 1
if counter == k and c <= 10 ** 9:
... | output | 1 | 3,061 | 12 | 6,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of integers of length n and integer number k. You should print any integer number x in the range of [1; 10^9] (i.e. 1 β€ x β€ 10^9) such that exactly k elements of given sequence are less than or equal to x.
Note that... | instruction | 0 | 3,062 | 12 | 6,124 |
Tags: sortings
Correct Solution:
```
z,zz=input,lambda:list(map(int,z().split()))
zzz=lambda:[int(i) for i in stdin.readline().split()]
szz,graph,mod,szzz=lambda:sorted(zz()),{},10**9+7,lambda:sorted(zzz())
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collec... | output | 1 | 3,062 | 12 | 6,125 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of integers of length n and integer number k. You should print any integer number x in the range of [1; 10^9] (i.e. 1 β€ x β€ 10^9) such that exactly k elements of given sequence are less than or equal to x.
Note that... | instruction | 0 | 3,063 | 12 | 6,126 |
Tags: sortings
Correct Solution:
```
n,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
a.append(1)
a.sort()
if k==n:
print(a[k])
else:
if a[k+1]-a[k]==0:
print(-1)
else:
print(a[k])
``` | output | 1 | 3,063 | 12 | 6,127 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of integers of length n and integer number k. You should print any integer number x in the range of [1; 10^9] (i.e. 1 β€ x β€ 10^9) such that exactly k elements of given sequence are less than or equal to x.
Note that... | instruction | 0 | 3,064 | 12 | 6,128 |
Tags: sortings
Correct Solution:
```
n,k = map(int,input().split())
l = map(int,input().split())
l = sorted(l)
if k == 0:
if l[0] == 1:
print(-1)
else:
print(1)
elif k == n:
print(1000000000)
else:
if l[k] == l[k-1]:
print(-1)
else:
print(l[k-1])
``` | output | 1 | 3,064 | 12 | 6,129 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of integers of length n and integer number k. You should print any integer number x in the range of [1; 10^9] (i.e. 1 β€ x β€ 10^9) such that exactly k elements of given sequence are less than or equal to x.
Note that... | instruction | 0 | 3,065 | 12 | 6,130 |
Tags: sortings
Correct Solution:
```
n,k=(int(i) for i in input().split())
a=[int(i) for i in input().split()]
a.sort()
if k==0:
print(-1+a[0]*(a[0]>1))
quit()
if a[k-1] not in a[k:]:
print(a[k-1])
quit()
print(-1)
``` | output | 1 | 3,065 | 12 | 6,131 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.