message stringlengths 2 23.4k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 129 108k | cluster float64 6 6 | __index_level_0__ int64 258 216k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expensive and exotic woo... | instruction | 0 | 32,837 | 6 | 65,674 |
Tags: math
Correct Solution:
```
def main():
s=input()
l=[]
t=''
result=1
count=0
for i in range(len(s)):
if s[i:i+1]=='?':
if i==0:
result=result*9
else:
count=count+1
if s[i:i+1]>='A' and s[i:i+1]<='J':
... | output | 1 | 32,837 | 6 | 65,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's call a string "s-palindrome" if it is symmetric about the middle of the string. For example, the string "oHo" is "s-palindrome", but the string "aa" is not. The string "aa" is not "s-palindrome", because the second half of it is not a ... | instruction | 0 | 33,005 | 6 | 66,010 |
Tags: implementation, strings
Correct Solution:
```
# Author : nitish420 --------------------------------------------------------------------
import os
import sys
from io import BytesIO, IOBase
mod=10**9+7
# sys.setrecursionlimit(10**6)
# from functools import lru_cache
def main():
s=list(input())
n=len(s)
... | output | 1 | 33,005 | 6 | 66,011 |
Provide tags and a correct Python 3 solution for this coding contest problem.
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string ... | instruction | 0 | 33,018 | 6 | 66,036 |
Tags: greedy, two pointers
Correct Solution:
```
def fill_uniq(nice,cts):
l_nice = list(nice)
letters = [chr(ord('A')+i) for i in range(26) if not cts[i]]
l_i = 0
for i,c in enumerate(l_nice):
if c == '?':
l_nice[i] = letters[l_i]
l_i += 1
return ''.join(l_nice)
def ... | output | 1 | 33,018 | 6 | 66,037 |
Provide tags and a correct Python 3 solution for this coding contest problem.
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string ... | instruction | 0 | 33,019 | 6 | 66,038 |
Tags: greedy, two pointers
Correct Solution:
```
from collections import Counter
from string import ascii_uppercase
s = input()
counter = Counter(s[:25])
for j in range(25, len(s)):
counter[s[j]] += 1
if j >= 26:
counter.subtract(s[j-26])
q = []
for l in ascii_uppercase:
if counter[l... | output | 1 | 33,019 | 6 | 66,039 |
Provide tags and a correct Python 3 solution for this coding contest problem.
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string ... | instruction | 0 | 33,020 | 6 | 66,040 |
Tags: greedy, two pointers
Correct Solution:
```
from collections import Counter
s = input()
counter = Counter(s[:26])
left, right = 0, 0
if len(counter) - int("?" in counter) + counter["?"] == 26:
left, right = 0, 26
else:
for i in range(26, len(s)):
counter[s[i]] += 1
counter[s[i-26]] -= 1
... | output | 1 | 33,020 | 6 | 66,041 |
Provide tags and a correct Python 3 solution for this coding contest problem.
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string ... | instruction | 0 | 33,021 | 6 | 66,042 |
Tags: greedy, two pointers
Correct Solution:
```
import collections
def GetWord(word,start_index,letter_dict,letters):
good_word = ''
for i in range(start_index):
if word[i] != '?':
good_word += word[i]
else:
good_word += 'A'
for i in range(start_index,start_index+26... | output | 1 | 33,021 | 6 | 66,043 |
Provide tags and a correct Python 3 solution for this coding contest problem.
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string ... | instruction | 0 | 33,022 | 6 | 66,044 |
Tags: greedy, two pointers
Correct Solution:
```
s = input()
left = 0
counter = 0
arr = [0]*26
if (len(s) < 26):
print(-1)
else:
for i in range(len(s)):
if (s[i] != '?'):
while (arr[ord(s[i]) - ord('A')] == 1):
if (s[left] != '?'):
arr[ord(s[left]) - ord('A')] = 0
left = left + ... | output | 1 | 33,022 | 6 | 66,045 |
Provide tags and a correct Python 3 solution for this coding contest problem.
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string ... | instruction | 0 | 33,023 | 6 | 66,046 |
Tags: greedy, two pointers
Correct Solution:
```
s=list(input())
n=len(s)
if n<26:
print(-1)
else:
a=[0]*26
c=0
j=0
x,y=-1,-1
for q in range(26):
if s[q]=='?':
j+=1
else:
a[ord(s[q])-65]+=1
if a[ord(s[q])-65]==1:
c+=1
if j+c... | output | 1 | 33,023 | 6 | 66,047 |
Provide tags and a correct Python 3 solution for this coding contest problem.
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string ... | instruction | 0 | 33,024 | 6 | 66,048 |
Tags: greedy, two pointers
Correct Solution:
```
def main():
s, cnt = input(), [-1] * 91
l = s.encode('utf-8')
for c in l[:25]:
cnt[c] += 1
twins, cnt[63] = sum(i > 0 for i in cnt[65:]), -27
for i, u, v in zip(range(50000), l, l[25:]):
cnt[v] = c = cnt[v] + 1
if c == 1:
... | output | 1 | 33,024 | 6 | 66,049 |
Provide tags and a correct Python 3 solution for this coding contest problem.
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string ... | instruction | 0 | 33,025 | 6 | 66,050 |
Tags: greedy, two pointers
Correct Solution:
```
s = input()
marks = 0
alphabit = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
missed = ''
sub_s = ''
s_length = len(s)
i = 0
while (i+26) <= s_length:
marks = 0
missed = ''
sub_s = s[i:(i+26)]
for ch in alphabit:
if ch not in sub_s:
missed += ch
... | output | 1 | 33,025 | 6 | 66,051 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vas... | instruction | 0 | 33,619 | 6 | 67,238 |
Tags: combinatorics
Correct Solution:
```
def solve():
mod=int(1e9+7)
line=input().split(' ')
n=int(line[0])
m=int(line[1])
lista = [set() for _ in range(m)]
for i in range(n):
string=input();
for j in range(m):
if(string[j] in lista[j]):
pass
... | output | 1 | 33,619 | 6 | 67,239 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vas... | instruction | 0 | 33,620 | 6 | 67,240 |
Tags: combinatorics
Correct Solution:
```
from collections import defaultdict
n,m=map(int,input().split())
d=defaultdict(set)
for i in range(n):
s=input()
for j in range(m):
d[j].add(s[j])
ans=1
for i in d:
ans*=len(d[i])
ans%=(10**9+7)
print(ans)
``` | output | 1 | 33,620 | 6 | 67,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ... | instruction | 0 | 33,843 | 6 | 67,686 |
Tags: *special
Correct Solution:
```
__author__ = "runekri3"
ALPHABET_LOWER = "abcdefghijklmnopqrstuvwxyz"
ALPHABET_HIGHER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
inp_str = input()
answer = 0
for letter in inp_str:
if letter in ALPHABET_HIGHER:
answer += ALPHABET_HIGHER.index(letter) + 1
elif letter in ALPHAB... | output | 1 | 33,843 | 6 | 67,687 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ... | instruction | 0 | 33,844 | 6 | 67,688 |
Tags: *special
Correct Solution:
```
def f(c):
v1 = c > '@'
v2 = c < '['
v3 = c > '`'
v4 = c < '{'
v5 = int(v1 and v2)
v6 = int(v3 and v4)
if c in '.0123456789':
v7 = -1
else:
v7 = 'abcdefghijklmnopqrstuvwxyz'.index(c.lower()) + 1
v8 = v5 * v7
v9 = v6 * v7
ret... | output | 1 | 33,844 | 6 | 67,689 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ... | instruction | 0 | 33,845 | 6 | 67,690 |
Tags: *special
Correct Solution:
```
'''s=input()
ans=0
for i in s[1:len(s)]:
p1=1 if '@'<i else 0;
p2=1 if '['>i else 0;
p3=1 if '`'<i else 0;
p4=1 if '{'>i else 0;
p1=1 if p1==p2 and p1==1 else 0;
p3=1 if p3==p4 and p4==1 else 0;
if i.isupper():
p5=ord(i)-64
elif
'''
s=input()
ans=0;
for i in s:
if i.isu... | output | 1 | 33,845 | 6 | 67,691 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ... | instruction | 0 | 33,846 | 6 | 67,692 |
Tags: *special
Correct Solution:
```
s = input()
ans = 0
for i in range(0, len(s)):
if (s[i] >= 'a' and s[i] <= 'z'):
ans -= ord(s[i]) - ord('a') + 1
elif (s[i] >= 'A' and s[i] <= 'Z'):
ans += ord(s[i]) - ord('A') + 1
print(ans)
``` | output | 1 | 33,846 | 6 | 67,693 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ... | instruction | 0 | 33,847 | 6 | 67,694 |
Tags: *special
Correct Solution:
```
s = input()
ans = 0
for c in s:
ind = ord(c)
if 'a' <= c <= 'z':
ans -= ind - ord('a') + 1
elif 'A' <= c <= 'Z':
ans += ind - ord('A') + 1
print(ans)
``` | output | 1 | 33,847 | 6 | 67,695 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ... | instruction | 0 | 33,848 | 6 | 67,696 |
Tags: *special
Correct Solution:
```
print(sum(ch.isupper() * (ord(ch) - ord('A') + 1) - ch.islower() * (ord(ch) - ord('a') + 1) for ch in input()))
``` | output | 1 | 33,848 | 6 | 67,697 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ... | instruction | 0 | 33,849 | 6 | 67,698 |
Tags: *special
Correct Solution:
```
print(sum(map(lambda x:96-x if x>96 else x-64,map(ord,filter(str.isalpha,input())))))
``` | output | 1 | 33,849 | 6 | 67,699 |
Provide tags and a correct Python 3 solution for this coding contest problem.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 ... | instruction | 0 | 33,850 | 6 | 67,700 |
Tags: *special
Correct Solution:
```
s = input()
ans = 0
for i in s:
if (i >= 'A') and (i <= 'Z'):
ans += ord(i) - ord('A') + 1
elif (i >= 'a') and (i <= 'z'):
ans -= ord(i) - ord('a') + 1
print(ans)
``` | output | 1 | 33,850 | 6 | 67,701 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a programming language in which every program is a non-empty sequence of "<" and ">" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using movement of instruction poin... | instruction | 0 | 35,443 | 6 | 70,886 |
Tags: data structures, implementation
Correct Solution:
```
n, q = map(int, input().split())
s = input()
for _ in range(q):
l, r = map(int, input().split())
t = list(s[l-1:r])
p, d = 0, 1
res = [0] * 10
while 0 <= p < len(t):
if '0' <= t[p] <= '9':
k = int(t[p])
res[k... | output | 1 | 35,443 | 6 | 70,887 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is a programming language in which every program is a non-empty sequence of "<" and ">" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using movement of instruction poin... | instruction | 0 | 35,444 | 6 | 70,888 |
Tags: data structures, implementation
Correct Solution:
```
n,Q = map(int,input().strip().split())
s = input()
d = 1
for q in range(Q):
arr = [0]*(10)
l,r = map(int,input().strip().split())
su = ""
for i in range(l-1,r):
su+=s[i]
su = list(su)
i = 0
d = 1
#print(su)
ll =... | output | 1 | 35,444 | 6 | 70,889 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so so... | instruction | 0 | 35,540 | 6 | 71,080 |
Tags: implementation
Correct Solution:
```
#!/usr/bin/env python3
import sys
keyboard = "qwertyuiopasdfghjkl;zxcvbnm,./"
right = "pqwertyuio;asdfghjkl/zxcvbnm,."
left = "wertyuiopqsdfghjkl;axcvbnm,./z"
def decrypt(shift, message):
table = str.maketrans(keyboard, right if shift == 'R' else left)
messag... | output | 1 | 35,540 | 6 | 71,081 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so so... | instruction | 0 | 35,541 | 6 | 71,082 |
Tags: implementation
Correct Solution:
```
# Lang: pypy3.6-v7.1.0-win32\pypy3.exe
# Problem Name: Keyboard
# Problem Serial No: 474
# Problem Type: A
# Problem Url: https://codeforces.com/problemset/problem/474/A
# Solution Generated at: 2019-09-17 20:19:20.119275 UTC
keyboard = [j for j in """qwertyuiop[]asdfghjkl;'... | output | 1 | 35,541 | 6 | 71,083 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so so... | instruction | 0 | 35,542 | 6 | 71,084 |
Tags: implementation
Correct Solution:
```
s1 = 'qwertyuiopasdfghjkl;zxcvbnm,./'
d = input()
s = input()
ans = []
if d == 'R':
for i in s:
ans.append(s1[s1.index(i) - 1])
else:
for i in s:
ans.append(s1[s1.index(i) + 1])
print(*ans, sep = '')
``` | output | 1 | 35,542 | 6 | 71,085 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so so... | instruction | 0 | 35,543 | 6 | 71,086 |
Tags: implementation
Correct Solution:
```
s="qwertyuiopasdfghjkl;zxcvbnm,./"
c,r,ans=input(),input(),""
if(c=="R"):
for i in range(len(r)): ans+=s[s.find(r[i])-1]
else:
for i in range(len(r)): ans+=s[s.find(r[i])+1]
print(ans)
``` | output | 1 | 35,543 | 6 | 71,087 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so so... | instruction | 0 | 35,544 | 6 | 71,088 |
Tags: implementation
Correct Solution:
```
n = input()
keyboard = "qwertyuiopasdfghjkl;zxcvbnm,./"
index_map = { c: keyboard.index(c) for c in keyboard }
s = input()
shift = -1 if n == 'R' else 1
ans = ''
for c in s:
index = index_map.get(c) + shift
ans += keyboard[index]
print(ans)
``` | output | 1 | 35,544 | 6 | 71,089 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so so... | instruction | 0 | 35,545 | 6 | 71,090 |
Tags: implementation
Correct Solution:
```
a,b,c='qwertyuiopasdfghjkl;zxcvbnm,./',input(),input();print(''.join(a[a.index(i)+1] for i in c) if b=='L' else ''.join(a[a.index(i)-1] for i in c))
``` | output | 1 | 35,545 | 6 | 71,091 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so so... | instruction | 0 | 35,546 | 6 | 71,092 |
Tags: implementation
Correct Solution:
```
""" *** Author--Saket Saumya ***
IIITM
"""
import math
import os
import random
import re
from sys import stdin, stdout
from collections import Counter
from itertools import permutations
def si():
return str(stdin.readline())
def ii():
return int(stdin.re... | output | 1 | 35,546 | 6 | 71,093 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so so... | instruction | 0 | 35,547 | 6 | 71,094 |
Tags: implementation
Correct Solution:
```
s = 'qwertyuiop asdfghjkl; zxcvbnm,./'
mod = input()
txt = input()
if mod=='R':
pre = {s[i]:s[i-1] for i in range(1,len(s))}
else:
pre = {s[i]:s[i+1] for i in range(0,len(s)-1)}
print(''.join(pre[c] for c in txt))
``` | output | 1 | 35,547 | 6 | 71,095 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbn... | instruction | 0 | 35,550 | 6 | 71,100 |
Yes | output | 1 | 35,550 | 6 | 71,101 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbn... | instruction | 0 | 35,551 | 6 | 71,102 |
Yes | output | 1 | 35,551 | 6 | 71,103 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ty... | instruction | 0 | 35,592 | 6 | 71,184 |
Tags: *special, dfs and similar, strings
Correct Solution:
```
n=int(input())
d={}
p={}
ans=''
for x in [input() for i in range(n)]:
for i in range(len(x)-1): d[x[i]]=x[i+1]
for i in range(1,len(x)): p[x[i]]=1
d.setdefault(x[-1],'')
for x in range(9,123):
x=chr(x)
if p.get(x,0)>0 or d.get(x,'Q')=='Q... | output | 1 | 35,592 | 6 | 71,185 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ty... | instruction | 0 | 35,593 | 6 | 71,186 |
Tags: *special, dfs and similar, strings
Correct Solution:
```
n = int(input())
enabled = [False] * 26
a = [[False]*26 for i in range(26)]
for i in range(n):
s = list(map(lambda x: ord(x)-ord('a'), input()))
for c in s:
enabled[c] = True
for i in range(len(s)-1):
a[s[i]][s[i+1]] = True
pos =... | output | 1 | 35,593 | 6 | 71,187 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ty... | instruction | 0 | 35,594 | 6 | 71,188 |
Tags: *special, dfs and similar, strings
Correct Solution:
```
from sys import exit
n = int(input())
a = []
for i in range(n):
s = input()
for j in range(len(a)):
check = a[j]
if s in check:
break
if check in s:
a[j] = s
break
else:
a.appe... | output | 1 | 35,594 | 6 | 71,189 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ty... | instruction | 0 | 35,595 | 6 | 71,190 |
Tags: *special, dfs and similar, strings
Correct Solution:
```
n = int(input())
a = []
b = [True]*n
S = ''
for i in range(n):
s = input()
S += s
a.append(s)
alf = list(set(S))
def find():
l = len(a)
b = False
for i in range(l):
if b:
break
x = list(a[i])
fo... | output | 1 | 35,595 | 6 | 71,191 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ty... | instruction | 0 | 35,596 | 6 | 71,192 |
Tags: *special, dfs and similar, strings
Correct Solution:
```
n = int(input())
seqs = []
lang = ''
for i in range(n):
s = input().strip()
seqs.append(s)
for let in s:
if let not in lang:
lang += let
seqs.sort(key=lambda x: -len(x))
class letB:
right = None
left = None
letters = {}
visited = {}
for i in lang... | output | 1 | 35,596 | 6 | 71,193 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ty... | instruction | 0 | 35,597 | 6 | 71,194 |
Tags: *special, dfs and similar, strings
Correct Solution:
```
def f(cur):
i = cur
while i != -1:
print(chr(i + 97), end = '')
i = d[i]
n = int(input())
d = [-2 for i in range(26)]
ans = []
first = [0] * 26
for i in range(n):
s = input()
if d[ord(s[0]) - 97] == -2:
fir... | output | 1 | 35,597 | 6 | 71,195 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ty... | instruction | 0 | 35,598 | 6 | 71,196 |
Tags: *special, dfs and similar, strings
Correct Solution:
```
#number = random.randrange(start, stop, step)
n = int(input())
arr = []
arr2 = ""
for i in range(n):
arr.append(str(input()))
res = [""]
count = 0
z = 0
while len(arr) != 0:
flag = False
z = 0
for i in range(len(arr)):
... | output | 1 | 35,598 | 6 | 71,197 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide ty... | instruction | 0 | 35,599 | 6 | 71,198 |
Tags: *special, dfs and similar, strings
Correct Solution:
```
n = int(input())
s = set()
for i in range(n):
s.add(input())
strings = list(s)
for i in range(len(strings)):
for j in range(len(strings)):
if i != j and strings[i] in strings[j]:
s.discard(strings[i])
strings = list(s)
label = ... | output | 1 | 35,599 | 6 | 71,199 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've... | instruction | 0 | 35,600 | 6 | 71,200 |
Yes | output | 1 | 35,600 | 6 | 71,201 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've... | instruction | 0 | 35,601 | 6 | 71,202 |
Yes | output | 1 | 35,601 | 6 | 71,203 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've... | instruction | 0 | 35,602 | 6 | 71,204 |
Yes | output | 1 | 35,602 | 6 | 71,205 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've... | instruction | 0 | 35,603 | 6 | 71,206 |
Yes | output | 1 | 35,603 | 6 | 71,207 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've... | instruction | 0 | 35,604 | 6 | 71,208 |
No | output | 1 | 35,604 | 6 | 71,209 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've... | instruction | 0 | 35,605 | 6 | 71,210 |
No | output | 1 | 35,605 | 6 | 71,211 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've... | instruction | 0 | 35,606 | 6 | 71,212 |
No | output | 1 | 35,606 | 6 | 71,213 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've... | instruction | 0 | 35,607 | 6 | 71,214 |
No | output | 1 | 35,607 | 6 | 71,215 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.... | instruction | 0 | 35,612 | 6 | 71,224 |
Tags: implementation, strings
Correct Solution:
```
s = input()
u, d, l, r = 0, 0, 0, 0
for i in s:
if i == 'U':
u += 1
elif i == 'D':
d += 1
elif i == 'R':
r += 1
else:
l += 1
if (r + l + u + d) % 2 != 0:
print(-1)
else:
print((abs(r - l) + abs(u - d)) // 2)
``` | output | 1 | 35,612 | 6 | 71,225 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.... | instruction | 0 | 35,613 | 6 | 71,226 |
Tags: implementation, strings
Correct Solution:
```
s = input()
if len(s) % 2 == 1:
print('-1')
exit()
a = abs(s.count('U') - s.count('D'))
b = abs(s.count('L') - s.count('R'))
print(a + b >> 1)
``` | output | 1 | 35,613 | 6 | 71,227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.