message stringlengths 2 23.4k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 129 108k | cluster float64 6 6 | __index_level_0__ int64 258 216k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to p... | instruction | 0 | 26,691 | 6 | 53,382 |
Tags: implementation
Correct Solution:
```
'''''''''''
Author : code_marshal
Method : strings
'''''''''''
x, f = input(), 0
for i in x:
h = bin(ord(i))[2:]; h = ('0' * (8 - len(h)) + h)[::-1]
print ((f - int(h, 2)) % 256)
f = int(h, 2)
``` | output | 1 | 26,691 | 6 | 53,383 |
Provide tags and a correct Python 3 solution for this coding contest problem.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to p... | instruction | 0 | 26,692 | 6 | 53,384 |
Tags: implementation
Correct Solution:
```
old=0
for c in input():
s=bin(ord(c))[2:][::-1]
now=int(s+"0"*(8-len(s)),2)
print((old-now)%256)
old=now
``` | output | 1 | 26,692 | 6 | 53,385 |
Provide tags and a correct Python 3 solution for this coding contest problem.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to p... | instruction | 0 | 26,693 | 6 | 53,386 |
Tags: implementation
Correct Solution:
```
s = input()
A = []
A.append(0)
for i in s:
codigo = ord(i)
sCodigo = bin(codigo).lstrip("0b")
sCodigo = sCodigo.rjust(8, '0')
sCodigo = sCodigo[::-1]
x = int(sCodigo, 2)
A.append(x)
size = len(s)
for i in range(0, size):
print((A[i] - A[i + 1]) % 2... | output | 1 | 26,693 | 6 | 53,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to p... | instruction | 0 | 26,694 | 6 | 53,388 |
Tags: implementation
Correct Solution:
```
def sum_pow(n):
mem = [1]
for i in range(8):
mem.append((n * mem[i]))
return mem
mem ,pre= sum_pow(2),0
for i in input():
asc, sum, c= ord(i), 0, 7
while (asc != 0):
sum += (asc % 2) * mem[c]
asc //= 2
c -= 1
print((p... | output | 1 | 26,694 | 6 | 53,389 |
Provide tags and a correct Python 3 solution for this coding contest problem.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to p... | instruction | 0 | 26,695 | 6 | 53,390 |
Tags: implementation
Correct Solution:
```
s = input()
f = 0
for i in range(len(s)):
asc = ord(s[i])
bi = format(asc, "08b")
bi = bi[::-1]
sasc = int(bi, 2)
res = (f - sasc) % 256
f = sasc
print(res)
``` | output | 1 | 26,695 | 6 | 53,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to p... | instruction | 0 | 26,696 | 6 | 53,392 |
Tags: implementation
Correct Solution:
```
def obin(a):
a = ord(a)
text = bin(a)[bin(a).find('1'):]
ntext = '0'*(8-len(text))+text
return ntext
def rev(a):
return a[-1::-1]
def revascii(char):
return int(rev(obin(char)),base=2)
text = input()
for i in range(len(text)):
if i == 0:
... | output | 1 | 26,696 | 6 | 53,393 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-... | instruction | 0 | 26,697 | 6 | 53,394 |
Yes | output | 1 | 26,697 | 6 | 53,395 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-... | instruction | 0 | 26,698 | 6 | 53,396 |
Yes | output | 1 | 26,698 | 6 | 53,397 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-... | instruction | 0 | 26,699 | 6 | 53,398 |
Yes | output | 1 | 26,699 | 6 | 53,399 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-... | instruction | 0 | 26,700 | 6 | 53,400 |
Yes | output | 1 | 26,700 | 6 | 53,401 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the ... | instruction | 0 | 26,716 | 6 | 53,432 |
Tags: graphs, sortings
Correct Solution:
```
import os
import io
from collections import deque, defaultdict
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def li():return [int(i) for i in input().rstrip().split()]
def st():return str(input().rstrip())[2:-1]
def val():return int(input().rstrip())
# def l... | output | 1 | 26,716 | 6 | 53,433 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the ... | instruction | 0 | 26,717 | 6 | 53,434 |
Tags: graphs, sortings
Correct Solution:
```
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key,lru_cache
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# ... | output | 1 | 26,717 | 6 | 53,435 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the ... | instruction | 0 | 26,718 | 6 | 53,436 |
Tags: graphs, sortings
Correct Solution:
```
import os
import io
from collections import deque, defaultdict
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def li():return [int(i) for i in input().rstrip().split()]
def st():return str(input().rstrip())[2:-1]
def val():return int(input().rstrip())
# def l... | output | 1 | 26,718 | 6 | 53,437 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the ... | instruction | 0 | 26,719 | 6 | 53,438 |
Tags: graphs, sortings
Correct Solution:
```
import os
import io
from collections import deque, defaultdict
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def li():return [int(i) for i in input().rstrip().split()]
def st():return str(input().rstrip())[2:-1]
def val():return int(input().rstrip())
# def l... | output | 1 | 26,719 | 6 | 53,439 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the ... | instruction | 0 | 26,720 | 6 | 53,440 |
Tags: graphs, sortings
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in f... | output | 1 | 26,720 | 6 | 53,441 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the ... | instruction | 0 | 26,721 | 6 | 53,442 |
Tags: graphs, sortings
Correct Solution:
```
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writab... | output | 1 | 26,721 | 6 | 53,443 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the ... | instruction | 0 | 26,722 | 6 | 53,444 |
Tags: graphs, sortings
Correct Solution:
```
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key,lru_cache
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline;M =... | output | 1 | 26,722 | 6 | 53,445 |
Provide tags and a correct Python 3 solution for this coding contest problem.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the ... | instruction | 0 | 26,723 | 6 | 53,446 |
Tags: graphs, sortings
Correct Solution:
```
# from collections import deque
import io
# input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline # η₯ε₯εΏ«θ―»οΌζ ζ³θΏθ‘θ°θ―
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd... | output | 1 | 26,723 | 6 | 53,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. ... | instruction | 0 | 26,724 | 6 | 53,448 |
No | output | 1 | 26,724 | 6 | 53,449 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. ... | instruction | 0 | 26,725 | 6 | 53,450 |
No | output | 1 | 26,725 | 6 | 53,451 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. ... | instruction | 0 | 26,726 | 6 | 53,452 |
No | output | 1 | 26,726 | 6 | 53,453 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. ... | instruction | 0 | 26,727 | 6 | 53,454 |
No | output | 1 | 26,727 | 6 | 53,455 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.
Given a group of n non-empty strings. During the game two players build the word together, initially the word is empty. The players move in tu... | instruction | 0 | 26,884 | 6 | 53,768 |
Tags: dfs and similar, dp, games, implementation, strings, trees
Correct Solution:
```
"""
Codeforces Contest 260 Div 1 Problem B
Author : chaotic_iak
Language: Python 3.3.4
"""
def main():
n,k = read()
s = set()
for i in range(n): s.add(read(0))
s = list(s)
s.sort()
s = treeify(s)
res = ... | output | 1 | 26,884 | 6 | 53,769 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.
Given a group of n non-empty strings. During the game two players build the word together, initially the word is empty. The players move in tu... | instruction | 0 | 26,885 | 6 | 53,770 |
Tags: dfs and similar, dp, games, implementation, strings, trees
Correct Solution:
```
class TrieNode(object):
def __init__(self, char: str):
self.char = char
self.children = []
self.word_finished = False
self.counter = 1
def add(root, word):
node = root
node.counter+=... | output | 1 | 26,885 | 6 | 53,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.
Given a group of n non-empty strings. During the game two players build the word together, initially the word is empty. The players move in tu... | instruction | 0 | 26,886 | 6 | 53,772 |
Tags: dfs and similar, dp, games, implementation, strings, trees
Correct Solution:
```
# ------------------- fast io --------------------
import os
import sys
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self.... | output | 1 | 26,886 | 6 | 53,773 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.
Given a group of n non-empty strings. During the game two players build the word together, initially the word is empty. The players move in tu... | instruction | 0 | 26,887 | 6 | 53,774 |
Tags: dfs and similar, dp, games, implementation, strings, trees
Correct Solution:
```
from sys import stdin, setrecursionlimit
setrecursionlimit(200000)
n, k = [int(i) for i in stdin.readline().split()]
tree = {}
for i in range(n):
_str = stdin.readline().strip()
cur = tree
for i in _str:
if not i... | output | 1 | 26,887 | 6 | 53,775 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.
Given a group of n non-empty strings. During the game two players build the word together, initially the word is empty. The players move in tu... | instruction | 0 | 26,889 | 6 | 53,778 |
Tags: dfs and similar, dp, games, implementation, strings, trees
Correct Solution:
```
def forced(tree):
if not tree:
return (False, True)
else:
winner = False
loser = False
for leaf in tree:
a, b = forced(tree[leaf])
if not a:
winner = True
if not b:
loser = True
... | output | 1 | 26,889 | 6 | 53,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.
Given a group of n non-empty strings. During the game two players build the word together, initially the word is empty. The players move in tu... | instruction | 0 | 26,890 | 6 | 53,780 |
Tags: dfs and similar, dp, games, implementation, strings, trees
Correct Solution:
```
from sys import stdin, setrecursionlimit
setrecursionlimit(200000)
n, k = [int(i) for i in stdin.readline().split()]
tree = {}
for i in range(n):
_str = stdin.readline().strip()
cur = tree
for i in _str:
if not i i... | output | 1 | 26,890 | 6 | 53,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alphabet of Bookland is so large that its letters ar... | instruction | 0 | 27,081 | 6 | 54,162 |
Tags: 2-sat, dfs and similar, graphs, implementation
Correct Solution:
```
from collections import defaultdict, deque
def main():
n,m = map(int, input().split())
cap = [None]*(m+1)
same_cap = defaultdict(list)
q = deque()
def apply_cap(a, c):
if cap[a] is not None:
return cap[a... | output | 1 | 27,081 | 6 | 54,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alphabet of Bookland is so large that its letters ar... | instruction | 0 | 27,082 | 6 | 54,164 |
Tags: 2-sat, dfs and similar, graphs, implementation
Correct Solution:
```
# -*- coding: utf-8 -*-
import math
import collections
import bisect
import heapq
import time
import random
import itertools
"""
created by shhuan at 2017/10/18 16:22
"""
M, N = map(int, input().split())
words = []
for i i... | output | 1 | 27,082 | 6 | 54,165 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alphabet of Bookland is so large that its letters ar... | instruction | 0 | 27,083 | 6 | 54,166 |
Tags: 2-sat, dfs and similar, graphs, implementation
Correct Solution:
```
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import th... | output | 1 | 27,083 | 6 | 54,167 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alpha... | instruction | 0 | 27,084 | 6 | 54,168 |
No | output | 1 | 27,084 | 6 | 54,169 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alpha... | instruction | 0 | 27,085 | 6 | 54,170 |
No | output | 1 | 27,085 | 6 | 54,171 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alpha... | instruction | 0 | 27,086 | 6 | 54,172 |
No | output | 1 | 27,086 | 6 | 54,173 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alpha... | instruction | 0 | 27,087 | 6 | 54,174 |
No | output | 1 | 27,087 | 6 | 54,175 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string β concatenation of l... | instruction | 0 | 27,381 | 6 | 54,762 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n,k=map(int,input().split())
s=input()
nl=[ chr(ord('a')+i) for i in range(26) ]
vall=[ 0 for i in range(0,26) ]
for i in s:
vall[ord(i)-ord('a')]+=1
j=0
ans=0
flag=0
while j<26 :
if vall[ord(nl[j])-ord('a')]>0 :
vall[ord(nl[j])-ord('a')]-=1
... | output | 1 | 27,381 | 6 | 54,763 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string β concatenation of l... | instruction | 0 | 27,382 | 6 | 54,764 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n,k=map(int,input().split())
s=input()
s=list(s)
s.sort()
ans=0
i=0
l=set()
cur=None
if(n==1 and k==1):
print(ord(s[0])-96)
elif(n==1 and k>1):
print(-1)
else:
while(i<n and k>0):
cur=s[i]
if(s[i] not in l):
ans+=ord(s[... | output | 1 | 27,382 | 6 | 54,765 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string β concatenation of l... | instruction | 0 | 27,383 | 6 | 54,766 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n, k = list(map(int, input().split()))
s = sorted(input())
su, i, e = ord(s[0]) - 96, 1, s[0]
while i < n:
if k <= 1:
break
if (ord(s[i]) - 96) - (ord(e) - 96) >= 2:
su += (ord(s[i]) - 96)
e, k = s[i], k - 1
i += 1
print(s... | output | 1 | 27,383 | 6 | 54,767 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string β concatenation of l... | instruction | 0 | 27,384 | 6 | 54,768 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n , k = [int(x) for x in input().split()]
MAXV = 999999999999999999999
s = input()
s = list(set(s))
n = len(s)
s.sort()
res = MAXV
cur = 0
st = 0
fin = st + 1
cur = ord(s[st]) - ord("a") + 1
taken = [s[st]]
while len(taken) < k and fin < n:
if ord(s[... | output | 1 | 27,384 | 6 | 54,769 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string β concatenation of l... | instruction | 0 | 27,385 | 6 | 54,770 |
Tags: greedy, implementation, sortings
Correct Solution:
```
num = input()
num = num.split()
n = int(num[0])
x = int(num[1])
ip = input()
myDict = {}
ch = 'a'
for i in range(1,27):
myDict.update({ch:i})
ch = chr(ord(ch) + 1)
myList = []
for c in ip:
myList.append([c,myDict[c]])
myList.sort(key = lambda x:... | output | 1 | 27,385 | 6 | 54,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string β concatenation of l... | instruction | 0 | 27,386 | 6 | 54,772 |
Tags: greedy, implementation, sortings
Correct Solution:
```
# cook your dish here
# from math import *
#for _ in range(int(input().strip())):
n,k = map(int,input().split())
s = input()
s = ''.join(sorted(s))
k-=1
prev = s[0]
ans = ord(s[0]) - ord('a') + 1
for i in range(n):
if k==0:
break
if ord(s[i]... | output | 1 | 27,386 | 6 | 54,773 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string β concatenation of l... | instruction | 0 | 27,387 | 6 | 54,774 |
Tags: greedy, implementation, sortings
Correct Solution:
```
n,k = list(map(int,input().split()))
data = sorted(list(input()))
data = list(map(lambda x:ord(x)-ord('a')+1,data))
result = 0
used = 0
idx =0
prev = -2
# print(data)
for d in data:
if d > prev+1:
result+= d
prev = d
used += ... | output | 1 | 27,387 | 6 | 54,775 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string β concatenation of l... | instruction | 0 | 27,388 | 6 | 54,776 |
Tags: greedy, implementation, sortings
Correct Solution:
```
import math as ma
from sys import exit
from decimal import Decimal as dec
def li():
return list(map(int , input().split()))
# https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/
def modInverse(a , m):
m0 = m
y = 0
x = 1
if (m == 1):
re... | output | 1 | 27,388 | 6 | 54,777 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can ... | instruction | 0 | 27,389 | 6 | 54,778 |
Yes | output | 1 | 27,389 | 6 | 54,779 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can ... | instruction | 0 | 27,390 | 6 | 54,780 |
Yes | output | 1 | 27,390 | 6 | 54,781 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can ... | instruction | 0 | 27,391 | 6 | 54,782 |
Yes | output | 1 | 27,391 | 6 | 54,783 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can ... | instruction | 0 | 27,392 | 6 | 54,784 |
Yes | output | 1 | 27,392 | 6 | 54,785 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can ... | instruction | 0 | 27,393 | 6 | 54,786 |
No | output | 1 | 27,393 | 6 | 54,787 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can ... | instruction | 0 | 27,394 | 6 | 54,788 |
No | output | 1 | 27,394 | 6 | 54,789 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can ... | instruction | 0 | 27,395 | 6 | 54,790 |
No | output | 1 | 27,395 | 6 | 54,791 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.