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.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know wha... | instruction | 0 | 237 | 10 | 474 |
Tags: greedy, sortings
Correct Solution:
```
length = int(input())
coin = [int(x) for x in input().split()]
b = sorted(coin,reverse=True)
sum = 0
for x in coin:
sum += x
crit = sum /2
take = 0
for i in range(length):
take += b[i]
if take > crit:
print(i+1)
break
``` | output | 1 | 237 | 10 | 475 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know wha... | instruction | 0 | 238 | 10 | 476 |
Tags: greedy, sortings
Correct Solution:
```
x = int(input())
y = input()
y = y.split()
l = []
for i in y:
i = int(i)
l.append(i)
l.sort()
l = l[::-1]
c= 1
s1 = l[0]
s = 0
for i in range(len(l)):
for j in range(i+1,len(l)):
s = s + l[j]
if s1 <= s:
s1 = s1 + l[i+1]
c+=1
s = ... | output | 1 | 238 | 10 | 477 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know wha... | instruction | 0 | 239 | 10 | 478 |
Tags: greedy, sortings
Correct Solution:
```
n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse = True)
total = sum(coins)
taken = []
for i in range(0, n):
if sum(taken) + coins[i] <= total - sum(taken) - coins[i]:
taken.append(coins[i])
else:
print(len(taken) + 1)
... | output | 1 | 239 | 10 | 479 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know wha... | instruction | 0 | 240 | 10 | 480 |
Tags: greedy, sortings
Correct Solution:
```
n = int(input())
s = input().split()
i = 0
for u in range(0,len(s)):
s[u]=int(s[u])
maxsum = 0
while(True):
maxsum += max(s)
del(s[s.index(max(s))])
i += 1
if (sum(s) < maxsum):
break
print(i)
``` | output | 1 | 240 | 10 | 481 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know wha... | instruction | 0 | 241 | 10 | 482 |
Tags: greedy, sortings
Correct Solution:
```
n=int(input())
s=list(map(int,input().split()))
s.sort(reverse=True)
x=sum(s)
x=(x//2)+1
su=0
c=0
for j in s:
su=su+j
c+=1
if su>=x:
break
print(c)
``` | output | 1 | 241 | 10 | 483 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know wha... | instruction | 0 | 242 | 10 | 484 |
Tags: greedy, sortings
Correct Solution:
```
n=int(input())
a=[]
c=list(map(int,input().split()))
a.extend(c)
a.sort(reverse=True)
v=sum(c)
count=0
ctr=0
for i in range(n):
if count<=v/2:
count=count+a[i]
ctr+=1
print(ctr)
``` | output | 1 | 242 | 10 | 485 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know wha... | instruction | 0 | 243 | 10 | 486 |
Tags: greedy, sortings
Correct Solution:
```
n=int(input())
li=list(map(int, input().split()))
li.sort(reverse=True)
sum=sum(li)
j=0
sum2=0
while sum2<=(sum//2):
sum2=sum2+li[j]
j=j+1
print(j)
exit()
``` | output | 1 | 243 | 10 | 487 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know wha... | instruction | 0 | 244 | 10 | 488 |
Tags: greedy, sortings
Correct Solution:
```
import sys
file = sys.stdin.readlines()
line = file[1]
numbers = line.split(" ")
numbers[-1] = numbers[-1].strip()
i = 0
while i < len(numbers):
numbers[i] = int(numbers[i])
i += 1
numbers.sort(reverse = True)
total = sum(numbers)
coins = []
for coin in numbers... | output | 1 | 244 | 10 | 489 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if ... | instruction | 0 | 245 | 10 | 490 |
Yes | output | 1 | 245 | 10 | 491 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if ... | instruction | 0 | 246 | 10 | 492 |
Yes | output | 1 | 246 | 10 | 493 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if ... | instruction | 0 | 247 | 10 | 494 |
Yes | output | 1 | 247 | 10 | 495 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if ... | instruction | 0 | 248 | 10 | 496 |
Yes | output | 1 | 248 | 10 | 497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if ... | instruction | 0 | 249 | 10 | 498 |
No | output | 1 | 249 | 10 | 499 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if ... | instruction | 0 | 250 | 10 | 500 |
No | output | 1 | 250 | 10 | 501 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if ... | instruction | 0 | 251 | 10 | 502 |
No | output | 1 | 251 | 10 | 503 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if ... | instruction | 0 | 252 | 10 | 504 |
No | output | 1 | 252 | 10 | 505 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving subproblem F2 you will receive 15 points, and for solving subproblem F3 you will receive 10 points.
Manao has developed a model to ... | instruction | 0 | 338 | 10 | 676 |
Tags: dp
Correct Solution:
```
import sys
ammount_prices, days_for_trading=map(int, input().split())
stonks=[]
for i in range (0, ammount_prices):
price=int(sys.stdin.readline())
stonks.append(price)
def get_max(days_for_trading, stonks):
size_prices = len(stonks)
if size_prices == 0 or size_prices =... | output | 1 | 338 | 10 | 677 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving subproblem F2 you will receive 15 points, and for solving subproblem F3 you will rece... | instruction | 0 | 339 | 10 | 678 |
No | output | 1 | 339 | 10 | 679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving subproblem F2 you will receive 15 points, and for solving subproblem F3 you will rece... | instruction | 0 | 340 | 10 | 680 |
No | output | 1 | 340 | 10 | 681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving subproblem F2 you will receive 15 points, and for solving subproblem F3 you will rece... | instruction | 0 | 341 | 10 | 682 |
No | output | 1 | 341 | 10 | 683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving subproblem F2 you will receive 15 points, and for solving subproblem F3 you will rece... | instruction | 0 | 342 | 10 | 684 |
No | output | 1 | 342 | 10 | 685 |
Provide a correct Python 3 solution for this coding contest problem.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets alo... | instruction | 0 | 607 | 10 | 1,214 |
"Correct Solution:
```
A=[0]*4
for i in range(4):
A[i]=int(input())
print(min(A[0],A[1])+min(A[2],A[3]))
``` | output | 1 | 607 | 10 | 1,215 |
Provide a correct Python 3 solution for this coding contest problem.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets alo... | instruction | 0 | 608 | 10 | 1,216 |
"Correct Solution:
```
x = [int(input()) for _ in range(4)]
res = min(x[0], x[1]) + min(x[2], x[3])
print(res)
``` | output | 1 | 608 | 10 | 1,217 |
Provide a correct Python 3 solution for this coding contest problem.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets alo... | instruction | 0 | 609 | 10 | 1,218 |
"Correct Solution:
```
a,b,c,d = map(int, [input() for i in range(4)])
print(min(a,b) + min(c,d))
``` | output | 1 | 609 | 10 | 1,219 |
Provide a correct Python 3 solution for this coding contest problem.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets alo... | instruction | 0 | 610 | 10 | 1,220 |
"Correct Solution:
```
a,b,c,d=[int(input())for i in"abcd"];print(min(a,b)+min(c,d))
``` | output | 1 | 610 | 10 | 1,221 |
Provide a correct Python 3 solution for this coding contest problem.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets alo... | instruction | 0 | 611 | 10 | 1,222 |
"Correct Solution:
```
a, b, c, d = (int(input()) for n in range(0, 4))
print(min(a, b) + min(c, d))
``` | output | 1 | 611 | 10 | 1,223 |
Provide a correct Python 3 solution for this coding contest problem.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets alo... | instruction | 0 | 612 | 10 | 1,224 |
"Correct Solution:
```
a,b,c,d=[int(input()) for i in range(4)]
print(min(a+c,a+d,b+c,b+d))
``` | output | 1 | 612 | 10 | 1,225 |
Provide a correct Python 3 solution for this coding contest problem.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets alo... | instruction | 0 | 613 | 10 | 1,226 |
"Correct Solution:
```
a=[int(input()) for i in range(4)]
print(min(a[:2])+min(a[2:]))
``` | output | 1 | 613 | 10 | 1,227 |
Provide a correct Python 3 solution for this coding contest problem.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets alo... | instruction | 0 | 614 | 10 | 1,228 |
"Correct Solution:
```
A,B,C,D = [int(input()) for i in range(4)]
x = [A,B]
y = [C,D]
print(min(x) + min(y))
``` | output | 1 | 614 | 10 | 1,229 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, th... | instruction | 0 | 615 | 10 | 1,230 |
Yes | output | 1 | 615 | 10 | 1,231 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, th... | instruction | 0 | 616 | 10 | 1,232 |
Yes | output | 1 | 616 | 10 | 1,233 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, th... | instruction | 0 | 617 | 10 | 1,234 |
Yes | output | 1 | 617 | 10 | 1,235 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, th... | instruction | 0 | 618 | 10 | 1,236 |
Yes | output | 1 | 618 | 10 | 1,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, th... | instruction | 0 | 619 | 10 | 1,238 |
No | output | 1 | 619 | 10 | 1,239 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, th... | instruction | 0 | 620 | 10 | 1,240 |
No | output | 1 | 620 | 10 | 1,241 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, th... | instruction | 0 | 621 | 10 | 1,242 |
No | output | 1 | 621 | 10 | 1,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, th... | instruction | 0 | 622 | 10 | 1,244 |
No | output | 1 | 622 | 10 | 1,245 |
Provide a correct Python 3 solution for this coding contest problem.
D: Is greed the best?
story
In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..
If the amount of coins is different f... | instruction | 0 | 772 | 10 | 1,544 |
"Correct Solution:
```
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.st... | output | 1 | 772 | 10 | 1,545 |
Provide a correct Python 3 solution for this coding contest problem.
D: Is greed the best?
story
In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..
If the amount of coins is different f... | instruction | 0 | 773 | 10 | 1,546 |
"Correct Solution:
```
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bi... | output | 1 | 773 | 10 | 1,547 |
Provide a correct Python 3 solution for this coding contest problem.
D: Is greed the best?
story
In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..
If the amount of coins is different f... | instruction | 0 | 774 | 10 | 1,548 |
"Correct Solution:
```
def inpl(): return list(map(int, input().split()))
A, B = inpl()
def calca(x):
return x//A + x%A
X = -(-B//A)*A
Y = calca(X - X//B*B) + X//B
if -(-B//A) < Y:
print(X)
else:
print(-1)
``` | output | 1 | 774 | 10 | 1,549 |
Provide a correct Python 3 solution for this coding contest problem.
D: Is greed the best?
story
In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..
If the amount of coins is different f... | instruction | 0 | 775 | 10 | 1,550 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
from operator import itemgetter
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy
from collections import Counter, deque
import heapq
from functools import reduce
# local only
# if not __debug__:
# fin = open('in_1.txt', ... | output | 1 | 775 | 10 | 1,551 |
Provide a correct Python 3 solution for this coding contest problem.
D: Is greed the best?
story
In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..
If the amount of coins is different f... | instruction | 0 | 776 | 10 | 1,552 |
"Correct Solution:
```
a,b=map(int,input().split())
d=e=-(-b//a)*a
c=0
while d>=b:
d-=b
c+=1
while d>=a:
d-=a
c+=1
c+=d
if c>e//a:
print(e)
else:
print(-1)
``` | output | 1 | 776 | 10 | 1,553 |
Provide a correct Python 3 solution for this coding contest problem.
D: Is greed the best?
story
In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..
If the amount of coins is different f... | instruction | 0 | 777 | 10 | 1,554 |
"Correct Solution:
```
A,B = map(int,input().split())
if B%A == 0:
print(-1)
exit()
_k = -(-B//A)
for k in range(_k, _k+10**7):
bn, rem = divmod(k*A, B)
an, rem = divmod(rem, A)
n = bn + an + rem
if n > k:
print(k*A)
exit()
print(-1)
``` | output | 1 | 777 | 10 | 1,555 |
Provide a correct Python 3 solution for this coding contest problem.
D: Is greed the best?
story
In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..
If the amount of coins is different f... | instruction | 0 | 778 | 10 | 1,556 |
"Correct Solution:
```
from math import ceil, floor
A, B = map(int, input().split())
ans = 10**10
for b in range(1, A+1):
a = ceil(b*B/A)
c = a*A - b*B
if b + c > a > 0:
ans = min(ans, a*A)
if ans == 10**10:
ans = -1
print(ans)
``` | output | 1 | 778 | 10 | 1,557 |
Provide a correct Python 3 solution for this coding contest problem.
D: Is greed the best?
story
In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..
If the amount of coins is different f... | instruction | 0 | 779 | 10 | 1,558 |
"Correct Solution:
```
A,B = map(int,input().split())
ans = -1
for i in range(B//A+1,A):
P = A*i
if (P//B) + (P%B)%A > i:
ans = P
break
print(ans)
``` | output | 1 | 779 | 10 | 1,559 |
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 | 933 | 10 | 1,866 |
Tags: binary search, greedy
Correct Solution:
```
from math import gcd
for step in range(int(input())):
n=int(input())
P=[int(i)//100 for i in input().split()]
x,a=map(int,input().split())
y,b=map(int,input().split())
k=int(input())
z=x+y
c=(a*b)//gcd(a,b)
P.sort(reverse=True)
if x<y... | output | 1 | 933 | 10 | 1,867 |
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 | 934 | 10 | 1,868 |
Tags: binary search, greedy
Correct Solution:
```
def nok(a, b):
return (a * b) // gcd(a, b)
def gcd(a, b):
while b:
a, b = b, a % b
return a
def test(z):
global x, a, y, b, p, k
ans = 0
xayb = z // nok(a, b)
xa = z // a - xayb
yb = z // b - xayb
if x >= y:
x1 = xa
... | output | 1 | 934 | 10 | 1,869 |
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 | 935 | 10 | 1,870 |
Tags: binary search, greedy
Correct Solution:
```
def gcd(a, b):
if a*b == 0:
return a+b
return gcd(b, a%b)
def f():
n = int(input())
p = list(map(lambda x:int(x)//100, input().split()))
x, a = map(int, input().split())
y, b = map(int, input().split())
k = int(input())
p.sort(r... | output | 1 | 935 | 10 | 1,871 |
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 | 936 | 10 | 1,872 |
Tags: binary search, greedy
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
import sys
from io import BytesIO, IOBase
from math import gcd
def lcm(x,y):
return x*y//gcd(x,y)
def check(p,x,a,y,b,k,mid):
z,i,su=lcm(a,b),0,0
while i<mid//z:
su+=(p[i]*(x+... | output | 1 | 936 | 10 | 1,873 |
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 | 937 | 10 | 1,874 |
Tags: binary search, greedy
Correct Solution:
```
def fun(n, p, x, y, xy_n, x_n, y_n):
s, i = 0, n
for _ in range(xy_n):
s += p[i - 1] * (x + y) // 100
i -= 1
for _ in range(x_n):
s += p[i - 1] * x // 100
i -= 1
for _ in range(y_n):
s += p[i - 1] * y // 100
... | output | 1 | 937 | 10 | 1,875 |
End of preview. Expand in Data Studio
- Downloads last month
- 6