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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Quickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered... | instruction | 0 | 29,758 | 14 | 59,516 |
No | output | 1 | 29,758 | 14 | 59,517 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i different items as a present. Some items ... | instruction | 0 | 30,193 | 14 | 60,386 |
Tags: combinatorics, math, probabilities
Correct Solution:
```
#!/usr/bin/env python3
import sys
from math import gcd
#lines = stdin.readlines()
def lcm(a,b):
return a*b//gcd(a,b)
def rint():
return map(int, sys.stdin.readline().split())
def input():
return sys.stdin.readline().rstrip('\n')
def oint():
... | output | 1 | 30,193 | 14 | 60,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i different items as a present. Some items ... | instruction | 0 | 30,194 | 14 | 60,388 |
Tags: combinatorics, math, probabilities
Correct Solution:
```
from sys import stdin,stdout
from math import gcd
n=int(stdin.readline().strip())
cnt=[0 for i in range(1000100)]
mod=998244353
s=[ list(map(int,stdin.readline().strip().split())) for i in range(n)]
for i in range(n):
for y in range(1,len(s[i])):
... | output | 1 | 30,194 | 14 | 60,389 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i different items as a present. Some items ... | instruction | 0 | 30,195 | 14 | 60,390 |
Tags: combinatorics, math, probabilities
Correct Solution:
```
import math
#------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
... | output | 1 | 30,195 | 14 | 60,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i different items as a present. Some items ... | instruction | 0 | 30,196 | 14 | 60,392 |
Tags: combinatorics, math, probabilities
Correct Solution:
```
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def power(a, b, mod):
res = 1
while b:
if b%2:
res = (res*a)%mod
b //= 2
a = (a*a)%mod
return res%mod
... | output | 1 | 30,196 | 14 | 60,393 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i different items as a present. Some items ... | instruction | 0 | 30,197 | 14 | 60,394 |
Tags: combinatorics, math, probabilities
Correct Solution:
```
import sys
from collections import Counter
mod = 998244353
n = int(input())
div_n = pow(n, mod-2, mod)
wants = []
cnt = Counter()
for a in (list(map(int, l.split())) for l in sys.stdin):
wants.append(a[1:])
cnt.update(a[1:])
ans = 0
for i in rang... | output | 1 | 30,197 | 14 | 60,395 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i different items as a present. Some items ... | instruction | 0 | 30,198 | 14 | 60,396 |
Tags: combinatorics, math, probabilities
Correct Solution:
```
import sys
input=sys.stdin.readline
def modInverse(a, m):
m0 = m
y = 0
x = 1
if (m == 1):
return 0
while (a > 1):
# q is quotient
q = a // m
t = m
# m is remainder now, process
# same a... | output | 1 | 30,198 | 14 | 60,397 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i different items as a present. Some items ... | instruction | 0 | 30,199 | 14 | 60,398 |
Tags: combinatorics, math, probabilities
Correct Solution:
```
from math import gcd
from collections import Counter
import sys
# inf = open('input.txt', 'r')
# reader = (map(int, line.split()) for line in inf)
reader = (map(int, line.split()) for line in sys.stdin)
input = reader.__next__
modulo = 998244353
def lcm(... | output | 1 | 30,199 | 14 | 60,399 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i different items as a present. Some items ... | instruction | 0 | 30,200 | 14 | 60,400 |
Tags: combinatorics, math, probabilities
Correct Solution:
```
from fractions import Fraction as Fr
import sys
import math
input=sys.stdin.readline
#This part is taken from gfg
def modInverse(b,m):
g = math.gcd(b, m)
if (g != 1):
return -1
else:
return pow(b, m - 2,... | output | 1 | 30,200 | 14 | 60,401 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one o... | instruction | 0 | 30,201 | 14 | 60,402 |
Yes | output | 1 | 30,201 | 14 | 60,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one o... | instruction | 0 | 30,202 | 14 | 60,404 |
Yes | output | 1 | 30,202 | 14 | 60,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one o... | instruction | 0 | 30,203 | 14 | 60,406 |
Yes | output | 1 | 30,203 | 14 | 60,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one o... | instruction | 0 | 30,204 | 14 | 60,408 |
Yes | output | 1 | 30,204 | 14 | 60,409 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one o... | instruction | 0 | 30,205 | 14 | 60,410 |
No | output | 1 | 30,205 | 14 | 60,411 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one o... | instruction | 0 | 30,206 | 14 | 60,412 |
No | output | 1 | 30,206 | 14 | 60,413 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one o... | instruction | 0 | 30,207 | 14 | 60,414 |
No | output | 1 | 30,207 | 14 | 60,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one o... | instruction | 0 | 30,208 | 14 | 60,416 |
No | output | 1 | 30,208 | 14 | 60,417 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties togethe... | instruction | 0 | 30,209 | 14 | 60,418 |
Tags: brute force, dfs and similar, graphs, implementation
Correct Solution:
```
def calculate(n, arr):
g = {}
for num1,num2 in arr:
if num1 not in g:
g[num1] = set()
g[num1].add(num2)
if num2 not in g:
g[num2] = set()
g[num2].add(num1)
data = []
... | output | 1 | 30,209 | 14 | 60,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties togethe... | instruction | 0 | 30,210 | 14 | 60,420 |
Tags: brute force, dfs and similar, graphs, implementation
Correct Solution:
```
n, m = (int(_) for _ in input().split())
sp = [[] for _ in range(n)]
for i in range(m):
a, b = (int(_)-1 for _ in input().split())
sp[a].append(b)
sp[b].append(a)
ans = 0
while 1:
vyg = []
for i in range(n):
... | output | 1 | 30,210 | 14 | 60,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties togethe... | instruction | 0 | 30,211 | 14 | 60,422 |
Tags: brute force, dfs and similar, graphs, implementation
Correct Solution:
```
n,m = map(int,input().split())
hash = {}
hashi = {}
for i in range(1,n+1):
hashi[i] = []
for i in range(m):
a,b = map(int,input().split())
try:
hash[a]
except:
hash[a] = 1
else:
hash[a... | output | 1 | 30,211 | 14 | 60,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties togethe... | instruction | 0 | 30,212 | 14 | 60,424 |
Tags: brute force, dfs and similar, graphs, implementation
Correct Solution:
```
n, m = [int(x) for x in input().split()]
adj = []
for i in range(101):
adj.append(set())
nodes = set()
for i in range(m):
u, v = [int(x) for x in input().split()]
adj[u].add(v)
adj[v].add(u)
nodes.add(u)
nodes.add(v... | output | 1 | 30,212 | 14 | 60,425 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties togethe... | instruction | 0 | 30,213 | 14 | 60,426 |
Tags: brute force, dfs and similar, graphs, implementation
Correct Solution:
```
n, m=map(int, input().split(' '))
adj=[[0]*n for i in range(n)]
for i in range(m):
x, y=map(int, input().split(' '))
adj[x-1][y-1]+=1
adj[y-1][x-1]+=1
groups=0
while(1 in [sum(x) for x in adj]):
#print(adj)
kk=[]
for x in range... | output | 1 | 30,213 | 14 | 60,427 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties togethe... | instruction | 0 | 30,214 | 14 | 60,428 |
Tags: brute force, dfs and similar, graphs, implementation
Correct Solution:
```
n,m=map(int,input().split())
g=[set() for i in range(n)]
for _ in range(m):
a,b=map(int,input().split())
g[a-1].add(b-1)
g[b-1].add(a-1)
cnt=0
while True:
p=set()
for i in range(n):
if len(g[i])==1:
p.add(i)
g[i]=... | output | 1 | 30,214 | 14 | 60,429 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties togethe... | instruction | 0 | 30,215 | 14 | 60,430 |
Tags: brute force, dfs and similar, graphs, implementation
Correct Solution:
```
W = 0
G = 1
n, m = map(int, input().split())
E = []
for i in range(m):
E.append(list(map(int, input().split())))
group = []
color = [-1]
deleted = [True] + [False for i in range(n)]
def get_nbs(v):
nbs = []
for e in E:
... | output | 1 | 30,215 | 14 | 60,431 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties togethe... | instruction | 0 | 30,216 | 14 | 60,432 |
Tags: brute force, dfs and similar, graphs, implementation
Correct Solution:
```
n,k=map(int,input().split())
a=[set() for i in range(0,n+1)]
for i in range(k):
x,y=map(int,input().split())
a[x].add(y)
a[y].add(x)
ans=0
while True:
outman=set()
for i in range(1,n+1):
if len(a[i])==1:
... | output | 1 | 30,216 | 14 | 60,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with eac... | instruction | 0 | 30,217 | 14 | 60,434 |
Yes | output | 1 | 30,217 | 14 | 60,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with eac... | instruction | 0 | 30,218 | 14 | 60,436 |
Yes | output | 1 | 30,218 | 14 | 60,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with eac... | instruction | 0 | 30,219 | 14 | 60,438 |
Yes | output | 1 | 30,219 | 14 | 60,439 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with eac... | instruction | 0 | 30,220 | 14 | 60,440 |
Yes | output | 1 | 30,220 | 14 | 60,441 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with eac... | instruction | 0 | 30,221 | 14 | 60,442 |
No | output | 1 | 30,221 | 14 | 60,443 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with eac... | instruction | 0 | 30,222 | 14 | 60,444 |
No | output | 1 | 30,222 | 14 | 60,445 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with eac... | instruction | 0 | 30,223 | 14 | 60,446 |
No | output | 1 | 30,223 | 14 | 60,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with eac... | instruction | 0 | 30,224 | 14 | 60,448 |
No | output | 1 | 30,224 | 14 | 60,449 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The characters are labeled from 1 to n. Every pair of two ... | instruction | 0 | 30,485 | 14 | 60,970 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
from sys import stdin, stdout
import sys
class Node(object):
def __init__(self, label):
self.label = label
self.par = self
self.rank = 0
class DisjointSet(object):
def __init__(self, n):
self.n = n
self.nodes = ... | output | 1 | 30,485 | 14 | 60,971 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The characters are labeled from 1 to n. Every pair of two ... | instruction | 0 | 30,486 | 14 | 60,972 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
class DSU(object):
def __init__(self, n):
self.father = list(range(n))
self.size = n
def union(self, x, s):
x = self.find(x)
s = self.find(s)
if x == s:
return
self.father[s] = x
self.si... | output | 1 | 30,486 | 14 | 60,973 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The characters are labeled from 1 to n. Every pair of two ... | instruction | 0 | 30,487 | 14 | 60,974 |
Tags: dfs and similar, dsu, graphs
Correct Solution:
```
class DisjointSet(object):
def __init__(self, n):
self.parent = list(range(n))
self.rank = [0] * n
self.num = n # number of disjoint sets
def union(self, x, y):
self._link(self.find_set(x), self.find_set(y))
def _lin... | output | 1 | 30,487 | 14 | 60,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The charact... | instruction | 0 | 30,488 | 14 | 60,976 |
No | output | 1 | 30,488 | 14 | 60,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The charact... | instruction | 0 | 30,489 | 14 | 60,978 |
No | output | 1 | 30,489 | 14 | 60,979 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The charact... | instruction | 0 | 30,490 | 14 | 60,980 |
No | output | 1 | 30,490 | 14 | 60,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The charact... | instruction | 0 | 30,491 | 14 | 60,982 |
No | output | 1 | 30,491 | 14 | 60,983 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya studies at university. The current academic year finishes with n special days. Petya needs to pass m exams in those special days. The special days in this problem are numbered from 1 to n.
There are three values about each exam:
* ... | instruction | 0 | 30,671 | 14 | 61,342 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n, m = map(int, input().split())
prep = []
days = [-1] * n
release = []
for i in range(m):
s_, d_, c_ = map(int, input().split())
release.append(s_)
days[d_ - 1] = i
prep.append(c_)
rel_on_day = {}
for i, r in enumerate(release):
if r -... | output | 1 | 30,671 | 14 | 61,343 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya studies at university. The current academic year finishes with n special days. Petya needs to pass m exams in those special days. The special days in this problem are numbered from 1 to n.
There are three values about each exam:
* ... | instruction | 0 | 30,672 | 14 | 61,344 |
Tags: greedy, implementation, sortings
Correct Solution:
```
from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re... | output | 1 | 30,672 | 14 | 61,345 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya studies at university. The current academic year finishes with n special days. Petya needs to pass m exams in those special days. The special days in this problem are numbered from 1 to n.
There are three values about each exam:
* ... | instruction | 0 | 30,673 | 14 | 61,346 |
Tags: greedy, implementation, sortings
Correct Solution:
```
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
from itertools import permutations
import heapq
#sys.setrecursionlimit(10**6)
#OneDrive\Documents\codeforces
I=sys.stdin.readline
alpha="abcdefghi... | output | 1 | 30,673 | 14 | 61,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya studies at university. The current academic year finishes with n special days. Petya needs to pass m exams in those special days. The special days in this problem are numbered from 1 to n.
There are three values about each exam:
* ... | instruction | 0 | 30,674 | 14 | 61,348 |
Tags: greedy, implementation, sortings
Correct Solution:
```
class exam1:
def __init__(self,ind,ee):
self.ind=ind
self.ee=ee
class exam:
def __init__(self,qq,ee,pp,ind):
self.qq=qq
self.ee=ee
self.pp=pp
self.ind=ind
yoar=list(map(int,input().split()))
n=yoar[0]
m=yoar[1]
ans=[]
examar=[]
paperar=[]
paperd... | output | 1 | 30,674 | 14 | 61,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya studies at university. The current academic year finishes with n special days. Petya needs to pass m exams in those special days. The special days in this problem are numbered from 1 to n.
There are three values about each exam:
* ... | instruction | 0 | 30,675 | 14 | 61,350 |
Tags: greedy, implementation, sortings
Correct Solution:
```
import heapq
n, m = map(int, input().split())
ans = [0]*n
ary = []
dp = [[0]*n for i in range(n)]
# print(dp)
tmp =0
while tmp < m:
s, d, c = map(int, input().split())
s -= 1; d -= 1
ans[d] = m + 1
ary.append((s, d, c + 1, tmp))
# pri... | output | 1 | 30,675 | 14 | 61,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya studies at university. The current academic year finishes with n special days. Petya needs to pass m exams in those special days. The special days in this problem are numbered from 1 to n.
There are three values about each exam:
* ... | instruction | 0 | 30,676 | 14 | 61,352 |
Tags: greedy, implementation, sortings
Correct Solution:
```
#!/usr/bin/env python3
from sys import stdin, stdout
def rint():
return map(int, stdin.readline().split())
#lines = stdin.readlines()
n, m = rint()
s = [0 for i in range(m)]
d = [0 for i in range(m)]
c = [0 for i in range(m)]
for i in range(m):
s... | output | 1 | 30,676 | 14 | 61,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya studies at university. The current academic year finishes with n special days. Petya needs to pass m exams in those special days. The special days in this problem are numbered from 1 to n.
There are three values about each exam:
* ... | instruction | 0 | 30,677 | 14 | 61,354 |
Tags: greedy, implementation, sortings
Correct Solution:
```
# from itertools import accumulate
# from bisect import bisect_left
# from collections import OrderedDict
I = lambda: list(map(int, input().split()))
n, m = I()
dates = [0 for i in range(n + 1)]
data = []
for i in range(m):
d = I() + [i + 1]
if date... | output | 1 | 30,677 | 14 | 61,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya studies at university. The current academic year finishes with n special days. Petya needs to pass m exams in those special days. The special days in this problem are numbered from 1 to n.
There are three values about each exam:
* ... | instruction | 0 | 30,678 | 14 | 61,356 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n, m = map(int, input().split())
ans = [0]*n
f = 0
li = []
for i in range(m):
a, b, c = map(int, input().split())
li.append((b,a,c,i+1))
li.sort()
for i in range(m):
b, a, c, k = li[i]
ans[b-1] = m+1
j = a-1
cnt = 0
while j < b and cnt < c:
if ans[j]... | output | 1 | 30,678 | 14 | 61,357 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people, conveniently numbered 1 through N. We want to divide them into some number of groups, under the following two conditions:
* Every group contains between A and B people, inclusive.
* Let F_i be the number of the groups containing... | instruction | 0 | 30,815 | 14 | 61,630 |
"Correct Solution:
```
N,A,B,C,D=map(int,input().split())
mod=10**9+7
F=[1]*(N+1)
for i in range(1,N+1):
F[i]=F[i-1]*(i)%mod
def power(x,y):
if y==0:
return 1
elif y==1:
return x%mod
elif y%2==0:
return power(x,y//2)**2%mod
else:
return (power(x,y//2)**2)*x%mod
invF=[1]*(N+1)
invF[N]=power(F... | output | 1 | 30,815 | 14 | 61,631 |
Provide a correct Python 3 solution for this coding contest problem.
There are N people, conveniently numbered 1 through N. We want to divide them into some number of groups, under the following two conditions:
* Every group contains between A and B people, inclusive.
* Let F_i be the number of the groups containing... | instruction | 0 | 30,817 | 14 | 61,634 |
"Correct Solution:
```
def main():
import sys
input = sys.stdin.readline
mod = 1000000007
nmax = 1001 # change here
fac = [0] * (nmax + 1)
finv = [0] * (nmax + 1)
inv = [0] * (nmax + 1)
fac[0] = 1
fac[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, nmax)... | output | 1 | 30,817 | 14 | 61,635 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.