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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have N items that you want to put them into a knapsack. Item i has value vi and weight wi.
You want to find a subset of items to put such that:
* The total value of the items is as large a... | instruction | 0 | 15,045 | 10 | 30,090 |
No | output | 1 | 15,045 | 10 | 30,091 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.
Overall the shop sells... | instruction | 0 | 15,074 | 10 | 30,148 |
Tags: brute force
Correct Solution:
```
n,m=map(int,input().split())
prices=list(map(int,input().split()))
match=[[False for _ in range(n+1)]for j in range(n+1)]
for i in range(m):
v,u=map(int,input().split())
match[u][v]=match[v][u]=True
t=-1
for i in range(1,n+1):
for j in range(i+1,n+1):
if no... | output | 1 | 15,074 | 10 | 30,149 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.
Overall the shop sells... | instruction | 0 | 15,075 | 10 | 30,150 |
Tags: brute force
Correct Solution:
```
n,m=map(int,input().split())
pr=list(map(int,input().split()))
g=[[0]*(n+1) for i in range(n+1)]
for i in range(m):
a,b=map(int,input().split())
g[a][b]=g[b][a]=1
ans=float('inf')
for i in range(1,n+1):
for j in range(i+1,n+1):
for k in range(j+1,n+1):
... | output | 1 | 15,075 | 10 | 30,151 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.
Overall the shop sells... | instruction | 0 | 15,076 | 10 | 30,152 |
Tags: brute force
Correct Solution:
```
ans = float('inf')
N, M = map(int, input().split())
price = [0] + list(map(int, input().split()))
match = [set() for _ in range(N+1)]
for _ in range(M):
a,b = map(int, input().split())
match[a].add(b)
match[b].add(a)
for i in range(1,N+1):
for j in range(i+1, N+1... | output | 1 | 15,076 | 10 | 30,153 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.
Overall the shop sells... | instruction | 0 | 15,077 | 10 | 30,154 |
Tags: brute force
Correct Solution:
```
I = lambda: map(int, input().split())
n, m = I()
A = list(I())
C = set()
for i in range(m):
x, y = sorted(I())
C.add((x-1,y-1))
print(min((A[i]+A[j]+A[k] for i in range(n) for j in range(i) for k in range(j)
if {(j,i),(k,i),(k,j)} <= C), defau... | output | 1 | 15,077 | 10 | 30,155 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.
Overall the shop sells... | instruction | 0 | 15,078 | 10 | 30,156 |
Tags: brute force
Correct Solution:
```
from math import *
class graph:
# initialize graph
def __init__(self, gdict=None):
if gdict is None:
gdict = dict({})
self.gdict = gdict
# get edges
def edges(self):
return self.find_edges()
# find edges
def find_edg... | output | 1 | 15,078 | 10 | 30,157 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.
Overall the shop sells... | instruction | 0 | 15,079 | 10 | 30,158 |
Tags: brute force
Correct Solution:
```
import math
import queue
from itertools import permutations
n,m= map(int,input().split())
upper=3000003
ans=upper
a=[]
for i in range(0,n+1):
a.append([])
for j in range(0,n+1):
a[i].append(0)
v=[int(cost) for cost in input().split()]
v=[0]+v
for i in ra... | output | 1 | 15,079 | 10 | 30,159 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.
Overall the shop sells... | instruction | 0 | 15,080 | 10 | 30,160 |
Tags: brute force
Correct Solution:
```
n, m = map(int, input().split())
prices = list(map(int, input().split()))
matches = [[]] * m
matches = [[0 for _ in range(n)] for _ in range(n)]
for _ in range(m):
a, b = map(lambda x: int(x) - 1, input().split())
matches[a][b] = 1
matches[b][a] = 1
MAX_M... | output | 1 | 15,080 | 10 | 30,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.
Overall the shop sells... | instruction | 0 | 15,081 | 10 | 30,162 |
Tags: brute force
Correct Solution:
```
#!/usr/bin/env python3
import sys
srci = sys.stdin
n, m = map(int, srci.readline().rstrip().split())
prices = list(map(int, srci.readline().rstrip().split()))
match = [[False for i in range(n+1)] for i in range(n+1)]
for i in range(m):
u, v = map(int, srci.readline().rstri... | output | 1 | 15,081 | 10 | 30,163 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking s... | instruction | 0 | 15,082 | 10 | 30,164 |
Yes | output | 1 | 15,082 | 10 | 30,165 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking s... | instruction | 0 | 15,083 | 10 | 30,166 |
Yes | output | 1 | 15,083 | 10 | 30,167 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking s... | instruction | 0 | 15,084 | 10 | 30,168 |
Yes | output | 1 | 15,084 | 10 | 30,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking s... | instruction | 0 | 15,085 | 10 | 30,170 |
Yes | output | 1 | 15,085 | 10 | 30,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking s... | instruction | 0 | 15,086 | 10 | 30,172 |
No | output | 1 | 15,086 | 10 | 30,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking s... | instruction | 0 | 15,087 | 10 | 30,174 |
No | output | 1 | 15,087 | 10 | 30,175 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking s... | instruction | 0 | 15,088 | 10 | 30,176 |
No | output | 1 | 15,088 | 10 | 30,177 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking s... | instruction | 0 | 15,089 | 10 | 30,178 |
No | output | 1 | 15,089 | 10 | 30,179 |
Provide a correct Python 3 solution for this coding contest problem.
A: four tea
problem
Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]
There are N players participating in the contest, so I would like to prepare tea for this number of people. There... | instruction | 0 | 15,905 | 10 | 31,810 |
"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 | 15,905 | 10 | 31,811 |
Provide a correct Python 3 solution for this coding contest problem.
A: four tea
problem
Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]
There are N players participating in the contest, so I would like to prepare tea for this number of people. There... | instruction | 0 | 15,906 | 10 | 31,812 |
"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 | 15,906 | 10 | 31,813 |
Provide a correct Python 3 solution for this coding contest problem.
A: four tea
problem
Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]
There are N players participating in the contest, so I would like to prepare tea for this number of people. There... | instruction | 0 | 15,907 | 10 | 31,814 |
"Correct Solution:
```
#import sys
#input = sys.stdin.readline
def main():
N = int( input())
p1, p2, p3, p4 = list( map( int, input().split()))
t1, t2, t3, t4 = list( map( int, input().split()))
ans = 10000
for i in range(N+1):
if i*p1 >= ans:
break
if i*t1 >= N:
... | output | 1 | 15,907 | 10 | 31,815 |
Provide a correct Python 3 solution for this coding contest problem.
A: four tea
problem
Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]
There are N players participating in the contest, so I would like to prepare tea for this number of people. There... | instruction | 0 | 15,908 | 10 | 31,816 |
"Correct Solution:
```
def inpl(): return list(map(int, input().split()))
N = int(input())
P = inpl()
T = inpl()
cost = 10**9
for a in range(-(-N//T[0]) + 1):
costa = P[0]*a
teaa = T[0]*a
rema = N - teaa
for b in range(max(1, -(-rema//T[1]) + 1)):
costb = P[1] * b
teab = T[1]*b
... | output | 1 | 15,908 | 10 | 31,817 |
Provide a correct Python 3 solution for this coding contest problem.
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided ... | instruction | 0 | 16,780 | 10 | 33,560 |
"Correct Solution:
```
while True:
N = int(input())
if not N: break
seeds = []
for i in range(N):
plant = input().split()
name, price = plant[0], int(plant[1])
seed_to_leaf, leaf_to_fruit = sum(map(int, plant[2:5])), sum(map(int, plant[5:7]))
num_per, sold, mult = int(pla... | output | 1 | 16,780 | 10 | 33,561 |
Provide a correct Python 3 solution for this coding contest problem.
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided ... | instruction | 0 | 16,781 | 10 | 33,562 |
"Correct Solution:
```
while True:
n = int(input())
if n == 0:
break
dic = []
for _ in range(n):
lst = input().split()
l = lst.pop(0)
p, a, b, c, d, e, f, s, m = map(int, lst)
time = a + b + c + (d + e) * m
prof = f * s * m - p
dic.append((-prof / time, l))
dic.sort()
for _, n... | output | 1 | 16,781 | 10 | 33,563 |
Provide a correct Python 3 solution for this coding contest problem.
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided ... | instruction | 0 | 16,782 | 10 | 33,564 |
"Correct Solution:
```
while 1:
n = int(input())
if n == 0:
break
ans = []
for i in range(n):
l,p,a,b,c,d,e,f,s,m = input().split()
p,a,b,c,d,e,f,s,m = map(int,[p,a,b,c,d,e,f,s,m])
sum = s*f*m-p
sum /= (a+b+c+d+e+(m-1)*(d+e))
ans.append([l,sum])
ans.so... | output | 1 | 16,782 | 10 | 33,565 |
Provide a correct Python 3 solution for this coding contest problem.
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided ... | instruction | 0 | 16,783 | 10 | 33,566 |
"Correct Solution:
```
while True:
N = int(input())
if N == 0: break
mem = []
for i in range(N):
l,p,a,b,c,d,e,f,s,m = map(lambda x:int(x) if x[0].isdigit() else x, input().split())
time = a+b+c+(d+e)*m
income = f*m*s - p
mem.append((-income/time, l))
for e,name in so... | output | 1 | 16,783 | 10 | 33,567 |
Provide a correct Python 3 solution for this coding contest problem.
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided ... | instruction | 0 | 16,784 | 10 | 33,568 |
"Correct Solution:
```
while True:
N = int(input())
if N == 0:
break
effies = {}
for _ in range(N):
L, P, A, B, C, D, E, F, S, M = map(str, input().split())
P = int(P)
A = int(A)
B = int(B)
C = int(C)
D = int(D)
E = int(E)
F = int(F... | output | 1 | 16,784 | 10 | 33,569 |
Provide a correct Python 3 solution for this coding contest problem.
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided ... | instruction | 0 | 16,785 | 10 | 33,570 |
"Correct Solution:
```
while 1:
n=int(input())
if n==0:
break
D=[]
for i in range(n):
l,p,a,b,c,d,e,f,s,m=input().split()
p,a,b,c,d,e,f,s,m=map(int,(p,a,b,c,d,e,f,s,m))
D.append(((s*f*m-p)/((d+e)*m+a+b+c),l))
D=sorted(D,key=lambda x:(-x[0],x[1]))
for i in range(n)... | output | 1 | 16,785 | 10 | 33,571 |
Provide a correct Python 3 solution for this coding contest problem.
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided ... | instruction | 0 | 16,786 | 10 | 33,572 |
"Correct Solution:
```
resultss = []
while True:
N = int(input())
if N == 0:
break
B = [list(map(str, input().split())) for _ in range(N)]
results = []
for i in range(N):
A = []
name = B[i][0]
B[i][0] = B[i][1]
for j in range(10):
A.append(... | output | 1 | 16,786 | 10 | 33,573 |
Provide a correct Python 3 solution for this coding contest problem.
You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided ... | instruction | 0 | 16,787 | 10 | 33,574 |
"Correct Solution:
```
while(True):
n = int(input())
if n==0:break
agri_list = {}
for i in range(n):
l,p,a,b,c,d,e,f,s,m = input().split()
p = int(p)
a = int(a)
b = int(b)
c = int(c)
d = int(d)
e = int(e)
f = int(f)
s = int(s)
m = int(m)
time = a + b + c + (d + e)* m
income = s * m * f - p
... | output | 1 | 16,787 | 10 | 33,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the array a and number y occurs in the array a;
... | instruction | 0 | 17,143 | 10 | 34,286 |
Tags: graphs, greedy, sortings
Correct Solution:
```
def Fun(n):
if(n%2): return n*(n-1)//2+1
return n*n//2
n,m = map(int,input().split())
q = [0] * (m)
w = [0] * (m)
for i in range(m):
q[i],w[i] = [int(x) for x in input().split()]
#print(q[i],w[i])
w.sort(reverse = True)
#print(*w)
s = 0
... | output | 1 | 17,143 | 10 | 34,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the array a and number y occurs in the array a;
... | instruction | 0 | 17,144 | 10 | 34,288 |
Tags: graphs, greedy, sortings
Correct Solution:
```
import itertools
def f(n):
return n * (n - 1) / 2 + 1 if n % 2 else n * (n - 1) / 2 + n / 2
n, m = map(int, input().split())
table = sorted([int(input().split()[1]) for _ in range(m)], reverse = True)
ans = 1
while f(ans) <= n:
ans += 1
ans -= 1
print(list(... | output | 1 | 17,144 | 10 | 34,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the array a and number y occurs in the array a;
... | instruction | 0 | 17,145 | 10 | 34,290 |
Tags: graphs, greedy, sortings
Correct Solution:
```
def readdata():
#fread = open('input.txt', 'r')
global n, m, w, q
n, m = [int(x) for x in input().split()]
q = [0] * m
w = [0] * m
for i in range(m):
q[i], w[i] = [int(x) for x in input().split()]
def podg():... | output | 1 | 17,145 | 10 | 34,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the array a and number y occurs in the array a;
... | instruction | 0 | 17,146 | 10 | 34,292 |
Tags: graphs, greedy, sortings
Correct Solution:
```
import sys, bisect
(n, m), *s = [map(int, s.split()) for s in sys.stdin.readlines()]
g = [n * (n - 1) // 2 + (n - 1) % 2 * (n // 2 - 1) for n in range(1, 2002)]
print(sum(sorted([w for _, w in s], reverse=True)[:min(m, bisect.bisect_left(g, n))]))
``` | output | 1 | 17,146 | 10 | 34,293 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the array a and number y occurs in the array a;
... | instruction | 0 | 17,147 | 10 | 34,294 |
Tags: graphs, greedy, sortings
Correct Solution:
```
def Fun(n):
if(n%2): return n*(n-1)//2+1
return n*n//2
n,m = map(int,input().split())
q = [0] * (m)
w = [0] * (m)
for i in range(m):
q[i],w[i] = [int(x) for x in input().split()]
#print(q[i],w[i])
w.sort(reverse = True)
#print(*w)
s = 0
v = 0
#print(... | output | 1 | 17,147 | 10 | 34,295 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the array a and number y occurs in the array a;
... | instruction | 0 | 17,148 | 10 | 34,296 |
Tags: graphs, greedy, sortings
Correct Solution:
```
n,m = map(int,input().split())
q = [0] * (m)
w = [0] * (m)
for i in range(m):
q[i],w[i] = [int(x) for x in input().split()]
#print(q[i],w[i])
w.sort(reverse = True)
#print(*w)
s = 0
v = 0
#print("n=",n)
for i in range(m):
i=i+1
if (i % 2 == 1): v = i*... | output | 1 | 17,148 | 10 | 34,297 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the... | instruction | 0 | 17,149 | 10 | 34,298 |
No | output | 1 | 17,149 | 10 | 34,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the... | instruction | 0 | 17,150 | 10 | 34,300 |
No | output | 1 | 17,150 | 10 | 34,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the... | instruction | 0 | 17,151 | 10 | 34,302 |
No | output | 1 | 17,151 | 10 | 34,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:
* consider all pairs of numbers x, y (x β y), such that number x occurs in the... | instruction | 0 | 17,152 | 10 | 34,304 |
No | output | 1 | 17,152 | 10 | 34,305 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where N... | instruction | 0 | 17,332 | 10 | 34,664 |
Tags: greedy, sortings
Correct Solution:
```
n, f=map(int, input().split())
a=[]
b=[]
for i in range (0, n):
k, l=map(int, input().split())
a.append(min(2*k, l)-min(k, l))
b.append(min(k, l))
a.sort(reverse=True)
ans=0
for i in range (0, f):
ans+=a[i]
for i in b:
ans+=i
print(ans)
``` | output | 1 | 17,332 | 10 | 34,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where N... | instruction | 0 | 17,333 | 10 | 34,666 |
Tags: greedy, sortings
Correct Solution:
```
n,f=list(map(int,input().split()))
k,l=[0 for i in range(n)],[0 for i in range(n)]
for i in range(n):
k[i],l[i]=list(map(int,input().split()))
p=[min(k[i],l[i]) for i in range(n)]
q=[min(2*k[i],l[i]) for i in range(n)]
r=[q[i]-p[i] for i in range(n)]
r.sort(reverse=True)
pr... | output | 1 | 17,333 | 10 | 34,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where N... | instruction | 0 | 17,334 | 10 | 34,668 |
Tags: greedy, sortings
Correct Solution:
```
n, f = map(int, input().split())
p = [0]*n
s = 0
for i in range(n):
k, l = map(int, input().split())
if l >= 2 * k:
p[i] = k
s += k
elif l > k:
p[i] = l-k
s += k
else:
s += l
s += sum( list(reversed(sorted(p)))[:f])
p... | output | 1 | 17,334 | 10 | 34,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where N... | instruction | 0 | 17,335 | 10 | 34,670 |
Tags: greedy, sortings
Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
import os
import math
# input_text_path = __file__.replace('.py', '.txt')
# fd = os.open(input_text_path, os.O_RDONLY)
# os.dup2(fd, sys.stdin.fileno())
n, f = map(int, input().split())
A = []
normal_sell_total = 0
for i in range(n):
... | output | 1 | 17,335 | 10 | 34,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where N... | instruction | 0 | 17,336 | 10 | 34,672 |
Tags: greedy, sortings
Correct Solution:
```
def solve(n, f, kls):
base = sum(min(k, l) for k, l in kls)
plus = sorted([min(2*k, l) - min(k, l) for k, l in kls])[::-1]
res = base + sum(plus[:f])
print(res)
def main():
n, f = map(int, input().split())
kls = []
for _ in range(n):
k, l... | output | 1 | 17,336 | 10 | 34,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where N... | instruction | 0 | 17,337 | 10 | 34,674 |
Tags: greedy, sortings
Correct Solution:
```
n,f=map(int,input().split())
a=[]
for i in range(n):
temp=list(map(int,input().split()))
if temp[0]>=temp[1]:
temp.append(0)
elif (temp[0]*2)>=temp[1]:
temp.append(temp[1]-temp[0])
else:
temp.append(temp[0])
a.append(temp)
a.sort(k... | output | 1 | 17,337 | 10 | 34,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where N... | instruction | 0 | 17,338 | 10 | 34,676 |
Tags: greedy, sortings
Correct Solution:
```
n,f=map(int,input().split())
w=[[int(x) for x in input().split()]for i in range(n)]
sum1=0
final=[0]*n
for j in range(len(w)):
sum1=sum1+min(w[j][0],w[j][1])
final[j]=min(2*w[j][0],w[j][1])-min(w[j][0],w[j][1])
final.sort(reverse=True)
for i in range(f):
sum1=sum... | output | 1 | 17,338 | 10 | 34,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where N... | instruction | 0 | 17,339 | 10 | 34,678 |
Tags: greedy, sortings
Correct Solution:
```
n,k=map(int,input().split())
s=0;e=[]
for i in range(n):
a,b=map(int,input().split())
c = min(a,b)
d = min(2*a,b)
s += c
e.append(d-c)
e.sort()
for i in range(n-1,n-k-1,-1):
s+=e[i]
print(s)
``` | output | 1 | 17,339 | 10 | 34,679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took ... | instruction | 0 | 17,340 | 10 | 34,680 |
Yes | output | 1 | 17,340 | 10 | 34,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took ... | instruction | 0 | 17,341 | 10 | 34,682 |
Yes | output | 1 | 17,341 | 10 | 34,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took ... | instruction | 0 | 17,342 | 10 | 34,684 |
Yes | output | 1 | 17,342 | 10 | 34,685 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.