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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call beauty of an array b_1, b_2, β¦, b_n (n > 1) β min_{1 β€ i < j β€ n} |b_i - b_j|.
You're given an array a_1, a_2, β¦ a_n and a number k. Calculate the sum of beauty over all subsequences... | instruction | 0 | 65,682 | 12 | 131,364 |
No | output | 1 | 65,682 | 12 | 131,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call beauty of an array b_1, b_2, β¦, b_n (n > 1) β min_{1 β€ i < j β€ n} |b_i - b_j|.
You're given an array a_1, a_2, β¦ a_n and a number k. Calculate the sum of beauty over all subsequences... | instruction | 0 | 65,683 | 12 | 131,366 |
No | output | 1 | 65,683 | 12 | 131,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call beauty of an array b_1, b_2, β¦, b_n (n > 1) β min_{1 β€ i < j β€ n} |b_i - b_j|.
You're given an array a_1, a_2, β¦ a_n and a number k. Calculate the sum of beauty over all subsequences... | instruction | 0 | 65,684 | 12 | 131,368 |
No | output | 1 | 65,684 | 12 | 131,369 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order by second elements. O... | instruction | 0 | 65,685 | 12 | 131,370 |
Tags: combinatorics
Correct Solution:
```
import sys
from collections import Counter
readline = sys.stdin.readline
readlines = sys.stdin.readlines
mod = 998244353
n=int(input())
ab=[tuple(map(int, readline().split())) for _ in range(n)]
ab.sort()
fun = [1] * (n + 1)
for i in range(1, n + 1):
fun[i] = fun[i - 1]... | output | 1 | 65,685 | 12 | 131,371 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order by second elements. O... | instruction | 0 | 65,686 | 12 | 131,372 |
Tags: combinatorics
Correct Solution:
```
from collections import Counter
import sys
input = sys.stdin.readline
MOD = 998244353
n = int(input())
s = sorted([tuple(map(int, input().split())) for _ in range(n)])
fact = [1]
for i in range(1, n + 1):
fact.append(fact[-1] * i % MOD)
def ways(l):
count = Counter(... | output | 1 | 65,686 | 12 | 131,373 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order by second elements. O... | instruction | 0 | 65,687 | 12 | 131,374 |
Tags: combinatorics
Correct Solution:
```
import sys
input = sys.stdin.readline
n = int(input())
s = [list(map(int, input().split())) for y in range(n)]
MOD = 998244353
fact = [1]*(n+1)
for i in range(1, n+1):
fact[i] = (fact[i-1] * i) % MOD
a, b = [0]*n, [0]*n
for x, y in s:
a[x-1] += 1
b[y-1] += 1
a_... | output | 1 | 65,687 | 12 | 131,375 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order by second elements. O... | instruction | 0 | 65,688 | 12 | 131,376 |
Tags: combinatorics
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()
self.buffer = BytesIO()
self.writable ... | output | 1 | 65,688 | 12 | 131,377 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order by second elements. O... | instruction | 0 | 65,689 | 12 | 131,378 |
Tags: combinatorics
Correct Solution:
```
from sys import stdin
input = stdin.readline
mod = 998244353
fact = [1, 1]
dictf = [0, 0]
dicts = [0, 0]
dictb = [0, 0]
for i in range(2, 3 * pow(10, 5) + 99):
fact.append((fact[-1] * i) % mod)
dicts.append(0)
dictf.append(0)
dictb.append(0)
n = int(input())
a... | output | 1 | 65,689 | 12 | 131,379 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order by second elements. O... | instruction | 0 | 65,690 | 12 | 131,380 |
Tags: combinatorics
Correct Solution:
```
"""
Satwik_Tiwari ;) .
24th july , 2020 - Friday
"""
#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function
from fractions import Fraction
impo... | output | 1 | 65,690 | 12 | 131,381 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order by second elements. O... | instruction | 0 | 65,691 | 12 | 131,382 |
Tags: combinatorics
Correct Solution:
```
import io, sys
input = lambda f=io.StringIO(sys.stdin.buffer.read().decode()).readline: f().rstrip()
MAX = 3 * 10 ** 5 + 5
MOD = 998244353
fac = [1] * MAX
for i in range(2, MAX):
fac[i] = fac[i - 1] * i % MOD
def count(z):
r = 1
i = 0
while i < len(z):
... | output | 1 | 65,691 | 12 | 131,383 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order by second elements. O... | instruction | 0 | 65,692 | 12 | 131,384 |
Tags: combinatorics
Correct Solution:
```
MOD = 998244353
# Read input
n = int(input())
a = []
b = []
fact = [1]
for i in range(n):
x_a, x_b = input().strip().split(' ')
a.append(int(x_a))
b.append(int(x_b))
for i in range(1, n+1):
fact.append((fact[i-1] * i) % MOD)
def count_permutations(arr):
... | output | 1 | 65,692 | 12 | 131,385 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorte... | instruction | 0 | 65,693 | 12 | 131,386 |
Yes | output | 1 | 65,693 | 12 | 131,387 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorte... | instruction | 0 | 65,694 | 12 | 131,388 |
Yes | output | 1 | 65,694 | 12 | 131,389 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorte... | instruction | 0 | 65,695 | 12 | 131,390 |
Yes | output | 1 | 65,695 | 12 | 131,391 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorte... | instruction | 0 | 65,696 | 12 | 131,392 |
Yes | output | 1 | 65,696 | 12 | 131,393 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorte... | instruction | 0 | 65,697 | 12 | 131,394 |
No | output | 1 | 65,697 | 12 | 131,395 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorte... | instruction | 0 | 65,698 | 12 | 131,396 |
No | output | 1 | 65,698 | 12 | 131,397 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorte... | instruction | 0 | 65,699 | 12 | 131,398 |
No | output | 1 | 65,699 | 12 | 131,399 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorte... | instruction | 0 | 65,700 | 12 | 131,400 |
No | output | 1 | 65,700 | 12 | 131,401 |
Provide tags and a correct Python 3 solution for this coding contest problem.
"You must lift the dam. With a lever. I will give it to you.
You must block the canal. With a rock. I will not give the rock to you."
Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Liz... | instruction | 0 | 65,771 | 12 | 131,542 |
Tags: bitmasks, math
Correct Solution:
```
# import numpy as npy
# idx=sorted(idx,key=functools.cmp_to_key(cmpx))
import bisect
import functools
import math
T=int(input())
for Tid in range(T):
n=int(input())
a=list(map(int,input().split()))
tab=[0 for i in range(35)]
ans=0
for i in range(n):
... | output | 1 | 65,771 | 12 | 131,543 |
Provide tags and a correct Python 3 solution for this coding contest problem.
"You must lift the dam. With a lever. I will give it to you.
You must block the canal. With a rock. I will not give the rock to you."
Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Liz... | instruction | 0 | 65,772 | 12 | 131,544 |
Tags: bitmasks, math
Correct Solution:
```
for _ in range(int(input())):
n=int(input())
lst = list(map(int,input().split()))
d={}
for ele in lst:
msbl = len(bin(ele))-2
if msbl in d:
d[msbl] +=1
else:
d[msbl] = 1
res = 0
for k in d:
e = d[k... | output | 1 | 65,772 | 12 | 131,545 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table o... | instruction | 0 | 65,786 | 12 | 131,572 |
Tags: constructive algorithms, implementation
Correct Solution:
```
def correct(x, y):
ans.append([x+1, y+1, x+1, y+2, x+2, y+2])
ans.append([x+1, y+1, x+2, y+1, x+2, y+2])
ans.append([x+1, y+1, x+1, y+2, x+2, y+1])
for nt in range(int(input())):
n,m = map(int,input().split())
a, ans = [], []
for i in range(n):
... | output | 1 | 65,786 | 12 | 131,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table o... | instruction | 0 | 65,787 | 12 | 131,574 |
Tags: constructive algorithms, implementation
Correct Solution:
```
def unique_pairs(n):
"""Produce pairs of indexes in range(n)"""
for i in range(n):
for j in range(n):
yield i, j
def oper1(table, n, m, res):
for i in range(n-1, 1, -1):
for j in range(m-2):
... | output | 1 | 65,787 | 12 | 131,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table o... | instruction | 0 | 65,788 | 12 | 131,576 |
Tags: constructive algorithms, implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
n, m = map(int, input().split())
a = list( list(map(int , input())) for _ in range(n))
all_ans = list()
for i in range(n-1):
for j in range(m-1):
ans = list()
if a[i... | output | 1 | 65,788 | 12 | 131,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table o... | instruction | 0 | 65,789 | 12 | 131,578 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import sys
import string
import random
from typing import List
sys.setrecursionlimit(99999)
t = int(input())
for _ in range(t):
n,m = map(int,... | output | 1 | 65,789 | 12 | 131,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table o... | instruction | 0 | 65,790 | 12 | 131,580 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import sys
from itertools import permutations
from itertools import combinations
from itertools import combinations_with_replacement
#sys.stdin = open('/Users/pranjalkandhari/Desktop/Template/input.txt', 'r')
def makeThree(mat , i , j , liAns):
li... | output | 1 | 65,790 | 12 | 131,581 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table o... | instruction | 0 | 65,791 | 12 | 131,582 |
Tags: constructive algorithms, 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 k in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k in ra... | output | 1 | 65,791 | 12 | 131,583 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table o... | instruction | 0 | 65,792 | 12 | 131,584 |
Tags: constructive algorithms, implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
n, m = map(int, input().split())
a = [list(map(int, input())) for i in range(n)]
def add(x, y, z):
a[x[0]][x[1]] ^= 1
a[y[0]][y[1]] ^= 1
a[z[0]][z[1]] ^= 1
ans.append(' '.j... | output | 1 | 65,792 | 12 | 131,585 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table o... | instruction | 0 | 65,793 | 12 | 131,586 |
Tags: constructive algorithms, implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
n,m = map(int, input().split())
S = []
for i in range(n):
s = list(str(input()))
s = [int(i) for i in s]
S.append(s)
ans = []
for i in range(n-1):
for j in range(m-... | output | 1 | 65,793 | 12 | 131,587 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) β€ ... | instruction | 0 | 65,803 | 12 | 131,606 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
n=int(input())
a=[int(i) for i in input().split()]
ans=0
for i in range(n-1):
if max(a[i],a[i+1])/min(a[i],a[i+1])>2:
maxx=max(a[i],a[i+1])
minn=min(a[i],a[i+1])
while minn<maxx:
... | output | 1 | 65,803 | 12 | 131,607 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) β€ ... | instruction | 0 | 65,804 | 12 | 131,608 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
s=0
for i in range(n-1):
a=max(l[i],l[i+1])
b=min(l[i],l[i+1])
while a>(2*b):
s+=1
b=b*2
print(s)
``` | output | 1 | 65,804 | 12 | 131,609 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) β€ ... | instruction | 0 | 65,805 | 12 | 131,610 |
Tags: greedy, math
Correct Solution:
```
ssi = lambda : map(int, input().split())
for _ in range(int(input())):
n = int(input())
l = list(ssi())
i= 0
ans=0
while i<n-1:
s,b = sorted(l[i:i+2])
while 2*s<b:
s<<=1
ans+=1
i+=1
print(ans)
``` | output | 1 | 65,805 | 12 | 131,611 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) β€ ... | instruction | 0 | 65,806 | 12 | 131,612 |
Tags: greedy, math
Correct Solution:
```
def inl():
return [int(i) for i in input().split()]
def inp():
return int(input())
if __name__ == "__main__":
for _ in range(inp()):
n = inp()
a = inl()
cnt = 0
for i in range(1,n):
x = min(a[i],a[i-1])
y = max... | output | 1 | 65,806 | 12 | 131,613 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) β€ ... | instruction | 0 | 65,807 | 12 | 131,614 |
Tags: greedy, math
Correct Solution:
```
import math
t = int(input())
def check():
return max(a[i], a[i+1]) > 2* min(a[i], a[i+1])
res = []
for _ in range(t):
n = int(input())
a = [int(i) for i in input().split()]
i=0
c=0
while(i<len(a)-1):
if check():
a.inse... | output | 1 | 65,807 | 12 | 131,615 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) β€ ... | instruction | 0 | 65,808 | 12 | 131,616 |
Tags: greedy, math
Correct Solution:
```
import copy
t=int(input())
for i in range(t):
n=int(input())
a = list(map(int, input().rstrip().split()))
gg=0
for i in range(len(a)-1):
h= max(a[i],a[i+1])
m= min(a[i],a[i+1])
if h/m>2:
t=copy.deepcopy(m)
... | output | 1 | 65,808 | 12 | 131,617 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) β€ ... | instruction | 0 | 65,809 | 12 | 131,618 |
Tags: greedy, math
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
inp = lambda: list(map(int,sys.stdin.readline().rstrip("\r\n").split()))
mod = 10**9+7; Mod = 998244353; INF = float('inf')
#___________________________________________________________________________________________... | output | 1 | 65,809 | 12 | 131,619 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(min(a[i], a[i+1])) β€ ... | instruction | 0 | 65,810 | 12 | 131,620 |
Tags: greedy, math
Correct Solution:
```
num = int(input())
for i in range(num):
size = int(input())
arr = list(map(int, input().rstrip().split()))
ans = 0
tmp = 0
for i in range(size-1):
if arr[i]>arr[i+1]*2:
tmp = arr[i+1]
while arr[i]>tmp*2:
tmp = t... | output | 1 | 65,810 | 12 | 131,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied... | instruction | 0 | 65,811 | 12 | 131,622 |
Yes | output | 1 | 65,811 | 12 | 131,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied... | instruction | 0 | 65,812 | 12 | 131,624 |
Yes | output | 1 | 65,812 | 12 | 131,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied... | instruction | 0 | 65,813 | 12 | 131,626 |
Yes | output | 1 | 65,813 | 12 | 131,627 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied... | instruction | 0 | 65,814 | 12 | 131,628 |
Yes | output | 1 | 65,814 | 12 | 131,629 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied... | instruction | 0 | 65,815 | 12 | 131,630 |
No | output | 1 | 65,815 | 12 | 131,631 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied... | instruction | 0 | 65,816 | 12 | 131,632 |
No | output | 1 | 65,816 | 12 | 131,633 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied... | instruction | 0 | 65,817 | 12 | 131,634 |
No | output | 1 | 65,817 | 12 | 131,635 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Polycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 β€ i β€ n-1), this condition must be satisfied... | instruction | 0 | 65,818 | 12 | 131,636 |
No | output | 1 | 65,818 | 12 | 131,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a number n and an array b_1, b_2, β¦, b_{n+2}, obtained according to the following algorithm:
* some array a_1, a_2, β¦, a_n was guessed;
* array a was written to array b, i.e. b_i = a_i (1 β€ i β€ n);
* The (n+1)-th elem... | instruction | 0 | 65,819 | 12 | 131,638 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
class Solution:
def solve(self, n, b):
m = n + 2
b.sort()
summ = sum(b[:m-1])
largest = b[m-1]
largest2 = b[m-2]
for i in range(m-1):
if summ - b[i] == largest:
... | output | 1 | 65,819 | 12 | 131,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a number n and an array b_1, b_2, β¦, b_{n+2}, obtained according to the following algorithm:
* some array a_1, a_2, β¦, a_n was guessed;
* array a was written to array b, i.e. b_i = a_i (1 β€ i β€ n);
* The (n+1)-th elem... | instruction | 0 | 65,820 | 12 | 131,640 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
lis = list(map(int,input().split()))
m = max(lis)
m_i = lis.index(m)
del lis[m_i]
s = sum(lis)
if s%2==0 and s==max(lis)*2:
s_m = max(lis)
s_m_i = lis.i... | output | 1 | 65,820 | 12 | 131,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a number n and an array b_1, b_2, β¦, b_{n+2}, obtained according to the following algorithm:
* some array a_1, a_2, β¦, a_n was guessed;
* array a was written to array b, i.e. b_i = a_i (1 β€ i β€ n);
* The (n+1)-th elem... | instruction | 0 | 65,821 | 12 | 131,642 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
l = list(map(int,input().split()))
l.sort()
t = sum(l)
if (t-l[-1]-l[-2])==l[-2]:
print(*l[:-2])
else:
t-=l[-1]
f = 0
for i in range(n+1):
... | output | 1 | 65,821 | 12 | 131,643 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a number n and an array b_1, b_2, β¦, b_{n+2}, obtained according to the following algorithm:
* some array a_1, a_2, β¦, a_n was guessed;
* array a was written to array b, i.e. b_i = a_i (1 β€ i β€ n);
* The (n+1)-th elem... | instruction | 0 | 65,822 | 12 | 131,644 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
for t in range(int(input())):
n=int(input())
b=[int(x) for x in input().split()]
b.sort()
flag=False
assumed_sum=b[-2]
total=sum(b)-assumed_sum-b[-1]
if(total==assumed_sum):
b.pop()
b.pop()
p... | output | 1 | 65,822 | 12 | 131,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a number n and an array b_1, b_2, β¦, b_{n+2}, obtained according to the following algorithm:
* some array a_1, a_2, β¦, a_n was guessed;
* array a was written to array b, i.e. b_i = a_i (1 β€ i β€ n);
* The (n+1)-th elem... | instruction | 0 | 65,823 | 12 | 131,646 |
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
def main():
from sys import stdin, stdout
for _ in range(int(stdin.readline())):
n = int(stdin.readline())
arr = list(map(int,stdin.readline().split()))
arrsum = sum(arr)
mydict = {}
for i in ra... | output | 1 | 65,823 | 12 | 131,647 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.