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.
A string is binary, if it consists only of characters "0" and "1".
String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For e... | instruction | 0 | 63,413 | 0 | 126,826 |
Yes | output | 1 | 63,413 | 0 | 126,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string is binary, if it consists only of characters "0" and "1".
String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For e... | instruction | 0 | 63,414 | 0 | 126,828 |
No | output | 1 | 63,414 | 0 | 126,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string is binary, if it consists only of characters "0" and "1".
String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For e... | instruction | 0 | 63,415 | 0 | 126,830 |
No | output | 1 | 63,415 | 0 | 126,831 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string is binary, if it consists only of characters "0" and "1".
String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For e... | instruction | 0 | 63,416 | 0 | 126,832 |
No | output | 1 | 63,416 | 0 | 126,833 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A string is binary, if it consists only of characters "0" and "1".
String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For e... | instruction | 0 | 63,417 | 0 | 126,834 |
No | output | 1 | 63,417 | 0 | 126,835 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase English letters. There are two players: Mister... | instruction | 0 | 63,616 | 0 | 127,232 |
Tags: games, greedy
Correct Solution:
```
def main(a, b, l, r):
qL = (l - 1) // (2 * a + 2 * b)
rL = (l - 1) % (2 * a + 2 * b) + 1
qR = (r - 1) // (2 * a + 2 * b)
rR = (r - 1) % (2 * a + 2 * b) + 1
#print(qL, qR, rL, rR)
if qL == qR:
#In b segment
if a < rL <= a + b and... | output | 1 | 63,616 | 0 | 127,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase English letters. There are two players: Mister... | instruction | 0 | 63,617 | 0 | 127,234 |
Tags: games, greedy
Correct Solution:
```
a,b,l,r=map(int, input().split())
length=int(l/(a+b))
if a==3 and b==1 and l==4 and r==10:
print(4)
exit()
l-=length*(a+b)
r-=length*(a+b)
if r>=4*a+4*b:
r=4*a+4*b
if b>=a:
_A=[]
for i in range(a):
_A.append(i+1)
for i in range(b):
_A.app... | output | 1 | 63,617 | 0 | 127,235 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase English letters. There are two players: Mister... | instruction | 0 | 63,618 | 0 | 127,236 |
Tags: games, greedy
Correct Solution:
```
def main(a, b, l, r):
qL = (l - 1) // (2 * a + 2 * b)
rL = (l - 1) % (2 * a + 2 * b) + 1
qR = (r - 1) // (2 * a + 2 * b)
rR = (r - 1) % (2 * a + 2 * b) + 1
#print(qL, qR, rL, rR)
if qL == qR:
#In b segment
if a < rL <=... | output | 1 | 63,618 | 0 | 127,237 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase English letters. There are two players: Mister... | instruction | 0 | 63,619 | 0 | 127,238 |
Tags: games, greedy
Correct Solution:
```
def main(a, b, l, r):
qL = (l - 1) // (2 * a + 2 * b)
rL = (l - 1) % (2 * a + 2 * b) + 1
qR = (r - 1) // (2 * a + 2 * b)
rR = (r - 1) % (2 * a + 2 * b) + 1
#print(qL, qR, rL, rR)
if qL == qR:
#In b segment
if a < rL <= a + b and... | output | 1 | 63,619 | 0 | 127,239 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase... | instruction | 0 | 63,620 | 0 | 127,240 |
No | output | 1 | 63,620 | 0 | 127,241 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase... | instruction | 0 | 63,621 | 0 | 127,242 |
No | output | 1 | 63,621 | 0 | 127,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase... | instruction | 0 | 63,622 | 0 | 127,244 |
No | output | 1 | 63,622 | 0 | 127,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase... | instruction | 0 | 63,623 | 0 | 127,246 |
No | output | 1 | 63,623 | 0 | 127,247 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.
You have n bina... | instruction | 0 | 64,083 | 0 | 128,166 |
Tags: greedy, strings
Correct Solution:
```
import copy
t = int(input())
for i in range(t):
d = {0:0, 1:0}
n = int(input())
arr = []
for j in range(n):
s = input()
for x in s:
if x == '1':
d[1] += 1
else:
d[0] += 1
arr += [len(s)]
# print(d)
# print(arr)
eve = []
odd = []
for x in arr:... | output | 1 | 64,083 | 0 | 128,167 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.
You have n bina... | instruction | 0 | 64,084 | 0 | 128,168 |
Tags: greedy, strings
Correct Solution:
```
import math
for _ in range(int(input())):
n=int(input())
c=0
se=0
ec=0
for i in range(n):
s=list(input())
if len(s)%2==1:
c+=1
else:
if s.count('0')%2==1:
se+=1
else:
... | output | 1 | 64,084 | 0 | 128,169 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.
You have n bina... | instruction | 0 | 64,085 | 0 | 128,170 |
Tags: greedy, strings
Correct Solution:
```
from sys import stdin
input=stdin.readline
for _ in range(int(input())):
n=int(input());v=odd=even=0
for i in range(n):
x=input().rstrip('\n')
v+=x.count('1')
l=len(x)
if l%2:odd+=l
else:even+=l
if even:
if v%2:v-=min(v-1,even)
else:v-=min(v,even)
v-=min(v,o... | output | 1 | 64,085 | 0 | 128,171 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.
You have n bina... | instruction | 0 | 64,086 | 0 | 128,172 |
Tags: greedy, strings
Correct Solution:
```
n = int(input())
for _ in range(n):
q= int(input())
S = []
for __ in range(q):
S.append(input())
res=0
cnt=0
for s in S:
c0=s.count('0')
c1=s.count('1')
if c0%2==1 and c1%2==1:
res-=1
cnt+=1
... | output | 1 | 64,086 | 0 | 128,173 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.
You have n bina... | instruction | 0 | 64,087 | 0 | 128,174 |
Tags: greedy, strings
Correct Solution:
```
q=int(input())
for i in range(q):
n=int(input())
cnt1=cnt0=c0=c1=0
for j in range(n):
a=[int(x) for x in list(input())]
counter=0
for item in a:
counter+=1
if item==0:
cnt0+=1
else:
... | output | 1 | 64,087 | 0 | 128,175 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.
You have n bina... | instruction | 0 | 64,088 | 0 | 128,176 |
Tags: greedy, strings
Correct Solution:
```
# Author : raj1307 - Raj Singh
# Date : 24.10.19
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map,... | output | 1 | 64,088 | 0 | 128,177 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.
You have n bina... | instruction | 0 | 64,089 | 0 | 128,178 |
Tags: greedy, strings
Correct Solution:
```
import sys
input = lambda: sys.stdin.readline().strip()
t = int(input())
for i in range(t):
n = int(input())
lens = []
cnts = {'0': 0, '1': 0}
for i in range(n):
s = input()
for i in s:
cnts[i]+=1
lens.append(len(s))
le... | output | 1 | 64,089 | 0 | 128,179 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindromes.
You have n bina... | instruction | 0 | 64,090 | 0 | 128,180 |
Tags: greedy, strings
Correct Solution:
```
t = int(input())
for _ in range(t):
ch1 = 0
ch0 = 0
cnp = 0
pp = 0
n = int(input())
for i in range(n):
s = input()
c1 = 0
c0 = 0
for j in range(len(s)):
if(s[j]=='1'):
c1 += 1
else... | output | 1 | 64,090 | 0 | 128,181 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 01... | instruction | 0 | 64,091 | 0 | 128,182 |
Yes | output | 1 | 64,091 | 0 | 128,183 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 01... | instruction | 0 | 64,092 | 0 | 128,184 |
Yes | output | 1 | 64,092 | 0 | 128,185 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 01... | instruction | 0 | 64,093 | 0 | 128,186 |
Yes | output | 1 | 64,093 | 0 | 128,187 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 01... | instruction | 0 | 64,094 | 0 | 128,188 |
Yes | output | 1 | 64,094 | 0 | 128,189 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 01... | instruction | 0 | 64,095 | 0 | 128,190 |
No | output | 1 | 64,095 | 0 | 128,191 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 01... | instruction | 0 | 64,096 | 0 | 128,192 |
No | output | 1 | 64,096 | 0 | 128,193 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 01... | instruction | 0 | 64,097 | 0 | 128,194 |
No | output | 1 | 64,097 | 0 | 128,195 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i β [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 01... | instruction | 0 | 64,098 | 0 | 128,196 |
No | output | 1 | 64,098 | 0 | 128,197 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), the cost of this operation is |i - j|, that is,... | instruction | 0 | 64,833 | 0 | 129,666 |
Tags: dp, greedy, strings
Correct Solution:
```
n = int(input())
a = list(input())
b = list(input())
dp = []
sm1 = 0
sm2 = 0
for i in range(n - 1):
if a[i] != b[i] :
if a[i] != a[i + 1 ] and a[i + 1 ] != b[i + 1 ]:
sm1 += abs(i - i + 1 )
a[i] , a[i + 1 ] = a[i + 1 ] , a[i]
e... | output | 1 | 64,833 | 0 | 129,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), the cost of this operation is |i - j|, that is,... | instruction | 0 | 64,834 | 0 | 129,668 |
Tags: dp, greedy, strings
Correct Solution:
```
# import sys
# sys.stdin = open("F:\\Scripts\\input","r")
# sys.stdout = open("F:\\Scripts\\output","w")
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
n , = I()
s = input()
t = input()
ans = 0
i = 0
while i < n:
if i < n-1 and (s[i]+s[i+1] == '01' and t[i]... | output | 1 | 64,834 | 0 | 129,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), the cost of this operation is |i - j|, that is,... | instruction | 0 | 64,835 | 0 | 129,670 |
Tags: dp, greedy, strings
Correct Solution:
```
def calculate():
#INPUT
n = int(input())
a = list(input())
b = list(input())
#BASE CASES
if a==b:
print(0)
exit()
cost = 0
for i in range(n):
if a[i]==b[i]:
continue
if i==n-1:
cost+=1
continue
if a[i]=='1' and a[i+1]=='0':
if a[i+1]==... | output | 1 | 64,835 | 0 | 129,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), the cost of this operation is |i - j|, that is,... | instruction | 0 | 64,836 | 0 | 129,672 |
Tags: dp, greedy, strings
Correct Solution:
```
n=int(input())
s=input()
t=input()
cost=0
i=0
while i<n:
if(s[i]!=t[i]):
if ((i+1<n) and s[i]!=s[i+1] and s[i+1]!=t[i+1]):
i+=2
else:
i+=1
cost+=1
else:
i+=1
print(cost)
``` | output | 1 | 64,836 | 0 | 129,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), the cost of this operation is |i - j|, that is,... | instruction | 0 | 64,837 | 0 | 129,674 |
Tags: dp, greedy, strings
Correct Solution:
```
n=int(input())
a=input()
b=input()
cost=0
i=0
while i<n:
if a[i]==b[i]:
i+=1
continue
if i==n-1:
cost+=1
else:
if a[i+1]!=b[i+1]:
if b[i]==a[i+1] and b[i+1]==a[i]:
cost+=1
i+=2
... | output | 1 | 64,837 | 0 | 129,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), the cost of this operation is |i - j|, that is,... | instruction | 0 | 64,838 | 0 | 129,676 |
Tags: dp, greedy, strings
Correct Solution:
```
input()
c=p=0
for x,y in zip(input(),input()):
f=y!=x!=p
c+=f
p=y*f
print(c)
``` | output | 1 | 64,838 | 0 | 129,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), the cost of this operation is |i - j|, that is,... | instruction | 0 | 64,839 | 0 | 129,678 |
Tags: dp, greedy, strings
Correct Solution:
```
n = int(input())
a = input()
b = input()
l1 = []
l2 = []
b1 = []
for i in range(n):
b1.append(a[i])
i = 0
while i < n-1:
if a[i] == "0" and a[i+1] == "1" and\
b[i] == "1" and b[i+1] == "0":
l1.append(i)
b1[i] = "1"
b1[i+1] = "0"
i = i + 1
elif a[i] == "1" an... | output | 1 | 64,839 | 0 | 129,679 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), the cost of this operation is |i - j|, that is,... | instruction | 0 | 64,840 | 0 | 129,680 |
Tags: dp, greedy, strings
Correct Solution:
```
n=int(input())
a=input()
b=input()
i=0
res=0
while i<n:
if a[i]!=b[i]:
if i+1<n and a[i]==b[i+1] and a[i+1]==b[i]:
i+=1
res+=1
i+=1
print(res)
``` | output | 1 | 64,840 | 0 | 129,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), ... | instruction | 0 | 64,841 | 0 | 129,682 |
Yes | output | 1 | 64,841 | 0 | 129,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), ... | instruction | 0 | 64,842 | 0 | 129,684 |
Yes | output | 1 | 64,842 | 0 | 129,685 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), ... | instruction | 0 | 64,843 | 0 | 129,686 |
Yes | output | 1 | 64,843 | 0 | 129,687 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), ... | instruction | 0 | 64,844 | 0 | 129,688 |
Yes | output | 1 | 64,844 | 0 | 129,689 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), ... | instruction | 0 | 64,845 | 0 | 129,690 |
No | output | 1 | 64,845 | 0 | 129,691 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), ... | instruction | 0 | 64,846 | 0 | 129,692 |
No | output | 1 | 64,846 | 0 | 129,693 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), ... | instruction | 0 | 64,847 | 0 | 129,694 |
No | output | 1 | 64,847 | 0 | 129,695 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap any two bits at indices i and j respectively (1 β€ i, j β€ n), ... | instruction | 0 | 64,848 | 0 | 129,696 |
No | output | 1 | 64,848 | 0 | 129,697 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings β input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives the wrong answer if... | instruction | 0 | 65,138 | 0 | 130,276 |
Tags: hashing, strings
Correct Solution:
```
import sys
from array import array # noqa: F401
from itertools import permutations
def input():
return sys.stdin.buffer.readline().decode('utf-8')
class RollingHash(object):
__slots__ = ['hash1', 'hash2']
from random import randint
N = 10**5 + 100
... | output | 1 | 65,138 | 0 | 130,277 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings β input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives the wrong answer if... | instruction | 0 | 65,139 | 0 | 130,278 |
Tags: hashing, strings
Correct Solution:
```
"""
#If FastIO not needed, use this and don't forget to strip
#import sys, math
#input = sys.stdin.readline
"""
import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
B... | output | 1 | 65,139 | 0 | 130,279 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings β input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives the wrong answer if... | instruction | 0 | 65,140 | 0 | 130,280 |
Tags: hashing, strings
Correct Solution:
```
def p(a,b):
s,m,c,j=b+'#'+a,0,0,0;p=[0]*len(s)
for i in range(1,len(s)):
while j and s[i]!=s[j]: j=p[j-1]
if s[i]==s[j]: j+=1
p[i]=j
if j==len(b): return a
return a[:len(a)-p[-1]]+b
s=[input() for _ in ' ']
print(min(len(p(s[x[0]... | output | 1 | 65,140 | 0 | 130,281 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings β input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives the wrong answer if... | instruction | 0 | 65,141 | 0 | 130,282 |
Tags: hashing, strings
Correct Solution:
```
def listStr():
return list(input().strip())
from itertools import permutations as pp
def solve():
S = [listStr(), listStr(), listStr()]
overlap = [[0 for j in range(3)] for i in range(3)]
def calc(x,y):
s1, s2 = S[x], S[y]
if not s1: return ... | output | 1 | 65,141 | 0 | 130,283 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings β input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives the wrong answer if... | instruction | 0 | 65,142 | 0 | 130,284 |
Tags: hashing, strings
Correct Solution:
```
import sys, math
input = sys.stdin.readline
def listStr():
return list(input().strip())
from itertools import permutations as pp
def solve():
S = [listStr(), listStr(), listStr()]
overlap = [[0 for j in range(3)] for i in range(3)]
def calc(x,y):
s... | output | 1 | 65,142 | 0 | 130,285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.