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.
You are given a permutation, p_1, p_2, …, p_n.
Imagine that some positions of the permutation contain bombs, such that there exists at least one position without a bomb.
For some fixed configu... | instruction | 0 | 36,971 | 12 | 73,942 |
No | output | 1 | 36,971 | 12 | 73,943 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a permutation, p_1, p_2, …, p_n.
Imagine that some positions of the permutation contain bombs, such that there exists at least one position without a bomb.
For some fixed configu... | instruction | 0 | 36,972 | 12 | 73,944 |
No | output | 1 | 36,972 | 12 | 73,945 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and... | instruction | 0 | 36,995 | 12 | 73,990 |
Tags: data structures, dfs and similar, graphs, greedy, implementation, trees
Correct Solution:
```
from collections import defaultdict
import sys
input=sys.stdin.readline
n=int(input())
a=[int(i) for i in input().split() if i!='\n']
b=[int(i) for i in input().split() if i!='\n']
visited=[0]*(n+1)
graph=defaultdic... | output | 1 | 36,995 | 12 | 73,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and... | instruction | 0 | 36,996 | 12 | 73,992 |
Tags: data structures, dfs and similar, graphs, greedy, implementation, trees
Correct Solution:
```
import sys
import collections
inpy = [int(x) for x in sys.stdin.read().split()]
n = inpy[0]
a = [0] + inpy[1:1+n]
b = [0] + inpy[1+n:]
p = [-1] * (n + 1)
res = 0
memo = []
# def helper(i):
# if p[i] != -1:
# ... | output | 1 | 36,996 | 12 | 73,993 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and... | instruction | 0 | 36,997 | 12 | 73,994 |
Tags: data structures, dfs and similar, graphs, greedy, implementation, trees
Correct Solution:
```
from types import GeneratorType
def bootstrap(f, stack=[]):
def wrappedfunc(*args, **kwargs):
if stack:
return f(*args, **kwargs)
else:
to = f(*args, **kwargs)
whil... | output | 1 | 36,997 | 12 | 73,995 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and... | instruction | 0 | 36,998 | 12 | 73,996 |
Tags: data structures, dfs and similar, graphs, greedy, implementation, trees
Correct Solution:
```
from collections import defaultdict, deque
if __name__ == "__main__":
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
graph = defaultdict(list)
inorder = defa... | output | 1 | 36,998 | 12 | 73,997 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and... | instruction | 0 | 36,999 | 12 | 73,998 |
Tags: data structures, dfs and similar, graphs, greedy, implementation, trees
Correct Solution:
```
from collections import deque
n,a,b = int(input()),list(map(int,input().split())),list(map(int,input().split()));ans = 0;ent = [0]*n
for x in b:
if x >= 0:ent[x-1] += 1
q = deque();G = [list() for _ in range(n)]
fo... | output | 1 | 36,999 | 12 | 73,999 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and... | instruction | 0 | 37,000 | 12 | 74,000 |
Tags: data structures, dfs and similar, graphs, greedy, implementation, trees
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
b = list(int(x)-1 for x in input().split())
indeg = [0] * n
for x in b:
if x >= 0:
indeg[x] += 1
#print(*indeg)
q = [i for i in range(n) if indeg[i] == 0... | output | 1 | 37,000 | 12 | 74,001 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and... | instruction | 0 | 37,001 | 12 | 74,002 |
Tags: data structures, dfs and similar, graphs, greedy, implementation, trees
Correct Solution:
```
n=int(input())
val=list(map(int,input().split()))
b=list(map(int,input().split()))
neig=[0]*n
for i in range(n):
neig[i]=[0]
inedges=[0]*n
for i in range(n):
if b[i]!=-1:
neig[i][0]+=1
neig[i].app... | output | 1 | 37,001 | 12 | 74,003 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and... | instruction | 0 | 37,002 | 12 | 74,004 |
Tags: data structures, dfs and similar, graphs, greedy, implementation, trees
Correct Solution:
```
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
indeg = Counter(b)
s = []
for i in range(n):
if i+1 not in indeg:
s.append(i)
ans ... | output | 1 | 37,002 | 12 | 74,005 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,003 | 12 | 74,006 |
Yes | output | 1 | 37,003 | 12 | 74,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,004 | 12 | 74,008 |
Yes | output | 1 | 37,004 | 12 | 74,009 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,005 | 12 | 74,010 |
Yes | output | 1 | 37,005 | 12 | 74,011 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,006 | 12 | 74,012 |
Yes | output | 1 | 37,006 | 12 | 74,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,007 | 12 | 74,014 |
No | output | 1 | 37,007 | 12 | 74,015 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,008 | 12 | 74,016 |
No | output | 1 | 37,008 | 12 | 74,017 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,009 | 12 | 74,018 |
No | output | 1 | 37,009 | 12 | 74,019 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,010 | 12 | 74,020 |
No | output | 1 | 37,010 | 12 | 74,021 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided t... | instruction | 0 | 37,011 | 12 | 74,022 |
No | output | 1 | 37,011 | 12 | 74,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease all elements of a suffix of the array by 1.
A... | instruction | 0 | 37,033 | 12 | 74,066 |
Tags: constructive algorithms, implementation
Correct Solution:
```
#n=int(input())
for y in range(int(input())):
#n,m=map(int,input().split())
#lst1=list(map(int,input().split()))
n=int(input())
lst=list(map(int,input().split()))
dif=[0]*(n-1)
for i in range(n-2,-1,-1):
dif[i]=abs(lst[i... | output | 1 | 37,033 | 12 | 74,067 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease all elements of a suffix of the array by 1.
A... | instruction | 0 | 37,034 | 12 | 74,068 |
Tags: constructive algorithms, implementation
Correct Solution:
```
"""
Author - Satwik Tiwari .
4th Dec , 2020 - Friday
"""
#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function
from ... | output | 1 | 37,034 | 12 | 74,069 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease all elements of a suffix of the array by 1.
A... | instruction | 0 | 37,035 | 12 | 74,070 |
Tags: constructive algorithms, implementation
Correct Solution:
```
def solve():
n=int(input())
arr=[int(v) for v in input().split()]
dp=[[0]*(n+10) for _ in range(2)]
for i in reversed(range(n-1)):
dp[1][i] = dp[1][i+1] + abs(arr[i+1]-arr[i])
if i<n-2:
dp[0][i] = dp[... | output | 1 | 37,035 | 12 | 74,071 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease all elements of a suffix of the array by 1.
A... | instruction | 0 | 37,036 | 12 | 74,072 |
Tags: constructive algorithms, implementation
Correct Solution:
```
t=int(input())
for q in range(t):
n=int(input())
ch=input()
L=[int(i)for i in ch.split()]
nb=0
for i in range(1,n):
nb+=abs(L[i]-L[i-1])
v=[]
v.append(abs(L[0]-L[1]))
v.append(abs(L[-1]-L[-2]))
for i in rang... | output | 1 | 37,036 | 12 | 74,073 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease all elements of a suffix of the array by 1.
A... | instruction | 0 | 37,037 | 12 | 74,074 |
Tags: constructive algorithms, implementation
Correct Solution:
```
# author : Tapan Goyal
# MNIT Jaipur
import math
import bisect
import itertools
import sys
I=lambda : sys.stdin.readline()
one=lambda : int(I())
more=lambda : map(int,I().split())
linput=lambda : list(more())
mod=10**9 +7
inf=10**18 + 1
'... | output | 1 | 37,037 | 12 | 74,075 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease all elements of a suffix of the array by 1.
A... | instruction | 0 | 37,038 | 12 | 74,076 |
Tags: constructive algorithms, implementation
Correct Solution:
```
t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
ans+=abs(a[i]-a[i+1])
c=0
c=max(abs(a[1]-a[0]),c)
c=max(c,abs(a[-1]-a[-2]))
for i in range(1,n-1):
... | output | 1 | 37,038 | 12 | 74,077 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease all elements of a suffix of the array by 1.
A... | instruction | 0 | 37,039 | 12 | 74,078 |
Tags: constructive algorithms, implementation
Correct Solution:
```
from sys import stdin
import math
input=stdin.readline
for _ in range(int(input())):
n,=map(int,input().split())
l=list(map(int,input().split()))
s=0
for j in range(n-1):
s+=abs(l[j]-l[j+1])
mx=max(abs(l[1]-l[0... | output | 1 | 37,039 | 12 | 74,079 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease all elements of a suffix of the array by 1.
A... | instruction | 0 | 37,040 | 12 | 74,080 |
Tags: constructive algorithms, implementation
Correct Solution:
```
for i1 in range(int(input())):
n=int(input())
a=[0]+list(map(int,input().split()))
ref=[abs(a[i]-a[i-1]) for i in range(2,n+1)]
ans=sum(ref)
mx = max(abs(a[2] - a[1]), abs(a[n] - a[n - 1]))
for i in range(2, n):
mx ... | output | 1 | 37,040 | 12 | 74,081 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease al... | instruction | 0 | 37,041 | 12 | 74,082 |
Yes | output | 1 | 37,041 | 12 | 74,083 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease al... | instruction | 0 | 37,042 | 12 | 74,084 |
Yes | output | 1 | 37,042 | 12 | 74,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease al... | instruction | 0 | 37,043 | 12 | 74,086 |
Yes | output | 1 | 37,043 | 12 | 74,087 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease al... | instruction | 0 | 37,044 | 12 | 74,088 |
Yes | output | 1 | 37,044 | 12 | 74,089 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease al... | instruction | 0 | 37,045 | 12 | 74,090 |
No | output | 1 | 37,045 | 12 | 74,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease al... | instruction | 0 | 37,046 | 12 | 74,092 |
No | output | 1 | 37,046 | 12 | 74,093 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease al... | instruction | 0 | 37,047 | 12 | 74,094 |
No | output | 1 | 37,047 | 12 | 74,095 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. Increase all elements of a suffix of the array by 1.
2. Decrease al... | instruction | 0 | 37,048 | 12 | 74,096 |
No | output | 1 | 37,048 | 12 | 74,097 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array a of size n.
You have to perform m queries. Each query has one of two types:
* "1 l r k" — calculate the minimum value dif such that there are exist k distinc... | instruction | 0 | 37,049 | 12 | 74,098 |
No | output | 1 | 37,049 | 12 | 74,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array a of size n.
You have to perform m queries. Each query has one of two types:
* "1 l r k" — calculate the minimum value dif such that there are exist k distinc... | instruction | 0 | 37,050 | 12 | 74,100 |
No | output | 1 | 37,050 | 12 | 74,101 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and ... | instruction | 0 | 37,051 | 12 | 74,102 |
Tags: 2-sat, constructive algorithms, data structures, greedy, sortings, two pointers
Correct Solution:
```
import sys,io,os
try:Z=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
except:Z=lambda:sys.stdin.readline().encode()
def sol(n,d,F):
L=[[0]*(n+2),[0]*(n+2)];L[0][-1]=L[1][0]=2*n+1
q=[1];nq=[];m=g=f=t=... | output | 1 | 37,051 | 12 | 74,103 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and ... | instruction | 0 | 37,052 | 12 | 74,104 |
Tags: 2-sat, constructive algorithms, data structures, greedy, sortings, two pointers
Correct Solution:
```
import sys,io,os
try:Z=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
except:Z=lambda:sys.stdin.readline().encode()
def sol(n,d,F):
L=[[0]*(n+2),[0]*(n+2)];L[0][-1]=L[1][0]=2*n+1
q=[1];nq=[];m=g=f=t=... | output | 1 | 37,052 | 12 | 74,105 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and ... | instruction | 0 | 37,053 | 12 | 74,106 |
Tags: 2-sat, constructive algorithms, data structures, greedy, sortings, two pointers
Correct Solution:
```
from sys import stdin
def solve():
n = int(stdin.readline())
dic = {}
cards = set()
for i in range(n):
a, b = map(int, stdin.readline().split())
a -= 1
b -= 1
dic[a... | output | 1 | 37,053 | 12 | 74,107 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and ... | instruction | 0 | 37,054 | 12 | 74,108 |
Tags: 2-sat, constructive algorithms, data structures, greedy, sortings, two pointers
Correct Solution:
```
number_of_cards = int(input())
opposite_side = {}
cards = set()
result = 0
top = []
bottom = []
highest_taken = 2 * number_of_cards + 1
lowest_taken = 0
for _ in range(number_of_cards):
front, back = map(in... | output | 1 | 37,054 | 12 | 74,109 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and ... | instruction | 0 | 37,055 | 12 | 74,110 |
Tags: 2-sat, constructive algorithms, data structures, greedy, sortings, two pointers
Correct Solution:
```
import sys
input = sys.stdin.readline
n = int(input())
front = [-1] * n
back = [-1] * n
rev = [-1] * (2 * n)
used = [False] * n
opp = [-1] * (2 * n)
for c in range(n):
a, b = map(lambda x: int(x) - 1, inpu... | output | 1 | 37,055 | 12 | 74,111 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and ... | instruction | 0 | 37,056 | 12 | 74,112 |
Tags: 2-sat, constructive algorithms, data structures, greedy, sortings, two pointers
Correct Solution:
```
mod = 1000000007
eps = 10**-9
def main():
import sys
input = sys.stdin.buffer.readline
N = int(input())
AB = [-1] * (2*N+1)
BA = [-1] * (2*N+1)
for _ in range(N):
a, b = map(int... | output | 1 | 37,056 | 12 | 74,113 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and ... | instruction | 0 | 37,057 | 12 | 74,114 |
Tags: 2-sat, constructive algorithms, data structures, greedy, sortings, two pointers
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.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().... | output | 1 | 37,057 | 12 | 74,115 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and ... | instruction | 0 | 37,058 | 12 | 74,116 |
Tags: 2-sat, constructive algorithms, data structures, greedy, sortings, two pointers
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
N = int(input())
X = [0] * (2 * N)
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
X[a] = ... | output | 1 | 37,058 | 12 | 74,117 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.
A deck is called sorted i... | instruction | 0 | 37,061 | 12 | 74,122 |
No | output | 1 | 37,061 | 12 | 74,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, ..., an. Similarly, sequence b consists of m integers b1, b2, ..., bm. As usual, Sereja studies the sequences he has. Today he wants to find the number ... | instruction | 0 | 37,163 | 12 | 74,326 |
Tags: binary search, data structures
Correct Solution:
```
from sys import stdin, stdout
from math import log, sqrt
lines = stdin.readlines()
n = int(lines[0].split()[0])
m = int(lines[0].split()[1])
p = int(lines[0].split()[2])
a = [int(x) for x in lines[1].split()]
b = [int(x) for x in lines[2].split()]
hash_map = {... | output | 1 | 37,163 | 12 | 74,327 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, ..., an. Similarly, sequence b consists of m integers b1, b2, ..., bm. As usual, Sereja studies the sequences he has. Today he wants to find the number ... | instruction | 0 | 37,164 | 12 | 74,328 |
Tags: binary search, data structures
Correct Solution:
```
from sys import stdin, stdout
from math import log, sqrt
lines = stdin.readlines()
n = int(lines[0].split()[0])
m = int(lines[0].split()[1])
p = int(lines[0].split()[2])
a = [int(x) for x in lines[1].split()]
b = [int(x) for x in lines[2].split()]
hash_map = ... | output | 1 | 37,164 | 12 | 74,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, ..., an. Similarly, sequence b consists of m integers b1, b2, ..., bm. As usual, Sereja studies the seque... | instruction | 0 | 37,166 | 12 | 74,332 |
No | output | 1 | 37,166 | 12 | 74,333 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A student of z-school found a kind of sorting called z-sort. The array a with n elements are z-sorted if two conditions hold:
1. ai ≥ ai - 1 for all even i,
2. ai ≤ ai - 1 for all odd i > 1.
For example the arrays [1,2,1,2] and [1,... | instruction | 0 | 37,291 | 12 | 74,582 |
Tags: sortings
Correct Solution:
```
n = int(input())
val = list(map(int, input().split()))
res = [0] * n
val = sorted(val)
for i in range(1, n + 1):
if i & 1:
res[i - 1] = val[i // 2]
else:
res[i - 1] = val[n - (i // 2)]
print(*res)
``` | output | 1 | 37,291 | 12 | 74,583 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.