message stringlengths 2 11.9k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 137 108k | cluster float64 18 18 | __index_level_0__ int64 274 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya recieved a gift of a string s with length up to 105 characters for his birthday. He took two more empty strings t and u and decided to play a game. This game has two possible moves:
* Extract the first character of s and append t with this character.
* Extract the last character of t and append u with this character.
Petya wants to get strings s and t empty and string u lexicographically minimal.
You should write a program that will help Petya win the game.
Input
First line contains non-empty string s (1 β€ |s| β€ 105), consisting of lowercase English letters.
Output
Print resulting string u.
Examples
Input
cab
Output
abc
Input
acdb
Output
abdc
Submitted Solution:
```
s=input()
a=list(s)
a.sort()
j=0
t=[]
u=[]
for i in s:
t.append(i)
while len(t)!=0 and a[j]==t[-1]:
u.append(t.pop())
j+=1
u.extend(t[::-1])
print(''.join(u))
``` | instruction | 0 | 61,967 | 18 | 123,934 |
No | output | 1 | 61,967 | 18 | 123,935 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya recieved a gift of a string s with length up to 105 characters for his birthday. He took two more empty strings t and u and decided to play a game. This game has two possible moves:
* Extract the first character of s and append t with this character.
* Extract the last character of t and append u with this character.
Petya wants to get strings s and t empty and string u lexicographically minimal.
You should write a program that will help Petya win the game.
Input
First line contains non-empty string s (1 β€ |s| β€ 105), consisting of lowercase English letters.
Output
Print resulting string u.
Examples
Input
cab
Output
abc
Input
acdb
Output
abdc
Submitted Solution:
```
s=input()
L=[]
output=""
for i in range(len(s)-1,-1,-1):
if(not L):
L.append(s[i])
elif(L[0]<s[i]):
L.append(s[i])
else:
while(L):
output=L[-1]+output
L.pop()
L.append(s[i])
while(L):
output=L[-1]+output
L.pop()
print(output)
``` | instruction | 0 | 61,969 | 18 | 123,938 |
No | output | 1 | 61,969 | 18 | 123,939 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
* f1 = 1,
* f2 = 1,
* fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 β€ n β€ 1000).
Output
Print Eleven's new name on the first and only line of output.
Examples
Input
8
Output
OOOoOooO
Input
15
Output
OOOoOooOooooOoo
Submitted Solution:
```
def main():
n = int(input())
name = ["o"] * n
b,c=1,1
while c <= n:
name[c - 1] = 'O'
b,c = c,b+c
print(''.join(name))
if __name__ == '__main__':
main()
``` | instruction | 0 | 62,852 | 18 | 125,704 |
Yes | output | 1 | 62,852 | 18 | 125,705 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
* f1 = 1,
* f2 = 1,
* fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 β€ n β€ 1000).
Output
Print Eleven's new name on the first and only line of output.
Examples
Input
8
Output
OOOoOooO
Input
15
Output
OOOoOooOooooOoo
Submitted Solution:
```
# https://codeforces.com/problemset/problem/918/A
n = int(input())
a, b = 1, 2
s = set()
while a <= n+1:
s.add(a)
a, b = b, a+b
for i in range(1, n+1):
if i in s:
print("O", end='')
else:
print('o', end="")
``` | instruction | 0 | 62,853 | 18 | 125,706 |
Yes | output | 1 | 62,853 | 18 | 125,707 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
* f1 = 1,
* f2 = 1,
* fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 β€ n β€ 1000).
Output
Print Eleven's new name on the first and only line of output.
Examples
Input
8
Output
OOOoOooO
Input
15
Output
OOOoOooOooooOoo
Submitted Solution:
```
l={1,2,3,5,8,13,21,34,55,89,144,233,377,610,987}
n=int(input())
for i in range(n):
if i+1 in l:
print("O",end="")
else:
print("o",end="")
``` | instruction | 0 | 62,854 | 18 | 125,708 |
Yes | output | 1 | 62,854 | 18 | 125,709 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
* f1 = 1,
* f2 = 1,
* fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 β€ n β€ 1000).
Output
Print Eleven's new name on the first and only line of output.
Examples
Input
8
Output
OOOoOooO
Input
15
Output
OOOoOooOooooOoo
Submitted Solution:
```
"""
βββ βββββββ βββ βββββββ βββββββ βββ ββββββ
βββββββββββββββ βββββββββββββββββββββββββββββ
ββββββ ββββββ ββββββββββββββββββββββββββββ
ββββββ ββββββ βββββββ βββββββββ βββ βββββββ
βββββββββββββββ βββββββββββββββββ βββ βββββββ
βββ βββββββ βββ ββββββββ βββββββ βββ ββββββ
"""
__author__ = "Dilshod"
n = int(input())
fibonacci = [1, 1]
f1 = 1
f2 = 1
name = ["o"] * n
while fibonacci[-1] < n:
a = f2
f2 = f1 + f2
f1 = a
fibonacci += [f2]
for i in fibonacci:
if i <= n:
name[i - 1] = "O"
print(* name, sep = "")
``` | instruction | 0 | 62,855 | 18 | 125,710 |
Yes | output | 1 | 62,855 | 18 | 125,711 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
* f1 = 1,
* f2 = 1,
* fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 β€ n β€ 1000).
Output
Print Eleven's new name on the first and only line of output.
Examples
Input
8
Output
OOOoOooO
Input
15
Output
OOOoOooOooooOoo
Submitted Solution:
```
n = int(input())
s = ''.join(str(s) for s in ['o'] * n)
arr = [1]
a, b = 1, 1
while b < n:
a, b = b, a + b
arr.append(b)
print(arr)
for i in range(len(arr)):
if arr[i] <= n:
s = s[:arr[i] - 1] + 'O' + s[arr[i]:]
print(s)
``` | instruction | 0 | 62,856 | 18 | 125,712 |
No | output | 1 | 62,856 | 18 | 125,713 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
* f1 = 1,
* f2 = 1,
* fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 β€ n β€ 1000).
Output
Print Eleven's new name on the first and only line of output.
Examples
Input
8
Output
OOOoOooO
Input
15
Output
OOOoOooOooooOoo
Submitted Solution:
```
n = int(input().strip())
if n == 1:
print('O')
elif n == 2:
print('OO')
else:
f = [0] * (n+1)
f[1], f[2] = 1, 1
fd = {1:True}
name = ''
i = 3
while i <= n and f[i] <= n:
f[i] = f[i-1] + f[i-2]
fd[f[i]] = True
i += 1
for i in range(1, n+1):
name += 'O' if i in fd else 'o'
print(name)
``` | instruction | 0 | 62,857 | 18 | 125,714 |
No | output | 1 | 62,857 | 18 | 125,715 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
* f1 = 1,
* f2 = 1,
* fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 β€ n β€ 1000).
Output
Print Eleven's new name on the first and only line of output.
Examples
Input
8
Output
OOOoOooO
Input
15
Output
OOOoOooOooooOoo
Submitted Solution:
```
n=int(input())
p=0
l=1
k=[]
j=[]
o=[]
if (n==0):
print(n)
else:
for i in range(n+1):
ans=p+l
if p==0:
pass
else:
k.append(p)
p=l
l=ans
for i in k:
if i<=n:
j.append(i)
else:
pass
for i in range(1,n+1):
o.append('o')
for u in j:
o[u-1]="O"
for b in o:
print(b,end='')
``` | instruction | 0 | 62,858 | 18 | 125,716 |
No | output | 1 | 62,858 | 18 | 125,717 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
<image>
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
* f1 = 1,
* f2 = 1,
* fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 β€ n β€ 1000).
Output
Print Eleven's new name on the first and only line of output.
Examples
Input
8
Output
OOOoOooO
Input
15
Output
OOOoOooOooooOoo
Submitted Solution:
```
n = int(input())
fib = []
if n==1:
print('O')
else:
fib = [1,1]
i=2
while True:
if fib[i-1]+fib[i-2] <= n:
fib.append(fib[i-1]+fib[i-2])
i+=1
else:
break
for i in range(1,n+1):
if i in fib:
print('O', end="")
else:
print('o', end="")
``` | instruction | 0 | 62,859 | 18 | 125,718 |
No | output | 1 | 62,859 | 18 | 125,719 |
Provide a correct Python 3 solution for this coding contest problem.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No | instruction | 0 | 62,966 | 18 | 125,932 |
"Correct Solution:
```
a,_ = map(int,input().split())
s = input()
print('YNeos'[1-all([s[:a].isdigit(),s[a]=='-',s[a+1:].isdigit()])::2])
``` | output | 1 | 62,966 | 18 | 125,933 |
Provide a correct Python 3 solution for this coding contest problem.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No | instruction | 0 | 62,967 | 18 | 125,934 |
"Correct Solution:
```
a,b = map(int,input().split())
s = list(input())
print("Yes" if s.count("-")==1 and s[a]=="-" else "No")
``` | output | 1 | 62,967 | 18 | 125,935 |
Provide a correct Python 3 solution for this coding contest problem.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No | instruction | 0 | 62,968 | 18 | 125,936 |
"Correct Solution:
```
a,b = map(int,input().split())
s = input()
if s.count("-") == 1 and s.index("-") == a:
print("Yes")
else:
print("No")
``` | output | 1 | 62,968 | 18 | 125,937 |
Provide a correct Python 3 solution for this coding contest problem.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No | instruction | 0 | 62,969 | 18 | 125,938 |
"Correct Solution:
```
A,B=map(int,input().split())
S=input()
print('Yes' if len(S.split('-')[0])==A and len(S.split('-')[1])==B else 'No')
``` | output | 1 | 62,969 | 18 | 125,939 |
Provide a correct Python 3 solution for this coding contest problem.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No | instruction | 0 | 62,970 | 18 | 125,940 |
"Correct Solution:
```
a,b=map(int,input().split())
s=input()
print("NYoe s"[s[0:a].isdecimal() and s[a]=="-" and s[a+1:].isdecimal()::2])
``` | output | 1 | 62,970 | 18 | 125,941 |
Provide a correct Python 3 solution for this coding contest problem.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No | instruction | 0 | 62,971 | 18 | 125,942 |
"Correct Solution:
```
A,B=map(int,input().split());S=input()
print('Yes' if S[:A].isdigit() and S[A]=='-' and S[B+1:].isdigit() else 'No')
``` | output | 1 | 62,971 | 18 | 125,943 |
Provide a correct Python 3 solution for this coding contest problem.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No | instruction | 0 | 62,972 | 18 | 125,944 |
"Correct Solution:
```
a,b=map(int,input().split());s=input().split("-");print("NYoe s"[len(s)and len(s[0])==a and len(s[1])==b::2])
``` | output | 1 | 62,972 | 18 | 125,945 |
Provide a correct Python 3 solution for this coding contest problem.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No | instruction | 0 | 62,973 | 18 | 125,946 |
"Correct Solution:
```
a,b = map(int, input().split())
s = input()
print('Yes' if s[a] == '-' and (s[:a] + s[a + 1:]).isdigit() else 'No')
``` | output | 1 | 62,973 | 18 | 125,947 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No
Submitted Solution:
```
a,b=map(int,input().split())
s=input()
if "-" in s[:a] or "-" in s[-b:] or s[a]!="-":
print("No")
else:
print("Yes")
``` | instruction | 0 | 62,974 | 18 | 125,948 |
Yes | output | 1 | 62,974 | 18 | 125,949 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No
Submitted Solution:
```
a, b = map(int, input().split())
s = input()
if s.count('-') == 1 and s.index('-') == a:
print('Yes')
else:
print('No')
``` | instruction | 0 | 62,975 | 18 | 125,950 |
Yes | output | 1 | 62,975 | 18 | 125,951 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No
Submitted Solution:
```
a,b = map(int, input().split())
s = list(input().split('-'))
print('Yes' if a==len(s[0]) and b==len(s[1]) else 'No')
``` | instruction | 0 | 62,976 | 18 | 125,952 |
Yes | output | 1 | 62,976 | 18 | 125,953 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No
Submitted Solution:
```
a,b=map(int,input().split())
s=input()
if s.count('-')== 1 and s[a]=='-' and len(s)==a+b+1:
print('Yes')
else:
print('No')
``` | instruction | 0 | 62,977 | 18 | 125,954 |
Yes | output | 1 | 62,977 | 18 | 125,955 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No
Submitted Solution:
```
a, b = map(int, input().split())
s = input()
a_str = s[0:a]
b_str = s[a+1:a+b+1]
if len(a_str) == a and len(b_str) == b and s[a] == "-" and str.isdecimal(a_str) and str.isdecimal(a_str):
print("Yes")
else:
print("No")
``` | instruction | 0 | 62,978 | 18 | 125,956 |
No | output | 1 | 62,978 | 18 | 125,957 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No
Submitted Solution:
```
a,b = map(int,input().split())
s = input()
if s[a] == '-' and len(s) == a+b+1:
print('Yes')
else:
print('No')
``` | instruction | 0 | 62,979 | 18 | 125,958 |
No | output | 1 | 62,979 | 18 | 125,959 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No
Submitted Solution:
```
a,b=map(int,input().split())
s=input()
if len(s)==a+b+1 and "-" in s and s.index("-")==a s.count("-")==1:
print("Yes")
else:
print("No")
``` | instruction | 0 | 62,980 | 18 | 125,960 |
No | output | 1 | 62,980 | 18 | 125,961 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.
You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.
Constraints
* 1β€A,Bβ€5
* |S|=A+B+1
* S consists of `-` and digits from `0` through `9`.
Input
Input is given from Standard Input in the following format:
A B
S
Output
Print `Yes` if S follows the postal code format in AtCoder Kingdom; print `No` otherwise.
Examples
Input
3 4
269-6650
Output
Yes
Input
1 1
---
Output
No
Input
1 2
7444
Output
No
Submitted Solution:
```
def main():
A, B = map(int, input().split())
S = input()
digit = [str(a) for a in range(10)]
collect = True
for i in range(len(S)):
if i == A:
if S[i] != "-":
collect = False
break
else:
if i not in digit:
collect = False
break
if collect == True:
print("Yes")
else:
print("No")
main()
``` | instruction | 0 | 62,981 | 18 | 125,962 |
No | output | 1 | 62,981 | 18 | 125,963 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For the simplicity, let's say that the "Death Note" is a notebook that kills a person when their name is written in it.
It's easy to kill with it, but it's pretty hard to keep track of people you haven't killed and still plan to. You decided to make a "Death Database Management System" β a computer program that provides the easy access to the database of possible victims. Let me describe its specifications to you.
Let's define a victim entity: a victim has a name (not necessarily unique) that consists only of lowercase Latin letters and an integer suspicion value.
At the start of the program the user enters a list of n victim names into a database, each suspicion value is set to 0.
Then the user makes queries of two types:
* 1~i~x β set the suspicion value of the i-th victim to x;
* 2~q β given a string q find the maximum suspicion value of a victim whose name is a contiguous substring of q.
Just to remind you, this program doesn't kill people, it only helps to search for the names to write down in an actual notebook. Thus, the list of the victims in the database doesn't change throughout the queries.
What are you waiting for? Write that program now!
Input
The first line contains two integers n and m (1 β€ n, m β€ 3 β
10^5) β the number of victims and the number of queries, respectively.
Each of the next n lines contains a single string s_i β the name of the i-th victim. Each name consists only of lowercase Latin letters.
Each of the next m lines contains a query of one of two types:
* 1~i~x (1 β€ i β€ n, 0 β€ x β€ 10^9) β change the suspicion value of the i-th victim to x;
* 2~q β given a string q consisting only of lowercase Latin letters find the maximum suspicion value of a victim whose name is a contiguous substring of q.
There is at least one query of the second type. The total length of the strings s_i doesn't exceed 3 β
10^5. The total length of the strings q doesn't exceed 3 β
10^5.
Output
For each query of the second type print an integer value. If there is no victim name that is a contiguous substring of q, then print -1. Otherwise, print the maximum suspicion value of a victim whose name is a contiguous substring of q.
Examples
Input
5 8
kurou
takuo
takeshi
naomi
shingo
2 nakiraomi
2 abanaomicaba
1 3 943
2 takuotakeshishingo
1 5 135832
2 shingotakeshi
1 5 0
2 shingotakeshi
Output
-1
0
943
135832
943
Input
6 15
a
ab
ba
b
a
ba
2 aa
1 4 4
2 bbb
1 2 1
1 2 18
2 b
2 c
1 6 10
2 aba
2 abbbba
1 2 12
2 bbaaab
1 1 11
1 5 5
2 baa
Output
0
4
4
-1
18
18
12
11
Submitted Solution:
```
# collaborated with no one
names, queries = map(int, input().split())
listOfNames = [[0 for i in range(2)] for j in range(names)]
for a in range(names):
name = input()
listOfNames[a][0] = name
for b in range(queries):
query = list(input().split())
if int(query[0]) == 1: # 1 means update
query[1] = int(query[1])
listOfNames[query[1] - 1][1] = int(query[2])
listOfNames.sort(key=lambda y: y[1], reverse=True)
else:
maxVal = -1
for x in range(names):
if listOfNames[x][0] in query[1]:
maxVal = listOfNames[x][1]
break
print(maxVal)
``` | instruction | 0 | 63,334 | 18 | 126,668 |
No | output | 1 | 63,334 | 18 | 126,669 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For the simplicity, let's say that the "Death Note" is a notebook that kills a person when their name is written in it.
It's easy to kill with it, but it's pretty hard to keep track of people you haven't killed and still plan to. You decided to make a "Death Database Management System" β a computer program that provides the easy access to the database of possible victims. Let me describe its specifications to you.
Let's define a victim entity: a victim has a name (not necessarily unique) that consists only of lowercase Latin letters and an integer suspicion value.
At the start of the program the user enters a list of n victim names into a database, each suspicion value is set to 0.
Then the user makes queries of two types:
* 1~i~x β set the suspicion value of the i-th victim to x;
* 2~q β given a string q find the maximum suspicion value of a victim whose name is a contiguous substring of q.
Just to remind you, this program doesn't kill people, it only helps to search for the names to write down in an actual notebook. Thus, the list of the victims in the database doesn't change throughout the queries.
What are you waiting for? Write that program now!
Input
The first line contains two integers n and m (1 β€ n, m β€ 3 β
10^5) β the number of victims and the number of queries, respectively.
Each of the next n lines contains a single string s_i β the name of the i-th victim. Each name consists only of lowercase Latin letters.
Each of the next m lines contains a query of one of two types:
* 1~i~x (1 β€ i β€ n, 0 β€ x β€ 10^9) β change the suspicion value of the i-th victim to x;
* 2~q β given a string q consisting only of lowercase Latin letters find the maximum suspicion value of a victim whose name is a contiguous substring of q.
There is at least one query of the second type. The total length of the strings s_i doesn't exceed 3 β
10^5. The total length of the strings q doesn't exceed 3 β
10^5.
Output
For each query of the second type print an integer value. If there is no victim name that is a contiguous substring of q, then print -1. Otherwise, print the maximum suspicion value of a victim whose name is a contiguous substring of q.
Examples
Input
5 8
kurou
takuo
takeshi
naomi
shingo
2 nakiraomi
2 abanaomicaba
1 3 943
2 takuotakeshishingo
1 5 135832
2 shingotakeshi
1 5 0
2 shingotakeshi
Output
-1
0
943
135832
943
Input
6 15
a
ab
ba
b
a
ba
2 aa
1 4 4
2 bbb
1 2 1
1 2 18
2 b
2 c
1 6 10
2 aba
2 abbbba
1 2 12
2 bbaaab
1 1 11
1 5 5
2 baa
Output
0
4
4
-1
18
18
12
11
Submitted Solution:
```
# collaborated with no one
names, queries = map(int, input().split())
listOfNames = [[0 for i in range(2)] for j in range(names)]
for a in range(names):
name = input()
listOfNames[a][0] = name
for b in range(queries):
query = list(input().split())
if int(query[0]) == 1: # 1 means update
query[1] = int(query[1])
listOfNames[query[1] - 1][1] = int(query[2])
else:
maxVal = 0
found = False
i = 0
j = names - 1
while i < j:
if listOfNames[i][0] in query[1]:
found = True
maxVal = max(maxVal, int(listOfNames[i][1]))
if listOfNames[j][0] in query[1]:
found = True
maxVal = max(maxVal, int(listOfNames[j][1]))
i += 1
j -= 1
print(maxVal if found else -1)
``` | instruction | 0 | 63,335 | 18 | 126,670 |
No | output | 1 | 63,335 | 18 | 126,671 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For the simplicity, let's say that the "Death Note" is a notebook that kills a person when their name is written in it.
It's easy to kill with it, but it's pretty hard to keep track of people you haven't killed and still plan to. You decided to make a "Death Database Management System" β a computer program that provides the easy access to the database of possible victims. Let me describe its specifications to you.
Let's define a victim entity: a victim has a name (not necessarily unique) that consists only of lowercase Latin letters and an integer suspicion value.
At the start of the program the user enters a list of n victim names into a database, each suspicion value is set to 0.
Then the user makes queries of two types:
* 1~i~x β set the suspicion value of the i-th victim to x;
* 2~q β given a string q find the maximum suspicion value of a victim whose name is a contiguous substring of q.
Just to remind you, this program doesn't kill people, it only helps to search for the names to write down in an actual notebook. Thus, the list of the victims in the database doesn't change throughout the queries.
What are you waiting for? Write that program now!
Input
The first line contains two integers n and m (1 β€ n, m β€ 3 β
10^5) β the number of victims and the number of queries, respectively.
Each of the next n lines contains a single string s_i β the name of the i-th victim. Each name consists only of lowercase Latin letters.
Each of the next m lines contains a query of one of two types:
* 1~i~x (1 β€ i β€ n, 0 β€ x β€ 10^9) β change the suspicion value of the i-th victim to x;
* 2~q β given a string q consisting only of lowercase Latin letters find the maximum suspicion value of a victim whose name is a contiguous substring of q.
There is at least one query of the second type. The total length of the strings s_i doesn't exceed 3 β
10^5. The total length of the strings q doesn't exceed 3 β
10^5.
Output
For each query of the second type print an integer value. If there is no victim name that is a contiguous substring of q, then print -1. Otherwise, print the maximum suspicion value of a victim whose name is a contiguous substring of q.
Examples
Input
5 8
kurou
takuo
takeshi
naomi
shingo
2 nakiraomi
2 abanaomicaba
1 3 943
2 takuotakeshishingo
1 5 135832
2 shingotakeshi
1 5 0
2 shingotakeshi
Output
-1
0
943
135832
943
Input
6 15
a
ab
ba
b
a
ba
2 aa
1 4 4
2 bbb
1 2 1
1 2 18
2 b
2 c
1 6 10
2 aba
2 abbbba
1 2 12
2 bbaaab
1 1 11
1 5 5
2 baa
Output
0
4
4
-1
18
18
12
11
Submitted Solution:
```
def query_2(name, list_victim, stt_victim):
idx = 0
max_dx = 0
len_name = 0
for i in list_victim:
if i in name:
c_len_name = len(i)
if c_len_name > len_name:
len_name = c_len_name
max_dx = idx
idx += 1
if len_name > 0:
return str(stt_victim[max_dx])
return '-1'
def query_1(id_victim, value, stt_victim):
tmp_val = stt_victim[id_victim]
stt_victim[id_victim] = max(tmp_val, value)
if __name__ == '__main__':
key_input = input().split(' ')
number_of_victims = int(key_input[0])
number_of_queries = int(key_input[1])
list_victim = list()
stt_victim = list()
output = list()
for i in range(number_of_victims):
list_victim.append(input())
stt_victim.append(0)
for i in range(number_of_queries):
key_input = input().split(' ')
if key_input[0] == '2':
output.append(query_2(key_input[1], list_victim, stt_victim))
else:
query_1(int(key_input[1])-1, int(key_input[2]), stt_victim)
print('\n'.join(output))
``` | instruction | 0 | 63,336 | 18 | 126,672 |
No | output | 1 | 63,336 | 18 | 126,673 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
For the simplicity, let's say that the "Death Note" is a notebook that kills a person when their name is written in it.
It's easy to kill with it, but it's pretty hard to keep track of people you haven't killed and still plan to. You decided to make a "Death Database Management System" β a computer program that provides the easy access to the database of possible victims. Let me describe its specifications to you.
Let's define a victim entity: a victim has a name (not necessarily unique) that consists only of lowercase Latin letters and an integer suspicion value.
At the start of the program the user enters a list of n victim names into a database, each suspicion value is set to 0.
Then the user makes queries of two types:
* 1~i~x β set the suspicion value of the i-th victim to x;
* 2~q β given a string q find the maximum suspicion value of a victim whose name is a contiguous substring of q.
Just to remind you, this program doesn't kill people, it only helps to search for the names to write down in an actual notebook. Thus, the list of the victims in the database doesn't change throughout the queries.
What are you waiting for? Write that program now!
Input
The first line contains two integers n and m (1 β€ n, m β€ 3 β
10^5) β the number of victims and the number of queries, respectively.
Each of the next n lines contains a single string s_i β the name of the i-th victim. Each name consists only of lowercase Latin letters.
Each of the next m lines contains a query of one of two types:
* 1~i~x (1 β€ i β€ n, 0 β€ x β€ 10^9) β change the suspicion value of the i-th victim to x;
* 2~q β given a string q consisting only of lowercase Latin letters find the maximum suspicion value of a victim whose name is a contiguous substring of q.
There is at least one query of the second type. The total length of the strings s_i doesn't exceed 3 β
10^5. The total length of the strings q doesn't exceed 3 β
10^5.
Output
For each query of the second type print an integer value. If there is no victim name that is a contiguous substring of q, then print -1. Otherwise, print the maximum suspicion value of a victim whose name is a contiguous substring of q.
Examples
Input
5 8
kurou
takuo
takeshi
naomi
shingo
2 nakiraomi
2 abanaomicaba
1 3 943
2 takuotakeshishingo
1 5 135832
2 shingotakeshi
1 5 0
2 shingotakeshi
Output
-1
0
943
135832
943
Input
6 15
a
ab
ba
b
a
ba
2 aa
1 4 4
2 bbb
1 2 1
1 2 18
2 b
2 c
1 6 10
2 aba
2 abbbba
1 2 12
2 bbaaab
1 1 11
1 5 5
2 baa
Output
0
4
4
-1
18
18
12
11
Submitted Solution:
```
n,m = map(int,input().split())
dic = {}
for _ in range(n):
dic[input()]=0
final = []
for _ in range(m):
ans = []
st = input().split()
cnt = ext = 0
if(len(st)==2):
for x,y in dic.items():
if x in st[1]:
ans.append(y)
else:
ext += 1
if ext==n:
ans.append(-1)
else:
c = 0
for x,y in dic.items():
c += 1
if(c==int(st[1])):
dic.update({x:int(st[2])})
continue
#print(ans)
try:
final.append(max(ans))
except Exception:
pass
print(*final,sep="\n")
``` | instruction | 0 | 63,337 | 18 | 126,674 |
No | output | 1 | 63,337 | 18 | 126,675 |
Provide a correct Python 3 solution for this coding contest problem.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13 | instruction | 0 | 63,800 | 18 | 127,600 |
"Correct Solution:
```
N = int(input())
A, B, C = [input() for _ in range(3)]
ans = 0
for i in range(N):
ans += len(set([A[i], B[i], C[i]])) - 1
print(ans)
``` | output | 1 | 63,800 | 18 | 127,601 |
Provide a correct Python 3 solution for this coding contest problem.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13 | instruction | 0 | 63,801 | 18 | 127,602 |
"Correct Solution:
```
n=int(input())
a,b,c=input(),input(),input()
ans=0
for i in range(n):
s=set([a[i],b[i],c[i]])
# print(s)
l=len(s)
ans+=(l-1)
print(ans)
``` | output | 1 | 63,801 | 18 | 127,603 |
Provide a correct Python 3 solution for this coding contest problem.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13 | instruction | 0 | 63,802 | 18 | 127,604 |
"Correct Solution:
```
N = int(input())
A = input()
B = input()
C = input()
count = 0
for a, b, c in zip(A, B, C):
var = set([a, b, c])
count += len(var) - 1
print(count)
``` | output | 1 | 63,802 | 18 | 127,605 |
Provide a correct Python 3 solution for this coding contest problem.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13 | instruction | 0 | 63,803 | 18 | 127,606 |
"Correct Solution:
```
N = int(input())
A = input()
B = input()
C = input()
count = 0
for a, b, c in zip(A, B, C):
count += max(len([i for i in [a!=b, a!=c, b!=c] if i]) -1, 0)
print(count)
``` | output | 1 | 63,803 | 18 | 127,607 |
Provide a correct Python 3 solution for this coding contest problem.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13 | instruction | 0 | 63,804 | 18 | 127,608 |
"Correct Solution:
```
N = int(input())
A, B, C = input(), input(), input()
ans = 0
for i in range(N):
a, b, c = A[i], B[i], C[i]
ans += len(set(tuple((a, b, c)))) - 1
print(ans)
``` | output | 1 | 63,804 | 18 | 127,609 |
Provide a correct Python 3 solution for this coding contest problem.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13 | instruction | 0 | 63,805 | 18 | 127,610 |
"Correct Solution:
```
N = int(input())
A, B, C = input(), input(), input()
ans = 0
for i in range(N):
abc = A[i], B[i], C[i]
ans += len(set(abc)) - 1
print(ans)
``` | output | 1 | 63,805 | 18 | 127,611 |
Provide a correct Python 3 solution for this coding contest problem.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13 | instruction | 0 | 63,806 | 18 | 127,612 |
"Correct Solution:
```
N = int(input())
A, B, C = input(), input(), input()
ans = 0
for i in range(N):
ans += len(set([A[i], B[i], C[i]])) - 1
print(ans)
``` | output | 1 | 63,806 | 18 | 127,613 |
Provide a correct Python 3 solution for this coding contest problem.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13 | instruction | 0 | 63,807 | 18 | 127,614 |
"Correct Solution:
```
input()
print(sum(len(set(_)) - 1 for _ in zip(*[list(input()) for _ in range(3)])))
``` | output | 1 | 63,807 | 18 | 127,615 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13
Submitted Solution:
```
n,a,b,c=int(input()),input(),input(),input()
ans=0
for i in range(n):
s=set()
s.add(a[i]);s.add(b[i]);s.add(c[i])
ans+=len(s)-1
print(ans)
``` | instruction | 0 | 63,808 | 18 | 127,616 |
Yes | output | 1 | 63,808 | 18 | 127,617 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13
Submitted Solution:
```
N=int(input())
A=input()
B=input()
C=input()
print(sum([len(set([A[i],B[i],C[i]]))-1 for i in range(N)]))
``` | instruction | 0 | 63,809 | 18 | 127,618 |
Yes | output | 1 | 63,809 | 18 | 127,619 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13
Submitted Solution:
```
N = int(input())
A = list(input())
B = list(input())
C = list(input())
ans = 0
for i in range(N):
abc = set([A[i],B[i],C[i]])
ans += len(abc) - 1
print(ans)
``` | instruction | 0 | 63,810 | 18 | 127,620 |
Yes | output | 1 | 63,810 | 18 | 127,621 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13
Submitted Solution:
```
N = int(input())
A = input()
B = input()
C = input()
count = 0
for i, j, k in zip(A,B,C):
#print(set([i,j,k]))
count = count + len(set([i,j,k])) - 1
print(count)
``` | instruction | 0 | 63,811 | 18 | 127,622 |
Yes | output | 1 | 63,811 | 18 | 127,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13
Submitted Solution:
```
#coding:utf-8
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i in range(n):
if a[i]==b[i] and b[i]==c[i] and c[i]==a[i]:
continue
else:
ans += 1
print(ans)
``` | instruction | 0 | 63,812 | 18 | 127,624 |
No | output | 1 | 63,812 | 18 | 127,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13
Submitted Solution:
```
n=int(input())
a=list(input())
b=list(input())
c=list(input())
ans=0
for i in range(n-1):
if a[i] == b[i] and a[i] == c[i] and b[i] == c[i]:
ans+=0
elif a[i] != b[i] and a[i] == c[i] and b[i] == c[i]:
ans+=1
elif a[i] == b[i] and a[i] != c[i] and b[i] == c[i]:
ans+=1
elif a[i] == b[i] and a[i] == c[i] and b[i] != c[i]:
ans+=1
elif a[i] != b[i] and a[i] == c[i] and b[i] != c[i]:
ans+=1
elif a[i] == b[i] and a[i] != c[i] and b[i] != c[i]:
ans+=1
elif a[i] != b[i] and a[i] != c[i] and b[i] == c[i]:
ans+=1
elif a[i] != b[i] and a[i] != c[i] and b[i] != c[i]:
ans+=2
print(str(ans))
``` | instruction | 0 | 63,813 | 18 | 127,626 |
No | output | 1 | 63,813 | 18 | 127,627 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13
Submitted Solution:
```
n = int(input())
a, b, c = input(), input(), input()
ans = 0
for i in range(n):
ans += len(set(a[i], b[i], c[i])) - 1
print(ans)
``` | instruction | 0 | 63,814 | 18 | 127,628 |
No | output | 1 | 63,814 | 18 | 127,629 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.
Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:
* Operation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.
What is the minimum number of operations required to achieve the objective?
Constraints
* 1 \leq N \leq 100
* Each of the strings A, B and C is a string of length N.
* Each character in each of the strings A, B and C is a lowercase English letter.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the minimum number of operations required.
Examples
Input
4
west
east
wait
Output
3
Input
9
different
different
different
Output
0
Input
7
zenkoku
touitsu
program
Output
13
Submitted Solution:
```
N = int(input())
A = input()
B = input()
C = input()
if A == B == C:
print(0)
count = 0
for a, b, c in zip(A,B,C):
if a == b == c:
pass
elif a == b and not a==c:
count += 1
elif a ==c and not a == b:
count += 1
elif b == c and not a == b:
count += 1
else:
count += 2
print(count)
``` | instruction | 0 | 63,815 | 18 | 127,630 |
No | output | 1 | 63,815 | 18 | 127,631 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.
Constraints
* 1 β€ length of T β€ 1000
* 1 β€ length of P β€ 1000
* The input consists of alphabetical characters and digits
Input
In the first line, a text T is given. In the second line, a string P is given.
Examples
Input
aabaaa
aa
Output
0
3
4
Input
xyzz
yz
Output
1
Input
abc
xyz
Output | instruction | 0 | 63,949 | 18 | 127,898 |
"Correct Solution:
```
T = input()
P = input()
t = len(T)
p = len(P)
for i in range(t - p + 1):
if T[i : i + p] == P:
print(i)
``` | output | 1 | 63,949 | 18 | 127,899 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.
Constraints
* 1 β€ length of T β€ 1000
* 1 β€ length of P β€ 1000
* The input consists of alphabetical characters and digits
Input
In the first line, a text T is given. In the second line, a string P is given.
Examples
Input
aabaaa
aa
Output
0
3
4
Input
xyzz
yz
Output
1
Input
abc
xyz
Output | instruction | 0 | 63,950 | 18 | 127,900 |
"Correct Solution:
```
s=input()
l=input()
for i in range(len(s)-len(l)+1):
if l==s[i:i+len(l)]:
print(i)
``` | output | 1 | 63,950 | 18 | 127,901 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.
Constraints
* 1 β€ length of T β€ 1000
* 1 β€ length of P β€ 1000
* The input consists of alphabetical characters and digits
Input
In the first line, a text T is given. In the second line, a string P is given.
Examples
Input
aabaaa
aa
Output
0
3
4
Input
xyzz
yz
Output
1
Input
abc
xyz
Output | instruction | 0 | 63,951 | 18 | 127,902 |
"Correct Solution:
```
t=str(input())
p=str(input())
a=int(0)
for i in range(len(t)):
f=t[i:i+len(p)]
if f.find(p)!=-1:
print(i)
``` | output | 1 | 63,951 | 18 | 127,903 |
Provide a correct Python 3 solution for this coding contest problem.
Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.
Constraints
* 1 β€ length of T β€ 1000
* 1 β€ length of P β€ 1000
* The input consists of alphabetical characters and digits
Input
In the first line, a text T is given. In the second line, a string P is given.
Examples
Input
aabaaa
aa
Output
0
3
4
Input
xyzz
yz
Output
1
Input
abc
xyz
Output | instruction | 0 | 63,952 | 18 | 127,904 |
"Correct Solution:
```
T=str(input())
P=str(input())
l1=len(T)
l2=len(P)
i=0
for i in range(l1-l2+1):
i+=1
x=T.find(P,i-1,i+l2-1)
if x==-1:
pass
else:
print(x)
``` | output | 1 | 63,952 | 18 | 127,905 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.