message stringlengths 2 20.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 1.95k 109k | cluster float64 17 17 | __index_level_0__ int64 3.91k 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each class must present two couples to the ball. In ... | instruction | 0 | 88,627 | 17 | 177,254 |
Tags: combinatorics, graphs, math
Correct Solution:
```
from math import sqrt
import operator
import sys
# inf = open('input.txt', 'r')
inf = sys.stdin
input = inf.readline
def read_one_int():
return int(input().rstrip('\n'))
def read_list_of_ints():
res = [int(val) for val in (input().rstrip('\n')).s... | output | 1 | 88,627 | 17 | 177,255 |
Provide tags and a correct Python 3 solution for this coding contest problem.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each class must present two couples to the ball. In ... | instruction | 0 | 88,628 | 17 | 177,256 |
Tags: combinatorics, graphs, math
Correct Solution:
```
from math import *
from collections import *
def read():
return list(map(int, input().split(' ')))
n, = read()
for _ in range(n):
a, b, k = read()
boy = read()
girl = read()
pair = [(boy[i], girl[i]) for i in range(k)]
if(k==1):
... | output | 1 | 88,628 | 17 | 177,257 |
Provide tags and a correct Python 3 solution for this coding contest problem.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each class must present two couples to the ball. In ... | instruction | 0 | 88,629 | 17 | 177,258 |
Tags: combinatorics, graphs, math
Correct Solution:
```
import math, sys
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
INF = float('inf')
MOD = int(1e9) + 7
MAX = int(1e6) + 1
def solve():
a, b, k = vars()
boys = array()
girls = array()
pair = []
for i in rang... | output | 1 | 88,629 | 17 | 177,259 |
Provide tags and a correct Python 3 solution for this coding contest problem.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each class must present two couples to the ball. In ... | instruction | 0 | 88,630 | 17 | 177,260 |
Tags: combinatorics, graphs, math
Correct Solution:
```
for _ in range(int(input())):
a, b, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
deg_a = [0]*(a+1)
deg_b = [0]*(b+1)
for i in range(k):
deg_a[A[i]] += 1
deg_b[B[i]] +=... | output | 1 | 88,630 | 17 | 177,261 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each ... | instruction | 0 | 88,631 | 17 | 177,262 |
Yes | output | 1 | 88,631 | 17 | 177,263 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each ... | instruction | 0 | 88,632 | 17 | 177,264 |
Yes | output | 1 | 88,632 | 17 | 177,265 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each ... | instruction | 0 | 88,633 | 17 | 177,266 |
Yes | output | 1 | 88,633 | 17 | 177,267 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each ... | instruction | 0 | 88,634 | 17 | 177,268 |
Yes | output | 1 | 88,634 | 17 | 177,269 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each ... | instruction | 0 | 88,635 | 17 | 177,270 |
No | output | 1 | 88,635 | 17 | 177,271 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each ... | instruction | 0 | 88,636 | 17 | 177,272 |
No | output | 1 | 88,636 | 17 | 177,273 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each ... | instruction | 0 | 88,637 | 17 | 177,274 |
No | output | 1 | 88,637 | 17 | 177,275 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.
Each ... | instruction | 0 | 88,638 | 17 | 177,276 |
No | output | 1 | 88,638 | 17 | 177,277 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:
* the f... | instruction | 0 | 88,676 | 17 | 177,352 |
Tags: implementation
Correct Solution:
```
n = int(input())
res = {input(): [0, 0, 0] for i in range(n)}
for i in range(n * (n - 1) // 2):
teams, score = input().split()
team1, team2 = teams.split("-")
sc1, sc2 = map(int, score.split(":"))
if sc1 > sc2:
res[team1][0] += 3
elif sc2 > sc1:
... | output | 1 | 88,676 | 17 | 177,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:
* the f... | instruction | 0 | 88,677 | 17 | 177,354 |
Tags: implementation
Correct Solution:
```
#this function will update information about team after each match
def completeTeamInfo(team,scored,missed):
team.scoredGoals += scored
team.missedGoals += missed
team.differenceScoredAndMissed += scored - missed
#if the team scored more goals than ... | output | 1 | 88,677 | 17 | 177,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:
* the f... | instruction | 0 | 88,678 | 17 | 177,356 |
Tags: implementation
Correct Solution:
```
'''Problem 19A - World Football Cup'''
score = {} # dict pentru a face totalurile pentru fiecare din jucatori
n = int(input()) # citim nr de echipe
for i in range(n):
team = input() # key = numele la echipe
score[team] = [0,0,0] # numele la echipa = [puncte pentru fiec... | output | 1 | 88,678 | 17 | 177,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:
* the f... | instruction | 0 | 88,679 | 17 | 177,358 |
Tags: implementation
Correct Solution:
```
class Info:
def __init__(self, newTeamName, newPoints, newGoalDiff, newScoredGoals):
self.teamName = newTeamName
self.points = newPoints
self.goalDiff = newGoalDiff
self.scoredGoals = newScoredGoals
def __str__(self):
temp = '\n... | output | 1 | 88,679 | 17 | 177,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:
* the f... | instruction | 0 | 88,680 | 17 | 177,360 |
Tags: implementation
Correct Solution:
```
#RAVENS
#TEAM_2
#ESSI-DAYI_MOHSEN-LORENZO
n = int(input())
team = dict()
for i in range(n):
team[input()] = [0,0,0]
for i in range(n*(n-1)//2):
a,b = input().split()
t1,t2=a.split('-')
g1,g2=map(int,b.split(':'))
team[t1][2]+=g1
team[t2][2]+=g2
if g1 > g2:team[t1][0]+=3... | output | 1 | 88,680 | 17 | 177,361 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:
* the f... | instruction | 0 | 88,681 | 17 | 177,362 |
Tags: implementation
Correct Solution:
```
import math
n = int(input())
d= {}
for i in range(n):
d[input()] = [0,0,0]
for i in range(math.factorial(n)//(2*math.factorial(n-2))):
t,s = input().split()
t1,t2 = t.split('-')
s1,s2 = map(int,s.split(':'))
if s1>s2 :
d[t1][0] += 3
d[t1][1]... | output | 1 | 88,681 | 17 | 177,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:
* the f... | instruction | 0 | 88,682 | 17 | 177,364 |
Tags: implementation
Correct Solution:
```
n = int(input())
# Score [points, diff, goals]
score = {}
for i in range(n):
score[input()] = [0, 0, 0]
for i in range(int(n*(n-1)/2)):
s = input().split()
p1 = s[0].split('-')[0]
p2 = s[0].split('-')[1]
s1 = int(s[1].split(':')[0])
s2 = int(s[... | output | 1 | 88,682 | 17 | 177,365 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:
* the f... | instruction | 0 | 88,683 | 17 | 177,366 |
Tags: implementation
Correct Solution:
```
n = int(input())
class Command:
def __init__(self, name):
self.name = name
self.score = 0
self.z = 0
self.p = 0
def get_r(self):
return self.z - self.p
arr = {}
for i in range(n):
name = input()
arr[name] = Comman... | output | 1 | 88,683 | 17 | 177,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision t... | instruction | 0 | 88,684 | 17 | 177,368 |
Yes | output | 1 | 88,684 | 17 | 177,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision t... | instruction | 0 | 88,685 | 17 | 177,370 |
Yes | output | 1 | 88,685 | 17 | 177,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision t... | instruction | 0 | 88,686 | 17 | 177,372 |
Yes | output | 1 | 88,686 | 17 | 177,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision t... | instruction | 0 | 88,687 | 17 | 177,374 |
Yes | output | 1 | 88,687 | 17 | 177,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision t... | instruction | 0 | 88,688 | 17 | 177,376 |
No | output | 1 | 88,688 | 17 | 177,377 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision t... | instruction | 0 | 88,689 | 17 | 177,378 |
No | output | 1 | 88,689 | 17 | 177,379 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision t... | instruction | 0 | 88,690 | 17 | 177,380 |
No | output | 1 | 88,690 | 17 | 177,381 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision t... | instruction | 0 | 88,691 | 17 | 177,382 |
No | output | 1 | 88,691 | 17 | 177,383 |
Provide a correct Python 3 solution for this coding contest problem.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the partici... | instruction | 0 | 89,142 | 17 | 178,284 |
"Correct Solution:
```
import sys
def f():
w=m=0;n,q=map(int,input().split());s=[0]*-~n
for e in sys.stdin:
a,v=map(int,e.split());s[a]+=v
if v<0 and a==w:m=max(s);w=s.index(m)
elif s[a]>m:w,m=a,s[a]
elif s[a]==m:w=min(w,a)
print(w,m)
if'__main__'==__name__:f()
``` | output | 1 | 89,142 | 17 | 178,285 |
Provide a correct Python 3 solution for this coding contest problem.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the partici... | instruction | 0 | 89,143 | 17 | 178,286 |
"Correct Solution:
```
def solve():
import heapq
from sys import stdin
lines = stdin
n, q = map(int, lines.readline().split())
# hq element: [number of caught fish, participant number]
hq = [(0, i) for i in range(1, n + 1)]
heapq.heapify(hq)
fish = [0] * (n + 1) # number of cau... | output | 1 | 89,143 | 17 | 178,287 |
Provide a correct Python 3 solution for this coding contest problem.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the partici... | instruction | 0 | 89,144 | 17 | 178,288 |
"Correct Solution:
```
"""
γ»γ°γ‘γ³γζ¨
"""
INF = 10 ** 20
n, q = map(int, input().split())
size = 1
while size < n:
size *= 2
size = size * 2 - 1
seg_tree = [(INF, 0) for _ in range(size)]
def update(a, v):
ind = (size - 1) // 2 + a
prea, prev = seg_tree[ind]
seg_tree[ind] = (a + 1, prev + v)
while ind > 0:
... | output | 1 | 89,144 | 17 | 178,289 |
Provide a correct Python 3 solution for this coding contest problem.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the partici... | instruction | 0 | 89,145 | 17 | 178,290 |
"Correct Solution:
```
n,q=map(int,input().split())
s=[0]*-~n
w=m=0
for _ in[0]*q:
a,v=map(int,input().split())
s[a]+=v
if v<0 and a==w:m=max(s);w=s.index(m)
elif s[a]>m:w,m=a,s[a]
elif s[a]==m and a<w:w=a
print(w,m)
``` | output | 1 | 89,145 | 17 | 178,291 |
Provide a correct Python 3 solution for this coding contest problem.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the partici... | instruction | 0 | 89,146 | 17 | 178,292 |
"Correct Solution:
```
[n,q] = map(int,input().split())
t = [ 0 for _ in range(n) ]
max_idx = 0
max_val = 0
for _ in range(q):
[a,v] = map(int,input().split())
t[a-1] += v
if max_idx == a-1:
if v > 0:
max_val = t[a-1]
else:
max_val = max(t)
max_idx = t... | output | 1 | 89,146 | 17 | 178,293 |
Provide a correct Python 3 solution for this coding contest problem.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the partici... | instruction | 0 | 89,147 | 17 | 178,294 |
"Correct Solution:
```
import sys
def f():
w=m=0;n,q=map(int,input().split());s=[0]*-~n
for e in sys.stdin:
a,v=map(int,e.split());s[a]+=v
if v<0 and a==w:m=max(s);w=s.index(m)
elif s[a]>m:w,m=a,s[a]
elif s[a]==m and w>a:w=a
print(w,m)
f()
``` | output | 1 | 89,147 | 17 | 178,295 |
Provide a correct Python 3 solution for this coding contest problem.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the partici... | instruction | 0 | 89,148 | 17 | 178,296 |
"Correct Solution:
```
import sys
def f():
w=m=0;n,q=map(int,input().split());s=[0]*-~n
for e in sys.stdin:
a,v=map(int,e.split());s[a]+=v
if v<0 and a==w:m=max(s);w=s.index(m)
elif s[a]>m:w,m=a,s[a]
elif s[a]==m:w=min(w,a)
print(w,m)
f()
``` | output | 1 | 89,148 | 17 | 178,297 |
Provide a correct Python 3 solution for this coding contest problem.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the partici... | instruction | 0 | 89,149 | 17 | 178,298 |
"Correct Solution:
```
"""
γ»γ°γ‘γ³γζ¨
"""
INF = 10 ** 20
def main():
n, q = map(int, input().split())
size = 1
while size < n:
size *= 2
size = size * 2 - 1
seg_tree = [(INF, 0) for _ in range(size)]
def update(a, v):
ind = (size - 1) // 2 + a
prea, prev = seg_tree[ind]
seg_tree[ind] ... | output | 1 | 89,149 | 17 | 178,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or... | instruction | 0 | 89,150 | 17 | 178,300 |
Yes | output | 1 | 89,150 | 17 | 178,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or... | instruction | 0 | 89,151 | 17 | 178,302 |
Yes | output | 1 | 89,151 | 17 | 178,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or... | instruction | 0 | 89,152 | 17 | 178,304 |
Yes | output | 1 | 89,152 | 17 | 178,305 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or... | instruction | 0 | 89,153 | 17 | 178,306 |
Yes | output | 1 | 89,153 | 17 | 178,307 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or... | instruction | 0 | 89,154 | 17 | 178,308 |
No | output | 1 | 89,154 | 17 | 178,309 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or... | instruction | 0 | 89,155 | 17 | 178,310 |
No | output | 1 | 89,155 | 17 | 178,311 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or... | instruction | 0 | 89,156 | 17 | 178,312 |
No | output | 1 | 89,156 | 17 | 178,313 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or... | instruction | 0 | 89,157 | 17 | 178,314 |
No | output | 1 | 89,157 | 17 | 178,315 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 β€ 2k β€ n) who showed the bes... | instruction | 0 | 89,619 | 17 | 179,238 |
Tags: implementation, sortings
Correct Solution:
```
def semifinals(l1,l2):
output1=[0]*len(l1)
output2=[0]*len(l2)
n=len(l1)
k = len(l1)//2
output1[0:k]=[1]*k
output2[0:k]=[1]*k
i = k
while i < len(l1):
if l1[i]<l2[n-i-1]:
output1[i]=1
if l2[i]<l1[n-i-1]:
... | output | 1 | 89,619 | 17 | 179,239 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 β€ 2k β€ n) who showed the bes... | instruction | 0 | 89,620 | 17 | 179,240 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
p1=['0' for _ in range(n)]
p2=['0' for _ in range(n)]
t1=[]
t2=[]
for i in range(n):
a, b = map(int, input().split())
t1.append((a,i))
t2.append((b,i))
t2.sort()
t1.sort()
for k in range((n//2)):
p1[t1[k][1]]='1'
p2[t2[k][1]]='1'... | output | 1 | 89,620 | 17 | 179,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 β€ 2k β€ n) who showed the bes... | instruction | 0 | 89,621 | 17 | 179,242 |
Tags: implementation, sortings
Correct Solution:
```
def chose_p(arr, brr, k):
n = len(arr)
crr = []
for i in range(k):
crr.append(arr[i])
arr[i] = 0
for i in range(k):
crr.append(brr[i])
brr[i] = 0
drr = [x for x in arr if x] + [x for x in brr if x]
drr.sort()... | output | 1 | 89,621 | 17 | 179,243 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 β€ 2k β€ n) who showed the bes... | instruction | 0 | 89,622 | 17 | 179,244 |
Tags: implementation, sortings
Correct Solution:
```
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect i... | output | 1 | 89,622 | 17 | 179,245 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 β€ 2k β€ n) who showed the bes... | instruction | 0 | 89,623 | 17 | 179,246 |
Tags: implementation, sortings
Correct Solution:
```
n=int(input())
k=[]
a=[]
b=[]
for i in range(n):
A,B=map(int, input().split())
a.append(A)
b.append(B)
la=0
lb=0
aind=[0]*n
bind=[0]*n
for i in range(n):
if a[la]<b[lb]:
aind[la]=1
la+=1
else:
bind[lb]=1
lb+=1
for i... | output | 1 | 89,623 | 17 | 179,247 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 β€ 2k β€ n) who showed the bes... | instruction | 0 | 89,624 | 17 | 179,248 |
Tags: implementation, sortings
Correct Solution:
```
n = int(input())
a = [None] * n
b = [None] * n
for i in range(n):
a[i], b[i] = map(int, input().split())
for i in range(n):
if i < n // 2 or a[i] < b[n - i - 1]:
print(1, end = "")
else:
print(0, end = "")
print()
for i in range(n):
... | output | 1 | 89,624 | 17 | 179,249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.