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.
We have a string s consisting of lowercase English letters. Snuke is partitioning s into some number of non-empty substrings. Let the subtrings obtained be s_1, s_2, ..., s_N from left to right.... | instruction | 0 | 78,126 | 0 | 156,252 |
No | output | 1 | 78,126 | 0 | 156,253 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.
Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:
1. Reverse the order... | instruction | 0 | 78,143 | 0 | 156,286 |
"Correct Solution:
```
s = list(input())
t = s[::-1]
for i, k in enumerate(t):
if k == "b":
t[i] = "d"
elif k == "d":
t[i] = "b"
elif k == "p":
t[i] = "q"
elif k == "q":
t[i] = "p"
if s == t:
print("Yes")
else:
print("No")
``` | output | 1 | 78,143 | 0 | 156,287 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.
Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:
1. Reverse the order... | instruction | 0 | 78,144 | 0 | 156,288 |
"Correct Solution:
```
s=list(input());print(['No','Yes'][s==[{'b':'d','d':'b','p':'q','q':'p'}[i]for i in s[::-1]]])
``` | output | 1 | 78,144 | 0 | 156,289 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.
Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:
1. Reverse the order... | instruction | 0 | 78,145 | 0 | 156,290 |
"Correct Solution:
```
def main():
S = input()
m = dict()
m['d'] = 'b'
m['b'] = 'd'
m['p'] = 'q'
m['q'] = 'p'
T = ""
for i in range(len(S)-1, -1, -1):
T += m[S[i]]
if T == S: return "Yes"
return "No"
if __name__ == '__main__':
print(main())
``` | output | 1 | 78,145 | 0 | 156,291 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.
Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:
1. Reverse the order... | instruction | 0 | 78,146 | 0 | 156,292 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline... | output | 1 | 78,146 | 0 | 156,293 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.
Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:
1. Reverse the order... | instruction | 0 | 78,147 | 0 | 156,294 |
"Correct Solution:
```
s=list(input())
n=len(s)
if n%2==1:
print('No')
else:
k=n//2
for i in range(k):
if s[i]=='b' and not s[n-1-i]=='d':
print('No')
exit()
if s[i]=='d' and not s[n-i-1]=='b':
print('No')
exit()
if s[i]=='p' and not... | output | 1 | 78,147 | 0 | 156,295 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.
Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:
1. Reverse the order... | instruction | 0 | 78,148 | 0 | 156,296 |
"Correct Solution:
```
r=str.replace
s=input()
print(['No','Yes'][s==''.join(reversed(r(r(r(r(r(r(r(r(s,'b','0'),'d','1'),'p','2'),'q','3'),'0','d'),'1','b'),'2','q'),'3','p')))])
``` | output | 1 | 78,148 | 0 | 156,297 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.
Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:
1. Reverse the order... | instruction | 0 | 78,149 | 0 | 156,298 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
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 j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in ran... | output | 1 | 78,149 | 0 | 156,299 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.
Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:
1. Reverse the order... | instruction | 0 | 78,150 | 0 | 156,300 |
"Correct Solution:
```
import string
s = input()
s2 = s[::-1]
dst = s2.translate(str.maketrans('bdpq', 'dbqp'))
if (s == dst):
print('Yes')
else:
print('No')
``` | output | 1 | 78,150 | 0 | 156,301 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of... | instruction | 0 | 78,397 | 0 | 156,794 |
Tags: binary search, greedy, hashing, string suffix structures, strings
Correct Solution:
```
#longest prefix which is also suffix
#return same prefic which is also suffix they both shl't overlap
#get longest prefix front string (0) string+'#'+string[::-1]
#get longest palindrome form last string[::-1]+'#'+string
def L... | output | 1 | 78,397 | 0 | 156,795 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of... | instruction | 0 | 78,398 | 0 | 156,796 |
Tags: binary search, greedy, hashing, string suffix structures, strings
Correct Solution:
```
import sys;input=sys.stdin.readline
def manacher(S):
N=len(S)
r,p=0,0
A=[0]*N
for i in range(N):
if i<=r: A[i]=min(A[2*p-i],r-i)
else: A[i]=0
while (i-A[i]-1>=0) and (i+A[i]+1<N) and (S... | output | 1 | 78,398 | 0 | 156,797 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of... | instruction | 0 | 78,399 | 0 | 156,798 |
Tags: binary search, greedy, hashing, string suffix structures, strings
Correct Solution:
```
# -*- coding: utf-8 -*-
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 j in range(b)] for i in range(a)]
def l... | output | 1 | 78,399 | 0 | 156,799 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of... | instruction | 0 | 78,400 | 0 | 156,800 |
Tags: binary search, greedy, hashing, string suffix structures, strings
Correct Solution:
```
#######################################################################################################################
# Author: BlackFyre
# Language: PyPy 3.7
#######################################################... | output | 1 | 78,400 | 0 | 156,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of... | instruction | 0 | 78,401 | 0 | 156,802 |
Tags: binary search, greedy, hashing, string suffix structures, strings
Correct Solution:
```
"""
Template written to be used by Python Programmers.
Use at your own risk!!!!
Owned by enraged(rating - 5 star at CodeChef and Specialist at Codeforces).
"""
import sys
import heapq
from math import ceil, floor, ... | output | 1 | 78,401 | 0 | 156,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of... | instruction | 0 | 78,402 | 0 | 156,804 |
Tags: binary search, greedy, hashing, string suffix structures, strings
Correct Solution:
```
def Z_Array(l):
left=0
right=0
n=len(l)
Z=[0]*n
for i in range(1,n):
if i>right:
left=i
right=i
while (right<n and l[right]==l[right-left]):
right... | output | 1 | 78,402 | 0 | 156,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of... | instruction | 0 | 78,403 | 0 | 156,806 |
Tags: binary search, greedy, hashing, string suffix structures, strings
Correct Solution:
```
import sys
import math
from collections import defaultdict,deque
import heapq
def kmp(s):
n=len(s)
lps=[0 for _ in range(n)]
l=0
lps[0]=0
i=1
while i<n:
if s[i]==s[l]:
l+=1
lps[i]=l
i+=1
else:
if l!=0:
... | output | 1 | 78,403 | 0 | 156,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.
You are given a string s, consisting of... | instruction | 0 | 78,404 | 0 | 156,808 |
Tags: binary search, greedy, hashing, string suffix structures, strings
Correct Solution:
```
from sys import stdin
from collections import defaultdict, Counter
from math import gcd
#wow
def solver(s):
# s is input string
# start by finding common suffix prefix
n = len(s)
i = 0
for i in range(n//2):
if s[i]... | output | 1 | 78,404 | 0 | 156,809 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this... | instruction | 0 | 78,405 | 0 | 156,810 |
Yes | output | 1 | 78,405 | 0 | 156,811 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this... | instruction | 0 | 78,406 | 0 | 156,812 |
Yes | output | 1 | 78,406 | 0 | 156,813 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this... | instruction | 0 | 78,407 | 0 | 156,814 |
Yes | output | 1 | 78,407 | 0 | 156,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this... | instruction | 0 | 78,408 | 0 | 156,816 |
Yes | output | 1 | 78,408 | 0 | 156,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this... | instruction | 0 | 78,409 | 0 | 156,818 |
No | output | 1 | 78,409 | 0 | 156,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this... | instruction | 0 | 78,410 | 0 | 156,820 |
No | output | 1 | 78,410 | 0 | 156,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this... | instruction | 0 | 78,411 | 0 | 156,822 |
No | output | 1 | 78,411 | 0 | 156,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this... | instruction | 0 | 78,412 | 0 | 156,824 |
No | output | 1 | 78,412 | 0 | 156,825 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:
1. Find any... | instruction | 0 | 78,604 | 0 | 157,208 |
Tags: data structures, implementation
Correct Solution:
```
def readln(): return tuple(map(int, input().split()))
q = input()
cnt = [[0] * 3 for _ in range(len(q) + 1)]
for i, v in enumerate(list(q)):
for j in range(3):
cnt[i + 1][j] = cnt[i][j]
if v == 'x':
cnt[i + 1][0] += 1
elif v == 'y'... | output | 1 | 78,604 | 0 | 157,209 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:
1. Find any... | instruction | 0 | 78,605 | 0 | 157,210 |
Tags: data structures, implementation
Correct Solution:
```
s = input()
n = int(input())
tests = []
for _ in range(n):
a, b = map(int, input().split())
a -= 1
b -= 1
tests.append((a, b))
count_left = {}
count_left[-1] = (0, 0, 0)
x, y, z = 0, 0, 0
for i, c in enumerate(s):
if c == 'x':
x +... | output | 1 | 78,605 | 0 | 157,211 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:
1. Find any... | instruction | 0 | 78,606 | 0 | 157,212 |
Tags: data structures, implementation
Correct Solution:
```
def main(stdin):
string = next(stdin).rstrip()
m = int(next(stdin))
letters = {'x': {0: 0}, 'y': {0: 0}, 'z': {0: 0}}
for i, letter in enumerate(list(string), 1):
letters['x'][i] = letters['x'][i - 1]
letters['y'][i] = letters[... | output | 1 | 78,606 | 0 | 157,213 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:
1. Find any... | instruction | 0 | 78,607 | 0 | 157,214 |
Tags: data structures, implementation
Correct Solution:
```
input=__import__('sys').stdin.readline
s = input()
nn=len(s)
cx=[0]*(nn+1)
cy=[0]*(nn+1)
cz=[0]*(nn+1)
for i in range(1,nn):
if s[i-1]=='x':
cx[i]=cx[i-1]+1
cy[i]=cy[i-1]
cz[i]=cz[i-1]
elif s[i-1]=='y':
cx[i]=cx[i-1]
... | output | 1 | 78,607 | 0 | 157,215 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:
1. Find any... | instruction | 0 | 78,608 | 0 | 157,216 |
Tags: data structures, implementation
Correct Solution:
```
'''input
zyxxxxxxyyz
5
5 5
1 3
1 11
1 4
3 6
'''
# practicing a skill right after sleep improves it a lot quickly
from sys import stdin, setrecursionlimit
def pre_process(string, xarr, yarr, zarr):
if string[0] == 'x':
xarr[0] = 1
elif string[0] == 'y':
... | output | 1 | 78,608 | 0 | 157,217 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:
1. Find any... | instruction | 0 | 78,609 | 0 | 157,218 |
Tags: data structures, implementation
Correct Solution:
```
def f(t): return t[2] - t[0] > 1
t = input()
n, m, p = len(t), int(input()), {'x': 0, 'y': 1, 'z': 2}
s = [[0] * (n + 1) for i in range(3)]
for i, c in enumerate(t, 1): s[p[c]][i] = 1
for i in range(3):
for j in range(1, n): s[i][j + 1] += s[i][j]
a... | output | 1 | 78,609 | 0 | 157,219 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:
1. Find any... | instruction | 0 | 78,610 | 0 | 157,220 |
Tags: data structures, implementation
Correct Solution:
```
#!/usr/bin/python3
def readln(): return tuple(map(int, input().split()))
q = input()
cnt = [[0] * 3 for _ in range(len(q) + 1)]
for i, v in enumerate(list(q)):
for j in range(3):
cnt[i + 1][j] = cnt[i][j]
if v == 'x':
cnt[i + 1][0] +=... | output | 1 | 78,610 | 0 | 157,221 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The ... | instruction | 0 | 78,611 | 0 | 157,222 |
No | output | 1 | 78,611 | 0 | 157,223 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The ... | instruction | 0 | 78,612 | 0 | 157,224 |
No | output | 1 | 78,612 | 0 | 157,225 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The ... | instruction | 0 | 78,613 | 0 | 157,226 |
No | output | 1 | 78,613 | 0 | 157,227 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
... | instruction | 0 | 78,945 | 0 | 157,890 |
"Correct Solution:
```
print(("Yes" if "".join(sorted(input()))=="abc" else "No"))
``` | output | 1 | 78,945 | 0 | 157,891 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
... | instruction | 0 | 78,946 | 0 | 157,892 |
"Correct Solution:
```
s = input()
print('Yes' if len(s)==len(set(s)) else 'No')
``` | output | 1 | 78,946 | 0 | 157,893 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
... | instruction | 0 | 78,947 | 0 | 157,894 |
"Correct Solution:
```
print('Yes' if len(set(input())) ==3 else 'No')
``` | output | 1 | 78,947 | 0 | 157,895 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
... | instruction | 0 | 78,948 | 0 | 157,896 |
"Correct Solution:
```
a = sorted(input())
a ="".join(a)
print("Yes" if a =="abc" else "No")
``` | output | 1 | 78,948 | 0 | 157,897 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
... | instruction | 0 | 78,949 | 0 | 157,898 |
"Correct Solution:
```
S = input()
print('Yes' if len(set(S)) == 3 else 'No')
``` | output | 1 | 78,949 | 0 | 157,899 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
... | instruction | 0 | 78,950 | 0 | 157,900 |
"Correct Solution:
```
print("Yes" if "".join(sorted(input())) == "abc" else "No")
``` | output | 1 | 78,950 | 0 | 157,901 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
... | instruction | 0 | 78,951 | 0 | 157,902 |
"Correct Solution:
```
print("No" if len(set(input()))!=3 else "Yes")
``` | output | 1 | 78,951 | 0 | 157,903 |
Provide a correct Python 3 solution for this coding contest problem.
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
Constraints
* |S|=3
* S consists of `a`, `b` and `c`.
Input
Input is given from Standard Input in the following format:
S
... | instruction | 0 | 78,952 | 0 | 157,904 |
"Correct Solution:
```
print('Yes' if len(list(set(input())))==3 else 'No')
``` | output | 1 | 78,952 | 0 | 157,905 |
Provide a correct Python 3 solution for this coding contest problem.
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a s... | instruction | 0 | 79,009 | 0 | 158,018 |
"Correct Solution:
```
S = input()
for i in range(len(S)-1):
if S[i] == S[i+1]:
print(i+1, i+2)
break
elif i < len(S)-2:
if S[i] == S[i+2]:
print(i+1, i+3)
break
else:
print(-1, -1)
``` | output | 1 | 79,009 | 0 | 158,019 |
Provide a correct Python 3 solution for this coding contest problem.
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a s... | instruction | 0 | 79,010 | 0 | 158,020 |
"Correct Solution:
```
def main():
s = input()
for i in range(len(s)-1):
if s[i] == s[i+1]:
print("{} {}".format(i+1,i+2))
return
elif i+2<len(s) and s[i] == s[i+2]:
print("{} {}".format(i+1, i+3))
return
print("-1 -1")
return
main()
``` | output | 1 | 79,010 | 0 | 158,021 |
Provide a correct Python 3 solution for this coding contest problem.
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a s... | instruction | 0 | 79,011 | 0 | 158,022 |
"Correct Solution:
```
s = input()
is_unbalanced = False
for i in range(len(s) - 1):
if s[i] == s[i + 1]:
print(i + 1, i + 2)
is_unbalanced = True
break
if is_unbalanced == False:
for i in range(len(s) - 2):
if s[i] == s[i + 2]:
print(i + 1, i + 3)
is_unba... | output | 1 | 79,011 | 0 | 158,023 |
Provide a correct Python 3 solution for this coding contest problem.
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a s... | instruction | 0 | 79,012 | 0 | 158,024 |
"Correct Solution:
```
s=input()
u=len(s)
a=s[0]
b=s[1]
if(u==2 or a==b):
print("1 2" if a==b else "-1 -1")
exit(0)
for i in range(2,u):
c = s[i]
if a==c:
print("{} {}".format(i-1,i+1))
exit(0)
if b==c:
print("{} {}".format(i,i+1))
exit(0)
a=b
b=c
print("-1 -1")
``` | output | 1 | 79,012 | 0 | 158,025 |
Provide a correct Python 3 solution for this coding contest problem.
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a s... | instruction | 0 | 79,013 | 0 | 158,026 |
"Correct Solution:
```
def main():
s = input().strip()
for i in range(1, len(s)):
if s[i] == s[i - 1]:
print(i, i + 1)
break
else:
for i in range(2, len(s)):
if s[i] == s[i - 2]:
print(i - 1, i + 1)
break
else:
... | output | 1 | 79,013 | 0 | 158,027 |
Provide a correct Python 3 solution for this coding contest problem.
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a s... | instruction | 0 | 79,014 | 0 | 158,028 |
"Correct Solution:
```
s=input()
n=len(s)
ans=[-1,-1]
for i in range(n-1):
if s[i]==s[i+1]:
ans[0],ans[1]=i+1,i+1+1
if n>=3:
for i in range(n-2):
if s[i]==s[i+2]:
ans[0],ans[1]=i+1,i+2+1
print(ans[0],ans[1])
``` | output | 1 | 79,014 | 0 | 158,029 |
Provide a correct Python 3 solution for this coding contest problem.
Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is.
You are given a s... | instruction | 0 | 79,015 | 0 | 158,030 |
"Correct Solution:
```
s = input()
n = len(s)
for i in range(n-1):
if i < n-2:
if s[i] == s[i+1]:
print(i+1,i+2)
break
elif s[i] == s[i+2]:
print(i+1,i+3)
break
else:
continue
else:
if s[i] == s[i+1]:
print(i... | output | 1 | 79,015 | 0 | 158,031 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.