message
stringlengths
2
65.1k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
0
108k
cluster
float64
14
14
__index_level_0__
int64
0
217k
Provide tags and a correct Python 3 solution for this coding contest problem. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less than one girl. How many ways are there to choose a...
instruction
0
19,581
14
39,162
Tags: combinatorics, math Correct Solution: ``` from math import factorial res = 0 n, m, t = map(int, input().split()) def choose(n, k): return factorial(n) // (factorial(k) * factorial(n-k)) for x in range(4, n+1): if 0 < t-x <= m and x <= n: res += choose(n,x) * choose(m, t-x) print(res) ```
output
1
19,581
14
39,163
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less tha...
instruction
0
19,582
14
39,164
Yes
output
1
19,582
14
39,165
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less tha...
instruction
0
19,583
14
39,166
Yes
output
1
19,583
14
39,167
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less tha...
instruction
0
19,584
14
39,168
Yes
output
1
19,584
14
39,169
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less tha...
instruction
0
19,585
14
39,170
Yes
output
1
19,585
14
39,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less tha...
instruction
0
19,586
14
39,172
No
output
1
19,586
14
39,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less tha...
instruction
0
19,587
14
39,174
No
output
1
19,587
14
39,175
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less tha...
instruction
0
19,588
14
39,176
No
output
1
19,588
14
39,177
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n boys and m girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly t actors containing no less than 4 boys and no less tha...
instruction
0
19,589
14
39,178
No
output
1
19,589
14
39,179
Provide tags and a correct Python 3 solution for this coding contest problem. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. Th...
instruction
0
19,773
14
39,546
Tags: brute force, implementation Correct Solution: ``` arr = [] for i in range(5): arri = list(map(int, input().split())) arr.append(arri) s = [0, 1, 2, 3, 4] from itertools import permutations perm = list(permutations(s)) mx = 0 sm = 0 for i in perm: s = list(i) sm = (arr[s[0]][s[1]]+arr[s[1]][s[0]...
output
1
19,773
14
39,547
Provide tags and a correct Python 3 solution for this coding contest problem. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. Th...
instruction
0
19,774
14
39,548
Tags: brute force, implementation Correct Solution: ``` from itertools import permutations g = [list(map(int, input().split())) for i in range(5)] j = lambda p: g[p[0]][p[1]] + g[p[1]][p[0]] + 2 * (g[p[2]][p[3]] + g[p[3]][p[2]]) + g[p[1]][p[2]] + g[p[2]][p[1]] + 2 * (g[p[3]][p[4]] + g[p[4]][p[3]]) print(max(j(p) for p ...
output
1
19,774
14
39,549
Provide tags and a correct Python 3 solution for this coding contest problem. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. Th...
instruction
0
19,775
14
39,550
Tags: brute force, implementation Correct Solution: ``` import itertools g = [[[] for _ in range(5)] for _ in range(5)] for i in range(5): gi = [int(gij) for gij in input().split(" ")] for j in range(5): gij = gi[j] g[i][j] = gij p = itertools.permutations([1,2,3,4,5]) ans = -1 for x in p: pi = list(x) pi = [pi...
output
1
19,775
14
39,551
Provide tags and a correct Python 3 solution for this coding contest problem. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. Th...
instruction
0
19,776
14
39,552
Tags: brute force, implementation Correct Solution: ``` import itertools g = [] for i in range(5): g.append(list(map(int, input().split(' ')))) def c(order): happy = 0 for i in range(5): for j in range(0, len(order), 2): if j + 1 < len(order): happy += g[order[j]][order...
output
1
19,776
14
39,553
Provide tags and a correct Python 3 solution for this coding contest problem. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. Th...
instruction
0
19,777
14
39,554
Tags: brute force, implementation Correct Solution: ``` from itertools import permutations def main(grid): return max(get_total_happiness(line, grid) for line in generate_lines()) def get_total_happiness(line, grid): total = 0 while line: for a, b in zip(line[::2], line[1::2]): total...
output
1
19,777
14
39,555
Provide tags and a correct Python 3 solution for this coding contest problem. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. Th...
instruction
0
19,778
14
39,556
Tags: brute force, implementation Correct Solution: ``` from itertools import permutations arr = [] for _ in range(5): arr.append(list(map(int, input().split()))) permutation = list(permutations([1, 2, 3, 4, 5])) maxsum = 0 sum = 0 for i in range(len(permutation)): first = permutation[i][0]-1 second = permu...
output
1
19,778
14
39,557
Provide tags and a correct Python 3 solution for this coding contest problem. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. Th...
instruction
0
19,779
14
39,558
Tags: brute force, implementation Correct Solution: ``` # coding: utf-8 import itertools g = [] for i in range(5): g.append([int(i) for i in input().split()]) permutations = list(itertools.permutations([0,1,2,3,4],5)) ans = -1 for per in permutations: tmp = (g[per[0]][per[1]]+g[per[1]][per[0]])*1\ + (g[...
output
1
19,779
14
39,559
Provide tags and a correct Python 3 solution for this coding contest problem. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. Th...
instruction
0
19,780
14
39,560
Tags: brute force, implementation Correct Solution: ``` """ Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away. """ import sys input = sys.stdin.readline # from bisect import bisect_left as lower_bound; # from bisect import bisect_right as upper_bound; # fr...
output
1
19,780
14
39,561
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple studen...
instruction
0
19,781
14
39,562
Yes
output
1
19,781
14
39,563
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple studen...
instruction
0
19,782
14
39,564
Yes
output
1
19,782
14
39,565
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple studen...
instruction
0
19,783
14
39,566
Yes
output
1
19,783
14
39,567
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple studen...
instruction
0
19,784
14
39,568
Yes
output
1
19,784
14
39,569
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple studen...
instruction
0
19,785
14
39,570
No
output
1
19,785
14
39,571
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple studen...
instruction
0
19,786
14
39,572
No
output
1
19,786
14
39,573
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple studen...
instruction
0
19,787
14
39,574
No
output
1
19,787
14
39,575
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple studen...
instruction
0
19,788
14
39,576
No
output
1
19,788
14
39,577
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya bought the collected works of a well-known Berland poet Petya in n volumes. The volumes are numbered from 1 to n. He thinks that it does not do to arrange the book simply according to their order. Vasya wants to minimize the number of ...
instruction
0
19,810
14
39,620
Tags: constructive algorithms, math Correct Solution: ``` #Code by Sounak, IIESTS #------------------------------warmup---------------------------- import os import sys import math from io import BytesIO, IOBase from fractions import Fraction from collections import defaultdict BUFSIZE = 8192 class FastIO(IOBas...
output
1
19,810
14
39,621
Provide tags and a correct Python 3 solution for this coding contest problem. While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers from 1 to n, not ne...
instruction
0
19,843
14
39,686
Tags: implementation Correct Solution: ``` R = lambda : map(int, input().split()) n,m = R() f,b = R(),list(R()) from collections import defaultdict def solve(f,b): df = defaultdict(list) for i,fi in enumerate(f,1): df[fi].append(i) r = [] for bi in b: if bi not in df: prin...
output
1
19,843
14
39,687
Provide tags and a correct Python 3 solution for this coding contest problem. While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers from 1 to n, not ne...
instruction
0
19,844
14
39,688
Tags: implementation Correct Solution: ``` def main(): n, m = map(int, input().split()) xlat, res, s = [-1] * (n + 1), [0] * m, "Possible" for i, f in enumerate(map(int, input().split()), 1): x = xlat[f] if x == -1: xlat[f] = i elif x > -1: xlat[f] = -2 fo...
output
1
19,844
14
39,689
Provide tags and a correct Python 3 solution for this coding contest problem. While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers from 1 to n, not ne...
instruction
0
19,846
14
39,692
Tags: implementation Correct Solution: ``` # Author : nitish420 -------------------------------------------------------------------- import os import sys from io import BytesIO, IOBase # mod=10**9+7 # sys.setrecursionlimit(10**6) # mxm=sys.maxsize # from functools import lru_cache def main(): n,m=map(int,input()...
output
1
19,846
14
39,693
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of lengt...
instruction
0
19,849
14
39,698
Yes
output
1
19,849
14
39,699
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of lengt...
instruction
0
19,850
14
39,700
Yes
output
1
19,850
14
39,701
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of lengt...
instruction
0
19,851
14
39,702
No
output
1
19,851
14
39,703
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of lengt...
instruction
0
19,853
14
39,706
No
output
1
19,853
14
39,707
Provide tags and a correct Python 3 solution for this coding contest problem. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority facto...
instruction
0
19,906
14
39,812
Tags: expression parsing, implementation, strings Correct Solution: ``` def main(): my_name = input() actions = (input().split() for _ in range(int(input()))) priority_factor = {} rewards = { "posted" : 15, "commented" : 10, "likes" : 5 } all_names = {my_n...
output
1
19,906
14
39,813
Provide tags and a correct Python 3 solution for this coding contest problem. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority facto...
instruction
0
19,907
14
39,814
Tags: expression parsing, implementation, strings Correct Solution: ``` myname=input();n=int(input());priority={} def func(action): if action[1]=="posted":k=15 else: k=10 if action[1]=="posted" or action[1]=="commented": name2,s=[x for x in action[3].split("'")] if action[0]==myname or name2...
output
1
19,907
14
39,815
Provide tags and a correct Python 3 solution for this coding contest problem. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority facto...
instruction
0
19,908
14
39,816
Tags: expression parsing, implementation, strings Correct Solution: ``` acttopoint={'posted':15,'commented':10,'likes':5} def addrait(rait,item,point): if item in rait: rait[item]+=point else: rait[item]=point def getnames(s): end=s.find(' ') fname=s[:end] beg=s.find(' ',end+1) point=acttopoint[s[end+1:beg]...
output
1
19,908
14
39,817
Provide tags and a correct Python 3 solution for this coding contest problem. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority facto...
instruction
0
19,909
14
39,818
Tags: expression parsing, implementation, strings Correct Solution: ``` me = input() n = int(input()) names = {} point = {'posted':15, 'commented':10, 'likes':5} for _ in range(n): data = input().split() if data[1]=='likes': b = data[2][:-2] else: b = data[3][:-2] if data[0]==me and b!=me: if b in names: n...
output
1
19,909
14
39,819
Provide tags and a correct Python 3 solution for this coding contest problem. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority facto...
instruction
0
19,910
14
39,820
Tags: expression parsing, implementation, strings Correct Solution: ``` ans=[] me=input() pri={} d={'p':15,'c':10,'l':5} n=int(input()) for i in range(n): s=input().split() a=s[0] b=s[1] c=s[-2][:-2] if a==me or c==me: if a==me: if c in pri: pri[c]-=d[b[0]] ...
output
1
19,910
14
39,821
Provide tags and a correct Python 3 solution for this coding contest problem. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority facto...
instruction
0
19,911
14
39,822
Tags: expression parsing, implementation, strings Correct Solution: ``` import sys def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def tinput(): return input().split() def rinput(): return map(int, tinput()) def rlinput(): return list(rinput()) from...
output
1
19,911
14
39,823
Provide tags and a correct Python 3 solution for this coding contest problem. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority facto...
instruction
0
19,912
14
39,824
Tags: expression parsing, implementation, strings Correct Solution: ``` n=input() t=int(input()) l=[] for i in range(t): l.append(input()) result={n:0} for j in l: act = j.split() if act[0] not in result: result[act[0]]=0 if act[-2][:-2] not in result: result[act[-2][:-2]]=0 ...
output
1
19,912
14
39,825
Provide tags and a correct Python 3 solution for this coding contest problem. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority facto...
instruction
0
19,913
14
39,826
Tags: expression parsing, implementation, strings Correct Solution: ``` #from dust i have come dust i will be class pair: def __init__(self,f,s): self.f=f self.s=s me=input() n=int(input()) mp={} for i in range(n): a=list(map(str,input().split())) if a[1]=="likes": ot=a[2] el...
output
1
19,913
14
39,827
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority fact...
instruction
0
19,914
14
39,828
Yes
output
1
19,914
14
39,829
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority fact...
instruction
0
19,915
14
39,830
Yes
output
1
19,915
14
39,831
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority fact...
instruction
0
19,916
14
39,832
Yes
output
1
19,916
14
39,833
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority fact...
instruction
0
19,917
14
39,834
Yes
output
1
19,917
14
39,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority fact...
instruction
0
19,918
14
39,836
No
output
1
19,918
14
39,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority fact...
instruction
0
19,919
14
39,838
No
output
1
19,919
14
39,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority fact...
instruction
0
19,920
14
39,840
No
output
1
19,920
14
39,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority fact...
instruction
0
19,921
14
39,842
No
output
1
19,921
14
39,843
Provide tags and a correct Python 3 solution for this coding contest problem. Andryusha is an orderly boy and likes to keep things in their place. Today he faced a problem to put his socks in the wardrobe. He has n distinct pairs of socks which are initially in a bag. The pairs are numbered from 1 to n. Andryusha wan...
instruction
0
19,922
14
39,844
Tags: implementation Correct Solution: ``` tmp, _ = set(), input() print(max(((tmp.remove(x) if x in tmp else tmp.add(x)), len(tmp))[1] for x in map(int, input().split(' ')))) ```
output
1
19,922
14
39,845