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 |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is the length of string s) is string slsl + 1...s... | instruction | 0 | 86,942 | 0 | 173,884 |
Tags: data structures, strings
Correct Solution:
```
import sys
import math as mt
#input=sys.stdin.buffer.readline
#t=int(input())
t=1
mod=9007199254740881
for ___ in range(t):
#n,m=map(int,input().split())
s1=input()
s2=input()
k=int(input())
d={}
for i in range(len(s1)):
suma=0
... | output | 1 | 86,942 | 0 | 173,885 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is the length of string s) is string slsl + 1...s... | instruction | 0 | 86,943 | 0 | 173,886 |
Tags: data structures, strings
Correct Solution:
```
s = input()
a = input()
k = int(input())
S=sorted(s[i:] for i in range(len(s)))
p=''
r=0
for e in S:
t=0
s=0
for i in range(len(e)):
if i >= len(p) or e[i] != p[i]:
s=1
if a[ord(e[i])-ord('a')]=='0':
t+=1
if t ... | output | 1 | 86,943 | 0 | 173,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is ... | instruction | 0 | 86,944 | 0 | 173,888 |
Yes | output | 1 | 86,944 | 0 | 173,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is ... | instruction | 0 | 86,945 | 0 | 173,890 |
Yes | output | 1 | 86,945 | 0 | 173,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is ... | instruction | 0 | 86,946 | 0 | 173,892 |
Yes | output | 1 | 86,946 | 0 | 173,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is ... | instruction | 0 | 86,947 | 0 | 173,894 |
Yes | output | 1 | 86,947 | 0 | 173,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is ... | instruction | 0 | 86,948 | 0 | 173,896 |
No | output | 1 | 86,948 | 0 | 173,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is ... | instruction | 0 | 86,949 | 0 | 173,898 |
No | output | 1 | 86,949 | 0 | 173,899 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is ... | instruction | 0 | 86,950 | 0 | 173,900 |
No | output | 1 | 86,950 | 0 | 173,901 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.
A substring s[l...r] (1 β€ l β€ r β€ |s|) of string s = s1s2...s|s| (where |s| is ... | instruction | 0 | 86,951 | 0 | 173,902 |
No | output | 1 | 86,951 | 0 | 173,903 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constrai... | instruction | 0 | 87,308 | 0 | 174,616 |
"Correct Solution:
```
k=int(input());s=input();l=len(s)
print(s[0:min(k,l)]+"."*3*(k<l))
``` | output | 1 | 87,308 | 0 | 174,617 |
Provide a correct Python 3 solution for this coding contest problem.
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append `...` to the end of them, and print the result.
Constrai... | instruction | 0 | 87,311 | 0 | 174,622 |
"Correct Solution:
```
k,s=open(0);k=int(k);print(s[:k]+'...'*(k<~-len(s)))
``` | output | 1 | 87,311 | 0 | 174,623 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap... | instruction | 0 | 88,511 | 0 | 177,022 |
Tags: implementation, strings
Correct Solution:
```
#!/usr/bin/env python3.7
n = int(input())
for _ in range(n):
a, b, c = input(), input(), input()
for x in zip(a, b, c):
xl = len(set(x))
if xl == 3:
print("NO")
break
elif xl == 2:
if x[0]==x[1]:
... | output | 1 | 88,511 | 0 | 177,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap... | instruction | 0 | 88,512 | 0 | 177,024 |
Tags: implementation, strings
Correct Solution:
```
def solve():
a=input()
b=input()
c=input()
n=len(a)
for x in range(n):
if a[x]!=c[x] and b[x]!=c[x]:
return "NO"
return "YES"
t=int(input())
for _ in range(t):
print(solve())
``` | output | 1 | 88,512 | 0 | 177,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap... | instruction | 0 | 88,513 | 0 | 177,026 |
Tags: implementation, strings
Correct Solution:
```
t = int(input().strip())
for _ in range(t):
a = input().strip()
b = input().strip()
c = input().strip()
ans = True
for i in range(len(a)):
if c[i] == a[i] or c[i] == b[i]:
continue
else:
ans = False
... | output | 1 | 88,513 | 0 | 177,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap... | instruction | 0 | 88,514 | 0 | 177,028 |
Tags: implementation, strings
Correct Solution:
```
for _ in [0]*int(input()):
v = list(input())
x = list(input())
q = list(input())
s = ''
k = True
for i in range(len(v)):
if x[i]==q[i]:
s = v[i]
v[i] = q[i]
q[i] = s
s = ''
elif v[... | output | 1 | 88,514 | 0 | 177,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap... | instruction | 0 | 88,515 | 0 | 177,030 |
Tags: implementation, strings
Correct Solution:
```
t=int(input())
while(t):
a=input()
b=input()
c=input()
s1=list(a)
s2=list(b)
s3=list(c)
c1=0
for i in range(len(s1)):
if(s1[i]==s2[i]==s3[i]):
c1+=1
else:
if(s1[i]==s3[i]):
t1=s3[i... | output | 1 | 88,515 | 0 | 177,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap... | instruction | 0 | 88,516 | 0 | 177,032 |
Tags: implementation, strings
Correct Solution:
```
for t in range(int(input())):
a, b, c = input(), input(), input()
anser = 'YES'
for i in range(len(a)):
if not (c[i] == a[i] or c[i] == b[i]):
anser = 'NO'
break
print(anser)
``` | output | 1 | 88,516 | 0 | 177,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap... | instruction | 0 | 88,517 | 0 | 177,034 |
Tags: implementation, strings
Correct Solution:
```
for _ in range(int(input())):
a,b,c=input(),input(),input()
ans="YES"
for i in range(len(a)):
if a[i]!=c[i] and b[i]!=c[i]:ans="NO"
print(ans)
``` | output | 1 | 88,517 | 0 | 177,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.
For every i (1 β€ i β€ n) you must swap... | instruction | 0 | 88,518 | 0 | 177,036 |
Tags: implementation, strings
Correct Solution:
```
for _ in range(int(input())):
a=str(input())
b=str(input())
c=str(input())
f=0
for i in range(len(a)):
if a[i]==b[i] and a[i] == c[i] or a[i] != b[i] and a[i] == c[i] or c[i] == b[i]:
f=1
else:
f=0
... | output | 1 | 88,518 | 0 | 177,037 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets ... | instruction | 0 | 88,591 | 0 | 177,182 |
Tags: brute force, data structures, greedy, strings
Correct Solution:
```
for _ in " "*int(input()):
s=input()
if "B" not in s:
print(len(s))
elif "A" not in s:
print(len(s)%2)
else:
sm=0
n=len(s)
cnt=0
ind = ''.join(s).rindex('B')
for i in range(ind+1):
if s[i] == "A":
... | output | 1 | 88,591 | 0 | 177,183 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets ... | instruction | 0 | 88,592 | 0 | 177,184 |
Tags: brute force, data structures, greedy, strings
Correct Solution:
```
num = int(input())
while num != 0:
s = input()
ans = len(s)
temp = 0
for i in s:
if i == 'B' and temp != 0:
ans = ans - 2
temp = temp - 1
else:
temp = temp + 1
num = num - 1
... | output | 1 | 88,592 | 0 | 177,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets ... | instruction | 0 | 88,593 | 0 | 177,186 |
Tags: brute force, data structures, greedy, strings
Correct Solution:
```
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
def gift():
for _ in range(t):
aabb = input()
n = len(aabb)
ans = n
curB = 0
for i in range(n):
#print(i, curB,aa... | output | 1 | 88,593 | 0 | 177,187 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets ... | instruction | 0 | 88,594 | 0 | 177,188 |
Tags: brute force, data structures, greedy, strings
Correct Solution:
```
for _ in range(int(input())):
ans = 0
for i in input():
if i == 'B' and ans != 0:
ans -= 1
else:
ans += 1
print(ans)
``` | output | 1 | 88,594 | 0 | 177,189 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets ... | instruction | 0 | 88,595 | 0 | 177,190 |
Tags: brute force, data structures, greedy, strings
Correct Solution:
```
from collections import deque
t = int(input())
for _ in range(t):
s=input()
n = len(s)
stack = deque()
for i in range(n):
if s[i]=='B' and stack:
stack.pop()
else:
stack.append(s[i])
le... | output | 1 | 88,595 | 0 | 177,191 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets ... | instruction | 0 | 88,596 | 0 | 177,192 |
Tags: brute force, data structures, greedy, strings
Correct Solution:
```
import bisect
def solve(s):
n = len(s)
stack = []
for j in range(n):
if stack:
if s[j] == 'B':
stack.pop()
else:
stack.append('A')
else:
stack.append... | output | 1 | 88,596 | 0 | 177,193 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets ... | instruction | 0 | 88,597 | 0 | 177,194 |
Tags: brute force, data structures, greedy, strings
Correct Solution:
```
import re
from collections import deque
T = int(input())
for test in range(T):
a = input()
basket = deque(re.findall('A+|B+', a))
i = 0
while i < len(basket) - 1: # A λ©μ΄λ¦¬κ° λ§μ§λ§μ μμΌλ©΄ μλλ€.
if basket[i][0] != 'A':
... | output | 1 | 88,597 | 0 | 177,195 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets ... | instruction | 0 | 88,598 | 0 | 177,196 |
Tags: brute force, data structures, greedy, strings
Correct Solution:
```
i = int(input())
for _ in range(i):
test = list(input())
ch = 0
totlen = len(test)
acount = 0
abcount = 0
aindex = []
for _ in range(len(test)):
if test[_]=='A':
test[_] = 'A*'
aindex.a... | output | 1 | 88,598 | 0 | 177,197 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When... | instruction | 0 | 88,599 | 0 | 177,198 |
Yes | output | 1 | 88,599 | 0 | 177,199 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When... | instruction | 0 | 88,600 | 0 | 177,200 |
Yes | output | 1 | 88,600 | 0 | 177,201 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When... | instruction | 0 | 88,601 | 0 | 177,202 |
Yes | output | 1 | 88,601 | 0 | 177,203 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When... | instruction | 0 | 88,602 | 0 | 177,204 |
Yes | output | 1 | 88,602 | 0 | 177,205 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When... | instruction | 0 | 88,603 | 0 | 177,206 |
No | output | 1 | 88,603 | 0 | 177,207 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When... | instruction | 0 | 88,604 | 0 | 177,208 |
No | output | 1 | 88,604 | 0 | 177,209 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When... | instruction | 0 | 88,605 | 0 | 177,210 |
No | output | 1 | 88,605 | 0 | 177,211 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When... | instruction | 0 | 88,606 | 0 | 177,212 |
No | output | 1 | 88,606 | 0 | 177,213 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.
He wants to convert string a into string b by performing some (possibly zero) operations on a.
In one move, he can eith... | instruction | 0 | 88,607 | 0 | 177,214 |
Tags: dp, greedy, hashing, implementation, strings
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
... | output | 1 | 88,607 | 0 | 177,215 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.
He wants to convert string a into string b by performing some (possibly zero) operations on a.
In one move, he can eith... | instruction | 0 | 88,608 | 0 | 177,216 |
Tags: dp, greedy, hashing, implementation, strings
Correct Solution:
```
# region fastio
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.writable = ... | output | 1 | 88,608 | 0 | 177,217 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.
He wants to convert string a into string b by performing some (possibly zero) operations on a.
In one move, he can eith... | instruction | 0 | 88,609 | 0 | 177,218 |
Tags: dp, greedy, hashing, implementation, strings
Correct Solution:
```
input = __import__('sys').stdin.readline
def solve(a, b, k, n):
deca = {}
decb = {}
for i in a:
if i in deca:
deca[i] += 1
else:
deca[i] = 1
for i in b:
if i in decb:
de... | output | 1 | 88,609 | 0 | 177,219 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.
He wants to convert string a into string b by performing some (possibly zero) operations on a.
In one move, he can eith... | instruction | 0 | 88,610 | 0 | 177,220 |
Tags: dp, greedy, hashing, implementation, strings
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
for _ in range(int(input())):
n,k = map(int,input().split())
a = input()
b=input()
d1=[0]*26
d2=[0]*26
for i1,i2 in zip(a,b):
d1[ord(i1)-97]+=1
... | output | 1 | 88,610 | 0 | 177,221 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.
He wants to convert string a into string b by performing some (possibly zero) operations on a.
In one move, he can eith... | instruction | 0 | 88,611 | 0 | 177,222 |
Tags: dp, greedy, hashing, implementation, strings
Correct Solution:
```
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for k in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k ... | output | 1 | 88,611 | 0 | 177,223 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.
He wants to convert string a into string b by performing some (possibly zero) operations on a.
In one move, he can eith... | instruction | 0 | 88,612 | 0 | 177,224 |
Tags: dp, greedy, hashing, implementation, strings
Correct Solution:
```
import math
from collections import deque
from sys import stdin, stdout, setrecursionlimit
from string import ascii_letters
letters = ascii_letters[:26]
from collections import defaultdict
#from functools import reduce
input = stdin.readline
print... | output | 1 | 88,612 | 0 | 177,225 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.
He wants to convert string a into string b by performing some (possibly zero) operations on a.
In one move, he can eith... | instruction | 0 | 88,613 | 0 | 177,226 |
Tags: dp, greedy, hashing, implementation, strings
Correct Solution:
```
import sys
input=sys.stdin.readline
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
a = input()
b = input()
c1=[0]*26
c2=[0]*26
for i in range(0,n):
c1[ord(a[i])-97]+=1
c2[ord(b[i])-97]+... | output | 1 | 88,613 | 0 | 177,227 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ashish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.
He wants to convert string a into string b by performing some (possibly zero) operations on a.
In one move, he can eith... | instruction | 0 | 88,614 | 0 | 177,228 |
Tags: dp, greedy, hashing, implementation, strings
Correct Solution:
```
'''
Auther: ghoshashis545 Ashis Ghosh
College: jalpaiguri Govt Enggineering College
'''
from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collecti... | output | 1 | 88,614 | 0 | 177,229 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fibonacci strings are defined as follows:
* f1 = Β«aΒ»
* f2 = Β«bΒ»
* fn = fn - 1 fn - 2, n > 2
Thus, the first five Fibonacci strings are: "a", "b", "ba", "bab", "babba".
You are given a Fibonacci string and m strings si. For each... | instruction | 0 | 88,675 | 0 | 177,350 |
Tags: matrices, strings
Correct Solution:
```
F = ['', 'a', 'b', 'ba', 'bab', 'babba', 'babbabab', 'babbababbabba', 'babbababbabbababbabab', 'babbababbabbababbababbabbababbabba', 'babbababbabbababbababbabbababbabbababbababbabbababbabab', 'babbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabba... | output | 1 | 88,675 | 0 | 177,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. Let's consider all subsequences of string s, co... | instruction | 0 | 88,692 | 0 | 177,384 |
Tags: data structures, dp, strings
Correct Solution:
```
import bisect
import string
s = input()
t = input()
max_match = [0 for i in range(len(s))]
min_match = [0 for i in range(len(s))]
char_idx = [0 for i in range(30)]
char_occur = [ [] for i in range(30) ]
for (i, ch) in enumerate(t):
idx = ord(ch) - ord('a')... | output | 1 | 88,692 | 0 | 177,385 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. ... | instruction | 0 | 88,693 | 0 | 177,386 |
No | output | 1 | 88,693 | 0 | 177,387 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. ... | instruction | 0 | 88,694 | 0 | 177,388 |
No | output | 1 | 88,694 | 0 | 177,389 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. ... | instruction | 0 | 88,695 | 0 | 177,390 |
No | output | 1 | 88,695 | 0 | 177,391 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).
You've got two strings β s and t. ... | instruction | 0 | 88,696 | 0 | 177,392 |
No | output | 1 | 88,696 | 0 | 177,393 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.