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
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use. In th...
instruction
0
38,229
6
76,458
No
output
1
38,229
6
76,459
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use. In th...
instruction
0
38,230
6
76,460
No
output
1
38,230
6
76,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use. In th...
instruction
0
38,231
6
76,462
No
output
1
38,231
6
76,463
Provide a correct Python 3 solution for this coding contest problem. A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to write a program that first reads a given text and a sequen...
instruction
0
38,514
6
77,028
"Correct Solution: ``` for _ in [0]*int(input()): s=input() char=0 for _ in [0]*int(input()): c=input() if c[0]=='i': c=c.split('"')[1] s=s[:char]+c+s[char:] char += len(c) elif c[8]=='w': while char <len(s) and s[char]==' ...
output
1
38,514
6
77,029
Provide a correct Python 3 solution for this coding contest problem. A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to write a program that first reads a given text and a sequen...
instruction
0
38,515
6
77,030
"Correct Solution: ``` for _ in [0]*int(input()): s=input() cur=0 for _ in [0]*int(input()): c=input() if c=='forward word': while cur<len(s) and s[cur]==' ':cur+=1 while cur<len(s) and s[cur]!=' ':cur+=1 elif c=='delete char' and cur!=len(s):s=s[:cur]+s[cur+1...
output
1
38,515
6
77,031
Provide a correct Python 3 solution for this coding contest problem. A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to write a program that first reads a given text and a sequen...
instruction
0
38,516
6
77,032
"Correct Solution: ``` for _ in [0]*int(input()): s=input() cur=0 for _ in [0]*int(input()): c=input() if c=='forward word': while cur<len(s) and s[cur]==' ':cur+=1 while cur<len(s) and s[cur]!=' ':cur+=1 elif c=='delete char':s=s[:cur]+s[cur+1:] elif ...
output
1
38,516
6
77,033
Provide a correct Python 3 solution for this coding contest problem. A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to write a program that first reads a given text and a sequen...
instruction
0
38,517
6
77,034
"Correct Solution: ``` class TextEditor: cur_w = 0 cur_c = 0 def __init__(self, txt): self.words = txt.split(' ') self.queries = { 'forward char': self.forward_char, 'forward word': self.forward_word, 'backward char': self.backward_char, 'back...
output
1
38,517
6
77,035
Provide a correct Python 3 solution for this coding contest problem. A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to write a program that first reads a given text and a sequen...
instruction
0
38,518
6
77,036
"Correct Solution: ``` for _ in [0]*int(input()): s=input() cur=0 for _ in [0]*int(input()): c=input() if c[0]=='i': c=c.split('"')[1] s=s[:cur]+c+s[cur:] cur+=len(c) elif c[8]=='w': while cur<len(s) and s[cur]==' ':cur+=1 w...
output
1
38,518
6
77,037
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to wr...
instruction
0
38,519
6
77,038
No
output
1
38,519
6
77,039
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to wr...
instruction
0
38,520
6
77,040
No
output
1
38,520
6
77,041
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a ...
instruction
0
39,042
6
78,084
Tags: constructive algorithms, implementation Correct Solution: ``` set=list(''.join(list(input().split(','))))[1:-1] present={} for i in range(97,123): present[chr(i)]=0 for letter in set: present[letter]=1 distinct=0 for i in range(97,123): if(present[chr(i)]): distinct+=1 print(distinct) ```
output
1
39,042
6
78,085
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a ...
instruction
0
39,043
6
78,086
Tags: constructive algorithms, implementation Correct Solution: ``` s = input() s = s[1:len(s)-1] if s != "": s = s.split(",") for i in range(1, len(s)): s[i] = s[i][1] print(len(set(s))) else: print("0") ```
output
1
39,043
6
78,087
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a ...
instruction
0
39,044
6
78,088
Tags: constructive algorithms, implementation Correct Solution: ``` a=input() if a=="{}": print(0) else: print(len(set(a[1:-1].split(", ")))) ```
output
1
39,044
6
78,089
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a ...
instruction
0
39,045
6
78,090
Tags: constructive algorithms, implementation Correct Solution: ``` br=input() brs=set(br.strip('{}').split(', ')) if brs=={''}: print(0) else: print(len(brs)) ```
output
1
39,045
6
78,091
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a ...
instruction
0
39,046
6
78,092
Tags: constructive algorithms, implementation Correct Solution: ``` if __name__ == '__main__': setString = input() if len(setString) > 2: setString = set(setString[1:-1].split(', ')) else: setString = [] print(len(setString)) ```
output
1
39,046
6
78,093
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a ...
instruction
0
39,047
6
78,094
Tags: constructive algorithms, implementation Correct Solution: ``` lst=input() lst=lst.strip('{') lst=lst.strip('}') lst=lst.split(', ') n=len(lst) text={} for l in lst: if l!='': text[l]=text.get(l,0)+1 num=len(text) print(num) ```
output
1
39,047
6
78,095
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a ...
instruction
0
39,048
6
78,096
Tags: constructive algorithms, implementation Correct Solution: ``` a=input() import re c=re.findall(r'[a-z]',a) d=set(c) print(len(d)) ```
output
1
39,048
6
78,097
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a ...
instruction
0
39,049
6
78,098
Tags: constructive algorithms, implementation Correct Solution: ``` s = input() if len(s) == 2: print(0) else: myset = set(s[1:-1].split(', ')) print(len(myset)) ```
output
1
39,049
6
78,099
Provide tags and a correct Python 3 solution for this coding contest problem. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program show...
instruction
0
39,058
6
78,116
Tags: implementation Correct Solution: ``` n = int(input()) l = ''.join(input().split()) l = l.strip('0') divs = 0 for a, b in zip(l[:-1], l[1:]): if a == '1' and b == '0': divs += 1 if l.count('1') == 0: print(0) elif l.count('0') == 0: print(len(l)) else: print(l.count('1') + divs) ```
output
1
39,058
6
78,117
Provide tags and a correct Python 3 solution for this coding contest problem. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program show...
instruction
0
39,059
6
78,118
Tags: implementation Correct Solution: ``` input() a = input() if a.count('1') == 0: print(0) exit() while '0 0' in a: a = a.replace('0 0', '0') a = a.split() print(len(a[a.index('1'): len(a) - list(reversed(a)).index('1')])) ```
output
1
39,059
6
78,119
Provide tags and a correct Python 3 solution for this coding contest problem. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program show...
instruction
0
39,060
6
78,120
Tags: implementation Correct Solution: ``` input() lis = list(map(int,input().split())) for i in range(1,len(lis)): if lis[len(lis) - 1] == 0: lis.pop() count = 0 i = 0 while i <len(lis): if lis[i] == 1: count += 1 if i + 1 == len(lis): break else: if lis...
output
1
39,060
6
78,121
Provide tags and a correct Python 3 solution for this coding contest problem. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program show...
instruction
0
39,061
6
78,122
Tags: implementation Correct Solution: ``` n = int(input()) a = input() beg = a.find('1') ending = a.rfind('1') sub = a[beg:ending + 1] if not sub: print(0) else: s = [i for i in sub.split('0') if not i.isspace()] t = len(s) p = 0 for i in s: for j in i: if j == '1': ...
output
1
39,061
6
78,123
Provide tags and a correct Python 3 solution for this coding contest problem. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program show...
instruction
0
39,062
6
78,124
Tags: implementation Correct Solution: ``` n = int(input()) m = [int(x) for x in input().split(' ')] ans = sum(m) m = m[::-1] if(ans > 0): m = m[m.index(1):] m = m[::-1] for i in range(len(m)): if(i == 0): curr = m[i] past = m[i] else: curr = m[i] if(past == 1 and curr == 0): ...
output
1
39,062
6
78,125
Provide tags and a correct Python 3 solution for this coding contest problem. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program show...
instruction
0
39,063
6
78,126
Tags: implementation Correct Solution: ``` ncartas = int(input())#número total de cartas geral = ''.join(input().split(' ')) #descrição atual dos emails anterior = -1 necessarias = 0 for carta in range(0,ncartas): #lançou o loop if(geral[carta] == '1'): #se o elemento da string é igual a 1 if (carta-anterio...
output
1
39,063
6
78,127
Provide tags and a correct Python 3 solution for this coding contest problem. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program show...
instruction
0
39,064
6
78,128
Tags: implementation Correct Solution: ``` n = int(input()) a = input().split() print(max(0, sum(1 + (i + 1 == n or a[i + 1] == '0') for i in range(n) if a[i] == '1') - 1)) ```
output
1
39,064
6
78,129
Provide tags and a correct Python 3 solution for this coding contest problem. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program show...
instruction
0
39,065
6
78,130
Tags: implementation Correct Solution: ``` input() print(len('a'.join(input().replace(' ', '').replace('0', ' ').split()))) # Made By Mostafa_Khaled ```
output
1
39,065
6
78,131
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content ...
instruction
0
39,066
6
78,132
Yes
output
1
39,066
6
78,133
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content ...
instruction
0
39,067
6
78,134
Yes
output
1
39,067
6
78,135
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content ...
instruction
0
39,068
6
78,136
Yes
output
1
39,068
6
78,137
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content ...
instruction
0
39,069
6
78,138
Yes
output
1
39,069
6
78,139
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content ...
instruction
0
39,070
6
78,140
No
output
1
39,070
6
78,141
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content ...
instruction
0
39,071
6
78,142
No
output
1
39,071
6
78,143
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content ...
instruction
0
39,072
6
78,144
No
output
1
39,072
6
78,145
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread. Alexey's mail program can either show a list of all letters or show the content ...
instruction
0
39,073
6
78,146
No
output
1
39,073
6
78,147
Provide tags and a correct Python 3 solution for this coding contest problem. A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that co...
instruction
0
39,090
6
78,180
Tags: brute force, implementation Correct Solution: ``` s = input() flag = False s = s.strip() if(len(s) >= 10): if( s[-10:] == "CODEFORCES"): flag = True elif (s[0:1] == "C" ) and (s[-9:] == "ODEFORCES"): flag = True elif (s[0:2] == "CO") and (s[-8:] == "DEFORCES"): flag = True...
output
1
39,090
6
78,181
Provide tags and a correct Python 3 solution for this coding contest problem. A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that co...
instruction
0
39,091
6
78,182
Tags: brute force, implementation Correct Solution: ``` t = 'CODEFORCES' s = input() for i in range(len(s)): for j in range(i, len(s) + 1): if ''.join((s[:i], s[j:])) == t: print('YES') exit() print('NO') ```
output
1
39,091
6
78,183
Provide tags and a correct Python 3 solution for this coding contest problem. A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that co...
instruction
0
39,092
6
78,184
Tags: brute force, implementation Correct Solution: ``` #!/usr/bin/python3 #Cutting Banner Round #300 #CodeForces def solve(): string = input() word = "CODEFORCES" found = False for i in range(len(string)): for j in range(len(string)): str1 = string[:i]+string[i+j:] #print(str1) if str1 == word: foun...
output
1
39,092
6
78,185
Provide tags and a correct Python 3 solution for this coding contest problem. A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that co...
instruction
0
39,093
6
78,186
Tags: brute force, implementation Correct Solution: ``` s=input() s1=len(s) l=['C','O','D','E','F','O','R','C','E','S'] i=0 j=0 m=0 k=1 if(s[0]!=l[0]): while(k<=10): if(s[-k]==l[-k]): m+=1 else: print("NO") break k+=1 if(m==10): print("YES") el...
output
1
39,093
6
78,187
Provide tags and a correct Python 3 solution for this coding contest problem. A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that co...
instruction
0
39,094
6
78,188
Tags: brute force, implementation Correct Solution: ``` s = input() s1 = "CODEFORCES" for i in range(len(s1)): num1 = s.find(s1[:i+1]) num2 = s.find(s1[i+1:]) #print() #print(s1[:i+1]+' '+s1[i+1:]) #print(num1) if num1 < num2: #print(str(num1)+' '+s1[-(len(s1)-i)+1:]+' '+s[-(len(s1)-i)+1...
output
1
39,094
6
78,189
Provide tags and a correct Python 3 solution for this coding contest problem. A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that co...
instruction
0
39,095
6
78,190
Tags: brute force, implementation Correct Solution: ``` s = input() t = 'CODEFORCES' for i in range(len(s)): if (s[0:i] == t): print('YES') exit() for j in range(i + 1, len(s)): if (s[0:i] + s[j:len(s)] == t or s[j:len(s)] == t): print('YES') exit() print(...
output
1
39,095
6
78,191
Provide tags and a correct Python 3 solution for this coding contest problem. A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that co...
instruction
0
39,096
6
78,192
Tags: brute force, implementation Correct Solution: ``` s = input() s2 = "CODEFORCES" while s and s2 and s[0] == s2[0]: s = s[1:] s2 = s2[1:] while s and s2 and s[-1] == s2[-1]: s = s[:-1] s2 = s2[:-1] if s2 == '': print("YES") else: print("NO") ```
output
1
39,096
6
78,193
Provide tags and a correct Python 3 solution for this coding contest problem. A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that co...
instruction
0
39,097
6
78,194
Tags: brute force, implementation Correct Solution: ``` x = input() check = 0 p = len(x) if x[:10] == 'CODEFORCES' or x[p - 9:] == 'CODEFORCES' : print('YES') check = 1 for i in range(len(x)): for j in range(i , len(x)): #print(str(i) + " " + str(j)) p1 = x[:i] p2 = x[j:] word = p1 + p2 #print(word) if w...
output
1
39,097
6
78,195
Provide tags and a correct Python 3 solution for this coding contest problem. The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G...
instruction
0
39,196
6
78,392
Tags: implementation, strings Correct Solution: ``` n = int(input()) st = input() if n % 4 != 0: print('===') else: ca, cb, cc, cd = 0, 0, 0, 0 av = n // 4 for i in range(len(st)): if st[i] == 'A': ca += 1 elif st[i] == 'C': cb += 1 elif st[i] == 'G': ...
output
1
39,196
6
78,393
Provide tags and a correct Python 3 solution for this coding contest problem. The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G...
instruction
0
39,197
6
78,394
Tags: implementation, strings Correct Solution: ``` import math n=int(input()) s=list(input()) ar=[0]*1000 for ch in s: if ch!='?': ar[ord(ch)]+=1 if n%4==0: val=n//4 for i in range(n): if s[i]=='?' and val>ar[ord('A')]: s[i]='A' ar[ord('A')]+=1 fo...
output
1
39,197
6
78,395
Provide tags and a correct Python 3 solution for this coding contest problem. The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G...
instruction
0
39,198
6
78,396
Tags: implementation, strings Correct Solution: ``` n=int(input()) s=input() arr=[] for i in range(0,len(s)): arr.append(s[i]) a=0 g=0 c=0 t=0 q=0 index=[] for i in range(0,len(s)): if(s[i]=="A"): a+=1 elif(s[i]=="G"): g+=1 elif(s[i]=="C"): c+=1 elif(s[i]=="T"): t=t+1...
output
1
39,198
6
78,397
Provide tags and a correct Python 3 solution for this coding contest problem. The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G...
instruction
0
39,199
6
78,398
Tags: implementation, strings Correct Solution: ``` f=int(input()) t=list(input()) if f%4!=0: print('===') else: a=t.count('A') y= t.count('T') c= t.count('C') g=t.count('G') b=t.count('?') v=f//4 if max(a,y,c,g)<=v: for j in range(v-a): t[t.index('?')]='A' ...
output
1
39,199
6
78,399
Provide tags and a correct Python 3 solution for this coding contest problem. The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G...
instruction
0
39,200
6
78,400
Tags: implementation, strings Correct Solution: ``` n = int(input()) genomes = list(input()) if n % 4 != 0 or any([genomes.count(x) > n // 4 for x in 'ACGT']): print('===') else: cnt = {} for x in 'ACGT': cnt[x] = n // 4 - genomes.count(x) for i in range(n): if genomes[i] == '?': for x in 'ACGT': ...
output
1
39,200
6
78,401
Provide tags and a correct Python 3 solution for this coding contest problem. The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G...
instruction
0
39,201
6
78,402
Tags: implementation, strings Correct Solution: ``` n = int(input()) s = input() def yolo(): if n % 4: print("===") return A = s.count("A") C = s.count("C") T = s.count("T") G = s.count("G") if max(A,C,T,G) > n / 4: print("===") return filled = "" for i in s: if i != "?": filled += i else: i...
output
1
39,201
6
78,403
Provide tags and a correct Python 3 solution for this coding contest problem. The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G...
instruction
0
39,202
6
78,404
Tags: implementation, strings Correct Solution: ``` input() s = input() a = s.count('A') c = s.count('C') g = s.count('G') t = s.count('T') n = len(s) if n%4!=0: print('===') exit() n=int(n/4) if a > n or c > n or g > n or t > n: print('===') exit() s = s.replace('?','A',n - a) s = s.replace('?', 'C',n ...
output
1
39,202
6
78,405
Provide tags and a correct Python 3 solution for this coding contest problem. The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G...
instruction
0
39,203
6
78,406
Tags: implementation, strings Correct Solution: ``` n=int(input()) s=input() if (n%4!=0): print("===") else: t=n//4 a=t-s.count("A") b=t-s.count("C") c=t-s.count("G") d=t-s.count("T") if (a>=0 and b>=0 and c>=0 and d>=0): e="A"*a+"C"*b+"G"*c+"T"*d i=0 f="" ...
output
1
39,203
6
78,407