message stringlengths 2 23.8k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 97 109k | cluster float64 0 0 | __index_level_0__ int64 194 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets the following conditions:
1. The string consists of n lowerca... | instruction | 0 | 107,319 | 0 | 214,638 |
No | output | 1 | 107,319 | 0 | 214,639 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets the following conditions:
1. The string consists of n lowerca... | instruction | 0 | 107,320 | 0 | 214,640 |
No | output | 1 | 107,320 | 0 | 214,641 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets the following conditions:
1. The string consists of n lowerca... | instruction | 0 | 107,321 | 0 | 214,642 |
No | output | 1 | 107,321 | 0 | 214,643 |
Provide a correct Python 3 solution for this coding contest problem.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that resu... | instruction | 0 | 107,760 | 0 | 215,520 |
"Correct Solution:
```
# 文字列の問題で、同じような文字列をまとめたいので、
# どう考えても Trie を使いたい気持ちになる
# あとは適当にやったらなんとかなった
# 1100 点の割には簡単っぽい
class TrieNode:
def __init__(self):
self.child = {}
self.count = 0 # 自身を含めた部分木の大きさ
class Trie:
def __init__(self):
self.root = TrieNode()
def add(self, s):
... | output | 1 | 107,760 | 0 | 215,521 |
Provide a correct Python 3 solution for this coding contest problem.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that resu... | instruction | 0 | 107,761 | 0 | 215,522 |
"Correct Solution:
```
# 文字列の問題で、同じような文字列をまとめたいので、
# どう考えても Trie を使いたい気持ちになる
# あとは適当にやったらなんとかなった
# 1100 点の割には簡単っぽい
class TrieNode:
def __init__(self):
self.child = {}
self.count = 0 # 自身を含めた部分木の大きさ
class Trie:
def __init__(self):
self.root = TrieNode()
def add(self, s):
... | output | 1 | 107,761 | 0 | 215,523 |
Provide a correct Python 3 solution for this coding contest problem.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that resu... | instruction | 0 | 107,762 | 0 | 215,524 |
"Correct Solution:
```
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import defaultdict
"""
・trie木
・各ノードから、アルファベットごとの子ノードの番号
・親ノードの番号
"""
N = int(readline())
data = tuple(read().split())
S = data[:N]
Q = int(data[N])
query_target ... | output | 1 | 107,762 | 0 | 215,525 |
Provide a correct Python 3 solution for this coding contest problem.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that resu... | instruction | 0 | 107,763 | 0 | 215,526 |
"Correct Solution:
```
import sys
alp = "abcdefghijklmnopqrstuvwxyz"
D = {}
for i in range(26):
D[alp[i]] = i
N = int(input())
c = [{}]
num = [N]
dep = [0]
Slis = []
lon = 0
for loop in range(N):
S = input()
S += " "
Slis.append(S)
#Slen += len(S)
nind = 0
for i in S:
if... | output | 1 | 107,763 | 0 | 215,527 |
Provide a correct Python 3 solution for this coding contest problem.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that resu... | instruction | 0 | 107,764 | 0 | 215,528 |
"Correct Solution:
```
from array import*;R=range;T=[0]*28;N=int(input());S=[[ord(C)-95 for C in input()]for _ in[0]*N];U=N*26**2*array('i',[0]);V=N*[0];Q=int(input())
for X in S:
P=0
for C in X:
if T[P+C]==0:T[P+C]=len(T);T+=[0]*28
T[P]+=1;P=T[P+C]
T[P]+=1;T[P+1]=1
for I in R(N):
P=0
for C in S[I]:
for A in... | output | 1 | 107,764 | 0 | 215,529 |
Provide a correct Python 3 solution for this coding contest problem.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that resu... | instruction | 0 | 107,765 | 0 | 215,530 |
"Correct Solution:
```
import sys
readline = sys.stdin.readline
class Node:
def __init__(self, sigma, depth):
self.end = False
self.child = [None] * sigma
self.depth = depth
self.count = 0
def __setitem__(self, i, x):
self.child[i] = x
def __getitem__(self, i):
... | output | 1 | 107,765 | 0 | 215,531 |
Provide a correct Python 3 solution for this coding contest problem.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that resu... | instruction | 0 | 107,766 | 0 | 215,532 |
"Correct Solution:
```
import array;R=range;L=input;T=[0]*28;N=int(L());S=[[ord(C)-95 for C in L()]for _ in[0]*N];U=N*26**2*array.array('i',[0]);V=N*[0];Q=int(L())
for X in S:
P=0
for C in X:
if T[P+C]==0:T[P+C]=len(T);T+=[0]*28
T[P]+=1;P=T[P+C]
T[P]+=1;T[P+1]=1
while N:
N-=1;P=0
for C in S[N]:
for A in R(26... | output | 1 | 107,766 | 0 | 215,533 |
Provide a correct Python 3 solution for this coding contest problem.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that resu... | instruction | 0 | 107,767 | 0 | 215,534 |
"Correct Solution:
```
import array;R=range;L=input;T=[0]*28;N=int(L());S=[[ord(C)-95 for C in L()]for _ in[0]*N];U=N*26**2*array.array('i',[0]);V=N*[0];Q=int(L())
for X in S:
P=0
for C in X:
if T[P+C]==0:T[P+C]=len(T);T+=[0]*28
T[P]+=1;P=T[P+C]
T[P]+=1;T[P+1]=1
while N:
N-=1;P=0
for C in S[N]:
for A in R(26... | output | 1 | 107,767 | 0 | 215,535 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An inte... | instruction | 0 | 107,768 | 0 | 215,536 |
Yes | output | 1 | 107,768 | 0 | 215,537 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An inte... | instruction | 0 | 107,769 | 0 | 215,538 |
No | output | 1 | 107,769 | 0 | 215,539 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An inte... | instruction | 0 | 107,770 | 0 | 215,540 |
No | output | 1 | 107,770 | 0 | 215,541 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An inte... | instruction | 0 | 107,771 | 0 | 215,542 |
No | output | 1 | 107,771 | 0 | 215,543 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries below. The i-th query has the following format:
Query: An inte... | instruction | 0 | 107,772 | 0 | 215,544 |
No | output | 1 | 107,772 | 0 | 215,545 |
Provide a correct Python 3 solution for this coding contest problem.
There is data of up to 100 characters per line, consisting of half-width alphabetic character strings. Some lines are symmetric (same whether read from the left edge or the right edge). Create a program that reads this data and outputs the number of ... | instruction | 0 | 107,776 | 0 | 215,552 |
"Correct Solution:
```
def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
N = list(get_input())
ans = 0
for ll in range(len(N)):
S = N[ll]
flag = True
for i in range(len(S) // 2):
if S[i] != S[len(S)-i-1]:
flag = F... | output | 1 | 107,776 | 0 | 215,553 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k.
Koa the Koala initially has n+1 strings s_1,... | instruction | 0 | 108,003 | 0 | 216,006 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
import string
import random
t=input()
t=int(t)
while(t>0):
n = int(input())
a = list(map(int,input().strip().split()))[:n]
alphabet = string.ascii_lowercase
test_list = list(alphabet)
ans=[]
start = 'fkbmlhfplstlnxggebayfkb... | output | 1 | 108,003 | 0 | 216,007 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k.
Koa the Koala initially has n+1 strings s_1,... | instruction | 0 | 108,004 | 0 | 216,008 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
T = int(input())
for case in range(1, T + 1):
N = int(input())
arr = [int(x) for x in input().split()]
ch = 0
res = [""] * (N +1)
res[0] = max(1, arr[0]) * chr(97 + ch)
if arr[0] == 0:
ch += 1
ch = ch % 26
... | output | 1 | 108,004 | 0 | 216,009 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k.
Koa the Koala initially has n+1 strings s_1,... | instruction | 0 | 108,005 | 0 | 216,010 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
import sys
input = sys.stdin.readline
def solve():
n = int(input())
l = [int(x) for x in input().split()]
c = max(l)
s = ['a'*(c+1)]*(n+1)
for i in range(n):
e = l[i]
d = 'a' if s[i][e] == 'b' else 'b'
s[i... | output | 1 | 108,005 | 0 | 216,011 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k.
Koa the Koala initially has n+1 strings s_1,... | instruction | 0 | 108,006 | 0 | 216,012 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
arr = [int(x) for x in input().split()]
max_n = max(arr)
arr = [max_n + 1] + arr
s = "a"*(max_n+1)
print(s)
for i in range(n):
if ord(s[arr[i+1]]) == 122:
... | output | 1 | 108,006 | 0 | 216,013 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k.
Koa the Koala initially has n+1 strings s_1,... | instruction | 0 | 108,007 | 0 | 216,014 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
t=int(input())
for _ in range(t):
n=int(input())
l=list(map(int,input().split()))
s=['a']*(max(l)+1)
print(''.join(s))
for i in l:
if(s[i]=='b'):
s[i]='a'
else:
s[i]='b'
print(''.join... | output | 1 | 108,007 | 0 | 216,015 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k.
Koa the Koala initially has n+1 strings s_1,... | instruction | 0 | 108,008 | 0 | 216,016 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
test= int(input())
for num in range(test):
n=int(input())
arr= list(map(int,input().split()))
s0= "a"*200
while(False):
break
print(s0)
for i in range(n):
xx= arr[i]
s=s0[:xx]
while(False):
... | output | 1 | 108,008 | 0 | 216,017 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k.
Koa the Koala initially has n+1 strings s_1,... | instruction | 0 | 108,009 | 0 | 216,018 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
# dcordb's solution idea
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
mx = max(a)
ans = ['a'*(mx+1) for i in range(n+1)]
for i in range(n):
s = 'a' ... | output | 1 | 108,009 | 0 | 216,019 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k.
Koa the Koala initially has n+1 strings s_1,... | instruction | 0 | 108,010 | 0 | 216,020 |
Tags: constructive algorithms, greedy, strings
Correct Solution:
```
t = int(input())
for _ in range(t):
n = int(input())
l = list(map(int, input().split()))
a = ['a'] * 200
print(*a, sep = '')
for i in l:
for j in range(i, 200):
if a[j] == 'b':
a[j] = 'a'
elif a[j] == 'a':
a[j] = 'b'
print... | output | 1 | 108,010 | 0 | 216,021 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,011 | 0 | 216,022 |
Yes | output | 1 | 108,011 | 0 | 216,023 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,012 | 0 | 216,024 |
Yes | output | 1 | 108,012 | 0 | 216,025 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,013 | 0 | 216,026 |
Yes | output | 1 | 108,013 | 0 | 216,027 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,014 | 0 | 216,028 |
Yes | output | 1 | 108,014 | 0 | 216,029 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,015 | 0 | 216,030 |
No | output | 1 | 108,015 | 0 | 216,031 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,016 | 0 | 216,032 |
No | output | 1 | 108,016 | 0 | 216,033 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,017 | 0 | 216,034 |
No | output | 1 | 108,017 | 0 | 216,035 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,018 | 0 | 216,036 |
No | output | 1 | 108,018 | 0 | 216,037 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
The length of the longest common prefix of two strings s = s_1 s_2 … s_n and t = t_1 t_2 … t_m is defined as the maximum integer k (0 ≤ k ≤ min(n,m)) such that s_1 s_2 … s_k equals t_1 t_2 … t_k... | instruction | 0 | 108,019 | 0 | 216,038 |
No | output | 1 | 108,019 | 0 | 216,039 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.
The string t ... | instruction | 0 | 108,052 | 0 | 216,104 |
Tags: implementation, strings
Correct Solution:
```
import sys
def fastio():
from io import StringIO
from atexit import register
global input
sys.stdin = StringIO(sys.stdin.read())
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.stdout = StringIO()
register(lambda : sys.__stdout__.w... | output | 1 | 108,052 | 0 | 216,105 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.
The string t ... | instruction | 0 | 108,053 | 0 | 216,106 |
Tags: implementation, strings
Correct Solution:
```
def check(l):
for _ in l:
if _<0:
return False
return True
a=input()
b=input()
ll=len(b)
lll=len(a)
if ll>lll:
print(0)
else:
l=[0]*26
for _ in b:
l[ord(_)-ord('a')]+=1
for i in range(ll):
if a[i]!='?':
l[ord(a[i])-ord('a')]-=1
c=0
if check(l):
c... | output | 1 | 108,053 | 0 | 216,107 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.
The string t ... | instruction | 0 | 108,054 | 0 | 216,108 |
Tags: implementation, strings
Correct Solution:
```
from collections import Counter as C
s, p = '_' + input(), input()
L, k = len(p), 0
Cs, Cp = C(s[:L]), C(p)
for i in range(len(s) - L):
Cs = Cs - C(s[i]) + C(s[L+i])
k += (Cs - Cp).keys() <= {'?'}
print(k)
``` | output | 1 | 108,054 | 0 | 216,109 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.
The string t ... | instruction | 0 | 108,055 | 0 | 216,110 |
Tags: implementation, strings
Correct Solution:
```
import math,sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda:int(input())
li = lambda:list(map(int,input().split()))
def case():
a=input().strip()
b=input().strip()
d=defaultdict(int)
... | output | 1 | 108,055 | 0 | 216,111 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.
The string t ... | instruction | 0 | 108,056 | 0 | 216,112 |
Tags: implementation, strings
Correct Solution:
```
s = input() + '?'
p = input()
cnt = 0
d = [0] * 26
for c in p:
d[ord(c)-97] += 1
for c in s[0:len(p)]:
if c != '?':
d[ord(c)-97] -= 1
for k in range(len(p), len(s)):
if min(d) >= 0:
cnt += 1
if s[k] != '?':
... | output | 1 | 108,056 | 0 | 216,113 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.
The string t ... | instruction | 0 | 108,057 | 0 | 216,114 |
Tags: implementation, strings
Correct Solution:
```
from collections import *
def change(mi, i):
global c
for j in range(mi, i):
c[s[j]] -= 1
if s[j] == s[i]:
return j + 1
def solve():
global c
ans, mi, ls, lp = 0, 0, len(s), len(p)
for i in range(ls):
if mem[... | output | 1 | 108,057 | 0 | 216,115 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.
The string t ... | instruction | 0 | 108,058 | 0 | 216,116 |
Tags: implementation, strings
Correct Solution:
```
from collections import Counter
s,p=input(),input()
if len(s)<len(p):
print(0)
exit()
cs=Counter(s[:len(p)])
cp=Counter(p)
ans,i,L=0,0,len(p)
while True:
ans+=((cs-cp).keys()<={'?'}) # если есть кроме "?"
if i==len(s)-L: break
cs=cs-Counter(s[i])... | output | 1 | 108,058 | 0 | 216,117 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "aba" and the string "aaa" is not.
The string t ... | instruction | 0 | 108,059 | 0 | 216,118 |
Tags: implementation, strings
Correct Solution:
```
s1 = input()
s2 = input()
cnt1, cnt2 = [0] * 27, [0] * 27
if len(s1) < len(s2):
print(0)
exit()
def is_valid():
res = 0
for i in range(26):
if cnt2[i] < cnt1[i]: return 0
res += cnt2[i] - cnt1[i]
return 1 if res == cnt1[26] else... | output | 1 | 108,059 | 0 | 216,119 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "a... | instruction | 0 | 108,060 | 0 | 216,120 |
Yes | output | 1 | 108,060 | 0 | 216,121 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "a... | instruction | 0 | 108,061 | 0 | 216,122 |
Yes | output | 1 | 108,061 | 0 | 216,123 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "a... | instruction | 0 | 108,062 | 0 | 216,124 |
Yes | output | 1 | 108,062 | 0 | 216,125 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "a... | instruction | 0 | 108,063 | 0 | 216,126 |
Yes | output | 1 | 108,063 | 0 | 216,127 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "a... | instruction | 0 | 108,064 | 0 | 216,128 |
No | output | 1 | 108,064 | 0 | 216,129 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "a... | instruction | 0 | 108,065 | 0 | 216,130 |
No | output | 1 | 108,065 | 0 | 216,131 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "a... | instruction | 0 | 108,066 | 0 | 216,132 |
No | output | 1 | 108,066 | 0 | 216,133 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string "aab" is an anagram of the string "a... | instruction | 0 | 108,067 | 0 | 216,134 |
No | output | 1 | 108,067 | 0 | 216,135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.