message stringlengths 2 65.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 0 108k | cluster float64 14 14 | __index_level_0__ int64 0 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on positio... | instruction | 0 | 64,040 | 14 | 128,080 |
Yes | output | 1 | 64,040 | 14 | 128,081 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on positio... | instruction | 0 | 64,041 | 14 | 128,082 |
Yes | output | 1 | 64,041 | 14 | 128,083 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on positio... | instruction | 0 | 64,042 | 14 | 128,084 |
Yes | output | 1 | 64,042 | 14 | 128,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on positio... | instruction | 0 | 64,043 | 14 | 128,086 |
Yes | output | 1 | 64,043 | 14 | 128,087 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on positio... | instruction | 0 | 64,044 | 14 | 128,088 |
No | output | 1 | 64,044 | 14 | 128,089 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on positio... | instruction | 0 | 64,045 | 14 | 128,090 |
No | output | 1 | 64,045 | 14 | 128,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on positio... | instruction | 0 | 64,046 | 14 | 128,092 |
No | output | 1 | 64,046 | 14 | 128,093 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on positio... | instruction | 0 | 64,047 | 14 | 128,094 |
No | output | 1 | 64,047 | 14 | 128,095 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there... | instruction | 0 | 64,149 | 14 | 128,298 |
Tags: binary search, brute force, data structures, dfs and similar, dp, greedy, sortings, two pointers
Correct Solution:
```
import sys
input=sys.stdin.readline
for _ in range(int(input())):
if _:input()
n,m=map(int,input().split())
a=[]
b=[]
for i in range(m):
v1,v2=map(int,input().split())
a.append(v1)
b.a... | output | 1 | 64,149 | 14 | 128,299 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there... | instruction | 0 | 64,150 | 14 | 128,300 |
Tags: binary search, brute force, data structures, dfs and similar, dp, greedy, sortings, two pointers
Correct Solution:
```
import sys
from array import array # noqa: F401
import typing as Tp # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
def output(*args):
sys.stdout.buffer... | output | 1 | 64,150 | 14 | 128,301 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there... | instruction | 0 | 64,151 | 14 | 128,302 |
Tags: binary search, brute force, data structures, dfs and similar, dp, greedy, sortings, two pointers
Correct Solution:
```
from bisect import bisect_left
t = int(input())
for case in range(t):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
aa = [e for e, _ in ... | output | 1 | 64,151 | 14 | 128,303 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there... | instruction | 0 | 64,152 | 14 | 128,304 |
Tags: binary search, brute force, data structures, dfs and similar, dp, greedy, sortings, two pointers
Correct Solution:
```
import bisect
t = int(input())
for _ in range(t):
n, m = list(map(int, input().split()))
li = []
for i in range(m):
a,b = list(map(int, input().split()))
li.append([a... | output | 1 | 64,152 | 14 | 128,305 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there... | instruction | 0 | 64,153 | 14 | 128,306 |
Tags: binary search, brute force, data structures, dfs and similar, dp, greedy, sortings, two pointers
Correct Solution:
```
for _ in range(int(input())):
if _: input()
n,m = map(int,input().split())
a1 = sorted( (tuple(map(int,input().split())) for i in range(m)),reverse=True)
a2 = sorted(a1,key=lambda... | output | 1 | 64,153 | 14 | 128,307 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there... | instruction | 0 | 64,154 | 14 | 128,308 |
Tags: binary search, brute force, data structures, dfs and similar, dp, greedy, sortings, two pointers
Correct Solution:
```
import sys, os, io
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.w... | output | 1 | 64,154 | 14 | 128,309 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there... | instruction | 0 | 64,155 | 14 | 128,310 |
Tags: binary search, brute force, data structures, dfs and similar, dp, greedy, sortings, two pointers
Correct Solution:
```
import sys
input=sys.stdin.readline
def binary_search(list, item):
low = 0
high = len(list) - 1
while low <= high:
mid = (low + high) // 2
guess = list[mid][0]
... | output | 1 | 64,155 | 14 | 128,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there... | instruction | 0 | 64,156 | 14 | 128,312 |
Tags: binary search, brute force, data structures, dfs and similar, dp, greedy, sortings, two pointers
Correct Solution:
```
from sys import stdin
TT = int(stdin.readline())
for loop in range(TT):
n,m = map(int,stdin.readline().split())
ba = []
alis = []
for i in range(m):
a,b = map(int,stdi... | output | 1 | 64,156 | 14 | 128,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij... | instruction | 0 | 64,243 | 14 | 128,486 |
Tags: bitmasks, dp, probabilities
Correct Solution:
```
n = int(input())
p = []
for i in range(n):
la = list(map(float,input().split()))
p.append(la)
full_bit = (1<<n) - 1
dp = [0]*(full_bit) + [1]
for i in range(full_bit,0,-1):
cunt = bin(i)[2:].count('1')
# print(cunt)
if cunt == 1 or dp[i]... | output | 1 | 64,243 | 14 | 128,487 |
Provide tags and a correct Python 3 solution for this coding contest problem.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij... | instruction | 0 | 64,244 | 14 | 128,488 |
Tags: bitmasks, dp, probabilities
Correct Solution:
```
from sys import stdin
input=stdin.readline
def count(n):
value=0
while(n):
n &= (n-1)
value+=1
return value
def nc2(n):
return (n*(n - 1))//2
def answer():
dp=[0]*(1 << n) #fishes
#let 1 be alive fishes
#let 0 be ... | output | 1 | 64,244 | 14 | 128,489 |
Provide tags and a correct Python 3 solution for this coding contest problem.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij... | instruction | 0 | 64,245 | 14 | 128,490 |
Tags: bitmasks, dp, probabilities
Correct Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n = int(input())
prob = [tuple(map(float, input().split())) for _ in range(n)]
full_bit = (1 << n) - 1
dp = [0.0] * full_bit + [1.0]
for bit i... | output | 1 | 64,245 | 14 | 128,491 |
Provide tags and a correct Python 3 solution for this coding contest problem.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij... | instruction | 0 | 64,246 | 14 | 128,492 |
Tags: bitmasks, dp, probabilities
Correct Solution:
```
import sys
input=sys.stdin.readline
def count_bits(x):
cnt=0
for i in range(n):
if((1<<i)&x):
cnt+=1
return(cnt)
n=int(input())
a=[list(map(float,input().split())) for i in range(n)]
dp=[0 for i in range(1<<n)] #Probabilty a parti... | output | 1 | 64,246 | 14 | 128,493 |
Provide tags and a correct Python 3 solution for this coding contest problem.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij... | instruction | 0 | 64,247 | 14 | 128,494 |
Tags: bitmasks, dp, probabilities
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO,IOBase
def count(x):
ans = 0
while x:
x &= x-1
ans += 1
return ans
def main():
n = int(input())
a = [list(map(float,input().spl... | output | 1 | 64,247 | 14 | 128,495 |
Provide tags and a correct Python 3 solution for this coding contest problem.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij... | instruction | 0 | 64,248 | 14 | 128,496 |
Tags: bitmasks, dp, probabilities
Correct Solution:
```
# Author : nitish420 --------------------------------------------------------------------
import os
import sys
from io import BytesIO, IOBase
# sys.setrecursionlimit(10**4)
def main():
n=int(input())
prob=[]
for _ in range(n):
prob.append(list... | output | 1 | 64,248 | 14 | 128,497 |
Provide tags and a correct Python 3 solution for this coding contest problem.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij... | instruction | 0 | 64,249 | 14 | 128,498 |
Tags: bitmasks, dp, probabilities
Correct Solution:
```
n=int(input())
b=[]
for i in range(n):
b.append(list(map(float,input().split())))
ma=1<<n
dp=[0 for j in range(ma)]
dp[0]=1
for mask in range(1,ma):
l=n-bin(mask).count("1")+1
res=l*(l-1)//2
for i in range(n):
if mask&(1<<i):
f... | output | 1 | 64,249 | 14 | 128,499 |
Provide tags and a correct Python 3 solution for this coding contest problem.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij... | instruction | 0 | 64,250 | 14 | 128,500 |
Tags: bitmasks, dp, probabilities
Correct Solution:
```
n = int(input())
probs = list()
for i in range(n): probs.append(list(map(float, input().split())))
dp = [list([0 for i in range(1<<n)]) for i in range(n)]
dp[0][(1<<n)-1] = 1
ak = [list() for i in range(n+1)]
for i in range(1<<n):
ak[bin(i).count("1")].append(... | output | 1 | 64,250 | 14 | 128,501 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first ... | instruction | 0 | 64,251 | 14 | 128,502 |
No | output | 1 | 64,251 | 14 | 128,503 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first ... | instruction | 0 | 64,252 | 14 | 128,504 |
No | output | 1 | 64,252 | 14 | 128,505 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first ... | instruction | 0 | 64,253 | 14 | 128,506 |
No | output | 1 | 64,253 | 14 | 128,507 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first ... | instruction | 0 | 64,254 | 14 | 128,508 |
No | output | 1 | 64,254 | 14 | 128,509 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the... | instruction | 0 | 64,355 | 14 | 128,710 |
Tags: bitmasks, constructive algorithms, dp, greedy, trees
Correct Solution:
```
def DFS(x):
for i in range(x):
if(Seen[i][x]):
continue
if(Rem[i]>=C[x]):
if(Rem[i]==C[x] and len(Children[i])==0):
continue
Rem[i]-=C[x]
Parent[x]... | output | 1 | 64,355 | 14 | 128,711 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the... | instruction | 0 | 64,356 | 14 | 128,712 |
Tags: bitmasks, constructive algorithms, dp, greedy, trees
Correct Solution:
```
def DFS(x):
for i in range(x):
if(Seen[i][x]):
continue
if(Rem[i]>=C[x]):
if(Rem[i]==C[x] and len(Children[i])==0):
continue
Rem[i]-=C[x]
Parent[x]=i
... | output | 1 | 64,356 | 14 | 128,713 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the... | instruction | 0 | 64,357 | 14 | 128,714 |
Tags: bitmasks, constructive algorithms, dp, greedy, trees
Correct Solution:
```
def DFS(x):
for i in range(x):
if(Seen[i][x]):
continue
if(Rem[i]>=C[x]):
if(Rem[i]==C[x] and len(Children[i])==0):
continue
Rem[i]-=C[x]
Parent[x]=i
... | output | 1 | 64,357 | 14 | 128,715 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Your task is the exact same as for the easy version. But this time, the marmots subtract the village's population P from their random number before responding to Heidi's request.
Also, there are now villages with as few as a single inhabita... | instruction | 0 | 64,500 | 14 | 129,000 |
Tags: math, probabilities
Correct Solution:
```
for i in range(int(input())):
a=list(map(int,input().split()))
mx=max(list(map(abs,a)))
std=(sum(list(map(lambda x:x*x,a)))/len(a))**0.5
print('poisson'if mx/std>2 else'uniform')
``` | output | 1 | 64,500 | 14 | 129,001 |
Provide a correct Python 3 solution for this coding contest problem.
Gift Exchange Party
A gift exchange party will be held at a school in TKB City.
For every pair of students who are close friends, one gift must be given from one to the other at this party, but not the other way around. It is decided in advance the... | instruction | 0 | 64,783 | 14 | 129,566 |
"Correct Solution:
```
from collections import deque
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
N, M = map(int, readline().split())
if N == M == 0:
return False
G = [[] for i in range(N)]
cs = [0]*N
for i in range(M):
u, v = map(int, readline().spl... | output | 1 | 64,783 | 14 | 129,567 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses ei... | instruction | 0 | 64,959 | 14 | 129,918 |
Tags: brute force, data structures, implementation
Correct Solution:
```
from sys import stdin, stdout
import math as np
dp = list()
item = list()
def top_down(left, right):
global dp
global item
level = int(np.ceil(np.log2(right - left + 1)))
if dp[level][left] != 0:
return dp[level][left]
... | output | 1 | 64,959 | 14 | 129,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses ei... | instruction | 0 | 64,960 | 14 | 129,920 |
Tags: brute force, data structures, implementation
Correct Solution:
```
V, IDX = [0]*3501, [0]*3501
def solve(A, n, m, k):
d = n-m
B = [0]*m
for i in range(m): B[i] = max(A[i], A[i+d])
w = max(1, m-k)
# print("* ", B, w)
res = 0
l = r = 0
for i in range(m):
while r > l and V[r-... | output | 1 | 64,960 | 14 | 129,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses ei... | instruction | 0 | 64,961 | 14 | 129,922 |
Tags: brute force, data structures, implementation
Correct Solution:
```
import sys
t = input()
def solve(n, m, k, nums):
ans = 0
new_k = min(m-1, k)
for kk in range(new_k+1):
left = kk
right = new_k-kk
temp = nums[left:len(nums)-right]
c = min([max(temp[i], temp[-(m-new_k-i)]) for i in range(m-new_k)])
... | output | 1 | 64,961 | 14 | 129,923 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses ei... | instruction | 0 | 64,962 | 14 | 129,924 |
Tags: brute force, data structures, implementation
Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):... | output | 1 | 64,962 | 14 | 129,925 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses ei... | instruction | 0 | 64,963 | 14 | 129,926 |
Tags: brute force, data structures, implementation
Correct Solution:
```
t = int(input())
for loop in range(t):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
if k < m-1:
for w in range(k+1):
x = k-w
nmin = float("inf")
f... | output | 1 | 64,963 | 14 | 129,927 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses ei... | instruction | 0 | 64,964 | 14 | 129,928 |
Tags: brute force, data structures, implementation
Correct Solution:
```
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 2 16:03:04 2020
@author: dennis
"""
import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.S... | output | 1 | 64,964 | 14 | 129,929 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses ei... | instruction | 0 | 64,965 | 14 | 129,930 |
Tags: brute force, data structures, implementation
Correct Solution:
```
t = int(input())
for y in range(t):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
if(k >= m-1):
ans = max(max(a[:m]),max(a[n-m:]))
else:
i = k
j = 0
ans = 0
while(i >= 0):
ind1 = i+(m-k)-1
ind2 = n-j-1
... | output | 1 | 64,965 | 14 | 129,931 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of the line chooses ei... | instruction | 0 | 64,966 | 14 | 129,932 |
Tags: brute force, data structures, implementation
Correct Solution:
```
t=int(input())
for i in range(t):
n,m,k=list(map(int,input().strip().split()))
a=list(map(int,input().strip().split()))
if k>=m:
k=m-1
z=m-1-k
sol=[]
for j in range(k+1):
big=max(a[j],a[j-k-z-1])
... | output | 1 | 64,966 | 14 | 129,933 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too m... | instruction | 0 | 65,653 | 14 | 131,306 |
Tags: implementation
Correct Solution:
```
n,m = map(int,input().split())
l = list(map(int,input().split()))
h = []
for i in range(m):
c = list(l)
for j in range(i,n,m):
c[j] = 0
h.append(abs(sum(c)))
print(max(h))
``` | output | 1 | 65,653 | 14 | 131,307 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too m... | instruction | 0 | 65,654 | 14 | 131,308 |
Tags: implementation
Correct Solution:
```
n = input().split(" ")
k = int(n[1])
n = int(n[0])
mas = input().split(" ")
mas = [int(i) for i in mas]
mas_n = set(i for i in range(n))
max_def = 0
for b in range(k):
drop_n = set(b+i for i in range(0, n, k))
mas_n_ = mas_n - drop_n
mas_ = [0 if index in drop... | output | 1 | 65,654 | 14 | 131,309 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too m... | instruction | 0 | 65,655 | 14 | 131,310 |
Tags: implementation
Correct Solution:
```
n, k = map(int , input().strip().split())
l = [int(x) for x in input().strip().split()]
e1 = 0
s1 = 0
for i in l:
if(i == 1):
e1+=1
else:
s1+=1
m = 0
for i in range(0, k):
e = e1
s = s1
for j in range(i, n, k):
if(l[j] == 1):
... | output | 1 | 65,655 | 14 | 131,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too m... | instruction | 0 | 65,656 | 14 | 131,312 |
Tags: implementation
Correct Solution:
```
s = input().split()
n = int(s[0])
k = int(s[1])
l = list(map(int, input().split()))
max_val = -1000
for b in range(n):
e = 0
s = 0
for j in range(n):
if j%k != b%k:
e += (1 if l[j] == 1 else 0)
s += (1 if l[j] == -1 else 0)
if a... | output | 1 | 65,656 | 14 | 131,313 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too m... | instruction | 0 | 65,657 | 14 | 131,314 |
Tags: implementation
Correct Solution:
```
def calMode(i):
ne, ns = 0, 0
temp = i
while temp<=(len(arr)-1):
if arr[temp]==1:
ne = ne + 1
else:
ns = ns + 1
temp = temp + k
return abs(e - ne - s + ns)
n, k = map(int, input().split(" "))
arr = list(map(int, ... | output | 1 | 65,657 | 14 | 131,315 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too m... | instruction | 0 | 65,658 | 14 | 131,316 |
Tags: implementation
Correct Solution:
```
n, k = map(int,input().split())
m = [int(i) for i in input().split()]
s = 0
e = 0
for i in range(n):
if m[i] == 1:
e+=1
else:
s-=1
r = s + e
res = 0
for i in range(k):
r = s + e
for j in range(n):
if i + k * j < n:
r -= m[i+k... | output | 1 | 65,658 | 14 | 131,317 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too m... | instruction | 0 | 65,659 | 14 | 131,318 |
Tags: implementation
Correct Solution:
```
import math
import bisect
import itertools
import sys
I=lambda : sys.stdin.readline()
mod=10**9 +7
'''fact=[1]*100001
ifact=[1]*100001
for i in range(1,100001):
fact[i]=((fact[i-1])*i)%mod
ifact[i]=((ifact[i-1])*pow(i,mod-2,mod))%mod
def ncr(n,r):
return (((fact[n]... | output | 1 | 65,659 | 14 | 131,319 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too m... | instruction | 0 | 65,660 | 14 | 131,320 |
Tags: implementation
Correct Solution:
```
a,b = map(int,input().split())
arr = list(map(int, input().split()))
maxi = 0
for n in range(b):
i = [arr[x] for x in range(a) if x not in range(n,a,b)]
x = abs(i.count(1) - i.count(-1))
if x>maxi:
maxi = x
print(maxi)
``` | output | 1 | 65,660 | 14 | 131,321 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This morning, Roman woke up and opened the browser with n opened tabs numbered from 1 to n. There are two kinds of tabs: those with the information required for the test and those with social ne... | instruction | 0 | 65,661 | 14 | 131,322 |
Yes | output | 1 | 65,661 | 14 | 131,323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.