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.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperat... | instruction | 0 | 33,483 | 14 | 66,966 |
Tags: dp, greedy, implementation, sortings, two pointers
Correct Solution:
```
import math
import collections
import sys
def inpu():
return input().split(' ')
def inti(a):
for i in range(len(a)):
a[i] = int(a[i])
return a
def inp():
a = inpu()
a = inti(a)
return a
def solution():... | output | 1 | 33,483 | 14 | 66,967 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperat... | instruction | 0 | 33,484 | 14 | 66,968 |
Tags: dp, greedy, implementation, sortings, two pointers
Correct Solution:
```
from sys import stdin, stdout
def takeSec(elem):
return elem[0]
def in_inter(ref, test):
if ref[1] >= test[0] and test[1] >= ref[0]: return True
else: return False
q = int(input())
for i in range(q):
n,m = map(int,input().split()... | output | 1 | 33,484 | 14 | 66,969 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperat... | instruction | 0 | 33,485 | 14 | 66,970 |
Tags: dp, greedy, implementation, sortings, two pointers
Correct Solution:
```
t1=int(input())
for i2 in range(t1):
n,m=map(int,input().split())
up,down,tb=m,m,0
ans=1
for i in range(n):
t,l,h=map(int,input().split())
tx=t-tb
up+=tx
down-=tx
if down>h or up<l:
... | output | 1 | 33,485 | 14 | 66,971 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperat... | instruction | 0 | 33,486 | 14 | 66,972 |
Tags: dp, greedy, implementation, sortings, two pointers
Correct Solution:
```
for q in range(int(input())):
res = 'YES'
time = 0
n,tmp = map(int,input().split())
tmp = [tmp,tmp]
for i in range(n):
ti,li,hi = map(int, input().split())
yy = ti - time
aa=[tmp[0] - yy, tmp[0] + ... | output | 1 | 33,486 | 14 | 66,973 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperat... | instruction | 0 | 33,487 | 14 | 66,974 |
Tags: dp, greedy, implementation, sortings, two pointers
Correct Solution:
```
for _ in range(int(input())):
n,m=map(int, input().split())
low=m
hi=m
prev=0
f=0
for i in range(n):
t,l,h=map(int, input().split())
low-=(t-prev)
hi+=(t-prev)
#print(low,hi)
if... | output | 1 | 33,487 | 14 | 66,975 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperat... | instruction | 0 | 33,488 | 14 | 66,976 |
Tags: dp, greedy, implementation, sortings, two pointers
Correct Solution:
```
cases = int(input())
for _ in range(cases):
n,temp = [int(i) for i in input().split(" ")]
time = 0
minTemp = temp
maxTemp = temp
ok = True
for _ in range(n):
cTime,cMin,cMax = [int(i) for i in input().split(" ")]
if not ok:
... | output | 1 | 33,488 | 14 | 66,977 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperat... | instruction | 0 | 33,489 | 14 | 66,978 |
Tags: dp, greedy, implementation, sortings, two pointers
Correct Solution:
```
import sys
input = sys.stdin.readline
for nt in range(int(input())):
n,m=map(int,input().split())
cus = []
for i in range(n):
cus.append(list(map(int,input().split())))
l,e=m,m
p=0
ans="YES"
for i in range(n):
l-=(cus[i][0]-p)
e... | output | 1 | 33,489 | 14 | 66,979 |
Provide tags and a correct Python 2 solution for this coding contest problem.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperat... | instruction | 0 | 33,490 | 14 | 66,980 |
Tags: dp, greedy, implementation, sortings, two pointers
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
from fractions import gcd
import heapq
raw_input = stdin.readline
pr = stdout.write
mod=998244353
def ni():
retu... | output | 1 | 33,490 | 14 | 66,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he e... | instruction | 0 | 33,491 | 14 | 66,982 |
Yes | output | 1 | 33,491 | 14 | 66,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he e... | instruction | 0 | 33,492 | 14 | 66,984 |
Yes | output | 1 | 33,492 | 14 | 66,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he e... | instruction | 0 | 33,493 | 14 | 66,986 |
Yes | output | 1 | 33,493 | 14 | 66,987 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he e... | instruction | 0 | 33,494 | 14 | 66,988 |
Yes | output | 1 | 33,494 | 14 | 66,989 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he e... | instruction | 0 | 33,495 | 14 | 66,990 |
No | output | 1 | 33,495 | 14 | 66,991 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he e... | instruction | 0 | 33,496 | 14 | 66,992 |
No | output | 1 | 33,496 | 14 | 66,993 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he e... | instruction | 0 | 33,497 | 14 | 66,994 |
No | output | 1 | 33,497 | 14 | 66,995 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.
Gildong tries so hard to satisfy the customers that he e... | instruction | 0 | 33,498 | 14 | 66,996 |
No | output | 1 | 33,498 | 14 | 66,997 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vas... | instruction | 0 | 33,613 | 14 | 67,226 |
Tags: combinatorics
Correct Solution:
```
x,y= map(int,input().split())
a=[]
for i in range(0,x):
p=input()
a.append(p)
ans=1
b=[]
for i in range (0,y):
for j in range(0,x):
b.append(a[j][i])
c=set(b)
ans*=len(c)
ans%=1000000007
b=[]
print(ans)
``` | output | 1 | 33,613 | 14 | 67,227 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vas... | instruction | 0 | 33,614 | 14 | 67,228 |
Tags: combinatorics
Correct Solution:
```
n,m=map(int,input().split())
ans=[set() for i in range(m)]
for i in range(n):
a=input()
for j in range(m):
ans[j].add(a[j])
ans1=1
#print(ans)
for i in range(len(ans)):
#print(len(ans[i]))
ans1=(ans1*len(ans[i]))%(10**9+7)
print(ans1%(10**9+7))
``` | output | 1 | 33,614 | 14 | 67,229 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vas... | instruction | 0 | 33,615 | 14 | 67,230 |
Tags: combinatorics
Correct Solution:
```
mod = 1000000007
resp = 1
entrada = input().split(' ')
quant = int(entrada[0])
tamanho = int(entrada[1])
aux =['']*tamanho
for i in range(quant):
s = input()
for j in range(tamanho):
if(s[j] not in aux[j]):
aux[j] += s[j]
for k in aux:
resp ... | output | 1 | 33,615 | 14 | 67,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vas... | instruction | 0 | 33,616 | 14 | 67,232 |
Tags: combinatorics
Correct Solution:
```
def multiplicacaoModular(a, b, mod):
return ((a % mod) * (b % mod)) % mod
# ----------------> MAIN <--------------------
qtdNames, tamanho = input().split()
qtdNames = int(qtdNames)
tamanho = int(tamanho)
mod = 1000000007
colunas = {}
for i in range(tamanho):
colunas[i + ... | output | 1 | 33,616 | 14 | 67,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vas... | instruction | 0 | 33,617 | 14 | 67,234 |
Tags: combinatorics
Correct Solution:
```
###################################################################
# ."-,.__
# `. `. ,
# .--' .._,'"-' `.
# . .' `'
# `. / ,'
# ` '--. ,-"'
# ... | output | 1 | 33,617 | 14 | 67,235 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vas... | instruction | 0 | 33,618 | 14 | 67,236 |
Tags: combinatorics
Correct Solution:
```
n,m=list(map(int,input().split()))
arr=[input() for _ in range(n)]
mod=10**9 +7
ans=1
for i in range(m):
li=[]
for j in range(n):
li.append(arr[j][i])
ans=((ans%mod )*(len(set(li))%mod))%mod
print(ans)
``` | output | 1 | 33,618 | 14 | 67,237 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in w... | instruction | 0 | 33,621 | 14 | 67,242 |
Yes | output | 1 | 33,621 | 14 | 67,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in w... | instruction | 0 | 33,622 | 14 | 67,244 |
Yes | output | 1 | 33,622 | 14 | 67,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in w... | instruction | 0 | 33,623 | 14 | 67,246 |
Yes | output | 1 | 33,623 | 14 | 67,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in w... | instruction | 0 | 33,624 | 14 | 67,248 |
Yes | output | 1 | 33,624 | 14 | 67,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in w... | instruction | 0 | 33,625 | 14 | 67,250 |
No | output | 1 | 33,625 | 14 | 67,251 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in w... | instruction | 0 | 33,626 | 14 | 67,252 |
No | output | 1 | 33,626 | 14 | 67,253 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in w... | instruction | 0 | 33,628 | 14 | 67,256 |
No | output | 1 | 33,628 | 14 | 67,257 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.
Th... | instruction | 0 | 33,630 | 14 | 67,260 |
Tags: greedy, sortings
Correct Solution:
```
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 21:10:35 2020
@author: mahedi
"""
R=lambda:list(map(int,input().split()))
n,d=R()
a,b=R()
lst1=[]
lst2=[]
lst3=[]
sum=0
cnt=1
for i in range(0,n):
x,y=R()
p=(x*a)+(y*b)
lst1.append(p)
lst2.append(i)
iteams=l... | output | 1 | 33,630 | 14 | 67,261 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.
Th... | instruction | 0 | 33,631 | 14 | 67,262 |
Tags: greedy, sortings
Correct Solution:
```
n , d = map(int,input().split())
lis=[]
aa=[]
m1,m2=map(int,input().split())
for i in range(n):
a,b=map(int,input().split())
lis.append([m1*a+m2*b,i+1])
lis.sort()
ans=0
for i in range(n):
if lis[i][0]+ans<=d:
ans+=lis[i][0]
aa.append(lis[i][1])
p... | output | 1 | 33,631 | 14 | 67,263 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.
Th... | instruction | 0 | 33,632 | 14 | 67,264 |
Tags: greedy, sortings
Correct Solution:
```
n,d=map(int,input().split())
a,b=map(int,input().split())
s=[None]*n
for i in range(n):
x,y=map(int,input().split())
s[i]=(a*x+b*y,i+1)
s.sort()
res=[]
for i in range(n):
if d-s[i][0] >= 0:
res.append(s[i][1])
d-=s[i][0]
else:
break
pr... | output | 1 | 33,632 | 14 | 67,265 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.
Th... | instruction | 0 | 33,633 | 14 | 67,266 |
Tags: greedy, sortings
Correct Solution:
```
n, d = map(int,input().split())
a, b = map(int,input().split())
l = []
for i in range(1,n+1):
a1, b1 = map(int,input().split())
l.append([a1*a + b1*b, i])
l.sort()
temp = d
ans = []
for i in l:
if i[0] <= temp:
ans.append(i[1])
temp -= i[0]
else:
break
print(len(an... | output | 1 | 33,633 | 14 | 67,267 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.
Th... | instruction | 0 | 33,634 | 14 | 67,268 |
Tags: greedy, sortings
Correct Solution:
```
import sys
input=sys.stdin.buffer.readline
import os
from math import*
n,d=map(int,input().split())
a,b=map(int,input().split())
price=[]
for i in range(n):
x,y=map(int,input().split())
price.append([x*a+y*b,i+1])
price.sort()
#print(price)
ans=[]
s=0
i=0
while i<n:
s+=... | output | 1 | 33,634 | 14 | 67,269 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.
Th... | instruction | 0 | 33,635 | 14 | 67,270 |
Tags: greedy, sortings
Correct Solution:
```
# Input
n, d = map(int, input().split())
a, b = map(int, input().split())
clients = []
for i in range(n):
x_i, y_i = map(int, input().split())
clients.append({'number': i + 1,
'size': x_i * a + y_i * b})
# Solve
clients = sorted(clients, key=la... | output | 1 | 33,635 | 14 | 67,271 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.
Th... | instruction | 0 | 33,636 | 14 | 67,272 |
Tags: greedy, sortings
Correct Solution:
```
I=lambda:map(int,input().split())
R=range
n,d=I()
a,b=I()
m=[]
v=[]
for i in R(n):x,y=I();v+=[x*a+y*b];m+=[i]
m=sorted(m,key=lambda x:v[x])
for i in R(n):
if v[m[i]]>d:n=i;break
d-=v[m[i]]
print(n)
for i in R(n):print(m[i]+1,end=' ')
``` | output | 1 | 33,636 | 14 | 67,273 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.
Th... | instruction | 0 | 33,637 | 14 | 67,274 |
Tags: greedy, sortings
Correct Solution:
```
##############--->>>>> Deepcoder Amit Kumar Bhuyan <<<<<---##############
"""
Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away.
"""
from __future__ import division, print_function
import os,sys
from io impor... | output | 1 | 33,637 | 14 | 67,275 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine... | instruction | 0 | 33,638 | 14 | 67,276 |
Yes | output | 1 | 33,638 | 14 | 67,277 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine... | instruction | 0 | 33,639 | 14 | 67,278 |
Yes | output | 1 | 33,639 | 14 | 67,279 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine... | instruction | 0 | 33,640 | 14 | 67,280 |
Yes | output | 1 | 33,640 | 14 | 67,281 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine... | instruction | 0 | 33,641 | 14 | 67,282 |
Yes | output | 1 | 33,641 | 14 | 67,283 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine... | instruction | 0 | 33,642 | 14 | 67,284 |
No | output | 1 | 33,642 | 14 | 67,285 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine... | instruction | 0 | 33,643 | 14 | 67,286 |
No | output | 1 | 33,643 | 14 | 67,287 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine... | instruction | 0 | 33,644 | 14 | 67,288 |
No | output | 1 | 33,644 | 14 | 67,289 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine... | instruction | 0 | 33,645 | 14 | 67,290 |
No | output | 1 | 33,645 | 14 | 67,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 33,662 | 14 | 67,324 |
Tags: dfs and similar, dsu
Correct Solution:
```
import sys
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')
input = sys.stdin.readline
def dfs(i, grp):
if vis[i]:
return
vis[i] = grp
langs = employees[i]
for lang in langs:
for emp in langs_d[lang]:
... | output | 1 | 33,662 | 14 | 67,325 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 33,663 | 14 | 67,326 |
Tags: dfs and similar, dsu
Correct Solution:
```
n, m = [int(x) for x in input().split()]
lang = dict()
for i in range(1, m + 1):
lang[i] = []
g = dict()
color = dict()
for i in range(1, n + 1):
g[i] = []
color[i] = 0
for i in range(1, n + 1):
inp = [int(x) for x in input().split()]
for j in range(... | output | 1 | 33,663 | 14 | 67,327 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 33,664 | 14 | 67,328 |
Tags: dfs and similar, dsu
Correct Solution:
```
# cook your dish here
import sys
sys.setrecursionlimit(10**6)
def find(i,parent):
if parent[i]==i:
return i
else:
parent[i]=find(parent[i],parent)
return parent[i]
def union(a,b,parent,size):
xa=find(a,parent)
xb=find(b,parent)
... | output | 1 | 33,664 | 14 | 67,329 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 33,665 | 14 | 67,330 |
Tags: dfs and similar, dsu
Correct Solution:
```
## necessary imports
import sys
input = sys.stdin.readline
from math import log2, log, ceil
# swap_array function
def swaparr(arr, a,b):
temp = arr[a];
arr[a] = arr[b];
arr[b] = temp
## gcd function
def gcd(a,b):
if a == 0:
return b
return g... | output | 1 | 33,665 | 14 | 67,331 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he k... | instruction | 0 | 33,666 | 14 | 67,332 |
Tags: dfs and similar, dsu
Correct Solution:
```
#!/usr/bin/env python3
from sys import stdin
def find(par, a):
if par[a] is not a:
par[a] = find(par, par[a])
return par[a]
def merge(par, rnk, a, b):
a = find(par, a)
b = find(par, b)
if a == b:
return
if rnk[a] < rnk[b]:
... | output | 1 | 33,666 | 14 | 67,333 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.