message stringlengths 2 30.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 237 109k | cluster float64 10 10 | __index_level_0__ int64 474 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th ticket is p_i. As a teller, you have a possibility... | instruction | 0 | 81,808 | 10 | 163,616 |
Tags: binary search, greedy
Correct Solution:
```
q=int(input())
out=[]
for i in range(q):
n=int(input())
p=[]
cont={}
for x in input().split():
el=int(x)//100
p.append(el)
p.sort(reverse = True)
x,a=[int(f) for f in input().split()]
y,b=[int(f) for f in input().split()]
... | output | 1 | 81,808 | 10 | 163,617 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th ticket is p_i. As a teller, you have a possibility... | instruction | 0 | 81,809 | 10 | 163,618 |
Tags: binary search, greedy
Correct Solution:
```
import sys,math,string,bisect
input=sys.stdin.readline
from collections import deque,defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
def lcm(a,b):
return (a*b)//math.g... | output | 1 | 81,809 | 10 | 163,619 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th ticket is p_i. As a teller, you have a possibility... | instruction | 0 | 81,810 | 10 | 163,620 |
Tags: binary search, greedy
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
import math
# region fastio
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 | 81,810 | 10 | 163,621 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th ticket is p_i. As a teller, you have a possibility... | instruction | 0 | 81,811 | 10 | 163,622 |
Tags: binary search, greedy
Correct Solution:
```
import math
global n, p, x, y, a, b, k
#############################################
def check(m):
lst, res = 0, 0
lcm = (a * b) // math.gcd(a, b)
t1 = m // lcm
for i in range(t1):
if res >= k:
return True
if lst >= m:
... | output | 1 | 81,811 | 10 | 163,623 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th ticket is p_i. As a teller, you have a possibility... | instruction | 0 | 81,812 | 10 | 163,624 |
Tags: binary search, greedy
Correct Solution:
```
from math import gcd
q = int(input())
for i in range(q):
n = int(input())
p = sorted(map(int, input().split()), key=int)[::-1]
x, a = map(int, input().split())
y, b = map(int, input().split())
k = int(input())
#preprocessing
c = a*b//gcd(a,... | output | 1 | 81,812 | 10 | 163,625 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th ticket is p_i. As a teller, you have a possibility... | instruction | 0 | 81,813 | 10 | 163,626 |
Tags: binary search, greedy
Correct Solution:
```
def max_contrib(p, amount, n, both, xlist, ylist, a, b):
collection = j = 0
for i in both:
if i > n:
break
collection += (x+y)*p[j]
j += 1
for i in xlist:
if i > n:
break
collection += x*p[j]
... | output | 1 | 81,813 | 10 | 163,627 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th tic... | instruction | 0 | 81,814 | 10 | 163,628 |
Yes | output | 1 | 81,814 | 10 | 163,629 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th tic... | instruction | 0 | 81,815 | 10 | 163,630 |
Yes | output | 1 | 81,815 | 10 | 163,631 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th tic... | instruction | 0 | 81,816 | 10 | 163,632 |
Yes | output | 1 | 81,816 | 10 | 163,633 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th tic... | instruction | 0 | 81,817 | 10 | 163,634 |
Yes | output | 1 | 81,817 | 10 | 163,635 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th tic... | instruction | 0 | 81,818 | 10 | 163,636 |
No | output | 1 | 81,818 | 10 | 163,637 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th tic... | instruction | 0 | 81,819 | 10 | 163,638 |
No | output | 1 | 81,819 | 10 | 163,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th tic... | instruction | 0 | 81,820 | 10 | 163,640 |
No | output | 1 | 81,820 | 10 | 163,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!
You have n tickets to sell. The price of the i-th tic... | instruction | 0 | 81,821 | 10 | 163,642 |
No | output | 1 | 81,821 | 10 | 163,643 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.
Today is Sage's birthday, and ... | instruction | 0 | 81,902 | 10 | 163,804 |
Tags: binary search, constructive algorithms, greedy, sortings
Correct Solution:
```
n=int(input())
a=[int(x) for x in input().split()]
if n<3:
print(0)
print(*a)
else:
a.sort()
b=[-1]*n
b[-1]=a[-1]
j=0
for z in range(1,n-1,2):
b[z]=a[j]
j+=1
ans=j
for z in range(n):
... | output | 1 | 81,902 | 10 | 163,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.
Today is Sage's birthday, and ... | instruction | 0 | 81,903 | 10 | 163,806 |
Tags: binary search, constructive algorithms, greedy, sortings
Correct Solution:
```
import sys
def inp():
return sys.stdin.readline().rstrip('\n').encode('utf8')
def mpint():
return map(int, sys.stdin.readline().split(' '))
def itg():
return int(sys.stdin.readline())
# #############################... | output | 1 | 81,903 | 10 | 163,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.
Today is Sage's birthday, and ... | instruction | 0 | 81,904 | 10 | 163,808 |
Tags: binary search, constructive algorithms, greedy, sortings
Correct Solution:
```
def winner(nums,n):
nums = sorted(nums)
ans = []
i = 0
j = n//2
count = 0
while j<n:
ans.append(nums[j])
if i<(n//2):
ans.append(nums[i])
if j!=n-1 and nums[i]!=nums[j]:
count+=1
j+=1
i+=1
return ans,count
n... | output | 1 | 81,904 | 10 | 163,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.
Today is Sage's birthday, and ... | instruction | 0 | 81,905 | 10 | 163,810 |
Tags: binary search, constructive algorithms, greedy, sortings
Correct Solution:
```
n = int(input())
arr = [int(num) for num in input().split(' ')]
arr.sort()
ans = [-1]*n
if n%2!=0:
i = 1
j = 0
while i<n:
ans[i] = arr[j]
i = i + 2
j = j + 1
i = 2
while i<n:
... | output | 1 | 81,905 | 10 | 163,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.
Today is Sage's birthday, and ... | instruction | 0 | 81,906 | 10 | 163,812 |
Tags: binary search, constructive algorithms, greedy, sortings
Correct Solution:
```
n=int(input())
arr=list(map(int,input().split()))
arr.sort()
point=0
temp=[0]*n
curr=1
while curr<n:
temp[curr]=arr[point]
curr+=2
point+=1
for i in range(n):
if temp[i]==0:
temp[i]=arr[point]
point+=1
count=0
for i... | output | 1 | 81,906 | 10 | 163,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.
Today is Sage's birthday, and ... | instruction | 0 | 81,907 | 10 | 163,814 |
Tags: binary search, constructive algorithms, greedy, sortings
Correct Solution:
```
n = int(input())
arr = list(map(int,input().split()))
arr.sort()
ans = [0]*n
if n<3:
print(0)
print(*arr)
else:
for i in range(1,n,2):
ans[i] = arr.pop(0)
for i in range(0,n,2):
ans[i] = arr... | output | 1 | 81,907 | 10 | 163,815 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.
Today is Sage's birthday, and ... | instruction | 0 | 81,908 | 10 | 163,816 |
Tags: binary search, constructive algorithms, greedy, sortings
Correct Solution:
```
n = int(input())
l = list(map(int,input().split()))
l.sort()
print((n-1)//2)
if n<3:
print(*l)
else:
arr = [0]*n
j = 0
for i in range(1,n,2):
arr[i] = l[j]
j+=1
for i in range(0,n,2):
arr[i... | output | 1 | 81,908 | 10 | 163,817 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions of the problem.
Today is Sage's birthday, and ... | instruction | 0 | 81,909 | 10 | 163,818 |
Tags: binary search, constructive algorithms, greedy, sortings
Correct Solution:
```
"""
pppppppppppppppppppp
ppppp ppppppppppppppppppp
ppppppp ppppppppppppppppppppp
pppppppp pppppppppppppppppppppp
... | output | 1 | 81,909 | 10 | 163,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions ... | instruction | 0 | 81,910 | 10 | 163,820 |
Yes | output | 1 | 81,910 | 10 | 163,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions ... | instruction | 0 | 81,911 | 10 | 163,822 |
Yes | output | 1 | 81,911 | 10 | 163,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions ... | instruction | 0 | 81,912 | 10 | 163,824 |
Yes | output | 1 | 81,912 | 10 | 163,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions ... | instruction | 0 | 81,913 | 10 | 163,826 |
Yes | output | 1 | 81,913 | 10 | 163,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions ... | instruction | 0 | 81,914 | 10 | 163,828 |
No | output | 1 | 81,914 | 10 | 163,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions ... | instruction | 0 | 81,915 | 10 | 163,830 |
No | output | 1 | 81,915 | 10 | 163,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions ... | instruction | 0 | 81,916 | 10 | 163,832 |
No | output | 1 | 81,916 | 10 | 163,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The difference between the versions is that in the easy version all prices a_i are different. You can make hacks if and only if you solved both versions ... | instruction | 0 | 81,917 | 10 | 163,834 |
No | output | 1 | 81,917 | 10 | 163,835 |
Provide a correct Python 3 solution for this coding contest problem.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precisely remembers she had n buyers and each of them bought e... | instruction | 0 | 82,178 | 10 | 164,356 |
"Correct Solution:
```
n,p=[int(i)for i in input().split()]
a=["half"!=input() for _ in range(n)]
s=c=0
for x in a[::-1]:s+=c*p+x*p//2;c=c*2+x
print(s)
``` | output | 1 | 82,178 | 10 | 164,357 |
Provide a correct Python 3 solution for this coding contest problem.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precisely remembers she had n buyers and each of them bought e... | instruction | 0 | 82,179 | 10 | 164,358 |
"Correct Solution:
```
n,p = map(int, input().split())
s = []
plus = 0;
for i in range(0,n):
s.append(input());
if s[i] == 'halfplus':
plus+=1
x = 1
for i in range(n - 2, -1, -1):
if s[i] == 'halfplus':
x = 2*x + 1;
else:
x = 2*x
print( x * p - plus * (p//2))
``` | output | 1 | 82,179 | 10 | 164,359 |
Provide a correct Python 3 solution for this coding contest problem.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precisely remembers she had n buyers and each of them bought e... | instruction | 0 | 82,180 | 10 | 164,360 |
"Correct Solution:
```
n, p = map(int, input().split())
A = []
for i in range(n):
s = input()
A.append(2 if s == 'half' else 1)
A.pop()
A = A[::-1]
h = p // 2
ans = h
c = 1
for i in range(n - 1):
if A[i] == 1:
ans += p * c + h
c = c * 2 + 1
else:
ans += c * p
c *= 2
pr... | output | 1 | 82,180 | 10 | 164,361 |
Provide a correct Python 3 solution for this coding contest problem.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precisely remembers she had n buyers and each of them bought e... | instruction | 0 | 82,181 | 10 | 164,362 |
"Correct Solution:
```
n, p = map(int, input().split())
s = sum(1 << i for i in range(n) if 's' in input())
print(sum(s >> i for i in range(n)) * p >> 1)
``` | output | 1 | 82,181 | 10 | 164,363 |
Provide a correct Python 3 solution for this coding contest problem.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precisely remembers she had n buyers and each of them bought e... | instruction | 0 | 82,182 | 10 | 164,364 |
"Correct Solution:
```
m,n = map(int,input().split())
lista = []
valor = 0.5
cont = 0
for i in range(m):
nome = input()
lista.append(nome)
for x in range(2,m+1):
if lista[-x]=='halfplus':
valor = (2*valor)+0.5
cont += valor
else:
valor = 2*valor
cont+= valor
... | output | 1 | 82,182 | 10 | 164,365 |
Provide a correct Python 3 solution for this coding contest problem.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precisely remembers she had n buyers and each of them bought e... | instruction | 0 | 82,183 | 10 | 164,366 |
"Correct Solution:
```
plus = 0
cnt = 0
a = []
n,p = map(int,input().split())
for i in range(n):
a.append(input())
for i in reversed(range(n)):
if a[i]=='halfplus':
plus+=0.5
cnt = cnt*2+1
else:cnt*=2
print(int((cnt-plus)*p))
``` | output | 1 | 82,183 | 10 | 164,367 |
Provide a correct Python 3 solution for this coding contest problem.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precisely remembers she had n buyers and each of them bought e... | instruction | 0 | 82,184 | 10 | 164,368 |
"Correct Solution:
```
n, p = map(int, input().split())
x = int(''.join('10'[input()=='half'] for _ in range(n))[::-1], 2)
k = 0
while x:
k += x/2
x //= 2
print(int(k*p))
``` | output | 1 | 82,184 | 10 | 164,369 |
Provide a correct Python 3 solution for this coding contest problem.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precisely remembers she had n buyers and each of them bought e... | instruction | 0 | 82,185 | 10 | 164,370 |
"Correct Solution:
```
from math import ceil
n, p = map(int, input().split())
bs = [input() for i in range(n)]
apples = 0
money = 0
for b in bs[::-1]:
apples *= 2
if b == 'halfplus':
apples += 0.5
apples = ceil(apples)
money += apples / 2 * p
print(int(money))
``` | output | 1 | 82,185 | 10 | 164,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precis... | instruction | 0 | 82,186 | 10 | 164,372 |
Yes | output | 1 | 82,186 | 10 | 164,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precis... | instruction | 0 | 82,187 | 10 | 164,374 |
Yes | output | 1 | 82,187 | 10 | 164,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precis... | instruction | 0 | 82,188 | 10 | 164,376 |
Yes | output | 1 | 82,188 | 10 | 164,377 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precis... | instruction | 0 | 82,189 | 10 | 164,378 |
Yes | output | 1 | 82,189 | 10 | 164,379 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precis... | instruction | 0 | 82,190 | 10 | 164,380 |
No | output | 1 | 82,190 | 10 | 164,381 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precis... | instruction | 0 | 82,191 | 10 | 164,382 |
No | output | 1 | 82,191 | 10 | 164,383 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precis... | instruction | 0 | 82,192 | 10 | 164,384 |
No | output | 1 | 82,192 | 10 | 164,385 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.
She precis... | instruction | 0 | 82,193 | 10 | 164,386 |
No | output | 1 | 82,193 | 10 | 164,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of the... | instruction | 0 | 82,660 | 10 | 165,320 |
Tags: binary search, greedy
Correct Solution:
```
import math
from collections import defaultdict
import sys
#input = sys.stdin.readline
def main():
n, m = map(int, input().split())
k = list(map(int, input().split()))
sales = [(0, 0)] * m
for i in range(m):
a, b = map(int, input().split())
... | output | 1 | 82,660 | 10 | 165,321 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of the... | instruction | 0 | 82,661 | 10 | 165,322 |
Tags: binary search, greedy
Correct Solution:
```
import sys
import copy
DEBUG = False
if DEBUG:
inf = open("input.txt")
else:
inf = sys.stdin
N, M = list(map(int, inf.readline().split(' ')))
n_items = list(map(int, inf.readline().split(' ')))
sales = []
for _ in range(M):
sale = list(map(int, inf.readli... | output | 1 | 82,661 | 10 | 165,323 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of the... | instruction | 0 | 82,662 | 10 | 165,324 |
Tags: binary search, greedy
Correct Solution:
```
import sys
import bisect
import copy
input = sys.stdin.readline
n,m=map(int,input().split())
K=[0]+list(map(int,input().split()))
SP=[list(map(int,input().split())) for i in range(m)]
SP2=[[] for i in range(n+1)]
for d,t in SP:
SP2[t].append(d)
for i in range(n+... | output | 1 | 82,662 | 10 | 165,325 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The only difference between easy and hard versions is constraints.
Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of the... | instruction | 0 | 82,663 | 10 | 165,326 |
Tags: binary search, greedy
Correct Solution:
```
def main():
inp = readnumbers()
ii = 0
n = inp[ii]
ii += 1
m = inp[ii]
ii += 1
K = inp[ii:n+ii]
ii += n
types = [[] for _ in range(n)]
for _ in range(m):
types[inp[ii+1]-1].append(inp[ii] - 1)
ii += 2
... | output | 1 | 82,663 | 10 | 165,327 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.