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 an array a_1, a_2, ... , a_n and two integers m and k.
You can choose some subarray a_l, a_{l+1}, ..., a_{r-1}, a_r.
The cost of subarray a_l, a_{l+1}, ..., a_{r-1}, a_r is equa... | instruction | 0 | 95,363 | 12 | 190,726 |
No | output | 1 | 95,363 | 12 | 190,727 |
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_1, a_2, ... , a_n and two integers m and k.
You can choose some subarray a_l, a_{l+1}, ..., a_{r-1}, a_r.
The cost of subarray a_l, a_{l+1}, ..., a_{r-1}, a_r is equa... | instruction | 0 | 95,364 | 12 | 190,728 |
No | output | 1 | 95,364 | 12 | 190,729 |
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_1, a_2, ... , a_n and two integers m and k.
You can choose some subarray a_l, a_{l+1}, ..., a_{r-1}, a_r.
The cost of subarray a_l, a_{l+1}, ..., a_{r-1}, a_r is equa... | instruction | 0 | 95,365 | 12 | 190,730 |
No | output | 1 | 95,365 | 12 | 190,731 |
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_1, a_2, ... , a_n and two integers m and k.
You can choose some subarray a_l, a_{l+1}, ..., a_{r-1}, a_r.
The cost of subarray a_l, a_{l+1}, ..., a_{r-1}, a_r is equa... | instruction | 0 | 95,366 | 12 | 190,732 |
No | output | 1 | 95,366 | 12 | 190,733 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
Both the given array and required subset may co... | instruction | 0 | 95,393 | 12 | 190,786 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
a = (list(map(int, input().split())))
l = len(a)
if(l == 1):
if(a[0]%2 == 0):
print(1)
print(1)
else:
print(-1)
else:
if(a[0]... | output | 1 | 95,393 | 12 | 190,787 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
Both the given array and required subset may co... | instruction | 0 | 95,394 | 12 | 190,788 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
n = int(input())
for i in range(n):
m = int(input())
l = list(map(int,input().split()))
count = 0
flag = 0
for i in range(len(l)):
if l[i]%2==0:
flag = 1
count += 1
print(count)
print(l.index(l[i])+1)
break
if flag==0:
if le... | output | 1 | 95,394 | 12 | 190,789 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
Both the given array and required subset may co... | instruction | 0 | 95,395 | 12 | 190,790 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin, tan
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readl... | output | 1 | 95,395 | 12 | 190,791 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
Both the given array and required subset may co... | instruction | 0 | 95,396 | 12 | 190,792 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
#!/bin/python3
t = int(input())
while t > 0:
n = int(input())
array = list(map(int, input().split()))
if n == 1:
# 1 is 00000001 in binary , and 2 is 00000010
# for future reference 1 bitwise AND 2 is false
# that's ... | output | 1 | 95,396 | 12 | 190,793 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
Both the given array and required subset may co... | instruction | 0 | 95,397 | 12 | 190,794 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
#!/usr/bin/env python3
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
odd = []
even = []
for k in range(n):
if a[k] & 1:
odd.append(k)
else:
even.append(k)
if len(even):
print(1)
print(even[... | output | 1 | 95,397 | 12 | 190,795 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
Both the given array and required subset may co... | instruction | 0 | 95,398 | 12 | 190,796 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
t = int(input())
for i in range(t):
n = int(input())
arr = list(map(int, input().split()))
result1 = []
flag = False
for s in range(len(arr)):
if arr[s] % 2 == 0:
print(1)
print(s+1)
flag ... | output | 1 | 95,398 | 12 | 190,797 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
Both the given array and required subset may co... | instruction | 0 | 95,399 | 12 | 190,798 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
for case in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
odd = -1
for i in range(n):
if a[i] & 1 and odd == -1:
odd = i
elif a[i] & 1:
print(2)
print(odd +... | output | 1 | 95,399 | 12 | 190,799 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
Both the given array and required subset may co... | instruction | 0 | 95,400 | 12 | 190,800 |
Tags: brute force, dp, greedy, implementation
Correct Solution:
```
# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
q=int(input())
for _ in range(q):
N=int(input())
A=list(map(int,input().split()))
even=[]
odd=[]
for i in range(len(A)):
if A[i]%2==0:
even.ap... | output | 1 | 95,400 | 12 | 190,801 |
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 positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
... | instruction | 0 | 95,402 | 12 | 190,804 |
Yes | output | 1 | 95,402 | 12 | 190,805 |
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 positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
... | instruction | 0 | 95,403 | 12 | 190,806 |
Yes | output | 1 | 95,403 | 12 | 190,807 |
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 positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
... | instruction | 0 | 95,404 | 12 | 190,808 |
Yes | output | 1 | 95,404 | 12 | 190,809 |
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 positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
... | instruction | 0 | 95,405 | 12 | 190,810 |
No | output | 1 | 95,405 | 12 | 190,811 |
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 positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
... | instruction | 0 | 95,406 | 12 | 190,812 |
No | output | 1 | 95,406 | 12 | 190,813 |
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 positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
... | instruction | 0 | 95,407 | 12 | 190,814 |
No | output | 1 | 95,407 | 12 | 190,815 |
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 positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.
... | instruction | 0 | 95,408 | 12 | 190,816 |
No | output | 1 | 95,408 | 12 | 190,817 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,485 | 12 | 190,970 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
for _ in range(int(input())):
n,m=map(int,input().split())
op=input()
pre=[[0,0,0]]
suf=[[0,0,0]]
out=0
for i in op:
if i=='-':
out-=1
... | output | 1 | 95,485 | 12 | 190,971 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,486 | 12 | 190,972 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
import sys
input=sys.stdin.readline
for z in range(int(input())):
n,m=map(int,input().split())
s=input()
a=[0]
for i in range(n):
if s[i]=="+":
a.append(a[-1]+1)
else:
a.append(a[-1]-1)
n... | output | 1 | 95,486 | 12 | 190,973 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,487 | 12 | 190,974 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
###### ### ####### ####### ## # ##### ### #####
# # # # # # # # # # # # # ###
# # # # # # # # # # # # ... | output | 1 | 95,487 | 12 | 190,975 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,488 | 12 | 190,976 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
from itertools import accumulate
from sys import stdin, stdout
readline = stdin.readline
write = stdout.write
def read_ints():
return map(int, readline().split())
def read_string():
return readline()[:-1]
def write_int(x):
writ... | output | 1 | 95,488 | 12 | 190,977 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,489 | 12 | 190,978 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
from sys import stdin
t=int(stdin.readline())
for _ in range(t):
n,m=map(int,stdin.readline().split())
s=stdin.readline()[:-1]
maxt=0
mint=0
maxil=[0]*(n+1)
minil=[0]*(n+1)
val=[0]*(n+1)
x=0
for i in range(n):
if s[i]=='+':
x+=1
el... | output | 1 | 95,489 | 12 | 190,979 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,490 | 12 | 190,980 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n, m = list(map(int, input().split()))
s = input()
sums = [0] * (n + 1)
pref_mins = [0] * (n + 1)
pref_maxs = [0] * (n + 1)
for i in range(n):
s... | output | 1 | 95,490 | 12 | 190,981 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,491 | 12 | 190,982 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
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 = "x" in file.mode... | output | 1 | 95,491 | 12 | 190,983 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,492 | 12 | 190,984 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
from collections import defaultdict,deque
import sys
import bisect
import math
input=sys.stdin.readline
mod=1000000007
def check(base, higher, lower):
return higher - base, lower - base
for t in range(int(input())):
n, m = map(int, inp... | output | 1 | 95,492 | 12 | 190,985 |
Provide tags and a correct Python 2 solution for this coding contest problem.
You are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types:
* increase x by 1;
* decrease x by 1.
You are given m queries of the following... | instruction | 0 | 95,493 | 12 | 190,986 |
Tags: data structures, dp, implementation, strings
Correct Solution:
```
""" Python 3 compatibility tools. """
from __future__ import division, print_function
import itertools
import sys
if sys.version_info[0] < 3:
input = raw_input
range = xrange
filter = itertools.ifilter
map = itertools.imap
z... | output | 1 | 95,493 | 12 | 190,987 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2, ..., a_n is excellent if:
* a is good;
... | instruction | 0 | 95,520 | 12 | 191,040 |
Tags: binary search, combinatorics, constructive algorithms, implementation, math, sortings, two pointers
Correct Solution:
```
import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
for t in range(int(input())):
n, l, r = map(int, input().split())
F = [0] * (n + 1)
F[0] = 1
for i in range(1, n + 1):
... | output | 1 | 95,520 | 12 | 191,041 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2, ..., a_n is excellent if:
* a is good;
... | instruction | 0 | 95,521 | 12 | 191,042 |
Tags: binary search, combinatorics, constructive algorithms, implementation, math, sortings, two pointers
Correct Solution:
```
import io,os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = 10**9+7
MAX = 10**6+1
factor = [1]*MAX
for i in range(1,MAX):
factor[i] = (factor[i-1]*i)%M
def fastfrac(a,... | output | 1 | 95,521 | 12 | 191,043 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2, ..., a_n is excellent if:
* a is good;
... | instruction | 0 | 95,522 | 12 | 191,044 |
Tags: binary search, combinatorics, constructive algorithms, implementation, math, sortings, two pointers
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType
from collections import defaultdict
BUFSIZE = 8192
from bisect import bisect_left
class FastIO(IOBase):
... | output | 1 | 95,522 | 12 | 191,045 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2, ..., a_n is excellent if:
* a is good;
... | instruction | 0 | 95,523 | 12 | 191,046 |
Tags: binary search, combinatorics, constructive algorithms, implementation, math, sortings, two pointers
Correct Solution:
```
def main():
from sys import stdin, setrecursionlimit
#from io import BytesIO
#from os import read, fstat
#from math import gcd
#from random import randint, choice, shuffle
... | output | 1 | 95,523 | 12 | 191,047 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2, ..., a_n is excellent if:
* a is good;
... | instruction | 0 | 95,524 | 12 | 191,048 |
Tags: binary search, combinatorics, constructive algorithms, implementation, math, sortings, two pointers
Correct Solution:
```
import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
for t in range(int(input())):
n, l, r = map(int, input().split())
F = [0] * (n + 1)
F[0] = 1
for i in range(1, n + 1):
... | output | 1 | 95,524 | 12 | 191,049 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2, ..., a_n is excellent if:
* a is good;
... | instruction | 0 | 95,525 | 12 | 191,050 |
Tags: binary search, combinatorics, constructive algorithms, implementation, math, sortings, two pointers
Correct Solution:
```
def divisors(M):
d=[]
i=1
while M>=i**2:
if M%i==0:
d.append(i)
if i**2!=M:
d.append(M//i)
i=i+1
return d
def popcount... | output | 1 | 95,525 | 12 | 191,051 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2, ..., a_n is excellent if:
* a is good;
... | instruction | 0 | 95,526 | 12 | 191,052 |
Tags: binary search, combinatorics, constructive algorithms, implementation, math, sortings, two pointers
Correct Solution:
```
import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
for t in range(int(input())):
n, l, r = map(int, input().split())
F = [0] * (n + 1)
F[0] = 1
for i in range(1, n + 1):
... | output | 1 | 95,526 | 12 | 191,053 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2, ..., a_n is excellent if:
* a is good;
... | instruction | 0 | 95,527 | 12 | 191,054 |
Tags: binary search, combinatorics, constructive algorithms, implementation, math, sortings, two pointers
Correct Solution:
```
import sys
from sys import stdin
def modfac(n, MOD):
f = 1
factorials = [1]
for m in range(1, n + 1):
f *= m
f %= MOD
factorials.append(f)
inv = pow(... | output | 1 | 95,527 | 12 | 191,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2,... | instruction | 0 | 95,528 | 12 | 191,056 |
Yes | output | 1 | 95,528 | 12 | 191,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2,... | instruction | 0 | 95,529 | 12 | 191,058 |
Yes | output | 1 | 95,529 | 12 | 191,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2,... | instruction | 0 | 95,530 | 12 | 191,060 |
Yes | output | 1 | 95,530 | 12 | 191,061 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2,... | instruction | 0 | 95,531 | 12 | 191,062 |
Yes | output | 1 | 95,531 | 12 | 191,063 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2,... | instruction | 0 | 95,532 | 12 | 191,064 |
No | output | 1 | 95,532 | 12 | 191,065 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2,... | instruction | 0 | 95,533 | 12 | 191,066 |
No | output | 1 | 95,533 | 12 | 191,067 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2,... | instruction | 0 | 95,534 | 12 | 191,068 |
No | output | 1 | 95,534 | 12 | 191,069 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.
Let F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.
Let's say that an array a_1, a_2,... | instruction | 0 | 95,535 | 12 | 191,070 |
No | output | 1 | 95,535 | 12 | 191,071 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai.
The Little Elephant wants to count, how many pairs of integers l and r are there, such that 1 ≤ l < r ≤ n a... | instruction | 0 | 95,552 | 12 | 191,104 |
Tags: data structures, two pointers
Correct Solution:
```
# 220E
import sys
from collections import defaultdict
class BIT():
def __init__(self, n):
self.n = n
self.tree = [0] * n
def _F(self, i):
return i & (i + 1)
def _get_sum(self, r):
'''
sum on interva... | output | 1 | 95,552 | 12 | 191,105 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The Little Elephant has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai.
The Little Elephant wants to count, how many pairs of integers l and r are there, such that 1 ≤ l < r ≤ n a... | instruction | 0 | 95,553 | 12 | 191,106 |
Tags: data structures, two pointers
Correct Solution:
```
'''
Created on 19/07/2018
@author: ernesto
'''
# XXX: http://codeforces.com/problemset/problem/220/E
# XXX: https://practice.geeksforgeeks.org/problems/magic-triplets/0
# XXX: https://gist.github.com/robert-king/5660418
class RangeBit:
def __init__(sel... | output | 1 | 95,553 | 12 | 191,107 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai.
The Little Elephant wants to count, how many pairs of intege... | instruction | 0 | 95,554 | 12 | 191,108 |
No | output | 1 | 95,554 | 12 | 191,109 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai.
The Little Elephant wants to count, how many pairs of intege... | instruction | 0 | 95,555 | 12 | 191,110 |
No | output | 1 | 95,555 | 12 | 191,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Little Elephant has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai.
The Little Elephant wants to count, how many pairs of intege... | instruction | 0 | 95,556 | 12 | 191,112 |
No | output | 1 | 95,556 | 12 | 191,113 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya has an array a consisting of n integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements standing one next to a... | instruction | 0 | 96,076 | 12 | 192,152 |
Tags: data structures, divide and conquer, two pointers
Correct Solution:
```
def merge(l,r):
global num
if l>=r:
return
mid=(l+r)>>1
merge(l,mid)
merge(mid+1,r)
j=mid+1
for i in range(l,mid+1):
while j<=r and arr[j]-arr[i]<t:
j+=1
num+=j-mid-1
arr[l:... | output | 1 | 96,076 | 12 | 192,153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.