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 |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several c... | instruction | 0 | 61,113 | 14 | 122,226 |
Tags: implementation, number theory
Correct Solution:
```
n = int(input())
a = sorted([int(i) for i in input().split()])
s = 0; o = 0; flag = True
for i in range(n):
s += a[i]
if a[i]&1 and flag:
o = a[i]
flag = False
if s&1 == 0 and flag:
print(0)
elif s&1:
print(s)
else:
print(s-o)... | output | 1 | 61,113 | 14 | 122,227 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several c... | instruction | 0 | 61,114 | 14 | 122,228 |
Tags: implementation, number theory
Correct Solution:
```
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
def main():
pass
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = Byt... | output | 1 | 61,114 | 14 | 122,229 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several c... | instruction | 0 | 61,115 | 14 | 122,230 |
Tags: implementation, number theory
Correct Solution:
```
# 59b.py
n = int(input())
v = list(map(int, input().split()))
ans, sum, mn = 0, 0, 101
for x in v:
sum += x
if x % 2 == 1:
mn = min(mn, x)
if sum % 2 == 1:
print(sum)
elif mn != 101:
print(sum - mn)
else:
print(0)
``` | output | 1 | 61,115 | 14 | 122,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several c... | instruction | 0 | 61,116 | 14 | 122,232 |
Tags: implementation, number theory
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt', 'r')
s... | output | 1 | 61,116 | 14 | 122,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several c... | instruction | 0 | 61,117 | 14 | 122,234 |
Tags: implementation, number theory
Correct Solution:
```
n = int(input())
a = [int(i) for i in input().split()]
d = sum(a)
e = 1
f = []
for i in range(0, len(a)):
if a[i] % 2 != 0:
f.append(a[i])
if len(f) == 0:
print(0)
else:
while e > 0:
if d == 0:
e = 0
elif d % 2 =... | output | 1 | 61,117 | 14 | 122,235 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easi... | instruction | 0 | 61,118 | 14 | 122,236 |
Yes | output | 1 | 61,118 | 14 | 122,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easi... | instruction | 0 | 61,119 | 14 | 122,238 |
Yes | output | 1 | 61,119 | 14 | 122,239 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easi... | instruction | 0 | 61,120 | 14 | 122,240 |
Yes | output | 1 | 61,120 | 14 | 122,241 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easi... | instruction | 0 | 61,121 | 14 | 122,242 |
Yes | output | 1 | 61,121 | 14 | 122,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easi... | instruction | 0 | 61,122 | 14 | 122,244 |
No | output | 1 | 61,122 | 14 | 122,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easi... | instruction | 0 | 61,123 | 14 | 122,246 |
No | output | 1 | 61,123 | 14 | 122,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easi... | instruction | 0 | 61,124 | 14 | 122,248 |
No | output | 1 | 61,124 | 14 | 122,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easi... | instruction | 0 | 61,125 | 14 | 122,250 |
No | output | 1 | 61,125 | 14 | 122,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
All... | instruction | 0 | 61,235 | 14 | 122,470 |
Tags: binary search, math
Correct Solution:
```
n = int(input())
a = [int(x) for x in input().split()]
min_arrival = (100000000000, -1)
def circ_dist(fr, to):
if fr <= to:
return to - fr
else:
return n - (fr - to)
for i, q in enumerate(a):
pos_when_first = q % n
dist_to_entrance = c... | output | 1 | 61,235 | 14 | 122,471 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
All... | instruction | 0 | 61,236 | 14 | 122,472 |
Tags: binary search, math
Correct Solution:
```
d = int(input())
f = [int(i) for i in input().split()]
g = []
k = 10000000000
op = 0
for i in range(len(f)):
f[i] = (f[i]-i+d-1)//d
if k>f[i]:
k = f[i]
op = i
print(op+1)
``` | output | 1 | 61,236 | 14 | 122,473 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
All... | instruction | 0 | 61,237 | 14 | 122,474 |
Tags: binary search, math
Correct Solution:
```
n=int(input())
a=[int(x) for x in input().split()]
t=min(a)
while a[t%n]>t:t+=1
print(t%n + 1)
# Made By Mostafa_Khaled
``` | output | 1 | 61,237 | 14 | 122,475 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
All... | instruction | 0 | 61,238 | 14 | 122,476 |
Tags: binary search, math
Correct Solution:
```
n=int(input())
l=[int(x) for x in input().split()]
cur_idx=0
cur_val=max(0,(l[0]-1)//n+1)
for i in range(n):
val = max(0,(l[i]-i-1)//n+1)
if(val<cur_val):
cur_val=val
cur_idx=i
print(cur_idx+1)
``` | output | 1 | 61,238 | 14 | 122,477 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
All... | instruction | 0 | 61,239 | 14 | 122,478 |
Tags: binary search, math
Correct Solution:
```
n = int(input())
lst = list(map(int,input().split()))
mn = min(lst)
for i,x in enumerate(lst):lst[i]-=mn
item,k,a=mn%n,0,0
for i in range(item,n):
if lst[i]-a<=0:print(i+1);k=1;break
a+=1
if k==0:
for i in range(item):
if lst[i]-a<=0:print(i+1);k=1;bre... | output | 1 | 61,239 | 14 | 122,479 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
All... | instruction | 0 | 61,240 | 14 | 122,480 |
Tags: binary search, math
Correct Solution:
```
import math
n=int(input())
l=list(map(int,input().strip().split()))
l1=[]
for x,y in enumerate(l):
if (y<x):
m=0
else:
m=y-x
l1.append(math.ceil(m/n))
min1=100000000000000
min2=1000000000000
for i in range(n):
if l1[i]<min1:
min1=l1[i]
min2=i+1
print (min2)
``... | output | 1 | 61,240 | 14 | 122,481 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
All... | instruction | 0 | 61,241 | 14 | 122,482 |
Tags: binary search, math
Correct Solution:
```
"""
Author - Satwik Tiwari .
13th NOV , 2020 - Friday
"""
#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function
from fractions import F... | output | 1 | 61,241 | 14 | 122,483 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
All... | instruction | 0 | 61,242 | 14 | 122,484 |
Tags: binary search, math
Correct Solution:
```
n = int(input())
a = [int(x) for x in input().split()]
finalIndex = 1e12
index = 0
for i in range(n):
val = a[i]
val -=i # k+tn
if val<=0:
val = 0
sol = int(val/n) #t
if val % n:
sol+=1
bande = i+sol*n # b = k +tn
if bande<finalIndex:
finalIndex = bande
... | output | 1 | 61,242 | 14 | 122,485 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its ... | instruction | 0 | 61,243 | 14 | 122,486 |
Yes | output | 1 | 61,243 | 14 | 122,487 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its ... | instruction | 0 | 61,244 | 14 | 122,488 |
Yes | output | 1 | 61,244 | 14 | 122,489 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its ... | instruction | 0 | 61,245 | 14 | 122,490 |
Yes | output | 1 | 61,245 | 14 | 122,491 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its ... | instruction | 0 | 61,246 | 14 | 122,492 |
Yes | output | 1 | 61,246 | 14 | 122,493 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its ... | instruction | 0 | 61,247 | 14 | 122,494 |
No | output | 1 | 61,247 | 14 | 122,495 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its ... | instruction | 0 | 61,248 | 14 | 122,496 |
No | output | 1 | 61,248 | 14 | 122,497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its ... | instruction | 0 | 61,249 | 14 | 122,498 |
No | output | 1 | 61,249 | 14 | 122,499 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its ... | instruction | 0 | 61,250 | 14 | 122,500 |
No | output | 1 | 61,250 | 14 | 122,501 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.
Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a comm... | instruction | 0 | 61,970 | 14 | 123,940 |
Tags: bitmasks, data structures, trees
Correct Solution:
```
from sys import stdin
input=stdin.readline
class Node:
def __init__(self,data):
self.data=data
self.left=None
self.right=None
self.count=0
class Trie():
def __init__(self):
self.root=Node(0)
def insert(sel... | output | 1 | 61,970 | 14 | 123,941 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.
Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a comm... | instruction | 0 | 61,971 | 14 | 123,942 |
Tags: bitmasks, data structures, trees
Correct Solution:
```
import sys
from collections import defaultdict
class Node:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
q = int(sys.stdin.readline())
root = Node(0)
# def search(node, bit, )
for _ in range(q):
l = list(map(int, sys.st... | output | 1 | 61,971 | 14 | 123,943 |
Provide tags and a correct Python 3 solution for this coding contest problem.
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.
Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a comm... | instruction | 0 | 61,972 | 14 | 123,944 |
Tags: bitmasks, data structures, trees
Correct Solution:
```
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
#import threading
from ... | output | 1 | 61,972 | 14 | 123,945 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.
Vova managed to build a large army, but forgot about the main person in the a... | instruction | 0 | 61,973 | 14 | 123,946 |
No | output | 1 | 61,973 | 14 | 123,947 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marke... | instruction | 0 | 62,355 | 14 | 124,710 |
Tags: implementation, two pointers
Correct Solution:
```
n, m, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
ans = 0
i = 0
rem = 0
while i < m:
page_no = (arr[i] - rem - 1) // k
j = i
cnt = 0
while j < m:
another_page = (arr[j] - rem - 1) // k
if another_page ... | output | 1 | 62,355 | 14 | 124,711 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marke... | instruction | 0 | 62,356 | 14 | 124,712 |
Tags: implementation, two pointers
Correct Solution:
```
n, m, k = map(int, input().split())
specials = list((map(int, input().split())))
specials.sort(reverse=True)
page = list()
counter = 0
# while specials:
# pg = (specials[0] - 1) // k
# o_len = len(specials)
# specials = [i for i in specials if i > (pg + 1) * k... | output | 1 | 62,356 | 14 | 124,713 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marke... | instruction | 0 | 62,357 | 14 | 124,714 |
Tags: implementation, two pointers
Correct Solution:
```
n, m, k = map(int, input().split())
p = list(map(int, input().split()))
rev = 1
new_rev = 1
page = None
count = 0
for i in range(m):
if (p[i] - rev) // k != page:
count += 1
rev = new_rev
page = (p[i] - rev) // k
new_rev += 1
print... | output | 1 | 62,357 | 14 | 124,715 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marke... | instruction | 0 | 62,358 | 14 | 124,716 |
Tags: implementation, two pointers
Correct Solution:
```
import sys
import math
input = sys.stdin.readline
def pn(n, k):
if n % k > 0:
return int(n / k) + 1
return int(n / k)
n,m,k=map(int,input().split())
l=list(map(int,input().split()))
ans=0
cur=0
diff=0
temp=0
now=pn(l[cur] - diff, k)
cur+=1
temp+=1
while... | output | 1 | 62,358 | 14 | 124,717 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marke... | instruction | 0 | 62,359 | 14 | 124,718 |
Tags: implementation, two pointers
Correct Solution:
```
import math
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
i = 1
q = math.ceil(a[0]/k)
diff = 0
ans = 1
count = 1
while i<m:
# print (i,math.ceil((a[i]-diff)/k),q,diff,ans)
if (a[i]-diff-1)//k+1==q:
count += 1
else:
ans += 1
diff += ... | output | 1 | 62,359 | 14 | 124,719 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marke... | instruction | 0 | 62,360 | 14 | 124,720 |
Tags: implementation, two pointers
Correct Solution:
```
def find_operations(num_per_page, special_numbers):
i = 0
count = 0
while i < len(special_numbers):
curr_special_number = special_numbers[i]
curr_special_page = get_special_page(num_per_page, curr_special_number, i)
largest_on_... | output | 1 | 62,360 | 14 | 124,721 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marke... | instruction | 0 | 62,361 | 14 | 124,722 |
Tags: implementation, two pointers
Correct Solution:
```
fstLine = list(map(int,input().split(' ')))
items = list(map(int,input().split(' ')))
ans, itemRange, i, counter, idk = 0, fstLine[2], 0, 0, 0
while (i<len(items)):
if (itemRange >= items[i]):
while (i<len(items) and itemRange >= items[i]):
... | output | 1 | 62,361 | 14 | 124,723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.
These n items are marke... | instruction | 0 | 62,362 | 14 | 124,724 |
Tags: implementation, two pointers
Correct Solution:
```
n,m,k=[int(x) for x in input().split()]
p=[int(x) for x in input().split()]
x=0
counter=0
answer=0
p.append(10**100)
prev=(p[0]-1)//k
for item in p:
num=(item-counter-1)//k
if num!=prev:
counter+=x
x=1
answer+=1
num=(item-c... | output | 1 | 62,362 | 14 | 124,725 |
Provide tags and a correct Python 3 solution for this coding contest problem.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A... | instruction | 0 | 62,440 | 14 | 124,880 |
Tags: data structures, greedy, sortings
Correct Solution:
```
a=int(input())
z=list(map(int,input().split()))
r=list(map(int,input().split()))
ans=[]
for i in range(a):
ans.append([z[i],r[i]])
ans.sort()
from heapq import *
i=0
pq=[]
ss=0
sol=0
while(i<len(z)):
if(len(pq)==0):
heappush(pq,-1*ans[i][1])... | output | 1 | 62,440 | 14 | 124,881 |
Provide tags and a correct Python 3 solution for this coding contest problem.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A... | instruction | 0 | 62,441 | 14 | 124,882 |
Tags: data structures, greedy, sortings
Correct Solution:
```
# Код программы написал на языке Python 3
import sys
from heapq import heappush, heappop
def main():
n = int(sys.stdin.readline())
h = sorted(list(zip([int(i) for i in sys.stdin.readline().split()], [int(i) for i in sys.stdin.readline().split()])))
... | output | 1 | 62,441 | 14 | 124,883 |
Provide tags and a correct Python 3 solution for this coding contest problem.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A... | instruction | 0 | 62,442 | 14 | 124,884 |
Tags: data structures, greedy, sortings
Correct Solution:
```
import sys
input = sys.stdin.readline
import heapq
n = int(input())
x = list(map(int, input().split()))
t = list(map(int, input().split()))
a = []
M = 1000000
for i in range(n):
a.append(x[i] * M + t[i])
a.sort()
i = 0
ans = 0
while i < n:
xi, ti = ... | output | 1 | 62,442 | 14 | 124,885 |
Provide tags and a correct Python 3 solution for this coding contest problem.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A... | instruction | 0 | 62,443 | 14 | 124,886 |
Tags: data structures, greedy, sortings
Correct Solution:
```
from sys import stdin, gettrace
from heapq import *
if not gettrace():
def input():
return next(stdin)[:-1]
def main():
n = int(input())
aa = [int(a) for a in input().split()]
bb = [int(a) for a in input().split()]
bss = {}
... | output | 1 | 62,443 | 14 | 124,887 |
Provide tags and a correct Python 3 solution for this coding contest problem.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A... | instruction | 0 | 62,444 | 14 | 124,888 |
Tags: data structures, greedy, sortings
Correct Solution:
```
from collections import defaultdict
import heapq
n = int(input())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
d = defaultdict(list)
for i in range(n):
d[a[i]].append(i)
h_a = list(d.keys())
heapq.heapify(h_a)
h_t = []
ti... | output | 1 | 62,444 | 14 | 124,889 |
Provide tags and a correct Python 3 solution for this coding contest problem.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A... | instruction | 0 | 62,445 | 14 | 124,890 |
Tags: data structures, greedy, sortings
Correct Solution:
```
import sys
input = sys.stdin.readline
n = int(input())
raw1 = list(map(int,input().split()))
raw2 = list(map(int,input().split()))
c = []
for i in range(n):
c.append((raw1[i],raw2[i]))
c.sort()
c.append((10**12,0))
#print(c)
import heapq
ans = 0
last = 0
n... | output | 1 | 62,445 | 14 | 124,891 |
Provide tags and a correct Python 3 solution for this coding contest problem.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A... | instruction | 0 | 62,446 | 14 | 124,892 |
Tags: data structures, greedy, sortings
Correct Solution:
```
import heapq
n = int(input())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
l = list(zip(l1, l2))
l.sort(key=lambda x: (x[0], -x[1]))
h = []
curr = l[0][0]
i = 1
res = 0
while (i < n):
while (h):
if (curr ... | output | 1 | 62,446 | 14 | 124,893 |
Provide tags and a correct Python 3 solution for this coding contest problem.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications.
The latest A... | instruction | 0 | 62,447 | 14 | 124,894 |
Tags: data structures, greedy, sortings
Correct Solution:
```
import sys
input = sys.stdin.readline
from collections import *
from heapq import *
n = int(input())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
d = defaultdict(list)
for i in range(n):
d[a[i]].append(t[i])
ks = list(d.keys... | output | 1 | 62,447 | 14 | 124,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch al... | instruction | 0 | 62,448 | 14 | 124,896 |
Yes | output | 1 | 62,448 | 14 | 124,897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.